cformat.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * format of cache on disk
  3. */
  4. typedef struct Dptr Dptr;
  5. typedef struct Dahdr Dahdr;
  6. typedef struct Dalloc Dalloc;
  7. typedef struct Fphdr Fphdr;
  8. typedef struct Fptr Fptr;
  9. typedef struct Inode Inode;
  10. typedef struct Dihdr Dihdr;
  11. typedef struct Dinode Dinode;
  12. enum
  13. {
  14. Amagic= 0xbebeefed, /* allocation block magic */
  15. Imagic= 0xbadc00ce, /* inode block magic */
  16. BtoUL= 8*sizeof(ulong),/* bits in a ulong */
  17. KNAMELEN= 28 /* old NAMELEN: BUG */
  18. };
  19. #define Indbno 0x80000000 /* indirect block */
  20. #define Notabno 0xFFFFFFFF /* not a block number */
  21. /*
  22. * Allocation blocks at the begining of the disk. There are
  23. * enough of these blocks to supply 1 bit for each block on the
  24. * disk;
  25. */
  26. struct Dahdr
  27. {
  28. ulong magic;
  29. ulong bsize; /* logical block size */
  30. char name[KNAMELEN];
  31. short nab; /* number of allocation blocks */
  32. };
  33. struct Dalloc
  34. {
  35. Dahdr;
  36. ulong bits[1];
  37. };
  38. /*
  39. * A pointer to disk data
  40. */
  41. struct Dptr
  42. {
  43. ulong fbno; /* file block number */
  44. ulong bno; /* disk block number */
  45. ushort start; /* offset into block of valid data */
  46. ushort end; /* offset into block after valid data */
  47. };
  48. /*
  49. * A file descriptor.
  50. */
  51. struct Inode
  52. {
  53. Qid qid;
  54. vlong length;
  55. Dptr ptr; /* pointer page */
  56. char inuse;
  57. };
  58. /*
  59. * inode blocks (after allocation blocks)
  60. */
  61. struct Dihdr
  62. {
  63. ulong magic;
  64. ulong nino; /* number of inodes */
  65. };
  66. struct Dinode
  67. {
  68. Dihdr;
  69. Inode inode[1];
  70. };