0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _HFS_H
0010 #define _HFS_H
0011
0012
0013 #define HFS_DD_BLK 0
0014 #define HFS_PMAP_BLK 1
0015 #define HFS_MDB_BLK 2
0016
0017
0018 #define HFS_DRVR_DESC_MAGIC 0x4552
0019 #define HFS_OLD_PMAP_MAGIC 0x5453
0020 #define HFS_NEW_PMAP_MAGIC 0x504D
0021 #define HFS_SUPER_MAGIC 0x4244
0022 #define HFS_MFS_SUPER_MAGIC 0xD2D7
0023
0024
0025 #define HFS_SECTOR_SIZE 512
0026 #define HFS_SECTOR_SIZE_BITS 9
0027 #define HFS_NAMELEN 31
0028 #define HFS_MAX_NAMELEN 128
0029 #define HFS_MAX_VALENCE 32767U
0030
0031
0032
0033
0034 #define HFS_SB_ATTRIB_HLOCK (1 << 7)
0035 #define HFS_SB_ATTRIB_UNMNT (1 << 8)
0036 #define HFS_SB_ATTRIB_SPARED (1 << 9)
0037 #define HFS_SB_ATTRIB_INCNSTNT (1 << 11)
0038 #define HFS_SB_ATTRIB_SLOCK (1 << 15)
0039
0040
0041 #define HFS_POR_CNID 1
0042 #define HFS_ROOT_CNID 2
0043 #define HFS_EXT_CNID 3
0044 #define HFS_CAT_CNID 4
0045 #define HFS_BAD_CNID 5
0046 #define HFS_ALLOC_CNID 6
0047 #define HFS_START_CNID 7
0048 #define HFS_ATTR_CNID 8
0049 #define HFS_EXCH_CNID 15
0050 #define HFS_FIRSTUSER_CNID 16
0051
0052
0053 #define HFS_CDR_DIR 0x01
0054 #define HFS_CDR_FIL 0x02
0055 #define HFS_CDR_THD 0x03
0056 #define HFS_CDR_FTH 0x04
0057
0058
0059 #define HFS_FK_DATA 0x00
0060 #define HFS_FK_RSRC 0xFF
0061
0062
0063 #define HFS_FIL_LOCK 0x01
0064 #define HFS_FIL_THD 0x02
0065 #define HFS_FIL_DOPEN 0x04
0066 #define HFS_FIL_ROPEN 0x08
0067 #define HFS_FIL_DIR 0x10
0068 #define HFS_FIL_NOCOPY 0x40
0069 #define HFS_FIL_USED 0x80
0070
0071
0072 #define HFS_DIR_LOCK 0x01
0073 #define HFS_DIR_THD 0x02
0074 #define HFS_DIR_INEXPFOLDER 0x04
0075 #define HFS_DIR_MOUNTED 0x08
0076 #define HFS_DIR_DIR 0x10
0077 #define HFS_DIR_EXPFOLDER 0x20
0078
0079
0080 #define HFS_FLG_INITED 0x0100
0081 #define HFS_FLG_LOCKED 0x1000
0082 #define HFS_FLG_INVISIBLE 0x4000
0083
0084
0085
0086
0087 struct hfs_name {
0088 u8 len;
0089 u8 name[HFS_NAMELEN];
0090 } __packed;
0091
0092 struct hfs_point {
0093 __be16 v;
0094 __be16 h;
0095 } __packed;
0096
0097 struct hfs_rect {
0098 __be16 top;
0099 __be16 left;
0100 __be16 bottom;
0101 __be16 right;
0102 } __packed;
0103
0104 struct hfs_finfo {
0105 __be32 fdType;
0106 __be32 fdCreator;
0107 __be16 fdFlags;
0108 struct hfs_point fdLocation;
0109 __be16 fdFldr;
0110 } __packed;
0111
0112 struct hfs_fxinfo {
0113 __be16 fdIconID;
0114 u8 fdUnused[8];
0115 __be16 fdComment;
0116 __be32 fdPutAway;
0117 } __packed;
0118
0119 struct hfs_dinfo {
0120 struct hfs_rect frRect;
0121 __be16 frFlags;
0122 struct hfs_point frLocation;
0123 __be16 frView;
0124 } __packed;
0125
0126 struct hfs_dxinfo {
0127 struct hfs_point frScroll;
0128 __be32 frOpenChain;
0129 __be16 frUnused;
0130 __be16 frComment;
0131 __be32 frPutAway;
0132 } __packed;
0133
0134 union hfs_finder_info {
0135 struct {
0136 struct hfs_finfo finfo;
0137 struct hfs_fxinfo fxinfo;
0138 } file;
0139 struct {
0140 struct hfs_dinfo dinfo;
0141 struct hfs_dxinfo dxinfo;
0142 } dir;
0143 } __packed;
0144
0145
0146 #define HFS_BKEY(X) (((void)((X)->KeyLen)), ((struct hfs_bkey *)(X)))
0147
0148
0149 struct hfs_cat_key {
0150 u8 key_len;
0151 u8 reserved;
0152 __be32 ParID;
0153 struct hfs_name CName;
0154 } __packed;
0155
0156
0157 struct hfs_ext_key {
0158 u8 key_len;
0159 u8 FkType;
0160 __be32 FNum;
0161 __be16 FABN;
0162 } __packed;
0163
0164 typedef union hfs_btree_key {
0165 u8 key_len;
0166 struct hfs_cat_key cat;
0167 struct hfs_ext_key ext;
0168 } hfs_btree_key;
0169
0170 #define HFS_MAX_CAT_KEYLEN (sizeof(struct hfs_cat_key) - sizeof(u8))
0171 #define HFS_MAX_EXT_KEYLEN (sizeof(struct hfs_ext_key) - sizeof(u8))
0172
0173 typedef union hfs_btree_key btree_key;
0174
0175 struct hfs_extent {
0176 __be16 block;
0177 __be16 count;
0178 };
0179 typedef struct hfs_extent hfs_extent_rec[3];
0180
0181
0182 struct hfs_cat_file {
0183 s8 type;
0184 u8 reserved;
0185 u8 Flags;
0186 s8 Typ;
0187 struct hfs_finfo UsrWds;
0188 __be32 FlNum;
0189 __be16 StBlk;
0190 __be32 LgLen;
0191 __be32 PyLen;
0192 __be16 RStBlk;
0193 __be32 RLgLen;
0194 __be32 RPyLen;
0195 __be32 CrDat;
0196 __be32 MdDat;
0197 __be32 BkDat;
0198 struct hfs_fxinfo FndrInfo;
0199 __be16 ClpSize;
0200
0201 hfs_extent_rec ExtRec;
0202
0203 hfs_extent_rec RExtRec;
0204
0205 u32 Resrv;
0206 } __packed;
0207
0208
0209 struct hfs_cat_dir {
0210 s8 type;
0211 u8 reserved;
0212 __be16 Flags;
0213 __be16 Val;
0214
0215 __be32 DirID;
0216 __be32 CrDat;
0217 __be32 MdDat;
0218 __be32 BkDat;
0219 struct hfs_dinfo UsrInfo;
0220 struct hfs_dxinfo FndrInfo;
0221 u8 Resrv[16];
0222 } __packed;
0223
0224
0225 struct hfs_cat_thread {
0226 s8 type;
0227 u8 reserved[9];
0228 __be32 ParID;
0229 struct hfs_name CName;
0230 } __packed;
0231
0232
0233 typedef union hfs_cat_rec {
0234 s8 type;
0235 struct hfs_cat_file file;
0236 struct hfs_cat_dir dir;
0237 struct hfs_cat_thread thread;
0238 } hfs_cat_rec;
0239
0240 struct hfs_mdb {
0241 __be16 drSigWord;
0242 __be32 drCrDate;
0243 __be32 drLsMod;
0244 __be16 drAtrb;
0245 __be16 drNmFls;
0246 __be16 drVBMSt;
0247
0248 __be16 drAllocPtr;
0249
0250 __be16 drNmAlBlks;
0251 __be32 drAlBlkSiz;
0252 __be32 drClpSiz;
0253
0254 __be16 drAlBlSt;
0255
0256 __be32 drNxtCNID;
0257
0258 __be16 drFreeBks;
0259 u8 drVN[28];
0260 __be32 drVolBkUp;
0261 __be16 drVSeqNum;
0262 __be32 drWrCnt;
0263 __be32 drXTClpSiz;
0264 __be32 drCTClpSiz;
0265 __be16 drNmRtDirs;
0266
0267 __be32 drFilCnt;
0268 __be32 drDirCnt;
0269 u8 drFndrInfo[32];
0270 __be16 drEmbedSigWord;
0271 __be32 drEmbedExtent;
0272
0273
0274
0275 __be32 drXTFlSize;
0276 hfs_extent_rec drXTExtRec;
0277 __be32 drCTFlSize;
0278 hfs_extent_rec drCTExtRec;
0279 } __packed;
0280
0281
0282
0283 struct hfs_readdir_data {
0284 struct list_head list;
0285 struct file *file;
0286 struct hfs_cat_key key;
0287 };
0288
0289 #endif