iso9660.h 2.7 KB

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