iso9660.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. #define VOLDESC 16 /* sector number */
  2. /*
  3. * L means little-endian, M means big-endian, and LM means little-endian
  4. * then again big-endian.
  5. */
  6. typedef uchar Byte2L[2];
  7. typedef uchar Byte2M[2];
  8. typedef uchar Byte4LM[4];
  9. typedef uchar Byte4L[4];
  10. typedef uchar Byte4M[4];
  11. typedef uchar Byte8LM[8];
  12. typedef union Drec Drec;
  13. typedef union Voldesc Voldesc;
  14. enum
  15. {
  16. Boot = 0,
  17. Primary = 1,
  18. Supplementary = 2,
  19. Partition = 3,
  20. Terminator = 255
  21. };
  22. union Voldesc
  23. { /* volume descriptor */
  24. uchar byte[Sectorsize];
  25. union { /* for CD001, the ECMA standard */
  26. struct
  27. {
  28. uchar type;
  29. uchar stdid[5];
  30. uchar version;
  31. uchar unused;
  32. uchar sysid[32];
  33. uchar bootid[32];
  34. uchar data[1977];
  35. } boot;
  36. struct
  37. {
  38. uchar type;
  39. uchar stdid[5];
  40. uchar version;
  41. uchar flags;
  42. uchar sysid[32];
  43. uchar volid[32];
  44. Byte8LM partloc;
  45. Byte8LM size;
  46. uchar escapes[32];
  47. Byte4LM vsetsize;
  48. Byte4LM vseqno;
  49. Byte4LM blksize;
  50. Byte8LM ptabsize;
  51. Byte4L lptable;
  52. Byte4L optlptable;
  53. Byte4M mptable;
  54. Byte4M optmptable;
  55. uchar rootdir[34];
  56. uchar volsetid[128];
  57. uchar pubid[128];
  58. uchar prepid[128];
  59. uchar appid[128];
  60. uchar copyright[37];
  61. uchar abstract[37];
  62. uchar bibliography[37];
  63. uchar cdate[17];
  64. uchar mdate[17];
  65. uchar expdate[17];
  66. uchar effdate[17];
  67. uchar fsversion;
  68. uchar unused3[1];
  69. uchar appuse[512];
  70. uchar unused4[653];
  71. } desc;
  72. } z;
  73. union
  74. { /* for CDROM, the `High Sierra' standard */
  75. struct
  76. {
  77. Byte8LM number;
  78. uchar type;
  79. uchar stdid[5];
  80. uchar version;
  81. uchar flags;
  82. uchar sysid[32];
  83. uchar volid[32];
  84. Byte8LM partloc;
  85. Byte8LM size;
  86. uchar escapes[32];
  87. Byte4LM vsetsize;
  88. Byte4LM vseqno;
  89. Byte4LM blksize;
  90. uchar quux[40];
  91. uchar rootdir[34];
  92. uchar volsetid[128];
  93. uchar pubid[128];
  94. uchar prepid[128];
  95. uchar appid[128];
  96. uchar copyright[32];
  97. uchar abstract[32];
  98. uchar cdate[16];
  99. uchar mdate[16];
  100. uchar expdate[16];
  101. uchar effdate[16];
  102. uchar fsversion;
  103. } desc;
  104. } r;
  105. };
  106. union Drec
  107. {
  108. struct
  109. {
  110. uchar reclen;
  111. uchar attrlen;
  112. Byte8LM addr;
  113. Byte8LM size;
  114. uchar date[6];
  115. uchar tzone; /* flags in high sierra */
  116. uchar flags; /* ? in high sierra */
  117. uchar unitsize; /* ? in high sierra */
  118. uchar gapsize; /* ? in high sierra */
  119. Byte4LM vseqno; /* ? in high sierra */
  120. uchar namelen;
  121. uchar name[1];
  122. };
  123. struct
  124. {
  125. uchar r_pad[24];
  126. uchar r_flags;
  127. };
  128. };
  129. struct Isofile
  130. {
  131. short fmt; /* 'z' if iso, 'r' if high sierra */
  132. short blksize;
  133. vlong offset; /* true offset when reading directory */
  134. long odelta; /* true size of directory just read */
  135. vlong doffset; /* plan9 offset when reading directory */
  136. Drec d;
  137. };