|
|
1.1 ! root 1: /* ! 2: * remote file access library ! 3: * for building file system daemons ! 4: */ ! 5: ! 6: typedef struct { ! 7: char *fs; /* fs-specific local data */ ! 8: long ino; ! 9: char dev; ! 10: char type; /* directory or regular */ ! 11: short mode; ! 12: short nlink; ! 13: short uid, gid; ! 14: short rdev; /* is this useful? */ ! 15: long size; ! 16: long ta; ! 17: long tm; ! 18: long tc; ! 19: } Rfile; ! 20: ! 21: extern int fserrno; ! 22: extern int rfdebug; ! 23: extern char *rfclient; ! 24: ! 25: /* ! 26: * service routines ! 27: * provided by the user, ! 28: * but this is what they should look like ! 29: */ ! 30: Rfile *fsinit(); /* (int argc, char **argv) */ ! 31: Rfile *fswalk(); /* (Rfile *dir, char *name) */ ! 32: Rfile *fscreate(); /* (Rfile *dir, char *newname, int mode, uid, gid) */ ! 33: int fsdelete(); /* (Rfile *dir, char *name) */ ! 34: int fslink(); /* (Rfile *dir, char *newname, Rfile *ofile) */ ! 35: int fsmkdir(); /* (Rfile *dir, char *name) */ ! 36: int fsrmdir(); /* (Rfile *dir, char *name, int mode, uid, gid) */ ! 37: int fsdone(); /* (Rfile *f) -- discard this Rfile */ ! 38: int fsstat(); /* (Rfile *f) -- fill it in with stat info */ ! 39: int fsread(); /* (Rfile *f, long off, char *buf, int len) */ ! 40: int fswrite(); /* (Rfile *f, long off, char *buf, int len) */ ! 41: int fsdirread(); /* (Rfile *f, long off, char *buf, int len, long *newoff) */ ! 42: int fsupdate(); /* (Rfile *f, Rfile *attr) -- copy attributes from attr */ ! 43: /* mode, size, uid, gid, ta, tm */ ! 44: ! 45: /* ! 46: * permission mapping ! 47: */ ! 48: ! 49: /* ! 50: * local name to local ID mapping ! 51: */ ! 52: typedef struct { ! 53: char name[9]; ! 54: short id; ! 55: } Idmap; ! 56: ! 57: /* ! 58: * local name to remote name mapping; ! 59: * used only for exception list ! 60: */ ! 61: typedef struct { ! 62: char sname[9]; ! 63: char cname[9]; ! 64: int sid; ! 65: } Namemap; ! 66: ! 67: Idmap *rfmkidmap(); /* (char *filename, Namemap *exlist) */ ! 68: extern Idmap *rfuidmap, *rfgidmap; ! 69: extern int rfuid, rfgid; ! 70: extern int rfotherdeny; ! 71: ! 72: #define RFNOID (-1) /* unmapped user- or group-id */ ! 73: ! 74: /* ! 75: * file modes ! 76: * these correspond to V7 Unix ! 77: * only the low nine bits (permissions) are used by the library ! 78: * other bits will be passed literally to the client ! 79: * if it expects unix-like modes ! 80: */ ! 81: #define RFPRD 04 /* read permission */ ! 82: #define RFPWR 02 /* write permission */ ! 83: #define RFPEX 01 /* execute permission */ ! 84: #define RFPDS RFPEX /* directory search permission */ ! 85: ! 86: #define RFPOTHER 0 /* shift to make `other' permissions */ ! 87: #define RFPGROUP 3 /* shift to make `group' permissions */ ! 88: #define RFPOWNER 6 /* shift to make `owner' permissions */ ! 89: ! 90: /* ! 91: * file types ! 92: * other types are just not allowed for now ! 93: * (but some protocols may sneak them through in the mode) ! 94: */ ! 95: #define RFTREG 0 /* regular file */ ! 96: #define RFTDIR 1 /* directory */ ! 97: ! 98: /* ! 99: * error codes in fserrno ! 100: * these intentionally match Unix errno values, ! 101: * and in fact errno values will usually do, ! 102: * but the library doesn't promise to preserve ! 103: * exact values that aren't here ! 104: */ ! 105: ! 106: #define RFEOWNER 1 /* not file owner */ ! 107: #define RFENOENT 2 /* no such file or directory */ ! 108: #define RFEIO 5 /* general I/O error */ ! 109: #define RFENXIO 6 /* no such file address */ ! 110: #define RFEACCES 13 /* no permission */ ! 111: #define RFEBUSY 16 /* something is in use and can't be used again */ ! 112: #define RFEEXIST 17 /* file exists when it shouldn't */ ! 113: #define RFEXDEV 18 /* link across devices (or just not allowed) */ ! 114: #define RFENOTDIR 20 /* not a directory and should be */ ! 115: #define RFEISDIR 21 /* is a directory and shouldn't be */ ! 116: #define RFEINVAL 22 /* invalid arg or function; catchall for internal errors */ ! 117: #define RFENOSPC 28 /* no space on disk or in buffer (dirread) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.