|
|
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 _IOFDISKPARTITIONSCHEME_H ! 24: #define _IOFDISKPARTITIONSCHEME_H ! 25: ! 26: #include <IOKit/IOTypes.h> ! 27: ! 28: /* ! 29: * FDisk Partition Map Definitions ! 30: */ ! 31: ! 32: #pragma pack(2) /* (enable 16-bit struct packing for fdisk_part, disk_blk0) */ ! 33: ! 34: /* ! 35: * General constants. ! 36: */ ! 37: ! 38: #define DISK_BLK0SZ sizeof(struct disk_blk0) /* (size of block zero) */ ! 39: #define DISK_BOOTSZ 446 /* (size of boot code in block zero) */ ! 40: #define DISK_SIGNATURE 0xAA55 /* (unique value for block zero) */ ! 41: #define DISK_NPART 4 /* (number of partition entries) */ ! 42: ! 43: /* ! 44: * Partition map entry, as found in blocks zero of the disk. ! 45: */ ! 46: ! 47: struct fdisk_part ! 48: { ! 49: UInt8 bootid; /* (is bootable?) */ ! 50: UInt8 beghead; /* (beginning head) */ ! 51: UInt8 begsect; /* (beginning sector; beginning cylinder, high 2 bits) */ ! 52: UInt8 begcyl; /* (beginning cylinder, low 8 bits) */ ! 53: UInt8 systid; /* (type of partition) */ ! 54: UInt8 endhead; /* (ending head) */ ! 55: UInt8 endsect; /* (ending sector; ending cylinder, high 2 bits) */ ! 56: UInt8 endcyl; /* (ending cylinder, low 8 bits) */ ! 57: UInt32 relsect; /* (physical block start of partition) */ ! 58: UInt32 numsect; /* (physical block count of partition) */ ! 59: }; ! 60: ! 61: /* ! 62: * Block zero of the disk. ! 63: */ ! 64: ! 65: struct disk_blk0 ! 66: { ! 67: UInt8 bootcode[DISK_BOOTSZ]; /* (boot code) */ ! 68: struct fdisk_part parts[DISK_NPART]; /* (partition entries) */ ! 69: UInt16 signature; /* (unique value for block zero) */ ! 70: }; ! 71: ! 72: #pragma options align=reset /* (reset to default struct packing) */ ! 73: ! 74: /* ! 75: * Kernel ! 76: */ ! 77: ! 78: #if defined(KERNEL) && defined(__cplusplus) ! 79: ! 80: #include <IOKit/IOBufferMemoryDescriptor.h> ! 81: #include <IOKit/storage/IOPartitionScheme.h> ! 82: ! 83: /* ! 84: * Class ! 85: */ ! 86: ! 87: class IOFDiskPartitionScheme : public IOPartitionScheme ! 88: { ! 89: OSDeclareDefaultStructors(IOFDiskPartitionScheme); ! 90: ! 91: protected: ! 92: IOBufferMemoryDescriptor * _buffer; /* (necessarily one media block) */ ! 93: UInt32 _bufferSize; /* (necessarily one media block) */ ! 94: ! 95: /* ! 96: * Free all of this object's outstanding resources. ! 97: */ ! 98: ! 99: virtual void free(void); ! 100: ! 101: /* ! 102: * Searches for the existence of an fdisk partition map on the given media. ! 103: */ ! 104: ! 105: virtual bool identify(IOMedia * media); ! 106: ! 107: public: ! 108: ! 109: /* ! 110: * Initialize this object's minimal state. ! 111: */ ! 112: ! 113: virtual bool init(OSDictionary * properties = 0); ! 114: ! 115: /* ! 116: * Determine whether the provider media contains an fdisk partition map. If ! 117: * it does, we return "this" to indicate success, otherwise we return zero. ! 118: */ ! 119: ! 120: virtual IOService * probe(IOService * provider, SInt32 * score); ! 121: ! 122: /* ! 123: * This method is called once we have been attached to the media object. We ! 124: * generate the new media objects that will represent our partitions here. ! 125: */ ! 126: ! 127: virtual bool start(IOService * provider); ! 128: }; ! 129: ! 130: #endif /* defined(KERNEL) && defined(__cplusplus) */ ! 131: ! 132: #endif /* !_IOFDISKPARTITIONSCHEME_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.