int ddWrite(int descriptor, int len, int *ev) { BOSIOptr BIOstream; int *bufout; int ifree,error,lenh,lenb,ncop,nfopen,lrlen; int ip,jp,kp; /* Ukazatel` na record segment header i data header v DD bufere */ int dathead[70]; /* intermediate buffers */ char *fmt, *ch; int i; DPR("\nSTART OF ddWrite >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); BIOstream = (BOSIOptr)descriptor; /* set pointers */ bufout = BIOS_BUFP; error = nfopen = 0; lrlen = ev[irNWRD]+RECHEADLEN; if (len < lrlen) { printf("ddWrite: FIFO length (%i) < Event length (%i) -> Corrupted\nReturn EBIO_CORREVENT\n", len,ev[irNWRD]+RECHEADLEN); return EBIO_CORREVENT; } DPR(">>> Got following event ============================================================\n"); PRLR(ev); DPR(">>> ================================================================================\n"); DPR1(">>> At the beginning IP=%i\n",IP); if(IP == 0) /* allocate output buffer */ { DPR1(">>> First time writing -> allocate I/O buffer RECL=%i\n",BIOS_RECL); bufout = BIOS_BUFP = (int *)malloc(BIOS_RECL); BIOS_NPHYSREC = 0; BIOS_NLOGREC = 0; START_NEW_PHYSREC_ }
int bosout(BOSIO *descriptor, int *buf) { BOSIO *st; int error, ircn, nbytes, ii; st = descriptor; error = 0; nbytes = buf[0]*sizeof(int); if(st->access == 1) /* sequential write */ { st->outnum++; ircn = 0; /* !!!!!!!!!!! remote files - as direct access !!!!! */ if (st->client != 0) ircn = st->recnum + 1; } else if(st->access == 2) /* direct write - determine record number */ { ircn = st->outnum; } if(st->client != 0) { if(ircn != 0) ircn = (ircn-1)*nbytes + 1; if(st->client < 0) /* network channel is dead, try to reconnect */ { error = bosnres(descriptor,st->client,st->stream,1); if(error != 0) return(error); /* reconnection failed */ } a: writec(&st->client,&st->stream,&ircn,&nbytes,buf,&error); if(error == -2) /* network channel is dead, try to reconnect */ { error = bosnres(descriptor,st->client,st->stream,1); if(error == 0) goto a; /* reconnection successful */ error = -1; } } else { error = cput(st->stream,ircn,buf[0],buf,st->medium); } if(st->access == 1) /* sequential write */ { if(error != 0) { DPR1("bosout : cput error = %i\n",error); return(error); } else st->recnum++; } else if(st->access == 2) /* direct write - determine record number */ { if(error != 0) return(error); else st->recnum = ircn; } return(error); }