/*
* Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
extern const OSSymbol * gIONameKey;
extern const OSSymbol * gIOLocationKey;
+extern const OSSymbol * gIORegistryEntryIDKey;
class IORegistryEntry;
class IORegistryPlane;
/*! @struct ExpansionData
@discussion This structure will be used to expand the capablilties of this class in the future.
*/
- struct ExpansionData { };
+ struct ExpansionData
+ {
+ uint64_t fRegistryEntryID;
+ };
/*! @var reserved
Reserved for future use. (Internal use only) */
IOOptionBits options =
kIORegistryIterateRecursively |
kIORegistryIterateParents) const;
+
/*! @function copyProperty
@abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy. Available in Mac OS X 10.1 or later.
@discussion This method will search for a property, starting first with this registry entry's property table, then iterating recusively through either the parent registry entries or the child registry entries of this entry. Once the first occurrence is found, it will lookup and return the value of the property, using the OSDictionary::getObject semantics. The iteration keeps track of entries that have been recursed into previously to avoid loops. This method is synchronized with other IORegistryEntry accesses to the property table(s).
virtual IORegistryEntry * copyChildEntry( const IORegistryPlane * plane ) const;
-private:
+ /* method available in Mac OS X 10.4 or later */
+/*!
+ @typedef Action
+ @discussion Type and arguments of callout C function that is used when
+a runCommand is executed by a client. Cast to this type when you want a C++
+member function to be used. Note the arg1 - arg3 parameters are passed straight pass through to the action callout.
+ @param target
+ Target of the function, can be used as a refcon. Note if a C++ function
+was specified, this parameter is implicitly the first parameter in the target
+member function's parameter list.
+ @param arg0 Argument to action from run operation.
+ @param arg1 Argument to action from run operation.
+ @param arg2 Argument to action from run operation.
+ @param arg3 Argument to action from run operation.
+*/
+ typedef IOReturn (*Action)(OSObject *target,
+ void *arg0, void *arg1,
+ void *arg2, void *arg3);
+
+/*! @function runPropertyAction
+ @abstract Single thread a call to an action w.r.t. the property lock
+ @discussion Client function that causes the given action to be called in a manner that syncrhonises with the registry iterators and serialisers. This functin can be used to synchronously manipulate the property table of this nub
+ @param action Pointer to function to be executed in work-loop context.
+ @param arg0 Parameter for action parameter, defaults to 0.
+ @param arg1 Parameter for action parameter, defaults to 0.
+ @param arg2 Parameter for action parameter, defaults to 0.
+ @param arg3 Parameter for action parameter, defaults to 0.
+ @result Returns the value of the Action callout.
+*/
+ virtual IOReturn runPropertyAction(Action action, OSObject *target,
+ void *arg0 = 0, void *arg1 = 0,
+ void *arg2 = 0, void *arg3 = 0);
+private:
+#if __LP64__
+ OSMetaClassDeclareReservedUnused(IORegistryEntry, 0);
+ OSMetaClassDeclareReservedUnused(IORegistryEntry, 1);
+ OSMetaClassDeclareReservedUnused(IORegistryEntry, 2);
+ OSMetaClassDeclareReservedUnused(IORegistryEntry, 3);
+ OSMetaClassDeclareReservedUnused(IORegistryEntry, 4);
+ OSMetaClassDeclareReservedUnused(IORegistryEntry, 5);
+#else
OSMetaClassDeclareReservedUsed(IORegistryEntry, 0);
OSMetaClassDeclareReservedUsed(IORegistryEntry, 1);
OSMetaClassDeclareReservedUsed(IORegistryEntry, 2);
OSMetaClassDeclareReservedUsed(IORegistryEntry, 3);
OSMetaClassDeclareReservedUsed(IORegistryEntry, 4);
-
- OSMetaClassDeclareReservedUnused(IORegistryEntry, 5);
+ OSMetaClassDeclareReservedUsed(IORegistryEntry, 5);
+#endif
OSMetaClassDeclareReservedUnused(IORegistryEntry, 6);
OSMetaClassDeclareReservedUnused(IORegistryEntry, 7);
OSMetaClassDeclareReservedUnused(IORegistryEntry, 8);
/*! @function setProperty
@abstract Synchronized method to construct and add an OSData property to a registry entry's property table.
- @discussion This method will add or replace a property in a registry entry's property table, using the OSDictionary::setObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table. The property is created as an OSData copied from the supplied date and length, set in the property table with the given name, and released.
+ @discussion This method will add or replace a property in a registry entry's property table, using the OSDictionary::setObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table. The property is created as an OSData copied from the supplied data and length, set in the property table with the given name, and released.
@param aKey The property's name as a C-string.
@param bytes The property's value as a pointer. OSData will copy this data.
@param length The property's size in bytes, for OSData.
/*! @function inPlane
@abstract Determines whether a registry entry is attached in a plane.
- @discussion This method determines if the entry is attached in a plane to any other entry.
- @param plane The plane object.
- @result If the entry has a parent in the plane, true is returned, otherwise false is returned. */
+ @discussion This method determines if the entry is attached in a plane to any other entry. It can also be used to determine if the entry is a member of any plane.
+ @param plane The plane object, 0 indicates any plane.
+ @result If the entry has a parent in the given plane or if plane = 0 then if entry has any parent; return true, otherwise false. */
- virtual bool inPlane( const IORegistryPlane * plane ) const;
+ virtual bool inPlane( const IORegistryPlane * plane = 0) const;
/*! @function getDepth
@abstract Counts the maximum number of entries between an entry and the registry root, in a plane.
static const char * dealiasPath( const char ** opath,
const IORegistryPlane * plane );
+/*! @function makePlane
+ @abstract Constructs an IORegistryPlane object.
+ @discussion Most planes in IOKit are created by the OS, although other planes may be created.
+ @param name A C-string name for the new plane, to be copied.
+ @result A new instance of an IORegistryPlane, or zero on failure. */
+
+ static const IORegistryPlane * makePlane( const char * name );
+
+/*! @abstract Returns an ID for the registry entry that is global to all tasks.
+ @discussion The entry ID returned by getRegistryEntryID can be used to identify a registry entry across all tasks. A registry entry may be looked up by its entry ID by creating a matching dictionary with IORegistryEntryIDMatching() in user space, or <code>IOService::registryEntryIDMatching()</code> in the kernel, to be used with the IOKit matching functions. The ID is valid only until the machine reboots.
+ @result An ID for the registry entry, assigned when the entry is first attached in the registry. */
+
+ uint64_t getRegistryEntryID( void );
+
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * internals * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-public:
- static IORegistryEntry * initialize( void );
- static const IORegistryPlane * makePlane( const char * name );
- // don't even think about using this
virtual bool init( IORegistryEntry * from,
const IORegistryPlane * inPlane );
+
+#ifdef XNU_KERNEL_PRIVATE
+public:
+#else
+private:
+#endif
+ static IORegistryEntry * initialize( void );
+
private:
inline bool arrayMember( OSArray * set,
const IORegistryEntry * member,
unsigned int relation,
const IORegistryPlane * plane ) const;
- virtual OSArray * getParentSetReference( const IORegistryPlane * plane )
+ APPLE_KEXT_COMPATIBILITY_VIRTUAL
+ OSArray * getParentSetReference( const IORegistryPlane * plane )
const;
- virtual OSArray * getChildSetReference( const IORegistryPlane * plane )
+
+ APPLE_KEXT_COMPATIBILITY_VIRTUAL
+ OSArray * getChildSetReference( const IORegistryPlane * plane )
const;
- virtual IORegistryEntry * getChildFromComponent( const char ** path,
+
+ APPLE_KEXT_COMPATIBILITY_VIRTUAL
+ IORegistryEntry * getChildFromComponent( const char ** path,
const IORegistryPlane * plane );
- virtual const OSSymbol * hasAlias( const IORegistryPlane * plane,
+ APPLE_KEXT_COMPATIBILITY_VIRTUAL
+ const OSSymbol * hasAlias( const IORegistryPlane * plane,
char * opath = 0, int * length = 0 ) const;
- virtual const char * matchPathLocation( const char * cmp,
+
+ APPLE_KEXT_COMPATIBILITY_VIRTUAL
+ const char * matchPathLocation( const char * cmp,
const IORegistryPlane * plane );
};