^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * linux/fs/hfs/hfs.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 1995-1997 Paul H. Hargrove
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * (C) 2003 Ardis Technologies <roman@ardistech.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * This file may be distributed under the terms of the GNU General Public License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #ifndef _HFS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #define _HFS_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) /* offsets to various blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define HFS_DD_BLK 0 /* Driver Descriptor block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define HFS_PMAP_BLK 1 /* First block of partition map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define HFS_MDB_BLK 2 /* Block (w/i partition) of MDB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /* magic numbers for various disk blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define HFS_DRVR_DESC_MAGIC 0x4552 /* "ER": driver descriptor map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define HFS_OLD_PMAP_MAGIC 0x5453 /* "TS": old-type partition map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define HFS_NEW_PMAP_MAGIC 0x504D /* "PM": new-type partition map */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define HFS_SUPER_MAGIC 0x4244 /* "BD": HFS MDB (super block) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define HFS_MFS_SUPER_MAGIC 0xD2D7 /* MFS MDB (super block) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* various FIXED size parameters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define HFS_SECTOR_SIZE 512 /* size of an HFS sector */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define HFS_SECTOR_SIZE_BITS 9 /* log_2(HFS_SECTOR_SIZE) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define HFS_NAMELEN 31 /* maximum length of an HFS filename */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define HFS_MAX_NAMELEN 128
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define HFS_MAX_VALENCE 32767U
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) /* Meanings of the drAtrb field of the MDB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) * Reference: _Inside Macintosh: Files_ p. 2-61
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define HFS_SB_ATTRIB_HLOCK (1 << 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define HFS_SB_ATTRIB_UNMNT (1 << 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define HFS_SB_ATTRIB_SPARED (1 << 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define HFS_SB_ATTRIB_INCNSTNT (1 << 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define HFS_SB_ATTRIB_SLOCK (1 << 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /* Some special File ID numbers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #define HFS_POR_CNID 1 /* Parent Of the Root */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define HFS_ROOT_CNID 2 /* ROOT directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define HFS_EXT_CNID 3 /* EXTents B-tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define HFS_CAT_CNID 4 /* CATalog B-tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define HFS_BAD_CNID 5 /* BAD blocks file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define HFS_ALLOC_CNID 6 /* ALLOCation file (HFS+) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define HFS_START_CNID 7 /* STARTup file (HFS+) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #define HFS_ATTR_CNID 8 /* ATTRibutes file (HFS+) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define HFS_EXCH_CNID 15 /* ExchangeFiles temp id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define HFS_FIRSTUSER_CNID 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* values for hfs_cat_rec.cdrType */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #define HFS_CDR_DIR 0x01 /* folder (directory) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define HFS_CDR_FIL 0x02 /* file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define HFS_CDR_THD 0x03 /* folder (directory) thread */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define HFS_CDR_FTH 0x04 /* file thread */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /* legal values for hfs_ext_key.FkType and hfs_file.fork */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define HFS_FK_DATA 0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #define HFS_FK_RSRC 0xFF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /* bits in hfs_fil_entry.Flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define HFS_FIL_LOCK 0x01 /* locked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define HFS_FIL_THD 0x02 /* file thread */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #define HFS_FIL_DOPEN 0x04 /* data fork open */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) #define HFS_FIL_ROPEN 0x08 /* resource fork open */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #define HFS_FIL_DIR 0x10 /* directory (always clear) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) #define HFS_FIL_NOCOPY 0x40 /* copy-protected file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #define HFS_FIL_USED 0x80 /* open */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* bits in hfs_dir_entry.Flags. dirflags is 16 bits. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) #define HFS_DIR_LOCK 0x01 /* locked */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) #define HFS_DIR_THD 0x02 /* directory thread */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) #define HFS_DIR_INEXPFOLDER 0x04 /* in a shared area */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) #define HFS_DIR_MOUNTED 0x08 /* mounted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) #define HFS_DIR_DIR 0x10 /* directory (always set) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) #define HFS_DIR_EXPFOLDER 0x20 /* share point */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* bits hfs_finfo.fdFlags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #define HFS_FLG_INITED 0x0100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #define HFS_FLG_LOCKED 0x1000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #define HFS_FLG_INVISIBLE 0x4000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /*======== HFS structures as they appear on the disk ========*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) /* Pascal-style string of up to 31 characters */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct hfs_name {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) u8 len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) u8 name[HFS_NAMELEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) struct hfs_point {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) __be16 v;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) __be16 h;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct hfs_rect {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) __be16 top;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) __be16 left;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) __be16 bottom;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) __be16 right;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct hfs_finfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) __be32 fdType;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) __be32 fdCreator;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) __be16 fdFlags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) struct hfs_point fdLocation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) __be16 fdFldr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct hfs_fxinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) __be16 fdIconID;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) u8 fdUnused[8];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) __be16 fdComment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) __be32 fdPutAway;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct hfs_dinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct hfs_rect frRect;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) __be16 frFlags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) struct hfs_point frLocation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) __be16 frView;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) struct hfs_dxinfo {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) struct hfs_point frScroll;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) __be32 frOpenChain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) __be16 frUnused;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) __be16 frComment;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) __be32 frPutAway;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) union hfs_finder_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) struct hfs_finfo finfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) struct hfs_fxinfo fxinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) } file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) struct {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) struct hfs_dinfo dinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct hfs_dxinfo dxinfo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) } dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) /* Cast to a pointer to a generic bkey */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #define HFS_BKEY(X) (((void)((X)->KeyLen)), ((struct hfs_bkey *)(X)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /* The key used in the catalog b-tree: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) struct hfs_cat_key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) u8 key_len; /* number of bytes in the key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) u8 reserved; /* padding */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) __be32 ParID; /* CNID of the parent dir */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) struct hfs_name CName; /* The filename of the entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) /* The key used in the extents b-tree: */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct hfs_ext_key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) u8 key_len; /* number of bytes in the key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) u8 FkType; /* HFS_FK_{DATA,RSRC} */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) __be32 FNum; /* The File ID of the file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) __be16 FABN; /* allocation blocks number*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) typedef union hfs_btree_key {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) u8 key_len; /* number of bytes in the key */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) struct hfs_cat_key cat;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct hfs_ext_key ext;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) } hfs_btree_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) #define HFS_MAX_CAT_KEYLEN (sizeof(struct hfs_cat_key) - sizeof(u8))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define HFS_MAX_EXT_KEYLEN (sizeof(struct hfs_ext_key) - sizeof(u8))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) typedef union hfs_btree_key btree_key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) struct hfs_extent {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) __be16 block;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) __be16 count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) typedef struct hfs_extent hfs_extent_rec[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /* The catalog record for a file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) struct hfs_cat_file {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) s8 type; /* The type of entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) u8 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) u8 Flags; /* Flags such as read-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) s8 Typ; /* file version number = 0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) struct hfs_finfo UsrWds; /* data used by the Finder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) __be32 FlNum; /* The CNID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) __be16 StBlk; /* obsolete */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) __be32 LgLen; /* The logical EOF of the data fork*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) __be32 PyLen; /* The physical EOF of the data fork */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) __be16 RStBlk; /* obsolete */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) __be32 RLgLen; /* The logical EOF of the rsrc fork */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) __be32 RPyLen; /* The physical EOF of the rsrc fork */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) __be32 CrDat; /* The creation date */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) __be32 MdDat; /* The modified date */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) __be32 BkDat; /* The last backup date */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) struct hfs_fxinfo FndrInfo; /* more data for the Finder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) __be16 ClpSize; /* number of bytes to allocate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) when extending files */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) hfs_extent_rec ExtRec; /* first extent record
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) for the data fork */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) hfs_extent_rec RExtRec; /* first extent record
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) for the resource fork */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) u32 Resrv; /* reserved by Apple */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /* the catalog record for a directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct hfs_cat_dir {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) s8 type; /* The type of entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) u8 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) __be16 Flags; /* flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) __be16 Val; /* Valence: number of files and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) dirs in the directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) __be32 DirID; /* The CNID */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) __be32 CrDat; /* The creation date */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) __be32 MdDat; /* The modification date */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) __be32 BkDat; /* The last backup date */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct hfs_dinfo UsrInfo; /* data used by the Finder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct hfs_dxinfo FndrInfo; /* more data used by Finder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) u8 Resrv[16]; /* reserved by Apple */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) /* the catalog record for a thread */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct hfs_cat_thread {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) s8 type; /* The type of entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) u8 reserved[9]; /* reserved by Apple */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) __be32 ParID; /* CNID of parent directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) struct hfs_name CName; /* The name of this entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) /* A catalog tree record */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) typedef union hfs_cat_rec {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) s8 type; /* The type of entry */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) struct hfs_cat_file file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) struct hfs_cat_dir dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) struct hfs_cat_thread thread;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) } hfs_cat_rec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) struct hfs_mdb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) __be16 drSigWord; /* Signature word indicating fs type */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) __be32 drCrDate; /* fs creation date/time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) __be32 drLsMod; /* fs modification date/time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) __be16 drAtrb; /* fs attributes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) __be16 drNmFls; /* number of files in root directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) __be16 drVBMSt; /* location (in 512-byte blocks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) of the volume bitmap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) __be16 drAllocPtr; /* location (in allocation blocks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) to begin next allocation search */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) __be16 drNmAlBlks; /* number of allocation blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) __be32 drAlBlkSiz; /* bytes in an allocation block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) __be32 drClpSiz; /* clumpsize, the number of bytes to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) allocate when extending a file */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) __be16 drAlBlSt; /* location (in 512-byte blocks)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) of the first allocation block */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) __be32 drNxtCNID; /* CNID to assign to the next
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) file or directory created */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) __be16 drFreeBks; /* number of free allocation blocks */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) u8 drVN[28]; /* the volume label */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) __be32 drVolBkUp; /* fs backup date/time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) __be16 drVSeqNum; /* backup sequence number */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) __be32 drWrCnt; /* fs write count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) __be32 drXTClpSiz; /* clumpsize for the extents B-tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) __be32 drCTClpSiz; /* clumpsize for the catalog B-tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) __be16 drNmRtDirs; /* number of directories in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) the root directory */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) __be32 drFilCnt; /* number of files in the fs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) __be32 drDirCnt; /* number of directories in the fs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) u8 drFndrInfo[32]; /* data used by the Finder */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) __be16 drEmbedSigWord; /* embedded volume signature */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) __be32 drEmbedExtent; /* starting block number (xdrStABN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) and number of allocation blocks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) (xdrNumABlks) occupied by embedded
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) volume */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) __be32 drXTFlSize; /* bytes in the extents B-tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) hfs_extent_rec drXTExtRec; /* extents B-tree's first 3 extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) __be32 drCTFlSize; /* bytes in the catalog B-tree */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) hfs_extent_rec drCTExtRec; /* catalog B-tree's first 3 extents */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) /*======== Data structures kept in memory ========*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) struct hfs_readdir_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) struct list_head list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) struct file *file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) struct hfs_cat_key key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) #endif