Annotation of XNU/iokit/IOKit/storage/IOApplePartitionScheme.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
                      3:  *
                      4:  * @APPLE_LICENSE_HEADER_START@
                      5:  * 
                      6:  * The contents of this file constitute Original Code as defined in and
                      7:  * are subject to the Apple Public Source License Version 1.1 (the
                      8:  * "License").  You may not use this file except in compliance with the
                      9:  * License.  Please obtain a copy of the License at
                     10:  * http://www.apple.com/publicsource and read it before using this file.
                     11:  * 
                     12:  * This Original Code and all software distributed under the License are
                     13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
                     14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
                     15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
                     16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
                     17:  * License for the specific language governing rights and limitations
                     18:  * under the License.
                     19:  * 
                     20:  * @APPLE_LICENSE_HEADER_END@
                     21:  */
                     22: 
                     23: #ifndef _IOAPPLEPARTITIONSCHEME_H
                     24: #define _IOAPPLEPARTITIONSCHEME_H
                     25: 
                     26: #include <IOKit/IOTypes.h>
                     27: 
                     28: /*
                     29:  * Apple Partition Map Definitions
                     30:  *
                     31:  * o  "dpme" is short for disk partition map entry
                     32:  * o  "dpme" and "Block0" are, and shall remain, 512 bytes long
                     33:  * o  for more information see:
                     34:  *    o  "Inside Macintosh: Devices" pages 3-12 to 3-15
                     35:  *    o  "Inside Macintosh - Volume V" pages V-576 to V-582
                     36:  *    o  "Inside Macintosh - Volume IV" page IV-292
                     37:  */
                     38: 
                     39: #pragma pack(4)     /* (enable 32-bit struct packing for dpme, DDMap, Block0) */
                     40: 
                     41: /*
                     42:  * General constants.
                     43:  */
                     44: 
                     45: #define BLOCK0_SIGNATURE  0x4552  /* (unique value for block zero, 'ER')      */
                     46: #define DPME_SIGNATURE    0x504D  /* (unique value for partition entry, 'PM') */
                     47: #define DPISTRLEN         32
                     48: 
                     49: /*
                     50:  * Partition map entry, as found in blocks 1..n of the disk.
                     51:  */
                     52: 
                     53: struct dpme
                     54: {
                     55:     UInt16  dpme_signature;       /* (unique value for partition entry, 'PM') */
                     56:     UInt16  dpme_reserved_1;      /* (reserved for future use)                */
                     57:     UInt32  dpme_map_entries;     /* (number of partition entries)            */
                     58:     UInt32  dpme_pblock_start;    /* (physical block start of partition)      */
                     59:     UInt32  dpme_pblocks;         /* (physical block count of partition)      */
                     60:     char    dpme_name[DPISTRLEN]; /* (name of partition)                      */
                     61:     char    dpme_type[DPISTRLEN]; /* (type of partition, eg. Apple_HFS)       */
                     62:     UInt32  dpme_lblock_start;    /* (logical block start of partition)       */
                     63:     UInt32  dpme_lblocks;         /* (logical block count of partition)       */
                     64:     UInt32  dpme_flags;           /* (partition flags, see defines below)     */
                     65:     UInt32  dpme_boot_block;
                     66:     UInt32  dpme_boot_bytes;
                     67:     UInt8 * dpme_load_addr;
                     68:     UInt8 * dpme_load_addr_2;
                     69:     UInt8 * dpme_goto_addr;
                     70:     UInt8 * dpme_goto_addr_2;
                     71:     UInt32  dpme_checksum;
                     72:     UInt8   dpme_process_id[16];
                     73:     UInt32  dpme_boot_args[32];
                     74:     UInt32  dpme_reserved_3[62];
                     75: };
                     76: typedef struct dpme DPME;
                     77: 
                     78: /*
                     79:  * Partition map entry flags (dpme_flags).
                     80:  */
                     81: 
                     82: #define DPME_FLAGS_VALID          0x00000001                   /* (bit 0)     */
                     83: #define DPME_FLAGS_ALLOCATED      0x00000002                   /* (bit 1)     */
                     84: #define DPME_FLAGS_IN_USE         0x00000004                   /* (bit 2)     */
                     85: #define DPME_FLAGS_BOOTABLE       0x00000008                   /* (bit 3)     */
                     86: #define DPME_FLAGS_READABLE       0x00000010                   /* (bit 4)     */
                     87: #define DPME_FLAGS_WRITABLE       0x00000020                   /* (bit 5)     */
                     88: #define DPME_FLAGS_OS_PIC_CODE    0x00000040                   /* (bit 6)     */
                     89: #define DPME_FLAGS_OS_SPECIFIC_2  0x00000080                   /* (bit 7)     */
                     90: #define DPME_FLAGS_OS_SPECIFIC_1  0x00000100                   /* (bit 8)     */
                     91: #define DPME_FLAGS_RESERVED_2     0xFFFFFE00                   /* (bit 9..31) */
                     92: 
                     93: /*
                     94:  * Driver descriptor map entry, as found in block zero of the disk. 
                     95:  */
                     96: 
                     97: struct DDMap
                     98: {
                     99:     UInt32  ddBlock;              /* (driver's block count, sbBlkSize-blocks) */
                    100:     UInt16  ddSize;               /* (driver's block count, 512-blocks)       */
                    101:     UInt16  ddType;               /* (driver's system type)                   */
                    102: };
                    103: typedef struct DDMap DDMap;
                    104: 
                    105: /*
                    106:  * Block zero of the disk.
                    107:  */
                    108: 
                    109: struct Block0
                    110: {
                    111:     UInt16  sbSig;                     /* (unique value for block zero, 'ER') */
                    112:     UInt16  sbBlkSize;                 /* (block size for this device)        */
                    113:     UInt32  sbBlkCount;                /* (block count for this device)       */
                    114:     UInt16  sbDevType;                 /* (device type)                       */
                    115:     UInt16  sbDevId;                   /* (device id)                         */
                    116:     UInt32  sbData;                    /* (not used)                          */
                    117:     UInt16  sbDrvrCount;               /* (driver descriptor count)           */
                    118:     UInt16  sbMap[247];                /* (driver descriptor table)           */
                    119: };
                    120: typedef struct Block0 Block0;
                    121: 
                    122: #pragma options align=reset              /* (reset to default struct packing) */
                    123: 
                    124: /*
                    125:  * Kernel
                    126:  */
                    127: 
                    128: #if defined(KERNEL) && defined(__cplusplus)
                    129: 
                    130: #include <IOKit/IOBufferMemoryDescriptor.h>
                    131: #include <IOKit/storage/IOPartitionScheme.h>
                    132: 
                    133: /*
                    134:  * Class
                    135:  */
                    136: 
                    137: class IOApplePartitionScheme : public IOPartitionScheme
                    138: {
                    139:     OSDeclareDefaultStructors(IOApplePartitionScheme);
                    140: 
                    141: protected:
                    142:     IOBufferMemoryDescriptor * _buffer;      /* (necessarily one media block) */
                    143:     UInt32                     _bufferSize;  /* (necessarily one media block) */
                    144: 
                    145:     bool                       _masteredAt512;
                    146: 
                    147:     /*
                    148:      * Free all of this object's outstanding resources.
                    149:      */
                    150: 
                    151:     virtual void free(void);
                    152: 
                    153:     /*
                    154:      * Searches for the existence of an apple partition map on the given media.
                    155:      */
                    156: 
                    157:     virtual bool identify(IOMedia * media);
                    158: 
                    159: public:
                    160: 
                    161:     /*
                    162:      * Initialize this object's minimal state.
                    163:      */
                    164: 
                    165:     virtual bool init(OSDictionary * properties = 0);
                    166: 
                    167:     /*
                    168:      * Determine whether the provider media contains an apple partition map.  If
                    169:      * it does, we return "this" to indicate success, otherwise we return zero.
                    170:      */
                    171: 
                    172:     virtual IOService * probe(IOService * provider, SInt32 * score);
                    173: 
                    174:     /*
                    175:      * This method is called once we have been attached to the media object.  We
                    176:      * generate the new media objects that will represent our partitions here.
                    177:      */
                    178: 
                    179:     virtual bool start(IOService * provider);
                    180: };
                    181: 
                    182: #endif /* defined(KERNEL) && defined(__cplusplus) */
                    183: 
                    184: #endif /* !_IOAPPLEPARTITIONSCHEME_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.