Annotation of researchv9/netb/src/share.h, revision 1.1.1.1

1.1       root        1: /* the makefile has to -I the proper directories */
                      2: #ifndef ns32000                /* wretched sequent nonsense */
                      3: #include "types.h"
                      4: #endif
                      5: #include "param.h"
                      6: #include "stat.h"
                      7: #include "errno.h"
                      8: 
                      9: /* what the tags refer to */
                     10: typedef struct {
                     11:        unsigned char *name;    /* the full path name */
                     12:        int fd;         /* the file descriptor i've got */
                     13:        char flags;     /* 1=>read-only */
                     14:        struct stat stb;        /* for various purposes */
                     15:        long tag;
                     16:        unsigned long pos;      /* cache to avoid some lseeks */
                     17: } file;
                     18: extern file files[];
                     19: #if sun
                     20: #define        FILES   28
                     21: #else
                     22: #define        FILES   128
                     23: #endif
                     24: 
                     25: /* with this setup, permissions have to be checked on every read/write,
                     26:  * which doesn't quite match unix semantics. */
                     27: 
                     28: /* translation table between host devs and client devs */
                     29: typedef struct {
                     30:        int hdev, cdev;
                     31: } dev;
                     32: extern dev *devs;
                     33: extern int ndev;
                     34: /* file descriptors */
                     35: extern int cfd;                /* talk to client */
                     36: extern int dbgfd;      /* debugging output */
                     37: extern int pfd;                /* used to read the exceptions during perm setup */
                     38: 
                     39: extern int errno;
                     40: 
                     41: /* the big server structure, translates from and to client messages */
                     42: /* the types have to be adjusted to cope with new kinds of clients */
                     43: extern struct client {
                     44:        char cmd;
                     45:        char flags;
                     46:        long trannum;
                     47:        long len;
                     48:        long tag;
                     49:        short uid, gid;
                     50:        unsigned short mode;
                     51:        long ta, tm, tc;        /* (&ta)[1] must be tm */
                     52:        long offset;
                     53:        long count;     /* len for read or write */
                     54:        int dev;
                     55:        long ino;       /* for linking */
                     56:        /* additional stuff for responses */
                     57:        short errno;
                     58:        long size;
                     59:        long resplen;
                     60:        short nlink;
                     61:        int used;
                     62:        short namiflags;
                     63: } client;
                     64: 
                     65: extern unsigned char *inbuf, *nmbuf;
                     66: extern unsigned char *slash;   /* pos of last slash in nmbuf */
                     67: extern int inlen, iamroot;
                     68: extern int nmoffset;   /* used to compute client.used */
                     69: extern int hisdev;     /* the major device the client thinks we are */
                     70: extern int roottag;    /* root's tag */
                     71: extern int otherok;    /* host other perms for mystery users from client? */
                     72: 
                     73: /* these are the nami flags, and have to be the same as in the client! (inode.h) */
                     74: #define NI_DEL 1       /* unlink this file */
                     75: #define NI_CREAT 2     /* create it if it doesn't exits */
                     76: #define NI_NXCREAT 3   /* create it, error if it already exists */
                     77: #define NI_LINK        4       /* make a link */
                     78: #define NI_MKDIR 5     /* make a directory */
                     79: #define NI_RMDIR 6     /* remove a directory */
                     80: 
                     81: /* these have to be the same as in the client! (netb.h) */
                     82: #define NETB 2
                     83: /* commands */
                     84: #define NBPUT  1
                     85: #define NBGET  2
                     86: #define NBUPD  3
                     87: #define NBREAD 4
                     88: #define NBWRT  5
                     89: #define NBNAMI 6
                     90: #define NBSTAT 7
                     91: #define NBIOCTL        8
                     92: #define NBTRNC 9
                     93: /* response flags */
                     94: #define NBROOT 1
                     95: 
                     96: /* delta time */
                     97: extern int dtime;
                     98: #ifndef NULL
                     99: #define NULL 0
                    100: #endif
                    101: #ifndef ROOTINO
                    102: #define ROOTINO 2
                    103: #endif
                    104: extern char *malloc(), *realloc();
                    105: extern int proto;      /* values are 'd' for datakit and 't' for tcp */
                    106: extern int clienttype; /* values are 's' for sun, 'c' for cray,
                    107:                         * and 'v' for vax */
                    108: 
                    109: /* logic for deternining host type */
                    110: #if !defined(vax) && !defined(sun) && !defined(cray) && !defined(ns32000)
                    111: xx() { xx(host);}
                    112: #endif
                    113: #if !defined(cray)
                    114: #define cray 0
                    115: #endif

unix.superglobalmegacorp.com

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