|
|
1.1 ! root 1: /* ! 2: * Creation Date: <2000/09/03 23:04:27 samuel> ! 3: * Time-stamp: <2000/09/04 01:23:55 samuel> ! 4: * ! 5: * <hfs_mdb.h> ! 6: * ! 7: * HFS Master Directory Block (MDB) ! 8: * ! 9: * This program is free software; you can redistribute it and/or ! 10: * modify it under the terms of the GNU General Public License ! 11: * as published by the Free Software Foundation ! 12: * ! 13: */ ! 14: ! 15: #ifndef _H_HFS_MDB ! 16: #define _H_HFS_MDB ! 17: ! 18: #include "libc/byteorder.h" ! 19: ! 20: typedef unsigned char hfs_char_t; ! 21: typedef unsigned char hfs_ushort_t[2]; ! 22: typedef unsigned char hfs_uint_t[4]; ! 23: ! 24: static inline unsigned short hfs_get_ushort(hfs_ushort_t addr) ! 25: { ! 26: return __be16_to_cpu(*((unsigned short *)(addr))); ! 27: } ! 28: ! 29: static inline unsigned int hfs_get_uint(hfs_uint_t addr) ! 30: { ! 31: return __be32_to_cpu(*((unsigned int *)(addr))); ! 32: } ! 33: ! 34: /* ! 35: * The HFS Master Directory Block (MDB). ! 36: * ! 37: * Also known as the Volume Information Block (VIB), this structure is ! 38: * the HFS equivalent of a superblock. ! 39: * ! 40: * Reference: _Inside Macintosh: Files_ pages 2-59 through 2-62 ! 41: * ! 42: * modified for HFS Extended ! 43: */ ! 44: ! 45: typedef struct hfs_mdb { ! 46: hfs_ushort_t drSigWord; /* Signature word indicating fs type */ ! 47: hfs_uint_t drCrDate; /* fs creation date/time */ ! 48: hfs_uint_t drLsMod; /* fs modification date/time */ ! 49: hfs_ushort_t drAtrb; /* fs attributes */ ! 50: hfs_ushort_t drNmFls; /* number of files in root directory */ ! 51: hfs_ushort_t drVBMSt; /* location (in 512-byte blocks) ! 52: of the volume bitmap */ ! 53: hfs_ushort_t drAllocPtr; /* location (in allocation blocks) ! 54: to begin next allocation search */ ! 55: hfs_ushort_t drNmAlBlks; /* number of allocation blocks */ ! 56: hfs_uint_t drAlBlkSiz; /* bytes in an allocation block */ ! 57: hfs_uint_t drClpSiz; /* clumpsize, the number of bytes to ! 58: allocate when extending a file */ ! 59: hfs_ushort_t drAlBlSt; /* location (in 512-byte blocks) ! 60: of the first allocation block */ ! 61: hfs_uint_t drNxtCNID; /* CNID to assign to the next ! 62: file or directory created */ ! 63: hfs_ushort_t drFreeBks; /* number of free allocation blocks */ ! 64: hfs_char_t drVN[28]; /* the volume label */ ! 65: hfs_uint_t drVolBkUp; /* fs backup date/time */ ! 66: hfs_ushort_t drVSeqNum; /* backup sequence number */ ! 67: hfs_uint_t drWrCnt; /* fs write count */ ! 68: hfs_uint_t drXTClpSiz; /* clumpsize for the extents B-tree */ ! 69: hfs_uint_t drCTClpSiz; /* clumpsize for the catalog B-tree */ ! 70: hfs_ushort_t drNmRtDirs; /* number of directories in ! 71: the root directory */ ! 72: hfs_uint_t drFilCnt; /* number of files in the fs */ ! 73: hfs_uint_t drDirCnt; /* number of directories in the fs */ ! 74: hfs_char_t drFndrInfo[32]; /* data used by the Finder */ ! 75: hfs_ushort_t drEmbedSigWord; /* embedded volume signature */ ! 76: hfs_uint_t drEmbedExtent; /* starting block number (xdrStABN) ! 77: and number of allocation blocks ! 78: (xdrNumABlks) occupied by embedded ! 79: volume */ ! 80: hfs_uint_t drXTFlSize; /* bytes in the extents B-tree */ ! 81: hfs_char_t drXTExtRec[12]; /* extents B-tree's first 3 extents */ ! 82: hfs_uint_t drCTFlSize; /* bytes in the catalog B-tree */ ! 83: hfs_char_t drCTExtRec[12]; /* catalog B-tree's first 3 extents */ ! 84: } hfs_mdb_t; ! 85: ! 86: #define HFS_PLUS_SIGNATURE 0x482b /* 'H+' */ ! 87: #define HFS_SIGNATURE 0x4244 /* HFS / embedded HFS+ */ ! 88: ! 89: ! 90: typedef struct hfs_plus_mdb ! 91: { ! 92: unsigned short signature; ! 93: unsigned short version; ! 94: unsigned int attributes; ! 95: unsigned int lastMountedVersion; ! 96: unsigned int reserved; ! 97: ! 98: unsigned int createDate; ! 99: unsigned int modifyDate; ! 100: unsigned int backupDate; ! 101: unsigned int checkedDate; ! 102: ! 103: unsigned int fileCount; ! 104: unsigned int folderCount; ! 105: ! 106: unsigned int blockSize; ! 107: unsigned int totalBlocks; ! 108: unsigned int freeBlocks; ! 109: ! 110: unsigned int nextAllocation; ! 111: unsigned int rsrcClumpSize; ! 112: unsigned int dataClumpSize; ! 113: ! 114: /* ... there are more fields here ... */ ! 115: } hfs_plus_mdb_t; ! 116: ! 117: ! 118: #endif /* _H_HFS_MDB */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.