dat.h 2.5 KB

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