/*
- * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#ifndef __HFS_FORMAT__
#define __HFS_FORMAT__
+#ifndef __HFSVOLUMES__
+
+#include <sys/types.h>
#include <sys/appleapiopts.h>
/*
enum {
kHFSSigWord = 0x4244, /* 'BD' in ASCII */
kHFSPlusSigWord = 0x482B, /* 'H+' in ASCII */
- kHFSJSigWord = 0x484a, /* 'HJ' in ASCII */
- kHFSPlusVersion = 0x0004, /* will change as format changes */
- /* version 4 shipped with Mac OS 8.1 */
+ kHFSXSigWord = 0x4858, /* 'HX' in ASCII */
+
+ kHFSPlusVersion = 0x0004, /* 'H+' volumes are version 4 only */
+ kHFSXVersion = 0x0005, /* 'HX' volumes start with version 5 */
+
kHFSPlusMountVersion = 0x31302E30, /* '10.0' for Mac OS X */
kHFSJMountVersion = 0x4846534a /* 'HFSJ' for journaled HFS+ on OS X */
};
};
+#ifndef __FILES__
/* Unicode strings are used for HFS Plus file and folder names */
struct HFSUniStr255 {
u_int16_t length; /* number of unicode characters */
};
typedef struct HFSUniStr255 HFSUniStr255;
typedef const HFSUniStr255 *ConstHFSUniStr255Param;
+#endif /* __FILES__ */
enum {
kHFSMaxVolumeNameChars = 27,
kHFSAllocationFileID = 6, /* File ID of the allocation file (HFS Plus only) */
kHFSStartupFileID = 7, /* File ID of the startup file (HFS Plus only) */
kHFSAttributesFileID = 8, /* File ID of the attribute file (HFS Plus only) */
+ kHFSRepairCatalogFileID = 14, /* Used when rebuilding Catalog B-tree */
kHFSBogusExtentFileID = 15, /* Used for exchanging extents in extents file */
kHFSFirstUserCatalogNodeID = 16
};
kHFSBootVolumeInconsistentBit = 11, /* boot volume is inconsistent (System 7.6 and later) */
kHFSCatalogNodeIDsReusedBit = 12,
kHFSVolumeJournaledBit = 13, /* this volume has a journal on it */
- /* Bit 14 is reserved for future use */
+ kHFSVolumeInconsistentBit = 14, /* serious inconsistencies detected at runtime */
kHFSVolumeSoftwareLockBit = 15, /* volume is locked by software */
kHFSVolumeHardwareLockMask = 1 << kHFSVolumeHardwareLockBit,
kHFSBootVolumeInconsistentMask = 1 << kHFSBootVolumeInconsistentBit,
kHFSCatalogNodeIDsReusedMask = 1 << kHFSCatalogNodeIDsReusedBit,
kHFSVolumeJournaledMask = 1 << kHFSVolumeJournaledBit,
+ kHFSVolumeInconsistentMask = 1 << kHFSVolumeInconsistentBit,
kHFSVolumeSoftwareLockMask = 1 << kHFSVolumeSoftwareLockBit,
kHFSMDBAttributesMask = 0x8380
};
typedef struct HFSMasterDirectoryBlock HFSMasterDirectoryBlock;
+#ifdef __APPLE_API_UNSTABLE
+#define SET_HFS_TEXT_ENCODING(hint) \
+ (0x656e6300 | ((hint) & 0xff))
+#define GET_HFS_TEXT_ENCODING(hint) \
+ (((hint) & 0xffffff00) == 0x656e6300 ? (hint) & 0x000000ff : 0xffffffffU)
+#endif /* __APPLE_API_UNSTABLE */
+
+
/* HFS Plus Volume Header - 512 bytes */
/* Stored at sector #2 (3rd sector) and second-to-last sector. */
struct HFSPlusVolumeHeader {
u_int16_t version; /* == kHFSPlusVersion */
u_int32_t attributes; /* volume attributes */
u_int32_t lastMountedVersion; /* implementation version which last mounted volume */
-//XXXdbg u_int32_t reserved; /* reserved - initialized as zero */
u_int32_t journalInfoBlock; /* block addr of journal info (if volume is journaled, zero otherwise) */
u_int32_t createDate; /* date and time of volume creation */
u_int16_t reserved1; /* unused */
u_int32_t clumpSize; /* reserved */
u_int8_t btreeType; /* reserved */
- u_int8_t reserved2; /* reserved */
+ u_int8_t keyCompareType; /* Key string Comparison Type */
u_int32_t attributes; /* persistent attributes about the tree */
u_int32_t reserved3[16]; /* reserved */
};
kBTVariableIndexKeysMask = 0x00000004 /* keys in index nodes are variable length */
};
+
+/* Catalog Key Name Comparison Type */
+enum {
+ kHFSCaseFolding = 0xCF, /* case folding (case-insensitive) */
+ kHFSBinaryCompare = 0xBC, /* binary compare (case-sensitive) */
+};
+
/* JournalInfoBlock - Structure that describes where our journal lives */
struct JournalInfoBlock {
u_int32_t flags;
}
#endif
+#else
+#warning hfs_format.h is not compatible with HFSVolumes.h (include only one)
+#endif /* __HFSVOLUMES__ */
+
#endif /* __HFS_FORMAT__ */