URI:
       ttapefs.h - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       ttapefs.h (1846B)
       ---
            1 #define getpass tapefs_getpass
            2 
            3 #define        g2byte(x)        (((x)[1]<<8) + (x)[0])                /* little-endian */
            4 #define        g3byte(x)        (((x)[2]<<16) + ((x)[1]<<8) + (x)[0])
            5 #define        g4byte(x)        (((x)[3]<<24) + ((x)[2]<<16) + ((x)[1]<<8) + (x)[0])
            6 
            7 /* big endian */
            8 #define        b4byte(x)        (((x)[0]<<24) + ((x)[1]<<16) + ((x)[2]<<8) + (x)[3])
            9 #define        b8byte(x)        (((vlong)b4byte(x)<<32) | (u32int)b4byte((x)+4))
           10 
           11 enum
           12 {
           13         OPERM        = 0x3,                /* mask of all permission types in open mode */
           14         Nram        = 512,
           15         Maxbuf        = 8192                /* max buffer size */
           16 };
           17 
           18 typedef struct Fid Fid;
           19 typedef struct Ram Ram;
           20 
           21 struct Fid
           22 {
           23         short        busy;
           24         short        open;
           25         short        rclose;
           26         int        fid;
           27         Fid        *next;
           28         char        *user;
           29         Ram        *ram;
           30 };
           31 
           32 struct Ram
           33 {
           34         char        busy;
           35         char        open;
           36         char        replete;
           37         Ram        *parent;        /* parent directory */
           38         Ram        *child;                /* first member of directory */
           39         Ram        *next;                /* next member of file's directory */
           40         Qid        qid;
           41         long        perm;
           42         char        *name;
           43         ulong        atime;
           44         ulong        mtime;
           45         char        *user;
           46         char        *group;
           47         vlong addr;
           48         void *data;
           49         vlong        ndata;
           50 };
           51 
           52 enum
           53 {
           54         Pexec =                1,
           55         Pwrite =         2,
           56         Pread =         4,
           57         Pother =         1,
           58         Pgroup =         8,
           59         Powner =        64
           60 };
           61 
           62 typedef struct idmap {
           63         char        *name;
           64         int        id;
           65 } Idmap;
           66 
           67 typedef struct fileinf {
           68         char        *name;
           69         vlong        addr;
           70         void        *data;
           71         vlong        size;
           72         int        mode;
           73         int        uid;
           74         int        gid;
           75         long        mdate;
           76 } Fileinf;
           77 
           78 extern        ulong        path;                /* incremented for each new file */
           79 extern        Ram        *ram;
           80 extern        char        *user;
           81 extern        Idmap        *uidmap;
           82 extern        Idmap        *gidmap;
           83 extern        int        replete;
           84 extern        int        blocksize;
           85 void        error(char*);
           86 void        *erealloc(void*, ulong);
           87 void        *emalloc(ulong);
           88 char        *estrdup(char*);
           89 void        populate(char *);
           90 void        dotrunc(Ram*);
           91 void        docreate(Ram*);
           92 char        *doread(Ram*, vlong, long);
           93 void        dowrite(Ram*, char*, long, long);
           94 int        dopermw(Ram*);
           95 Idmap        *getpass(char*);
           96 char        *mapid(Idmap*,int);
           97 Ram        *poppath(Fileinf fi, int new);
           98 Ram        *popfile(Ram *dir, Fileinf fi);
           99 void        popdir(Ram*);
          100 Ram        *lookup(Ram*, char*);