dat.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. typedef struct Ioclust Ioclust;
  2. typedef struct Iobuf Iobuf;
  3. typedef struct Isofile Isofile;
  4. typedef struct Xdata Xdata;
  5. typedef struct Xfile Xfile;
  6. typedef struct Xfs Xfs;
  7. typedef struct Xfsub Xfsub;
  8. enum
  9. {
  10. Sectorsize = 2048,
  11. Maxname = 256,
  12. };
  13. struct Iobuf
  14. {
  15. Ioclust* clust;
  16. long addr;
  17. uchar* iobuf;
  18. };
  19. struct Ioclust
  20. {
  21. long addr;
  22. Xdata* dev;
  23. Ioclust* next;
  24. Ioclust* prev;
  25. int busy;
  26. int nbuf;
  27. Iobuf* buf;
  28. uchar* iobuf;
  29. };
  30. struct Xdata
  31. {
  32. Xdata* next;
  33. char* name; /* of underlying file */
  34. Qid qid;
  35. short type;
  36. short fdev;
  37. int ref; /* attach count */
  38. int dev; /* for read/write */
  39. };
  40. struct Xfsub
  41. {
  42. void (*reset)(void);
  43. int (*attach)(Xfile*);
  44. void (*clone)(Xfile*, Xfile*);
  45. void (*walkup)(Xfile*);
  46. void (*walk)(Xfile*, char*);
  47. void (*open)(Xfile*, int);
  48. void (*create)(Xfile*, char*, long, int);
  49. long (*readdir)(Xfile*, uchar*, long, long);
  50. long (*read)(Xfile*, char*, long, long);
  51. long (*write)(Xfile*, char*, long, long);
  52. void (*clunk)(Xfile*);
  53. void (*remove)(Xfile*);
  54. void (*stat)(Xfile*, Dir*);
  55. void (*wstat)(Xfile*, Dir*);
  56. };
  57. struct Xfs
  58. {
  59. Xdata* d; /* how to get the bits */
  60. Xfsub* s; /* how to use them */
  61. int ref;
  62. int issusp; /* follows system use sharing protocol */
  63. long suspoff; /* if so, offset at which SUSP area begins */
  64. int isrock; /* Rock Ridge format */
  65. int isplan9; /* has Plan 9-specific directory info */
  66. Qid rootqid;
  67. Isofile* ptr; /* private data */
  68. };
  69. struct Xfile
  70. {
  71. Xfile* next; /* in fid hash bucket */
  72. Xfs* xf;
  73. long fid;
  74. ulong flags;
  75. Qid qid;
  76. int len; /* of private data */
  77. Isofile* ptr;
  78. };
  79. enum
  80. {
  81. Asis,
  82. Clean,
  83. Clunk
  84. };
  85. enum
  86. {
  87. Oread = 1,
  88. Owrite = 2,
  89. Orclose = 4,
  90. Omodes = 3,
  91. };
  92. extern char Enonexist[]; /* file does not exist */
  93. extern char Eperm[]; /* permission denied */
  94. extern char Enofile[]; /* no file system specified */
  95. extern char Eauth[]; /* authentication failed */
  96. extern char *srvname;
  97. extern char *deffile;
  98. extern int chatty;
  99. extern jmp_buf err_lab[];
  100. extern int nerr_lab;
  101. extern char err_msg[];
  102. extern int nojoliet;
  103. extern int noplan9;
  104. extern int norock;