Annotation of 43BSDReno/usr.sbin/amd/rpcx/nfs_prot.x, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1990 Jan-Simon Pendry
                      3:  * Copyright (c) 1990 Imperial College of Science, Technology & Medicine
                      4:  * Copyright (c) 1990 The Regents of the University of California.
                      5:  * All rights reserved.
                      6:  *
                      7:  * This code is derived from software contributed to Berkeley by
                      8:  * Jan-Simon Pendry at Imperial College, London.
                      9:  *
                     10:  * Redistribution and use in source and binary forms are permitted provided
                     11:  * that: (1) source distributions retain this entire copyright notice and
                     12:  * comment, and (2) distributions including binaries display the following
                     13:  * acknowledgement:  ``This product includes software developed by the
                     14:  * University of California, Berkeley and its contributors'' in the
                     15:  * documentation or other materials provided with the distribution and in
                     16:  * all advertising materials mentioning features or use of this software.
                     17:  * Neither the name of the University nor the names of its contributors may
                     18:  * be used to endorse or promote products derived from this software without
                     19:  * specific prior written permission.
                     20:  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     21:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     22:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     23:  *
                     24:  *     @(#)nfs_prot.x  5.1 (Berkeley) 7/19/90
                     25:  */
                     26: 
                     27: const NFS_PORT          = 2049;
                     28: const NFS_MAXDATA       = 8192;
                     29: const NFS_MAXPATHLEN    = 1024;
                     30: const NFS_MAXNAMLEN    = 255;
                     31: const NFS_FHSIZE       = 32;
                     32: const NFS_COOKIESIZE   = 4;
                     33: const NFS_FIFO_DEV     = -1;   /* size kludge for named pipes */
                     34: 
                     35: /*
                     36:  * File types
                     37:  */
                     38: const NFSMODE_FMT  = 0170000;  /* type of file */
                     39: const NFSMODE_DIR  = 0040000;  /* directory */
                     40: const NFSMODE_CHR  = 0020000;  /* character special */
                     41: const NFSMODE_BLK  = 0060000;  /* block special */
                     42: const NFSMODE_REG  = 0100000;  /* regular */
                     43: const NFSMODE_LNK  = 0120000;  /* symbolic link */
                     44: const NFSMODE_SOCK = 0140000;  /* socket */
                     45: const NFSMODE_FIFO = 0010000;  /* fifo */
                     46: 
                     47: /*
                     48:  * Error status
                     49:  */
                     50: enum nfsstat {
                     51:        NFS_OK= 0,              /* no error */
                     52:        NFSERR_PERM=1,          /* Not owner */
                     53:        NFSERR_NOENT=2,         /* No such file or directory */
                     54:        NFSERR_IO=5,            /* I/O error */
                     55:        NFSERR_NXIO=6,          /* No such device or address */
                     56:        NFSERR_ACCES=13,        /* Permission denied */
                     57:        NFSERR_EXIST=17,        /* File exists */
                     58:        NFSERR_NODEV=19,        /* No such device */
                     59:        NFSERR_NOTDIR=20,       /* Not a directory*/
                     60:        NFSERR_ISDIR=21,        /* Is a directory */
                     61:        NFSERR_FBIG=27,         /* File too large */
                     62:        NFSERR_NOSPC=28,        /* No space left on device */
                     63:        NFSERR_ROFS=30,         /* Read-only file system */
                     64:        NFSERR_NAMETOOLONG=63,  /* File name too long */
                     65:        NFSERR_NOTEMPTY=66,     /* Directory not empty */
                     66:        NFSERR_DQUOT=69,        /* Disc quota exceeded */
                     67:        NFSERR_STALE=70,        /* Stale NFS file handle */
                     68:        NFSERR_WFLUSH=99        /* write cache flushed */
                     69: };
                     70: 
                     71: /*
                     72:  * File types
                     73:  */
                     74: enum ftype {
                     75:        NFNON = 0,      /* non-file */
                     76:        NFREG = 1,      /* regular file */
                     77:        NFDIR = 2,      /* directory */
                     78:        NFBLK = 3,      /* block special */
                     79:        NFCHR = 4,      /* character special */
                     80:        NFLNK = 5,      /* symbolic link */
                     81:        NFSOCK = 6,     /* unix domain sockets */
                     82:        NFBAD = 7,      /* unused */
                     83:        NFFIFO = 8      /* named pipe */
                     84: };
                     85: 
                     86: /*
                     87:  * File access handle
                     88:  */
                     89: struct nfs_fh {
                     90:        opaque data[NFS_FHSIZE];
                     91: };
                     92: 
                     93: /* 
                     94:  * Timeval
                     95:  */
                     96: struct nfstime {
                     97:        unsigned seconds;
                     98:        unsigned useconds;
                     99: };
                    100: 
                    101: 
                    102: /*
                    103:  * File attributes
                    104:  */
                    105: struct fattr {
                    106:        ftype type;             /* file type */
                    107:        unsigned mode;          /* protection mode bits */
                    108:        unsigned nlink;         /* # hard links */
                    109:        unsigned uid;           /* owner user id */
                    110:        unsigned gid;           /* owner group id */
                    111:        unsigned size;          /* file size in bytes */
                    112:        unsigned blocksize;     /* prefered block size */
                    113:        unsigned rdev;          /* special device # */
                    114:        unsigned blocks;        /* Kb of disk used by file */
                    115:        unsigned fsid;          /* device # */
                    116:        unsigned fileid;        /* inode # */
                    117:        nfstime atime;          /* time of last access */
                    118:        nfstime mtime;          /* time of last modification */
                    119:        nfstime ctime;          /* time of last change */
                    120: };
                    121: 
                    122: /*
                    123:  * File attributes which can be set
                    124:  */
                    125: struct sattr {
                    126:        unsigned mode;  /* protection mode bits */
                    127:        unsigned uid;   /* owner user id */
                    128:        unsigned gid;   /* owner group id */
                    129:        unsigned size;  /* file size in bytes */
                    130:        nfstime atime;  /* time of last access */
                    131:        nfstime mtime;  /* time of last modification */
                    132: };
                    133: 
                    134: 
                    135: typedef string filename<NFS_MAXNAMLEN>; 
                    136: typedef string nfspath<NFS_MAXPATHLEN>;
                    137: 
                    138: /*
                    139:  * Reply status with file attributes
                    140:  */
                    141: union attrstat switch (nfsstat status) {
                    142: case NFS_OK:
                    143:        fattr attributes;
                    144: default:
                    145:        void;
                    146: };
                    147: 
                    148: struct sattrargs {
                    149:        nfs_fh file;
                    150:        sattr attributes;
                    151: };
                    152: 
                    153: /*
                    154:  * Arguments for directory operations
                    155:  */
                    156: struct diropargs {
                    157:        nfs_fh  dir;    /* directory file handle */
                    158:        filename name;          /* name (up to NFS_MAXNAMLEN bytes) */
                    159: };
                    160: 
                    161: struct diropokres {
                    162:        nfs_fh file;
                    163:        fattr attributes;
                    164: };
                    165: 
                    166: /*
                    167:  * Results from directory operation
                    168:  */
                    169: union diropres switch (nfsstat status) {
                    170: case NFS_OK:
                    171:        diropokres diropres;
                    172: default:
                    173:        void;
                    174: };
                    175: 
                    176: union readlinkres switch (nfsstat status) {
                    177: case NFS_OK:
                    178:        nfspath data;
                    179: default:
                    180:        void;
                    181: };
                    182: 
                    183: /*
                    184:  * Arguments to remote read
                    185:  */
                    186: struct readargs {
                    187:        nfs_fh file;            /* handle for file */
                    188:        unsigned offset;        /* byte offset in file */
                    189:        unsigned count;         /* immediate read count */
                    190:        unsigned totalcount;    /* total read count (from this offset)*/
                    191: };
                    192: 
                    193: /*
                    194:  * Status OK portion of remote read reply
                    195:  */
                    196: struct readokres {
                    197:        fattr   attributes;     /* attributes, need for pagin*/
                    198:        opaque data<NFS_MAXDATA>;
                    199: };
                    200: 
                    201: union readres switch (nfsstat status) {
                    202: case NFS_OK:
                    203:        readokres reply;
                    204: default:
                    205:        void;
                    206: };
                    207: 
                    208: /*
                    209:  * Arguments to remote write 
                    210:  */
                    211: struct writeargs {
                    212:        nfs_fh  file;           /* handle for file */
                    213:        unsigned beginoffset;   /* beginning byte offset in file */
                    214:        unsigned offset;        /* current byte offset in file */
                    215:        unsigned totalcount;    /* total write count (to this offset)*/
                    216:        opaque data<NFS_MAXDATA>;
                    217: };
                    218: 
                    219: struct createargs {
                    220:        diropargs where;
                    221:        sattr attributes;
                    222: };
                    223: 
                    224: struct renameargs {
                    225:        diropargs from;
                    226:        diropargs to;
                    227: };
                    228: 
                    229: struct linkargs {
                    230:        nfs_fh from;
                    231:        diropargs to;
                    232: };
                    233: 
                    234: struct symlinkargs {
                    235:        diropargs from;
                    236:        nfspath to;
                    237:        sattr attributes;
                    238: };
                    239: 
                    240: 
                    241: typedef opaque nfscookie[NFS_COOKIESIZE];
                    242: 
                    243: /*
                    244:  * Arguments to readdir
                    245:  */
                    246: struct readdirargs {
                    247:        nfs_fh dir;             /* directory handle */
                    248:        nfscookie cookie;
                    249:        unsigned count;         /* number of directory bytes to read */
                    250: };
                    251: 
                    252: struct entry {
                    253:        unsigned fileid;
                    254:        filename name;
                    255:        nfscookie cookie;
                    256:        entry *nextentry;
                    257: };
                    258: 
                    259: struct dirlist {
                    260:        entry *entries;
                    261:        bool eof;
                    262: };
                    263: 
                    264: union readdirres switch (nfsstat status) {
                    265: case NFS_OK:
                    266:        dirlist reply;
                    267: default:
                    268:        void;
                    269: };
                    270: 
                    271: struct statfsokres {
                    272:        unsigned tsize; /* preferred transfer size in bytes */
                    273:        unsigned bsize; /* fundamental file system block size */
                    274:        unsigned blocks;        /* total blocks in file system */
                    275:        unsigned bfree; /* free blocks in fs */
                    276:        unsigned bavail;        /* free blocks avail to non-superuser */
                    277: };
                    278: 
                    279: union statfsres switch (nfsstat status) {
                    280: case NFS_OK:
                    281:        statfsokres reply;
                    282: default:
                    283:        void;
                    284: };
                    285: 
                    286: /*
                    287:  * Remote file service routines
                    288:  */
                    289: program NFS_PROGRAM {
                    290:        version NFS_VERSION {
                    291:                void 
                    292:                NFSPROC_NULL(void) = 0;
                    293: 
                    294:                attrstat 
                    295:                NFSPROC_GETATTR(nfs_fh) =       1;
                    296: 
                    297:                attrstat 
                    298:                NFSPROC_SETATTR(sattrargs) = 2;
                    299: 
                    300:                void 
                    301:                NFSPROC_ROOT(void) = 3;
                    302: 
                    303:                diropres 
                    304:                NFSPROC_LOOKUP(diropargs) = 4;
                    305: 
                    306:                readlinkres 
                    307:                NFSPROC_READLINK(nfs_fh) = 5;
                    308: 
                    309:                readres 
                    310:                NFSPROC_READ(readargs) = 6;
                    311: 
                    312:                void 
                    313:                NFSPROC_WRITECACHE(void) = 7;
                    314: 
                    315:                attrstat
                    316:                NFSPROC_WRITE(writeargs) = 8;
                    317: 
                    318:                diropres
                    319:                NFSPROC_CREATE(createargs) = 9;
                    320: 
                    321:                nfsstat
                    322:                NFSPROC_REMOVE(diropargs) = 10;
                    323: 
                    324:                nfsstat
                    325:                NFSPROC_RENAME(renameargs) = 11;
                    326: 
                    327:                nfsstat
                    328:                NFSPROC_LINK(linkargs) = 12;
                    329: 
                    330:                nfsstat
                    331:                NFSPROC_SYMLINK(symlinkargs) = 13;
                    332: 
                    333:                diropres
                    334:                NFSPROC_MKDIR(createargs) = 14;
                    335: 
                    336:                nfsstat
                    337:                NFSPROC_RMDIR(diropargs) = 15;
                    338: 
                    339:                readdirres
                    340:                NFSPROC_READDIR(readdirargs) = 16;
                    341: 
                    342:                statfsres
                    343:                NFSPROC_STATFS(nfs_fh) = 17;
                    344:        } = 2;
                    345: } = 100003;

unix.superglobalmegacorp.com

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