|
|
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: #include <IOKit/IOLib.h> ! 23: #include <IOKit/storage/scsi/IOSCSIHDDriveNub.h> ! 24: #include <IOKit/storage/scsi/IOSCSIHDDrive.h> ! 25: ! 26: #define super IOHDDriveNub ! 27: OSDefineMetaClassAndStructors(IOSCSIHDDriveNub,IOHDDriveNub) ! 28: ! 29: bool ! 30: IOSCSIHDDriveNub::attach(IOService * provider) ! 31: { ! 32: // IOLog("IOSCSIHDDriveNub: attach\n"); ! 33: ! 34: if (!super::attach(provider)) { ! 35: return(false); ! 36: } ! 37: ! 38: // IOLog("IOSCSIHDDriveNub: attach; casting provider\n"); ! 39: _provider = OSDynamicCast(IOSCSIHDDrive,provider); ! 40: if (_provider == NULL) { ! 41: IOLog("IOSCSIHDDriveNub: attach; wrong provider type!\n"); ! 42: return(false); ! 43: } else { ! 44: // IOLog("IOSCSIHDDriveNub: attach; provider OK\n"); ! 45: return(true); ! 46: } ! 47: } ! 48: ! 49: void IOSCSIHDDriveNub::detach(IOService * provider) ! 50: { ! 51: if( _provider == provider) ! 52: _provider = 0; ! 53: ! 54: super::detach( provider ); ! 55: } ! 56: ! 57: IOReturn ! 58: IOSCSIHDDriveNub::doAsyncReadWrite(IOMemoryDescriptor *buffer, ! 59: UInt32 block,UInt32 nblks, ! 60: gdCompletionFunction action, ! 61: IOService *target,void *param) ! 62: { ! 63: return(_provider->doAsyncReadWrite(buffer,block,nblks,action,target,param)); ! 64: } ! 65: ! 66: IOReturn ! 67: IOSCSIHDDriveNub::doSyncReadWrite(IOMemoryDescriptor *buffer,UInt32 block,UInt32 nblks) ! 68: { ! 69: return(_provider->doSyncReadWrite(buffer,block,nblks)); ! 70: } ! 71: ! 72: IOReturn ! 73: IOSCSIHDDriveNub::doEjectMedia(void) ! 74: { ! 75: return(_provider->doEjectMedia()); ! 76: } ! 77: ! 78: IOReturn ! 79: IOSCSIHDDriveNub::doFormatMedia(UInt64 byteCapacity) ! 80: { ! 81: return(_provider->doFormatMedia(byteCapacity)); ! 82: } ! 83: ! 84: UInt32 ! 85: IOSCSIHDDriveNub::doGetFormatCapacities(UInt64 * capacities, ! 86: UInt32 capacitiesMaxCount) const ! 87: { ! 88: return(_provider->doGetFormatCapacities(capacities,capacitiesMaxCount)); ! 89: } ! 90: ! 91: IOReturn ! 92: IOSCSIHDDriveNub::doLockUnlockMedia(bool doLock) ! 93: { ! 94: return(_provider->doLockUnlockMedia(doLock)); ! 95: } ! 96: ! 97: IOReturn ! 98: IOSCSIHDDriveNub::doSynchronizeCache(void) ! 99: { ! 100: return(_provider->doSynchronizeCache()); ! 101: } ! 102: ! 103: IOReturn ! 104: IOSCSIHDDriveNub::executeCdb(struct cdbParams *params) ! 105: { ! 106: return(_provider->executeCdb(params)); ! 107: } ! 108: ! 109: char * ! 110: IOSCSIHDDriveNub::getVendorString(void) ! 111: { ! 112: return(_provider->getVendorString()); ! 113: } ! 114: ! 115: char * ! 116: IOSCSIHDDriveNub::getProductString(void) ! 117: { ! 118: return(_provider->getProductString()); ! 119: } ! 120: ! 121: char * ! 122: IOSCSIHDDriveNub::getRevisionString(void) ! 123: { ! 124: return(_provider->getRevisionString()); ! 125: } ! 126: ! 127: char * ! 128: IOSCSIHDDriveNub::getAdditionalDeviceInfoString(void) ! 129: { ! 130: return(_provider-> getAdditionalDeviceInfoString()); ! 131: } ! 132: ! 133: IOReturn ! 134: IOSCSIHDDriveNub::reportBlockSize(UInt64 *blockSize) ! 135: { ! 136: return(_provider->reportBlockSize(blockSize)); ! 137: } ! 138: ! 139: IOReturn ! 140: IOSCSIHDDriveNub::reportEjectability(bool *isEjectable) ! 141: { ! 142: return(_provider->reportEjectability(isEjectable)); ! 143: } ! 144: ! 145: IOReturn ! 146: IOSCSIHDDriveNub::reportLockability(bool *isLockable) ! 147: { ! 148: return(_provider->reportLockability(isLockable)); ! 149: } ! 150: ! 151: IOReturn ! 152: IOSCSIHDDriveNub::reportPollRequirements(bool *pollIsRequired,bool *pollIsExpensive) ! 153: { ! 154: return(_provider->reportPollRequirements(pollIsRequired,pollIsExpensive)); ! 155: } ! 156: ! 157: IOReturn ! 158: IOSCSIHDDriveNub::reportMaxReadTransfer (UInt64 blockSize,UInt64 *max) ! 159: { ! 160: return(_provider->reportMaxReadTransfer(blockSize,max)); ! 161: } ! 162: ! 163: IOReturn ! 164: IOSCSIHDDriveNub::reportMaxValidBlock(UInt64 *maxBlock) ! 165: { ! 166: return(_provider->reportMaxValidBlock(maxBlock)); ! 167: } ! 168: ! 169: IOReturn ! 170: IOSCSIHDDriveNub::reportMaxWriteTransfer(UInt64 blockSize,UInt64 *max) ! 171: { ! 172: return(_provider->reportMaxWriteTransfer(blockSize,max)); ! 173: } ! 174: ! 175: IOReturn ! 176: IOSCSIHDDriveNub::reportMediaState(bool *mediaPresent,bool *changed) ! 177: { ! 178: return(_provider->reportMediaState(mediaPresent,changed)); ! 179: } ! 180: ! 181: IOReturn ! 182: IOSCSIHDDriveNub::reportRemovability(bool *isRemovable) ! 183: { ! 184: return(_provider->reportRemovability(isRemovable)); ! 185: } ! 186: ! 187: IOReturn ! 188: IOSCSIHDDriveNub::reportWriteProtection(bool *isWriteProtected) ! 189: { ! 190: return(_provider->reportWriteProtection(isWriteProtected)); ! 191: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.