#include <CoreFoundation/CFBase.h>
enum {
kHasBeenInited = 0x0100,
kHasCustomIcon = 0x0400,
kIsStationery = 0x0800,
kNameLocked = 0x1000,
kHasBundle = 0x2000,
kIsInvisible = 0x4000,
kIsAlias = 0x8000
};
struct FInfo {
uint32_t fileType;
uint32_t 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 HFSMAXBSIZE 2147483648U
#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_t sectorSize;
uint32_t sectorOffset;
uint64_t totalSectors;
uint32_t physSectorSize;
uint64_t physSectorsPerIO;
uint64_t physTotalSectors;
};
typedef struct DriveInfo DriveInfo;
enum {
kMakeHFSWrapper = 0x01,
kMakeMaxHFSBitmap = 0x02,
kMakeStandardHFS = 0x04,
kMakeCaseSensitive = 0x08,
kUseAccessPerms = 0x10,
};
struct hfsparams {
uint32_t flags;
uint32_t blockSize;
uint32_t rsrcClumpSize;
uint32_t dataClumpSize;
uint32_t nextFreeFileID;
uint32_t catalogClumpSize;
uint32_t catalogNodeSize;
uint32_t extentsClumpSize;
uint32_t extentsNodeSize;
uint32_t attributesClumpSize;
uint32_t attributesNodeSize;
uint32_t allocationClumpSize;
uint32_t createDate;
uint32_t hfsAlignment;
unsigned char volumeName[kHFSPlusMaxFileNameChars + 1];
uint32_t encodingHint;
uint32_t journaledHFS;
uint32_t journalSize;
char *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_t *totalSectors, uint32_t *sectorOffset);
extern int make_hfsplus(const DriveInfo *driveInfo, hfsparams_t *defaults);
#if __STDC__
void fatal(const char *fmt, ...);
#else
void fatal();
#endif