Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

160 lines
5.9 KiB

  1. /*
  2. File: AppleDiskPartitions.h
  3. Contains: The Apple disk partition scheme as defined in Inside Macintosh: Volume V.
  4. Version: QuickTime 7.3
  5. Copyright: (c) 2007 (c) 2000-2001 by Apple Computer, Inc., all rights reserved
  6. Bugs?: For bug reports, consult the following page on
  7. the World Wide Web:
  8. http://developer.apple.com/bugreporter/
  9. */
  10. #ifndef __APPLEDISKPARTITIONS__
  11. #define __APPLEDISKPARTITIONS__
  12. #ifndef __MACTYPES__
  13. #include <MacTypes.h>
  14. #endif
  15. #if PRAGMA_ONCE
  16. #pragma once
  17. #endif
  18. #if PRAGMA_IMPORT
  19. #pragma import on
  20. #endif
  21. #if PRAGMA_STRUCT_ALIGN
  22. #pragma options align=mac68k
  23. #elif PRAGMA_STRUCT_PACKPUSH
  24. #pragma pack(push, 2)
  25. #elif PRAGMA_STRUCT_PACK
  26. #pragma pack(2)
  27. #endif
  28. /* Block 0 Definitions */
  29. enum {
  30. sbSIGWord = 0x4552, /* signature word for Block 0 ('ER') */
  31. sbMac = 1 /* system type for Mac */
  32. };
  33. /* Partition Map Signatures */
  34. enum {
  35. pMapSIG = 0x504D, /* partition map signature ('PM') */
  36. pdSigWord = 0x5453, /* partition map signature ('TS') */
  37. oldPMSigWord = pdSigWord,
  38. newPMSigWord = pMapSIG
  39. };
  40. /* Driver Descriptor Map */
  41. struct Block0 {
  42. UInt16 sbSig; /* unique value for SCSI block 0 */
  43. UInt16 sbBlkSize; /* block size of device */
  44. UInt32 sbBlkCount; /* number of blocks on device */
  45. UInt16 sbDevType; /* device type */
  46. UInt16 sbDevId; /* device id */
  47. UInt32 sbData; /* not used */
  48. UInt16 sbDrvrCount; /* driver descriptor count */
  49. UInt32 ddBlock; /* 1st driver's starting block */
  50. UInt16 ddSize; /* size of 1st driver (512-byte blks) */
  51. UInt16 ddType; /* system type (1 for Mac+) */
  52. UInt16 ddPad[243]; /* ARRAY[0..242] OF INTEGER; not used */
  53. };
  54. typedef struct Block0 Block0;
  55. /* Driver descriptor */
  56. struct DDMap {
  57. UInt32 ddBlock; /* 1st driver's starting block */
  58. UInt16 ddSize; /* size of 1st driver (512-byte blks) */
  59. UInt16 ddType; /* system type (1 for Mac+) */
  60. };
  61. typedef struct DDMap DDMap;
  62. /* Constants for the ddType field of the DDMap structure. */
  63. enum {
  64. kDriverTypeMacSCSI = 0x0001,
  65. kDriverTypeMacATA = 0x0701,
  66. kDriverTypeMacSCSIChained = 0xFFFF,
  67. kDriverTypeMacATAChained = 0xF8FF
  68. };
  69. /* Partition Map Entry */
  70. struct Partition {
  71. UInt16 pmSig; /* unique value for map entry blk */
  72. UInt16 pmSigPad; /* currently unused */
  73. UInt32 pmMapBlkCnt; /* # of blks in partition map */
  74. UInt32 pmPyPartStart; /* physical start blk of partition */
  75. UInt32 pmPartBlkCnt; /* # of blks in this partition */
  76. UInt8 pmPartName[32]; /* ASCII partition name */
  77. UInt8 pmParType[32]; /* ASCII partition type */
  78. UInt32 pmLgDataStart; /* log. # of partition's 1st data blk */
  79. UInt32 pmDataCnt; /* # of blks in partition's data area */
  80. UInt32 pmPartStatus; /* bit field for partition status */
  81. UInt32 pmLgBootStart; /* log. blk of partition's boot code */
  82. UInt32 pmBootSize; /* number of bytes in boot code */
  83. UInt32 pmBootAddr; /* memory load address of boot code */
  84. UInt32 pmBootAddr2; /* currently unused */
  85. UInt32 pmBootEntry; /* entry point of boot code */
  86. UInt32 pmBootEntry2; /* currently unused */
  87. UInt32 pmBootCksum; /* checksum of boot code */
  88. UInt8 pmProcessor[16]; /* ASCII for the processor type */
  89. UInt16 pmPad[188]; /* ARRAY[0..187] OF INTEGER; not used */
  90. };
  91. typedef struct Partition Partition;
  92. /* Flags for the pmPartStatus field of the Partition data structure. */
  93. enum {
  94. kPartitionAUXIsValid = 0x00000001,
  95. kPartitionAUXIsAllocated = 0x00000002,
  96. kPartitionAUXIsInUse = 0x00000004,
  97. kPartitionAUXIsBootValid = 0x00000008,
  98. kPartitionAUXIsReadable = 0x00000010,
  99. kPartitionAUXIsWriteable = 0x00000020,
  100. kPartitionAUXIsBootCodePositionIndependent = 0x00000040,
  101. kPartitionIsWriteable = 0x00000020,
  102. kPartitionIsMountedAtStartup = 0x40000000,
  103. kPartitionIsStartup = (long)0x80000000,
  104. kPartitionIsChainCompatible = 0x00000100,
  105. kPartitionIsRealDeviceDriver = 0x00000200,
  106. kPartitionCanChainToNext = 0x00000400
  107. };
  108. /* Well known driver signatures, stored in the first four byte of pmPad. */
  109. enum {
  110. kPatchDriverSignature = FOUR_CHAR_CODE('ptDR'), /* SCSI and ATA[PI] patch driver */
  111. kSCSIDriverSignature = 0x00010600, /* SCSI hard disk driver */
  112. kATADriverSignature = FOUR_CHAR_CODE('wiki'), /* ATA hard disk driver */
  113. kSCSICDDriverSignature = FOUR_CHAR_CODE('CDvr'), /* SCSI CD-ROM driver */
  114. kATAPIDriverSignature = FOUR_CHAR_CODE('ATPI'), /* ATAPI CD-ROM driver */
  115. kDriveSetupHFSSignature = FOUR_CHAR_CODE('DSU1') /* Drive Setup HFS partition */
  116. };
  117. #if PRAGMA_STRUCT_ALIGN
  118. #pragma options align=reset
  119. #elif PRAGMA_STRUCT_PACKPUSH
  120. #pragma pack(pop)
  121. #elif PRAGMA_STRUCT_PACK
  122. #pragma pack()
  123. #endif
  124. #ifdef PRAGMA_IMPORT_OFF
  125. #pragma import off
  126. #elif PRAGMA_IMPORT
  127. #pragma import reset
  128. #endif
  129. #endif /* __APPLEDISKPARTITIONS__ */