1/* 2 * Copyright (c) 1998-2014 Apple Inc. All rights reserved. 3 * 4 * @APPLE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. Please obtain a copy of the License at 10 * http://www.opensource.apple.com/apsl/ and read it before using this 11 * file. 12 * 13 * The Original Code and all software distributed under the License are 14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 * Please see the License for the specific language governing rights and 19 * limitations under the License. 20 * 21 * @APPLE_LICENSE_HEADER_END@ 22 */ 23 24#ifndef _IOMEDIABSDCLIENT_H 25#define _IOMEDIABSDCLIENT_H 26 27#include <sys/disk.h> 28 29#ifdef KERNEL 30#ifdef __cplusplus 31 32/* 33 * Kernel 34 */ 35 36#include <sys/conf.h> 37#include <IOKit/storage/IOMedia.h> 38 39class AnchorTable; 40class MinorTable; 41struct MinorSlot; 42 43UInt64 _IOMediaBSDClientGetThrottleMask(IOMedia * media); 44 45/* 46 * Class 47 */ 48 49class IOMediaBSDClient : public IOService 50{ 51 OSDeclareDefaultStructors(IOMediaBSDClient) 52 53protected: 54 55 struct ExpansionData { /* */ }; 56 ExpansionData * _expansionData; 57 58private: 59 60 AnchorTable * _anchors; 61 UInt32 _reserved0064 __attribute__ ((unused)); 62 UInt32 _reserved0096 __attribute__ ((unused)); 63 MinorTable * _minors; 64 UInt32 _reserved0160 __attribute__ ((unused)); 65 66protected: 67 68 /* 69 * Find the whole media that roots the given media tree. 70 */ 71 72 virtual IOMedia * getWholeMedia( IOMedia * media, 73 UInt32 * slicePathSize = 0, 74 char * slicePath = 0 ); 75 76 /* 77 * Create bdevsw and cdevsw nodes for the given media object. 78 */ 79 80 virtual bool createNodes(IOMedia * media); 81 82 /* 83 * Free all of this object's outstanding resources. 84 */ 85 86 virtual void free(); 87 88public: 89 90 /* 91 * Obtain this object's provider. We override the superclass's method to 92 * return a more specific subclass of IOService -- IOMedia. This method 93 * method serves simply as a convenience to subclass developers. 94 */ 95 96 virtual IOMedia * getProvider() const; 97 98 /* 99 * Initialize this object's minimal state. 100 */ 101 102 virtual bool init(OSDictionary * properties = 0); 103 104 /* 105 * This method is called once we have been attached to the provider object. 106 */ 107 108 virtual bool start(IOService * provider); 109 110 /* 111 * This method is called when we are to terminate from the provider object. 112 */ 113 114 virtual bool terminate(IOOptionBits options); 115 116#ifndef __LP64__ 117 virtual AnchorTable * getAnchors() __attribute__ ((deprecated)); 118 virtual MinorTable * getMinors() __attribute__ ((deprecated)); 119 virtual MinorSlot * getMinor(UInt32 minorID) __attribute__ ((deprecated)); 120#endif /* !__LP64__ */ 121 122 /* 123 * Process a foreign ioctl. 124 */ 125 126 virtual int ioctl(dev_t dev, u_long cmd, caddr_t data, int flags, proc_t proc); 127 128#ifdef __LP64__ 129 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 0); 130#else /* !__LP64__ */ 131 OSMetaClassDeclareReservedUsed(IOMediaBSDClient, 0); 132#endif /* !__LP64__ */ 133 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 1); 134 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 2); 135 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 3); 136 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 4); 137 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 5); 138 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 6); 139 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 7); 140 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 8); 141 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 9); 142 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 10); 143 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 11); 144 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 12); 145 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 13); 146 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 14); 147 OSMetaClassDeclareReservedUnused(IOMediaBSDClient, 15); 148}; 149 150#endif /* __cplusplus */ 151#endif /* KERNEL */ 152#endif /* !_IOMEDIABSDCLIENT_H */ 153