00001
00002
00003
00004
00005
00006 #include<linux/vmalloc.h>
00007 #include<linux/linkage.h>
00008
00009 #include <system_data_cells.h>
00010 #include <descrip.h>
00011 #include <starlet.h>
00012 #include <misc.h>
00013 #include <ssdef.h>
00014 #include <ipldef.h>
00015 #include <ipl.h>
00016 #include <ccbdef.h>
00017 #include <cmbdef.h>
00018 #include <lnmdef.h>
00019 #include <ucbdef.h>
00020 #include <queue.h>
00021 #include <exe_routines.h>
00022 #include <ioc_routines.h>
00023 #include <misc_routines.h>
00024 #include <sch_routines.h>
00025
00026 long clone_init_ucb() {
00027 extern struct _mb_ucb * mbucb0;
00028
00029 struct _ucb * u;
00030 ioc_std_clone_ucb(mbucb0,&u);
00031 struct _mb_ucb * m = u;
00032 qhead_init(&m->ucb_l_mb_readqfl);
00033 qhead_init(&m->ucb_l_mb_writerwaitqfl);
00034 qhead_init(&m->ucb_l_mb_readerwaitqfl);
00035 qhead_init(&m->ucb_l_mb_nowriterwaitqfl);
00036 qhead_init(&m->ucb_l_mb_noreaderwaitqfl);
00037 return u;
00038 }
00039
00040 long find_mb_log(void * lognam) {
00041 _DESCRIPTOR(mytabnam,"LNM$SYSTEM_TABLE");
00042 struct item_list_3 i[6];
00043 char c[64];
00044 int retlen, retlenu;
00045 long back = LNMX_C_BACKPTR;
00046 long u;
00047 int status;
00048 i[0].item_code=LNM__STRING;
00049 i[0].buflen=4;
00050 i[0].bufaddr=&u;
00051 i[0].retlenaddr=&retlen;
00052 i[1].item_code=LNM__INDEX;
00053 i[1].buflen=4;
00054 i[1].bufaddr=&back;
00055 i[1].retlenaddr=&retlenu;
00056 i[2].item_code=0;
00057 status=exe_trnlnm(0,&mytabnam,lognam,0,i);
00058 if (status&1)
00059 return u;
00060 else
00061 return 0;
00062 }
00063
00064 int create_mb_log(void * lognam, long bufquo, struct _ucb * u) {
00065 _DESCRIPTOR(mytabnam,"LNM$SYSTEM_TABLE");
00066 struct item_list_3 i[6];
00067 int status;
00068 if (lognam) {
00069 char c[64];
00070 int retlen, retlenu;
00071 int index=0;
00072 long back = LNMX_C_BACKPTR;
00073
00074 u->ucb_w_bufquo=bufquo;
00075 u->ucb_w_iniquo=bufquo;
00076
00077 sprintf(c,"MBA%d",u->ucb_w_unit);
00078
00079 i[0].item_code=LNM__STRING;
00080 i[0].buflen=4;
00081 i[0].bufaddr=u;
00082 i[0].retlenaddr=&retlen;
00083 i[1].item_code=LNM__INDEX;
00084 i[1].buflen=4;
00085 i[1].bufaddr=&back;
00086 i[1].retlenaddr=&retlenu;
00087 i[2].item_code=LNM__LNMB_ADDR;
00088 i[2].buflen=4;
00089 i[2].bufaddr=&((struct _mb_ucb *)u)->ucb_l_logadr;
00090 i[2].retlenaddr=&retlenu;
00091 i[3].item_code=LNM__STRING;
00092 i[3].buflen=strlen(c);
00093 i[3].bufaddr=c;
00094 i[3].retlenaddr=&retlenu;
00095 i[4].item_code=LNM__INDEX;
00096 i[4].buflen=4;
00097 i[4].bufaddr=&index;
00098 i[4].retlenaddr=&retlenu;
00099 i[5].item_code=0;
00100 status=exe_crelnm(0,&mytabnam,lognam,0,i);
00101 }
00102 }
00103
00104 asmlinkage int exe_crembx (char prmflg, unsigned short int *chan, unsigned int maxmsg, unsigned int bufquo, unsigned int promsk, unsigned int acmode, void *lognam, long flags,...) {
00105 int status;
00106 struct _ccb * c;
00107 struct _ucb * u;
00108 _DESCRIPTOR(mytabnam,"LNM$SYSTEM_TABLE");
00109 _DESCRIPTOR(mypartab,"LNM$SYSTEM_DIRECTORY");
00110 struct item_list_3 i[6];
00111
00112
00113 setipl(IPL__ASTDEL);
00114
00115
00116
00117
00118 sch_iolockw();
00119 status=ioc_ffchan(chan);
00120 if (status!=SS__NORMAL) return status;
00121
00122
00123
00124
00125
00126 c=&ctl_gl_ccbbase[*chan];
00127 c->ccb_b_amod=1;
00128 if (lognam==0) {
00129
00130 if (bufquo==0) bufquo=DEFMBXBUFQUO;
00131 if (maxmsg==0) maxmsg=DEFMBXMXMSG;
00132 u=clone_init_ucb();
00133 u->ucb_w_bufquo=bufquo;
00134 u->ucb_w_iniquo=bufquo;
00135 u->ucb_w_msgmax=maxmsg;
00136 u->ucb_w_devbufsiz=maxmsg;
00137 ((struct _mb_ucb *)u)->ucb_l_logadr=0;
00138
00139 } else {
00140 u=find_mb_log(lognam);
00141
00142 if (u==0) {
00143 u=clone_init_ucb();
00144 u->ucb_w_bufquo=bufquo;
00145 u->ucb_w_iniquo=bufquo;
00146 u->ucb_w_msgmax=maxmsg;
00147 u->ucb_w_devbufsiz=maxmsg;
00148 u->ucb_l_pid=0;
00149 u->ucb_l_devdepend=0;
00150 u->ucb_l_devsts=0;
00151 if (prmflg) {
00152 u->ucb_l_devsts|=UCB$M_PRMMBX;
00153 } else {
00154 u->ucb_l_devsts|=UCB$M_DELMBX;
00155 }
00156 }
00157 c->ccb_l_ucb=u;
00158 create_mb_log(lognam,bufquo,u);
00159 goto out;
00160 }
00161
00162 c->ccb_l_ucb=u;
00163
00164 if (flags&CMB_M_READONLY)
00165 c->ccb_l_sts|=CCB$M_NOWRITEACC;
00166 if (flags&CMB_M_WRITEONLY)
00167 c->ccb_l_sts|=CCB$M_NOREADACC;
00168
00169 mb_chanunwait(u,c);
00170
00171
00172
00173 out:
00174
00175 sch_iounlockw();
00176
00177 setipl(0);
00178 return SS__NORMAL;
00179 }
00180
00181 int exe_delmbx (unsigned short int chan)
00182 {
00183 }
00184
00185 asmlinkage int exe_crembx_wrap(struct struct_crembx * s) {
00186 return exe_crembx(s->prmflg, s->chan, s->maxmsg, s->bufquo, s->promsk, s->acmode, s->lognam, s->flags);
00187 }
00188