dat.h 2.1 KB

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