RootDomainUserClient.cpp [plain text]
#include <IOKit/assert.h>
#include <IOKit/IOLib.h>
#include <IOKit/IOBufferMemoryDescriptor.h>
#include "RootDomainUserClient.h"
#include <IOKit/pwr_mgt/IOPMLibDefs.h>
#define super IOUserClient
OSDefineMetaClassAndStructors(RootDomainUserClient, IOUserClient)
bool RootDomainUserClient::start( IOService * provider )
{
assert(OSDynamicCast(IOPMrootDomain, provider));
if(!super::start(provider))
return false;
fOwner = (IOPMrootDomain *)provider;
return true;
}
IOReturn RootDomainUserClient::clientClose( void )
{
detach(fOwner);
return kIOReturnSuccess;
}
IOExternalMethod *
RootDomainUserClient::getTargetAndMethodForIndex( IOService ** targetP, UInt32 index )
{
static IOExternalMethod sMethods[] = {
{ 0, (IOMethod)&IOPMrootDomain::setAggressiveness, kIOUCScalarIScalarO, 2, 0
},
{ 0, (IOMethod)&IOPMrootDomain::getAggressiveness, kIOUCScalarIScalarO, 1, 1
},
{ 0, (IOMethod)&IOPMrootDomain::sleepSystem, kIOUCScalarIScalarO, 0, 0
},
{ 0, (IOMethod)&IOPMrootDomain::allowPowerChange, kIOUCScalarIScalarO, 1, 0
},
{ 0, (IOMethod)&IOPMrootDomain::cancelPowerChange, kIOUCScalarIScalarO, 1, 0
},
{ 0, (IOMethod)&IOPMrootDomain::shutdownSystem, kIOUCScalarIScalarO, 0, 0
},
{ 0, (IOMethod)&IOPMrootDomain::restartSystem, kIOUCScalarIScalarO, 0, 0
},
{ 1, (IOMethod) &RootDomainUserClient::setPreventative, kIOUCScalarIScalarO, 2, 0
},
};
if(index >= kNumPMMethods)
return NULL;
else {
if (sMethods[index].object)
*targetP = this;
else
*targetP = fOwner;
return &sMethods[index];
}
}
void
RootDomainUserClient::setPreventative(UInt32 on_off, UInt32 types_of_sleep)
{
return;
}