Annotation of xinu/sys/rfmkpac.c, revision 1.1

1.1     ! root        1: /* rfmkpac.c - rfmkpac */
        !             2: 
        !             3: #include <conf.h>
        !             4: #include <kernel.h>
        !             5: #include <network.h>
        !             6: 
        !             7: static struct  fpacket packet;
        !             8: 
        !             9: /*------------------------------------------------------------------------
        !            10:  *  rfmkpac  --  make a remote file request packet and send it
        !            11:  *------------------------------------------------------------------------
        !            12:  */
        !            13: rfmkpac(rop, rname, rpos, buff, len)
        !            14: int    rop;
        !            15: char   *rname;
        !            16: long   *rpos;
        !            17: char   *buff;
        !            18: int    len;
        !            19: {
        !            20:        struct  fphdr   *fptr;
        !            21:        int     reqlen, rplylen;
        !            22: 
        !            23:        wait(Rf.rmutex);
        !            24:        fptr = (struct fphdr *) &packet;
        !            25:        fptr->f_op = hs2net(rop);
        !            26:        fptr->f_pos = hl2net(*rpos);
        !            27:        fptr->f_count = hs2net(len);
        !            28:        strncpy(fptr->f_name, rname, RNAMLEN);
        !            29:        reqlen = rplylen = FPHLEN + len;
        !            30:        switch (rop) {
        !            31: 
        !            32:            case FS_WRITE:
        !            33:            case FS_RENAME:
        !            34:                if (len > RDATLEN) {
        !            35:                        signal(Rf.rmutex);
        !            36:                        return(SYSERR);
        !            37:                        }       
        !            38:                blkcopy(packet.fpdata, buff, len);
        !            39:                rplylen = FPHLEN;
        !            40:                break;
        !            41: 
        !            42:            case FS_CLOSE:
        !            43:            case FS_OPEN:
        !            44:            case FS_UNLINK:
        !            45:            case FS_MKDIR:
        !            46:            case FS_RMDIR:
        !            47:            case FS_ACCESS:
        !            48:                rplylen = FPHLEN;
        !            49:                /* fall through */
        !            50:                
        !            51:            case FS_READ:
        !            52:                if (len > RDATLEN) {
        !            53:                        signal(Rf.rmutex);
        !            54:                        return(SYSERR);
        !            55:                }
        !            56:                reqlen = FPHLEN;
        !            57:                break;
        !            58: 
        !            59:            default:
        !            60:                ;
        !            61:        }
        !            62:        if (rfsend(fptr, reqlen, rplylen) == SYSERR ||
        !            63:            net2hs(fptr->f_op) == FS_ERROR) {
        !            64:                signal(Rf.rmutex);
        !            65:                return(SYSERR);
        !            66:        }
        !            67:        switch (rop) {
        !            68: 
        !            69:            case FS_READ:
        !            70:                blkcopy(buff, packet.fpdata, len);
        !            71:                /* fall through */
        !            72: 
        !            73:            case FS_WRITE:
        !            74:                *rpos = net2hl(fptr->f_pos);
        !            75:                len = net2hs(fptr->f_count);
        !            76:                break;
        !            77: 
        !            78:            default:
        !            79:                len = OK;
        !            80:        }
        !            81:        signal(Rf.rmutex);
        !            82:        return(len);
        !            83: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.