#include <CoreFoundation/CFBase.h>
enum {
kHasBeenInited = 0x0100,
kHasCustomIcon = 0x0400,
kIsStationery = 0x0800,
kNameLocked = 0x1000,
kHasBundle = 0x2000,
kIsInvisible = 0x4000,
kIsAlias = 0x8000
};
struct FInfo {
UInt32 fileType;
UInt32 fileCreator;
UInt16 finderFlags;
UInt8 opaque[6];
};
typedef struct FInfo FInfo;
struct FXInfo {
UInt8 opaque[16];
};
typedef struct FXInfo FXInfo;
struct DInfo {
UInt8 opaque[16];
};
typedef struct DInfo DInfo;
struct DXInfo {
UInt8 opaque[16];
};
typedef struct DXInfo DXInfo;
enum {
kMinHFSPlusVolumeSize = (512 * 1024),
kBytesPerSector = 512,
kBitsPerSector = 4096,
kBTreeHeaderUserBytes = 128,
kLog2SectorSize = 9,
kHFSNodeSize = 512,
kHFSMaxAllocationBlks = 65536,
kHFSPlusDataClumpFactor = 16,
kHFSPlusRsrcClumpFactor = 16,
kWriteSeqNum = 2,
kHeaderBlocks = 3,
kTailBlocks = 2,
kMDBStart = 2,
kVolBitMapStart = kHeaderBlocks,
kWapperFileCount = 5,
kMaxWrapperSize = 1024 * 1024 * 32,
kMaxWrapableSectors = (kMaxWrapperSize/8) * (65536/512)
};
#define KD_SKIP 0
#define KD_BYTE 1
#define KD_SIGNBYTE 2
#define KD_STRING 3
#define KD_WORD 4
#define KD_SIGNWORD 5
#define KD_LONG 6
#define KD_SIGNLONG 7
#define KD_FIXLENSTR 8
#define KD_DTDBSTR 9
#define KD_USEPROC 10
enum {
kTextEncodingMacRoman = 0L,
kTextEncodingMacJapanese = 1
};
#define HFSOPTIMALBLKSIZE 4096
#define HFSMINBSIZE 512
#define DFL_BLKSIZE HFSOPTIMALBLKSIZE
#define kDTDF_FileID 16
#define kDTDF_Name "Desktop DF"
#define kDTDF_Chars 10
#define kDTDF_Type 'DTFL'
#define kDTDF_Creator 'DMGR'
#define kDTDB_FileID 17
#define kDTDB_Name "Desktop DB"
#define kDTDB_Chars 10
#define kDTDB_Type 'BTFL'
#define kDTDB_Creator 'DMGR'
#define kDTDB_Size 1024
#define kReadMe_FileID 18
#define kReadMe_Name "ReadMe"
#define kReadMe_Chars 6
#define kReadMe_Type 'ttro'
#define kReadMe_Creator 'ttxt'
#define kFinder_FileID 19
#define kFinder_Name "Finder"
#define kFinder_Chars 6
#define kFinder_Type 'FNDR'
#define kFinder_Creator 'MACS'
#define kSystem_FileID 20
#define kSystem_Name "System"
#define kSystem_Chars 6
#define kSystem_Type 'zsys'
#define kSystem_Creator 'MACS'
#if !defined(FALSE) && !defined(TRUE)
enum {
FALSE = 0,
TRUE = 1
};
#endif
#define kDefaultVolumeNameStr "untitled"
#define MAC_GMT_FACTOR 2082844800UL
struct DriveInfo {
int fd;
UInt32 sectorSize;
UInt32 sectorOffset;
UInt32 sectorsPerIO;
UInt64 totalSectors;
};
typedef struct DriveInfo DriveInfo;
enum {
kMakeHFSWrapper = 0x01,
kMakeMaxHFSBitmap = 0x02,
kMakeStandardHFS = 0x04,
kMakeCaseSensitive = 0x08,
kUseAccessPerms = 0x10,
};
struct hfsparams {
UInt32 flags;
UInt32 blockSize;
UInt32 rsrcClumpSize;
UInt32 dataClumpSize;
UInt32 nextFreeFileID;
UInt32 catalogClumpSize;
UInt32 catalogNodeSize;
UInt32 extentsClumpSize;
UInt32 extentsNodeSize;
UInt32 attributesClumpSize;
UInt32 attributesNodeSize;
UInt32 allocationClumpSize;
UInt32 createDate;
UInt32 hfsAlignment;
UInt8 volumeName[kHFSPlusMaxFileNameChars + 1];
UInt32 encodingHint;
UInt32 journaledHFS;
UInt32 journalSize;
UInt8 *journalDevice;
uid_t owner;
gid_t group;
mode_t mask;
};
typedef struct hfsparams hfsparams_t;
extern int make_hfs(const DriveInfo *driveInfo, hfsparams_t *defaults,
UInt32 *totalSectors, UInt32 *sectorOffset);
extern int make_hfsplus(const DriveInfo *driveInfo, hfsparams_t *defaults);
#if __STDC__
void fatal(const char *fmt, ...);
#else
void fatal();
#endif