]> git.saurik.com Git - apple/xnu.git/blame - iokit/IOKit/IORegistryEntry.h
xnu-1228.tar.gz
[apple/xnu.git] / iokit / IOKit / IORegistryEntry.h
CommitLineData
1c79356b
A
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
30 *
31 * HISTORY
32 *
33 */
34
35
36#ifndef _IOKIT_IOREGISTRYENTRY_H
37#define _IOKIT_IOREGISTRYENTRY_H
38
39#include <IOKit/IOTypes.h>
40#include <libkern/c++/OSContainers.h>
41
42
43extern const OSSymbol * gIONameKey;
44extern const OSSymbol * gIOLocationKey;
45
46class IORegistryEntry;
47class IORegistryPlane;
48class IORegistryIterator;
49
50typedef void (*IORegistryEntryApplierFunction)(IORegistryEntry * entry,
51 void * context);
52
53enum {
54 kIORegistryIterateRecursively = 0x00000001,
55 kIORegistryIterateParents = 0x00000002
56};
57
58/*! @class IORegistryEntry : public OSObject
59 @abstract The base class for all objects in the registry.
60 @discussion The IORegistryEntry base class provides functions for describing graphs of connected registry entries, each with a dictionary-based property table. Entries may be connected in different planes, with differing topologies. Access to the registry is protected against multiple threads. Inside the kernel planes are specified with plane objects and are published by the creator - IOService exports the gIOServicePlane plane object for example. Non kernel clients specify planes by their name.
61*/
62
63class IORegistryEntry : public OSObject
64{
9bccf70c 65 friend class IORegistryIterator;
1c79356b
A
66
67 OSDeclareDefaultStructors(IORegistryEntry)
68
69protected:
70/*! @struct ExpansionData
71 @discussion This structure will be used to expand the capablilties of this class in the future.
72 */
73 struct ExpansionData { };
74
75/*! @var reserved
76 Reserved for future use. (Internal use only) */
77 ExpansionData * reserved;
78
79private:
80
81 OSDictionary * fRegistryTable;
82 OSDictionary * fPropertyTable;
83
0b4e3aa0
A
84public:
85 /* methods available in Mac OS X 10.1 or later */
86
87/*! @function copyProperty
88 @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.
89 @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).
90 @param aKey The property's name as a C-string.
91 @param plane The plane to iterate over, eg. gIOServicePlane.
92 @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
93 @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */
94
95 virtual OSObject * copyProperty( const char * aKey,
96 const IORegistryPlane * plane,
97 IOOptionBits options =
98 kIORegistryIterateRecursively |
99 kIORegistryIterateParents) const;
91447636
A
100 OSMetaClassDeclareReservedUsed(IORegistryEntry, 0);
101
0b4e3aa0
A
102/*! @function copyProperty
103 @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.
104 @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).
105 @param aKey The property's name as an OSString.
106 @param plane The plane to iterate over, eg. gIOServicePlane.
107 @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
108 @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */
109
110 virtual OSObject * copyProperty( const OSString * aKey,
111 const IORegistryPlane * plane,
112 IOOptionBits options =
113 kIORegistryIterateRecursively |
114 kIORegistryIterateParents) const;
91447636 115 OSMetaClassDeclareReservedUsed(IORegistryEntry, 1);
0b4e3aa0
A
116
117/*! @function copyProperty
118 @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.
119 @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).
120 @param aKey The property's name as an OSSymbol.
121 @param plane The plane to iterate over, eg. gIOServicePlane.
122 @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
123 @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */
124
125 virtual OSObject * copyProperty( const OSSymbol * aKey,
126 const IORegistryPlane * plane,
127 IOOptionBits options =
128 kIORegistryIterateRecursively |
129 kIORegistryIterateParents) const;
91447636 130 OSMetaClassDeclareReservedUsed(IORegistryEntry, 2);
0b4e3aa0
A
131
132/*! @function copyParentEntry
133 @abstract Returns an registry entry's first parent entry in a plane. Available in Mac OS X 10.1 or later.
134 @discussion This function will return the parent to which a registry entry was first attached. Since the majority of registry entrys have only one provider, this is a useful simplification.
135 @param plane The plane object.
136 @result Returns the first parent of the registry entry, or zero if the entry is not attached into the registry in that plane. A reference on the entry is returned to caller, which should be released. */
137
138 virtual IORegistryEntry * copyParentEntry( const IORegistryPlane * plane ) const;
91447636 139 OSMetaClassDeclareReservedUsed(IORegistryEntry, 3);
0b4e3aa0
A
140
141/*! @function copyChildEntry
142 @abstract Returns an registry entry's first child entry in a plane. Available in Mac OS X 10.1 or later.
143 @discussion This function will return the child which first attached to a registry entry.
144 @param plane The plane object.
145 @result Returns the first child of the registry entry, or zero if the entry is not attached into the registry in that plane. A reference on the entry is returned to caller, which should be released. */
146
147 virtual IORegistryEntry * copyChildEntry( const IORegistryPlane * plane ) const;
91447636 148 OSMetaClassDeclareReservedUsed(IORegistryEntry, 4);
0b4e3aa0 149
91447636
A
150 /* method available in Mac OS X 10.4 or later */
151/*!
152 @typedef Action
153 @discussion Type and arguments of callout C function that is used when
154a runCommand is executed by a client. Cast to this type when you want a C++
155member function to be used. Note the arg1 - arg3 parameters are passed straight pass through to the action callout.
156 @param target
157 Target of the function, can be used as a refcon. Note if a C++ function
158was specified, this parameter is implicitly the first parameter in the target
159member function's parameter list.
160 @param arg0 Argument to action from run operation.
161 @param arg1 Argument to action from run operation.
162 @param arg2 Argument to action from run operation.
163 @param arg3 Argument to action from run operation.
164*/
165 typedef IOReturn (*Action)(OSObject *target,
166 void *arg0, void *arg1,
167 void *arg2, void *arg3);
168
169/*! @function runPropertyAction
170 @abstract Single thread a call to an action w.r.t. the property lock
171 @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
172 @param action Pointer to function to be executed in work-loop context.
173 @param arg0 Parameter for action parameter, defaults to 0.
174 @param arg1 Parameter for action parameter, defaults to 0.
175 @param arg2 Parameter for action parameter, defaults to 0.
176 @param arg3 Parameter for action parameter, defaults to 0.
177 @result Returns the value of the Action callout.
178*/
179 virtual IOReturn runPropertyAction(Action action, OSObject *target,
180 void *arg0 = 0, void *arg1 = 0,
181 void *arg2 = 0, void *arg3 = 0);
182 OSMetaClassDeclareReservedUsed(IORegistryEntry, 5);
0b4e3aa0 183
91447636 184private:
0b4e3aa0 185
1c79356b
A
186 OSMetaClassDeclareReservedUnused(IORegistryEntry, 6);
187 OSMetaClassDeclareReservedUnused(IORegistryEntry, 7);
188 OSMetaClassDeclareReservedUnused(IORegistryEntry, 8);
189 OSMetaClassDeclareReservedUnused(IORegistryEntry, 9);
190 OSMetaClassDeclareReservedUnused(IORegistryEntry, 10);
191 OSMetaClassDeclareReservedUnused(IORegistryEntry, 11);
192 OSMetaClassDeclareReservedUnused(IORegistryEntry, 12);
193 OSMetaClassDeclareReservedUnused(IORegistryEntry, 13);
194 OSMetaClassDeclareReservedUnused(IORegistryEntry, 14);
195 OSMetaClassDeclareReservedUnused(IORegistryEntry, 15);
196 OSMetaClassDeclareReservedUnused(IORegistryEntry, 16);
197 OSMetaClassDeclareReservedUnused(IORegistryEntry, 17);
198 OSMetaClassDeclareReservedUnused(IORegistryEntry, 18);
199 OSMetaClassDeclareReservedUnused(IORegistryEntry, 19);
200 OSMetaClassDeclareReservedUnused(IORegistryEntry, 20);
201 OSMetaClassDeclareReservedUnused(IORegistryEntry, 21);
202 OSMetaClassDeclareReservedUnused(IORegistryEntry, 22);
203 OSMetaClassDeclareReservedUnused(IORegistryEntry, 23);
204 OSMetaClassDeclareReservedUnused(IORegistryEntry, 24);
205 OSMetaClassDeclareReservedUnused(IORegistryEntry, 25);
206 OSMetaClassDeclareReservedUnused(IORegistryEntry, 26);
207 OSMetaClassDeclareReservedUnused(IORegistryEntry, 27);
208 OSMetaClassDeclareReservedUnused(IORegistryEntry, 28);
209 OSMetaClassDeclareReservedUnused(IORegistryEntry, 29);
210 OSMetaClassDeclareReservedUnused(IORegistryEntry, 30);
211 OSMetaClassDeclareReservedUnused(IORegistryEntry, 31);
212
213public:
214
215 /* Registry accessors */
216
217/*! @function getRegistryRoot
218 @abstract Returns a pointer to the root instance of the registry.
219 @discussion This method provides an accessor to the root of the registry for the machine. The root may be passed to a registry iterator when iterating a plane, and contains properties that describe the available planes, and diagnostic information for IOKit. Keys for these properties are in IOKitKeys.h.
220 @result A pointer to the IORegistryEntry root instance. It should not be released by the caller. */
221
222 static IORegistryEntry * getRegistryRoot( void );
223
224/*! @function getGenerationCount
225 @abstract Returns an generation count for all registry changing operations.
226 @discussion This method provides an accessor to the current generation count (or seed) of the registry which changes when any topology change occurs in the registry - this does not include property table changes. It may be used to invalidate any caching of the results from IORegistryEntry methods.
227 @result An integer generation count. */
228
229 static SInt32 getGenerationCount( void );
230
231/*! @function getPlane
232 @abstract Looks up the plane object by a C-string name.
233 @discussion Planes are usually provided as globals by the creator, eg. gIOServicePlane, gIODeviceTreePlane, or gIOAudioPlane, however they may also be looked up by name with this method.
234 @result A pointer to the plane object, or zero if no such plane exists. The returned plane should not be released. */
235
236 static const IORegistryPlane * getPlane( const char * name );
237
238 /* Registry Entry allocation & init */
239
240/*! @function init
241 @abstract Standard init method for all IORegistryEntry subclasses.
242 @discussion A registry entry must be initialized with this method before it can be used. A property dictionary may passed and will be retained by this method for use as the registry entry's property table, or an empty one will be created.
243 @param A dictionary that will become the registry entry's property table (retaining it), or zero which will cause an empty property table to be created.
244 @result true on success, or false on a resource failure. */
245
246 virtual bool init( OSDictionary * dictionary = 0 );
247
248/*! @function free
249 @abstract Standard free method for all IORegistryEntry subclasses.
250 @discussion This method will release any resources of the entry, in particular its property table. Note that the registry entry must always be detached from the registry before free may be called, and subclasses (namely IOService) will have additional protocols for removing registry entries. free should never need be called directly. */
251
252 virtual void free( void );
253
254/*! @function setPropertyTable
255 @abstract Replace a registry entry's property table.
256 @discussion This method will release the current property table of a the entry and replace it with another, retaining the new property table.
257 @param dict The new dictionary to be used as the entry's property table. */
258
259 virtual void setPropertyTable( OSDictionary * dict );
260
261 /* Synchronized property accessors; wrappers to OSDictionary
262 * plus property creation helpers */
263
264/*! @function setProperty
265 @abstract Synchronized method to add a property to a registry entry's property table.
266 @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.
267 @param aKey The properties name as an OSSymbol.
268 @param anObject The property value.
269 @result true on success or false on a resource failure. */
270
271 virtual bool setProperty(const OSSymbol * aKey, OSObject * anObject);
272
273/*! @function setProperty
274 @abstract Synchronized method to add a property to a registry entry's property table.
275 @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.
276 @param aKey The property's name as an OSString.
277 @param anObject The property value.
278 @result true on success or false on a resource failure. */
279
280 virtual bool setProperty(const OSString * aKey, OSObject * anObject);
281
282/*! @function setProperty
283 @abstract Synchronized method to add a property to a registry entry's property table.
284 @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.
285 @param aKey The property's name as a C-string.
286 @param anObject The property value.
287 @result true on success or false on a resource failure. */
288
289 virtual bool setProperty(const char * aKey, OSObject * anObject);
290
291/*! @function setProperty
292 @abstract Synchronized method to construct and add a OSString property to a registry entry's property table.
293 @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 OSString from the supplied C-string, set in the property table with the given name, and released.
294 @param aKey The property's name as a C-string.
295 @param aString The property value as a C-string.
296 @result true on success or false on a resource failure. */
297
298 virtual bool setProperty(const char * aKey, const char * aString);
299
300/*! @function setProperty
301 @abstract Synchronized method to construct and add an OSBoolean property to a registry entry's property table.
302 @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 OSBoolean from the supplied value, set in the property table with the given name, and released.
303 @param aKey The property's name as a C-string.
304 @param aBoolean The property's boolean value.
305 @result true on success or false on a resource failure. */
306
307 virtual bool setProperty(const char * aKey, bool aBoolean);
308
309/*! @function setProperty
310 @abstract Synchronized method to construct and add an OSNumber property to a registry entry's property table.
311 @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 OSNumber from the supplied value and size, set in the property table with the given name, and released.
312 @param aKey The property's name as a C-string.
313 @param aValue The property's numeric value.
314 @param aNumberOfBits The property's size in bits, for OSNumber.
315 @result true on success or false on a resource failure. */
316
317 virtual bool setProperty( const char * aKey,
318 unsigned long long aValue,
319 unsigned int aNumberOfBits);
320
321/*! @function setProperty
322 @abstract Synchronized method to construct and add an OSData property to a registry entry's property table.
2d21ac55 323 @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.
1c79356b
A
324 @param aKey The property's name as a C-string.
325 @param bytes The property's value as a pointer. OSData will copy this data.
326 @param length The property's size in bytes, for OSData.
327 @result true on success or false on a resource failure. */
328
329 virtual bool setProperty( const char * aKey,
330 void * bytes,
331 unsigned int length);
332
333/*! @function removeProperty
334 @abstract Synchronized method to remove a property from a registry entry's property table.
335 @discussion This method will remove a property from a registry entry's property table, using the OSDictionary::removeObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table.
336 @param aKey The property's name as an OSSymbol. */
337
338 virtual void removeProperty( const OSSymbol * aKey);
339
340/*! @function removeProperty
341 @abstract Synchronized method to remove a property from a registry entry's property table.
342 @discussion This method will remove a property from a registry entry's property table, using the OSDictionary::removeObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table.
343 @param aKey The property's name as an OSString. */
344
345 virtual void removeProperty( const OSString * aKey);
346
347/*! @function removeProperty
348 @abstract Synchronized method to remove a property from a registry entry's property table.
349 @discussion This method will remove a property from a registry entry's property table, using the OSDictionary::removeObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table.
350 @param aKey The property's name as a C-string. */
351
352 virtual void removeProperty( const char * aKey);
353
354/*! @function getProperty
355 @abstract Synchronized method to obtain a property from a registry entry's property table.
356 @discussion This method will lookup a property in a registry entry's property table, using the OSDictionary::getObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table.
357 @param aKey The property's name as an OSSymbol.
358 @result The property value found, or zero. */
359
360 virtual OSObject * getProperty( const OSSymbol * aKey) const;
361
362/*! @function getProperty
363 @abstract Synchronized method to obtain a property from a registry entry's property table.
364 @discussion This method will lookup a property in a registry entry's property table, using the OSDictionary::getObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table.
365 @param aKey The property's name as an OSString.
366 @result The property value found, or zero. */
367
368 virtual OSObject * getProperty( const OSString * aKey) const;
369
370/*! @function getProperty
371 @abstract Synchronized method to obtain a property from a registry entry's property table.
372 @discussion This method will lookup a property in a registry entry's property table, using the OSDictionary::getObject semantics. This method is synchronized with other IORegistryEntry accesses to the property table.
373 @param aKey The property's name as a C-string.
374 @result The property value found, or zero. */
375
376 virtual OSObject * getProperty( const char * aKey) const;
377
378/*! @function getProperty
379 @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy.
380 @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).
381 @param aKey The property's name as an OSSymbol.
382 @param plane The plane to iterate over, eg. gIOServicePlane.
383 @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
384 @result The property value found, or zero. */
385
386 virtual OSObject * getProperty( const OSSymbol * aKey,
387 const IORegistryPlane * plane,
388 IOOptionBits options =
389 kIORegistryIterateRecursively |
390 kIORegistryIterateParents) const;
391
392/*! @function getProperty
393 @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy.
394 @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).
395 @param aKey The property's name as an OSString.
396 @param plane The plane to iterate over, eg. gIOServicePlane.
397 @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
398 @result The property value found, or zero. */
399
400 virtual OSObject * getProperty( const OSString * aKey,
401 const IORegistryPlane * plane,
402 IOOptionBits options =
403 kIORegistryIterateRecursively |
404 kIORegistryIterateParents) const;
405
406/*! @function getProperty
407 @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy.
408 @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).
409 @param aKey The property's name as a C-string.
410 @param plane The plane to iterate over, eg. gIOServicePlane.
411 @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard getProperty() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children.
412 @result The property value found, or zero. */
413
414 virtual OSObject * getProperty( const char * aKey,
415 const IORegistryPlane * plane,
416 IOOptionBits options =
417 kIORegistryIterateRecursively |
418 kIORegistryIterateParents) const;
419
420/*! @function copyProperty
421 @abstract Synchronized method to obtain a property from a registry entry's property table.
422 @discussion This method will lookup a property in a registry entry's property table, using the OSDictionary::getObject semantics, and return a reference to the caller. This method is synchronized with other IORegistryEntry accesses to the property table.
423 @param aKey The property's name as an OSSymbol.
424 @result The property value found, or zero. It should be released by the caller. */
425
426 virtual OSObject * copyProperty( const OSSymbol * aKey) const;
427
428/*! @function copyProperty
429 @abstract Synchronized method to obtain a property from a registry entry's property table.
430 @discussion This method will lookup a property in a registry entry's property table, using the OSDictionary::getObject semantics, and return a reference to the caller. This method is synchronized with other IORegistryEntry accesses to the property table.
431 @param aKey The property's name as an OSString.
432 @result The property value found, or zero. It should be released by the caller. */
433
434 virtual OSObject * copyProperty( const OSString * aKey) const;
435
436/*! @function copyProperty
437 @abstract Synchronized method to obtain a property from a registry entry's property table.
438 @discussion This method will lookup a property in a registry entry's property table, using the OSDictionary::getObject semantics, and return a reference to the caller. This method is synchronized with other IORegistryEntry accesses to the property table.
439 @param aKey The property's name as a C-string.
440 @result The property value found, or zero. It should be released by the caller. */
441
442 virtual OSObject * copyProperty( const char * aKey) const;
443
444/*! @function dictionaryWithProperties
445 @abstract Synchronized method to obtain copy a registry entry's property table.
446 @discussion This method will copy a registry entry's property table, using the OSDictionary::withDictionary semantics. This method is synchronized with other IORegistryEntry accesses to the property table. Since OSDictionary will only copy property values by reference, synchronization is not guaranteed to any collection values.
447 @result The created dictionary, or zero on a resource value. It should be released by the caller. */
448
449 virtual OSDictionary * dictionaryWithProperties( void ) const;
450
451/*! @function serializeProperties
452 @abstract Synchronized method to serialize a registry entry's property table.
453 @discussion This method will serialize a registry entry's property table, using the OSDictionary::serialize semantics. This method is synchronized with other IORegistryEntry accesses to the property table. Many non-kernel clients of IOKit read information from the registry via properties, and will invoke this method in a registry entry to create a serialization of all the entry's properties, which is then reconstructed in the client's task as a CFDictionary. This method may be intercepted by subclasses to update their properties or implement a different serialization method, though it is usually better to implement such functionality by creating objects in the property table and implementing their serialize methods, avoiding any need to implement serializeProperties.
454 @param serialize The OSSerialize instance representing the serialization request.
455 @result True on success, false otherwise. */
456
457 virtual bool serializeProperties( OSSerialize * serialize ) const;
458
459 /* Unsynchronized(!) property table access */
460
461/*! @function getPropertyTable
462 @abstract Unsynchronized accessor to a registry entry's property table.
463 @discussion This method will return a pointer to the live property table as an OSDictionery. Its use is not recommended in most cases, instead use the synchronized accessors and helper functions of IORegistryEntry to access properties. It can only safely be used by one thread, which usually means it can only be used before a registry entry is entered into the registry.
464 @result A pointer to the property table as an OSDictionary. The pointer is valid while the registry entry is retained, and should not be released by the caller. */
465
9bccf70c
A
466 /* inline */ OSDictionary * getPropertyTable( void ) const;
467 /* { return(fPropertyTable); } */
1c79356b
A
468
469 /* Set properties from user level, to be overridden if supported */
470
471/*! @function setProperties
472 @abstract Optionally supported external method to set properties in a registry entry.
473 @discussion This method is not implemented by IORegistryEntry, but is available to kernel and non-kernel clients to set properties in a registry entry. IOUserClient provides connection based, more controlled access to this functionality and may be more appropriate for many uses, since there is no differentiation between clients available to this method.
474 @param properties Any OSObject subclass, to be interpreted by the implementing method - for example an OSDictionary, OSData etc. may all be appropriate.
475 @result An IOReturn code to be returned to the caller. */
476
477 virtual IOReturn setProperties( OSObject * properties );
478
479 /* Topology */
480
481/*! @function getParentIterator
482 @abstract Returns an iterator over an registry entry's parent entries in a specified plane.
483 @param plane The plane object.
484 @result Returns an iterator over the parents of the registry entry, or zero if there is a resource failure. The iterator must be released when the iteration is finished. All objects returned by the iteration are retained while the iterator is valid, though they may no longer be attached during the iteration. */
485
486 virtual OSIterator * getParentIterator( const IORegistryPlane * plane )
487 const;
488 virtual void applyToParents( IORegistryEntryApplierFunction applier,
489 void * context,
490 const IORegistryPlane * plane ) const;
491
492/*! @function getParentEntry
493 @abstract Returns an registry entry's first parent entry in a plane.
494 @discussion This function will return the parent to which a registry entry was first attached. Since the majority of registry entrys have only one provider, this is a useful simplification.
495 @param plane The plane object.
496 @result Returns the first parent of the registry entry, or zero if the entry is not attached into the registry in that plane. The parent is retained while the entry is attached, and should not be released by the caller. */
497
0b4e3aa0 498 virtual IORegistryEntry * getParentEntry( const IORegistryPlane * plane ) const;
1c79356b
A
499
500/*! @function getChildIterator
501 @abstract Returns an iterator over an registry entry's child entries in a plane.
502 @discussion This method creates an iterator which will return each of a registry entry's child entries in a specified plane.
503 @param plane The plane object.
504 @result Returns an iterator over the children of the entry, or zero if there is a resource failure. The iterator must be released when the iteration is finished. All objects returned by the iteration are retained while the iterator is valid, though they may no longer be attached during the iteration. */
505
506 virtual OSIterator * getChildIterator( const IORegistryPlane * plane )
507 const;
508
509 virtual void applyToChildren( IORegistryEntryApplierFunction applier,
510 void * context,
511 const IORegistryPlane * plane ) const;
512
513/*! @function getChildEntry
514 @abstract Returns an registry entry's first child entry in a plane.
515 @discussion This function will return the child which first attached to a registry entry.
516 @param plane The plane object.
517 @result Returns the first child of the registry entry, or zero if the entry is not attached into the registry in that plane. The child is retained while the entry is attached, and should not be released by the caller. */
518
0b4e3aa0 519 virtual IORegistryEntry * getChildEntry( const IORegistryPlane * plane ) const;
1c79356b
A
520
521/*! @function isChild
522 @abstract Determines whether a registry entry is the child of another in a plane.
523 @discussion This method called in the parent entry determines if the specified entry is a child, in a plane. Additionally, it can check if the child is the only child of the parent entry.
524 @param child The possible child registry entry.
525 @param plane The plane object.
526 @param onlyChild If true, check also if the child is the only child.
527 @result If the child argument is not a child of the registry entry, false is returned. If onlyChild is true and the child is not the only child of the entry, false is returned, otherwise true is returned. */
528
529 virtual bool isChild( IORegistryEntry * child,
530 const IORegistryPlane * plane,
531 bool onlyChild = false ) const;
532
533/*! @function isParent
534 @abstract Determines whether a registry entry is the parent of another in a plane.
535 @discussion This method called in the child entry determines if the specified entry is a parent, in a plane. Additionally, it can check if the parent is the only parent of the child entry.
536 @param parent The possible parent registry entry.
537 @param plane The plane object.
538 @param onlyParent If true, check also if the parent is the only parent.
539 @result If the parent argument is not a parent of the registry entry, false is returned. If onlyParent is true and the parent is not the only parent of the entry, false is returned, otherwise true is returned. */
540
541 virtual bool isParent( IORegistryEntry * parent,
542 const IORegistryPlane * plane,
543 bool onlyParent = false ) const;
544
545/*! @function inPlane
546 @abstract Determines whether a registry entry is attached in a plane.
91447636
A
547 @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.
548 @param plane The plane object, 0 indicates any plane.
549 @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. */
1c79356b 550
91447636 551 virtual bool inPlane( const IORegistryPlane * plane = 0) const;
1c79356b
A
552
553/*! @function getDepth
554 @abstract Counts the maximum number of entries between an entry and the registry root, in a plane.
555 @discussion This method counts the number of entries between and entry and the registry root, in a plane, for each parent of the entry and returns the maximum value.
556 @param plane The plane object.
557 @result The maximum number of entries between the entry and the root. Zero is returned if the entry is not attached in the plane. */
558
559 virtual unsigned int getDepth( const IORegistryPlane * plane ) const;
560
561 /* Attach / detach */
562
563/*! @function attachToParent
564 @abstract Attaches a entry to a parent entry in a plane.
565 @discussion This is the usual method of entering an entry into the registry. It is a no-op and success if the entry is already attached to the parent. Attaching the entry into the registry retains both the child and parent while they are attached. This method will call attachToChild in the parent entry if it is not being called from attachToChild.
566 @param parent The registry entry to attach to.
567 @param plane The plane object.
568 @result true on success, or false on a resource failure, or if the parent is the same as the child. */
569
570 virtual bool attachToParent( IORegistryEntry * parent,
571 const IORegistryPlane * plane );
572
573/*! @function detachFromParent
574 @abstract Detaches an entry from a parent entry in a plane.
575 @discussion This is the usual method of removing an entry from the registry. It is a no-op if the entry is not attached to the parent. Detaching the entry will release both the child and parent. This method will call detachFromChild in the parent entry if it is not being called from detachFromChild.
576 @param parent The registry entry to detach from.
577 @param plane The plane object. */
578
579 virtual void detachFromParent( IORegistryEntry * parent,
580 const IORegistryPlane * plane );
581
582/*! @function attachToChild
583 @abstract Method called in the parent entry when a child attaches.
584 @discussion This method is called in the parent entry when a child attaches, to make overrides possible. This method will also call attachToParent in the child entry if it is not being called from attachToParent. It is a no-op and success if the entry is already a child. Attaching the entry into the registry retains both the child and parent while they are attached.
585 @param child The registry entry being attached.
586 @param plane The plane object.
587 @result true on success, or false on a resource failure, or if the parent is the same as the child. */
588
589 virtual bool attachToChild( IORegistryEntry * child,
590 const IORegistryPlane * plane );
591
592/*! @function detachFromChild
593 @abstract Detaches a child entry from its parent in a plane.
594 @discussion This method is called in the parent entry when a child detaches, to make overrides possible. It is a no-op if the entry is not a child of the parent. Detaching the entry will release both the child and parent. This method will call detachFromParent in the child entry if it is not being called from detachFromParent.
595 @param parent The registry entry to detach.
596 @param plane The plane object. */
597
598 virtual void detachFromChild( IORegistryEntry * child,
599 const IORegistryPlane * plane );
600
601/*! @function detachAbove
602 @abstract Detaches an entry from all its parent entries in a plane.
603 @discussion This method calls detachFromParent in the entry for each of its parent entries in the plane.
604 @param plane The plane object. */
605
606 virtual void detachAbove( const IORegistryPlane * plane );
607
608/*! @function detachAll
609 @abstract Detaches an entry and all its children recursively in a plane.
610 @discussion This method breaks the registry connections for a subtree. detachAbove is called in the entry, and all child entries and their children in the plane.
611 @param plane The plane object. */
612
613 virtual void detachAll( const IORegistryPlane * plane );
614
615 /* Name, location and path accessors */
616
617/*! @function getName
618 @abstract Returns the name assigned to the registry entry as a C-string.
619 @discussion Entries can be named in a particular plane, or globally. If the entry is named in plane and the plane is specified that name will be returned, otherwise the global name is returned. The global name defaults to the entry's meta class name if it has not been named.
620 @param plane The plane object, or zero for the global name.
621 @result A C-string name, valid while the entry is retained. */
622
623 virtual const char * getName( const IORegistryPlane * plane = 0 ) const;
624
625/*! @function copyName
626 @abstract Returns the name assigned to the registry entry as an OSSymbol.
627 @discussion Entries can be named in a particular plane, or globally. If the entry is named in plane and the plane is specified that name will be returned, otherwise the global name is returned. The global name defaults to the entry's meta class name if it has not been named.
628 @param plane The plane object, or zero for the global name.
629 @result A reference to an OSSymbol for the name, which should be released by the caller. */
630
631 virtual const OSSymbol * copyName(
632 const IORegistryPlane * plane = 0 ) const;
633
634/*! @function compareNames
635 @abstract Compares the name of the entry with one or more names, and optionally returns the matching name.
636 @discussion This method is called during IOService name matching and elsewhere to compare the entry's global name with a list of names, or a single name. A list of names may be passed as any OSCollection of OSStrings, while a single name may be passed an OSString, in the name parameter. compareNames will call the compareName method for each name, for overrides.
637 @param name The name or names to compare with as any OSCollection (eg. OSArray, OSSet, OSDictionary) of OSStrings, or a single name may be passed an OSString.
638 @param matched If the caller wants the successfully matched name returned, pass a non-zero pointer for the matched parameter and an OSString will be returned here. It should be released by the caller.
639 @result True if one of the names compared true with the entry's global name. */
640
641 virtual bool compareNames( OSObject * name, OSString ** matched = 0 ) const;
642
643/*! @function compareName
644 @abstract Compares the name of the entry with one name, and optionally returns the matching name.
645 @discussion This method is called during IOService name matching and elsewhere from the compareNames method. It should be overridden to provide non-standard name matching.
646 @param name The name to compare with as an OSString.
647 @param matched If the caller wants the successfully matched name returned, pass a non-zero pointer for the matched parameter and an OSString will be returned here. It should be released by the caller. Generally, this will be the same as the name parameter, but may not be if wildcards are used.
648 @result True if the name compared true with the entry's global name. */
649
650 virtual bool compareName( OSString * name, OSString ** matched = 0 ) const;
651
652/*! @function setName
653 @abstract Sets a name for the registry entry, in a particular plane, or globally.
654 @discussion Entries can be named in a particular plane, or globally. If the plane is specified the name applies only to that plane, otherwise the global name is set. The global name defaults to the entry's meta class name if it has not been named.
655 @param name An OSSymbol which will be retained.
656 @param plane The plane object, or zero to set the global name. */
657
658 virtual void setName( const OSSymbol * name,
659 const IORegistryPlane * plane = 0 );
660
661/*! @function setName
662 @abstract Sets a name for the registry entry, in a particular plane, or globally.
663 @discussion Entries can be named in a particular plane, or globally. If the plane is specified the name applies only to that plane, otherwise the global name is set. The global name defaults to the entry's meta class name if it has not been named.
664 @param name A const C-string name which will be copied.
665 @param plane The plane object, or zero to set the global name. */
666
667 virtual void setName( const char * name,
668 const IORegistryPlane * plane = 0 );
669
670/*! @function getLocation
671 @abstract Returns the location string assigned to the registry entry as a C-string.
672 @discussion Entries can given a location string in a particular plane, or globally. If the entry has had a location set in a plane and the plane is specified that location string will be returned, otherwise the global location string is returned. If no global location string has been set, zero is returned.
673 @param plane The plane object, or zero for the global name.
674 @result A C-string location string, valid while the entry is retained, or zero. */
675
676 virtual const char * getLocation( const IORegistryPlane * plane = 0 ) const;
677
678/*! @function copyLocation
679 @abstract Returns the location string assigned to the registry entry as an OSSymbol.
680 @discussion Entries can given a location string in a particular plane, or globally. If the entry has had a location set in a plane and the plane is specified that location string will be returned, otherwise the global location string is returned. If no global location string has been set, zero is returned.
681 @param plane The plane object, or zero for the global name.
682 @result A reference to an OSSymbol for the location if one exists, which should be released by the caller, or zero. */
683
684 virtual const OSSymbol * copyLocation(
685 const IORegistryPlane * plane = 0 ) const;
686
687/*! @function setLocation
688 @abstract Sets a location string for the registry entry, in a particular plane, or globally.
689 @discussion Entries can be given a location string in a particular plane, or globally. If the plane is specified the location applies only to that plane, otherwise the global location is set. The location string may be used during path lookups of registry entries, to distinguish between sibling entries with the same name. The default IORegistryEntry parsing of location strings expects a list of hex numbers separated by commas, though subclasses of IORegistryEntry might do their own parsing.
690 @param location A C-string location string which will be copied, or an OSSymbol which will be retained.
691 @param plane The plane object, or zero to set the global location string. */
692
693 virtual void setLocation( const OSSymbol * location,
694 const IORegistryPlane * plane = 0 );
695 virtual void setLocation( const char * location,
696 const IORegistryPlane * plane = 0 );
697
698/*! @function getPath
699 @abstract Create a path for a registry entry.
700 @discussion The path for a registry entry is copied to the caller's buffer. The path describes the entry's attachment in a particular plane, which must be specified. The path begins with the plane name followed by a colon, and then followed by '/' separated path components for each of the entries between the root and the registry entry. Each component is constructed with the getPathComponent method called in each entry. An alias may also exist for the entry, which are described as properties in a registry entry found at /aliases in the plane. If a property value interpreted as a path in a call to IORegistryEntry::fromPath yields the entry, then the property name is used as the entry's path.
701 @param path A char buffer allocated by the caller.
702 @param length An in/out parameter - the caller sets the length of the buffer available, and getPath returns the total length of the path copied to the buffer.
703 @param plane The plane object.
704 @result getPath will fail if the entry is not attached in the plane, or if the buffer is not large enough to contain the path. */
705
706 virtual bool getPath( char * path, int * length,
707 const IORegistryPlane * plane) const;
708
709/*! @function getPathComponent
710 @abstract Create a path component for a registry entry.
711 @discussion Each component of a path created with getPath is created with getPathComponent. The default implementation concatenates the entry's name in the the plane, with the "at" symbol and the location string of the entry in the plane if it has been set.
712 @param path A char buffer allocated by the caller.
713 @param length An in/out parameter - the caller sets the length of the buffer available, and getPathComponent returns the total length of the path component copied to the buffer.
714 @param plane The plane object.
715 @result true if the path fits into the supplied buffer or false on a overflow. */
716
717 virtual bool getPathComponent( char * path, int * length,
718 const IORegistryPlane * plane ) const;
719
720/*! @function fromPath
721 @abstract Looks up a registry entry by path.
722 @discussion This function parses paths to lookup registry entries. The path may begin with the <plane name>: created by getPath, or the plane may be set by the caller. If there are characters remaining unparsed after an entry has been looked up, this may be considered an invalid lookup, or those characters may be passed back to the caller and the lookup successful.
723 @param path A C-string path.
724 @param plane The plane to lookup up the path, or zero, in which case the path must begin with the plane name.
725 @param residualPath If the path may contain residual characters after the last path component, the residual will be copied back to the caller's residualPath buffer. If there are residual characters and no residual buffer is specified, fromPath will fail.
726 @param residualLength An in/out parameter - the caller sets the length of the residual buffer available, and fromPath returns the total length of the residual path copied to the buffer. If there is no residualBuffer (residualPath = 0) then residualLength may be zero also.
727 @param fromEntry The lookup will proceed rooted at this entry if non-zero, otherwise it proceeds from the root of the plane.
728 @result A retained registry entry is returned on success, or zero on failure. The caller should release the entry. */
729
730 static IORegistryEntry * fromPath( const char * path,
731 const IORegistryPlane * plane = 0,
732 char * residualPath = 0,
733 int * residualLength = 0,
734 IORegistryEntry * fromEntry = 0 );
735
736/*! @function fromPath
737 @abstract Looks up a registry entry by relative path.
738 @discussion This function looks up a entry below the called entry by a relative path. It is just a convenience that calls IORegistryEntry::fromPath with this as the fromEntry parameter.
739 @param path See IORegistryEntry::fromPath.
740 @param plane See IORegistryEntry::fromPath.
741 @param residualPath See IORegistryEntry::fromPath.
742 @param residualLength See IORegistryEntry::fromPath.
743 @result See IORegistryEntry::fromPath. */
744
745 virtual IORegistryEntry * childFromPath( const char * path,
746 const IORegistryPlane * plane = 0,
747 char * residualPath = 0,
748 int * residualLength = 0 );
749
750/*! @function dealiasPath
751 @abstract Strips any aliases from the head of path and returns the full path.
752 @discussion If the path specified begins with an alias found in the /aliases entry, the value of the alias is returned, and a pointer into the passed in path after the alias is passed back to the caller. If an alias is not found, zero is returned and the path parameter is unchanged.
753 @param opath An in/out paramter - the caller passes in a pointer to a C-string pointer to a path. If an alias is found, dealiasPath returns a pointer into the path just beyond the end of the alias.
754 @param plane A plane object must be specified.
755 @result A C-string pointer to the value of the alias if one is found, or zero if not. */
756
757 static const char * dealiasPath( const char ** opath,
758 const IORegistryPlane * plane );
759
760 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
761 /* * * * * * * * * * * * internals * * * * * * * * * * * */
762 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */
763
764public:
765 static IORegistryEntry * initialize( void );
766 static const IORegistryPlane * makePlane( const char * name );
767 // don't even think about using this
768 virtual bool init( IORegistryEntry * from,
769 const IORegistryPlane * inPlane );
770private:
771 inline bool arrayMember( OSArray * set,
772 const IORegistryEntry * member,
773 unsigned int * index = 0 ) const;
774
775 bool makeLink( IORegistryEntry * to,
776 unsigned int relation,
777 const IORegistryPlane * plane ) const;
778 void breakLink( IORegistryEntry * to,
779 unsigned int relation,
780 const IORegistryPlane * plane ) const;
781
782 virtual OSArray * getParentSetReference( const IORegistryPlane * plane )
783 const;
784 virtual OSArray * getChildSetReference( const IORegistryPlane * plane )
785 const;
786 virtual IORegistryEntry * getChildFromComponent( const char ** path,
787 const IORegistryPlane * plane );
788
789 virtual const OSSymbol * hasAlias( const IORegistryPlane * plane,
790 char * opath = 0, int * length = 0 ) const;
791 virtual const char * matchPathLocation( const char * cmp,
792 const IORegistryPlane * plane );
793
794};
795
796/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
797
798/*! @class IORegistryIterator : public OSIterator
799 @abstract An iterator over the registry.
800 @discussion An iterator that can traverse the children or parents of a registry entry in a plane, and recurse. Access to the registry is protected against multiple threads, but an IORegistryIterator instance is for use by one thread only. */
801
802class IORegistryIterator : public OSIterator
803{
804 OSDeclareAbstractStructors(IORegistryIterator)
805
806private:
807 struct IORegCursor {
808 IORegCursor * next;
809 IORegistryEntry * current;
810 OSIterator * iter;
811 };
812 IORegCursor start;
813 IORegCursor * where;
814 IORegistryEntry * root;
815 OSOrderedSet * done;
816 const IORegistryPlane * plane;
817 IOOptionBits options;
818
819 virtual void free( void );
820
821public:
822/*! @function iterateOver
823 @abstract Create an iterator rooted at a given registry entry.
824 @discussion This method creates an IORegistryIterator that is set up with options to iterate children or parents of a root entry, and to recurse automatically into entries as they are returned, or only when instructed. The iterator object keeps track of entries that have been recursed into previously to avoid loops.
825 @param start The root entry to begin the iteration at.
826 @param plane A plane object must be specified.
827 @param options kIORegistryIterateRecursively may be set to recurse automatically into each entry as it is returned. This option affects the behaviour of the getNextObject method, which is defined in the OSIterator superclass. Other methods will override this behaviour. kIORegistryIterateParents may be set to iterate the parents of each entry, by default the children are iterated.
828 @result A created IORegistryIterator instance, to be released by the caller when it has finished with it. */
829
830 static IORegistryIterator * iterateOver( IORegistryEntry * start,
831 const IORegistryPlane * plane,
832 IOOptionBits options = 0 );
833
834/*! @function iterateOver
835 @abstract Create an iterator rooted at the registry root.
836 @discussion This method creates an IORegistryIterator that is set up with options to iterate children of the registry root entry, and to recurse automatically into entries as they are returned, or only when instructed. The iterator object keeps track of entries that have been recursed into previously to avoid loops.
837 @param plane A plane object must be specified.
838 @param options kIORegistryIterateRecursively may be set to recurse automatically into each entry as it is returned. This option affects the behaviour of the getNextObject method, which is defined in the OSIterator superclass. Other methods will override this behaviour. kIORegistryIterateParents may be set to iterate the parents of each entry, by default the children are iterated.
839 @result A created IORegistryIterator instance, to be released by the caller when it has finished with it. */
840
841 static IORegistryIterator * iterateOver( const IORegistryPlane * plane,
842 IOOptionBits options = 0 );
843
844/*! @function getNextObject
845 @abstract Return the next object in the registry iteration.
846 @discussion This method calls either getNextObjectFlat or getNextObjectRecursive depending on the options the iterator was created with. This implements the OSIterator defined getNextObject method. The object returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it.
847 @result The next registry entry in the iteration (the current entry), or zero if the iteration has finished at this level of recursion. The entry returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it. */
848
849 virtual IORegistryEntry * getNextObject( void );
850
851/*! @function getNextObjectFlat
852 @abstract Return the next object in the registry iteration, ignoring the kIORegistryIterateRecursively option.
853 @discussion This method returns the next child, or parent if the kIORegistryIterateParents option was used to create the iterator, of the current root entry. The object returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it.
854 @result The next registry entry in the iteration (the current entry), or zero if the iteration has finished at this level of recursion, or the iteration is invalid (see isValid). The entry returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it. */
855
856 virtual IORegistryEntry * getNextObjectFlat( void );
857
858/*! @function getNextObjectRecursive
859 @abstract Return the next object in the registry iteration, and enter it.
860 @discussion If the iterator has a current entry, and the iterator has not already entered previously, enterEntry is called to recurse into it, ie. make it the new root, and the next child, or parent if the kIORegistryIterateParents option was used to create the iterator, at this new level of recursion is returned. If there is no current entry at this level of recursion, exitEntry is called and the process repeats, until the iteration returns to the entry the iterator was created with and zero is returned. The object returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it.
861 @result The next registry entry in the iteration (the current entry), or zero if its finished, or the iteration is invalid (see isValid). The entry returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it. */
862
863 virtual IORegistryEntry * getNextObjectRecursive( void );
864
865/*! @function getCurrentEntry
866 @abstract Return the current entry in the registry iteration.
867 @discussion This method returns the current entry, last returned by getNextObject et al. The object returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it. If the iteration is no longer valid (see isValid), the current entry is zero.
868 @result The current registry entry in the iteration, or zero if the last iteration returned zero, or the iteration is invalid (see isValid). The entry returned is retained while the iterator is pointing at it (its the current entry), or recursing into it. The caller should not release it. */
869
870 virtual IORegistryEntry * getCurrentEntry( void );
871
872/*! @function enterEntry
873 @abstract Recurse into the current entry in the registry iteration.
874 @discussion This method makes the current entry, ie. the last entry returned by getNextObject et al., the root in a new level of recursion. */
875
876 virtual void enterEntry( void );
877
878/*! @function enterEntry
879 @abstract Recurse into the current entry in the registry iteration.
880 @discussion This method recurses into an entry as with enterEntry, but also switches from the current plane to a new one set by the caller.
881 @param plane The new plane to switch into. */
882
883 virtual void enterEntry( const IORegistryPlane * plane );
884
885/*! @function exitEntry
886 @abstract Exits a level of recursion, restoring the current entry.
887 @discussion This method undoes an enterEntry, restoring the current entry. If there are no more levels of recursion to exit false is returned, otherwise true is returned.
888 @result true if a level of recursion was undone, false if no recursive levels are left in the iteration. */
889
890 virtual bool exitEntry( void );
891
892/*! @function reset
893 @abstract Exits all levels of recursion, restoring the iterator to its state at creation.
894 @discussion This method exits all levels of recursion, and restores the iterator to its state at creation. */
895
896 virtual void reset( void );
897
898/*! @function isValid
899 @abstract Checks that no registry changes have invalidated the iteration.
900 @discussion If a registry iteration is invalidated by changes to the registry, it will be made invalid, the currentEntry will be considered zero, and further calls to getNextObject et al. will return zero. The iterator should be reset to restart the iteration when this happens.
901 @result false if the iterator has been invalidated by changes to the registry, true otherwise. */
902
903 virtual bool isValid( void );
904
905/*! @function iterateAll
906 @abstract Iterates all entries (with getNextObject) and returns a set of all returned entries.
907 @discussion This method will reset, then iterate all entries in the iteration (with getNextObject) until successful (ie. the iterator is valid at the end of the iteration).
908 @result A set of entries returned by the iteration. The caller should release the set when it has finished with it. Zero is returned on a resource failure. */
909
910 virtual OSOrderedSet * iterateAll( void );
911};
912
913#endif /* _IOKIT_IOREGISTRYENTRY_H */