1 | /* |
2 | * Copyright (c) 1998-2019 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_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. 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. |
14 | * |
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 |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
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. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
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 | #include <libkern/c++/OSPtr.h> |
42 | |
43 | #if defined(IOKIT_ENABLE_SHARED_PTR) |
44 | /*! @parseOnly */ |
45 | #define APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR __attribute__((deprecated)) |
46 | #else |
47 | /*! @parseOnly */ |
48 | #define APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR |
49 | #endif /* IOKIT_ENABLE_SHARED_PTR */ |
50 | |
51 | |
52 | extern const OSSymbol * gIONameKey; |
53 | extern const OSSymbol * gIOLocationKey; |
54 | extern const OSSymbol * gIORegistryEntryIDKey; |
55 | extern const OSSymbol * gIORegistryEntryPropertyKeysKey; |
56 | extern const OSSymbol * gIORegistryEntryAllowableSetPropertiesKey; |
57 | extern const OSSymbol * gIORegistryEntryDefaultLockingSetPropertiesKey; |
58 | |
59 | class IORegistryEntry; |
60 | class IORegistryPlane; |
61 | class IORegistryIterator; |
62 | |
63 | typedef void (*IORegistryEntryApplierFunction)(IORegistryEntry * entry, |
64 | void * context); |
65 | |
66 | enum { |
67 | kIORegistryIterateRecursively = 0x00000001, |
68 | kIORegistryIterateParents = 0x00000002, |
69 | }; |
70 | |
71 | #ifdef KERNEL_PRIVATE |
72 | enum{ |
73 | kIORegistryEntryIndexedPropertyCLPC = 0, |
74 | kIORegistryEntryIndexedPropertyCount, |
75 | }; |
76 | #endif /* KERNEL_PRIVATE */ |
77 | |
78 | /*! @class IORegistryEntry : public OSObject |
79 | * @abstract The base class for all objects in the registry. |
80 | * @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. |
81 | */ |
82 | |
83 | class IORegistryEntry : public OSObject |
84 | { |
85 | friend class IORegistryIterator; |
86 | |
87 | OSDeclareDefaultStructors(IORegistryEntry); |
88 | |
89 | protected: |
90 | /*! @struct ExpansionData |
91 | * @discussion This structure will be used to expand the capablilties of this class in the future. |
92 | */ |
93 | struct ExpansionData; |
94 | |
95 | /*! @var reserved |
96 | * Reserved for future use. (Internal use only) */ |
97 | ExpansionData * reserved; |
98 | |
99 | private: |
100 | |
101 | OSDictionary * fRegistryTable; |
102 | OSDictionary * fPropertyTable; |
103 | |
104 | public: |
105 | /* methods available in Mac OS X 10.1 or later */ |
106 | |
107 | /*! @function copyProperty |
108 | * @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. |
109 | * @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). |
110 | * @param aKey The property's name as a C-string. |
111 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
112 | * @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. |
113 | * @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */ |
114 | |
115 | virtual OSPtr<OSObject> copyProperty( const char * aKey, |
116 | const IORegistryPlane * plane, |
117 | IOOptionBits options = |
118 | kIORegistryIterateRecursively | |
119 | kIORegistryIterateParents) const; |
120 | |
121 | /*! @function copyProperty |
122 | * @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. |
123 | * @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). |
124 | * @param aKey The property's name as an OSString. |
125 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
126 | * @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. |
127 | * @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */ |
128 | |
129 | virtual OSPtr<OSObject> copyProperty( const OSString * aKey, |
130 | const IORegistryPlane * plane, |
131 | IOOptionBits options = |
132 | kIORegistryIterateRecursively | |
133 | kIORegistryIterateParents) const; |
134 | |
135 | /*! @function copyProperty |
136 | * @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. |
137 | * @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). |
138 | * @param aKey The property's name as an OSSymbol. |
139 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
140 | * @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. |
141 | * @result The property value found, or zero. A reference on any found property is returned to caller, which should be released. */ |
142 | |
143 | virtual OSPtr<OSObject> copyProperty( const OSSymbol * aKey, |
144 | const IORegistryPlane * plane, |
145 | IOOptionBits options = |
146 | kIORegistryIterateRecursively | |
147 | kIORegistryIterateParents) const; |
148 | |
149 | /*! @function copyParentEntry |
150 | * @abstract Returns an registry entry's first parent entry in a plane. Available in Mac OS X 10.1 or later. |
151 | * @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. |
152 | * @param plane The plane object. |
153 | * @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. */ |
154 | |
155 | virtual OSPtr<IORegistryEntry> copyParentEntry( const IORegistryPlane * plane ) const; |
156 | |
157 | /*! @function copyChildEntry |
158 | * @abstract Returns an registry entry's first child entry in a plane. Available in Mac OS X 10.1 or later. |
159 | * @discussion This function will return the child which first attached to a registry entry. |
160 | * @param plane The plane object. |
161 | * @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. */ |
162 | |
163 | virtual OSPtr<IORegistryEntry> copyChildEntry( const IORegistryPlane * plane ) const; |
164 | |
165 | /* method available in Mac OS X 10.4 or later */ |
166 | /*! |
167 | * @typedef Action |
168 | * @discussion Type and arguments of callout C function that is used when |
169 | * a runCommand is executed by a client. Cast to this type when you want a C++ |
170 | * member function to be used. Note the arg1 - arg3 parameters are passed straight pass through to the action callout. |
171 | * @param target |
172 | * Target of the function, can be used as a refcon. Note if a C++ function |
173 | * was specified, this parameter is implicitly the first parameter in the target |
174 | * member function's parameter list. |
175 | * @param arg0 Argument to action from run operation. |
176 | * @param arg1 Argument to action from run operation. |
177 | * @param arg2 Argument to action from run operation. |
178 | * @param arg3 Argument to action from run operation. |
179 | */ |
180 | typedef IOReturn (*Action)(OSObject *target, |
181 | void *arg0, void *arg1, |
182 | void *arg2, void *arg3); |
183 | |
184 | /*! @function runPropertyAction |
185 | * @abstract Single thread a call to an action w.r.t. the property lock |
186 | * @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 |
187 | * @param action Pointer to function to be executed in work-loop context. |
188 | * @param arg0 Parameter for action parameter, defaults to 0. |
189 | * @param arg1 Parameter for action parameter, defaults to 0. |
190 | * @param arg2 Parameter for action parameter, defaults to 0. |
191 | * @param arg3 Parameter for action parameter, defaults to 0. |
192 | * @result Returns the value of the Action callout. |
193 | */ |
194 | virtual IOReturn runPropertyAction(Action action, OSObject *target, |
195 | void *arg0 = NULL, void *arg1 = NULL, |
196 | void *arg2 = NULL, void *arg3 = NULL); |
197 | |
198 | #ifdef __BLOCKS__ |
199 | typedef IOReturn (^ActionBlock)(void); |
200 | IOReturn runPropertyActionBlock(ActionBlock block); |
201 | #endif /* __BLOCKS__ */ |
202 | |
203 | private: |
204 | #if __LP64__ |
205 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 0); |
206 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 1); |
207 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 2); |
208 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 3); |
209 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 4); |
210 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 5); |
211 | #else |
212 | OSMetaClassDeclareReservedUsedX86(IORegistryEntry, 0); |
213 | OSMetaClassDeclareReservedUsedX86(IORegistryEntry, 1); |
214 | OSMetaClassDeclareReservedUsedX86(IORegistryEntry, 2); |
215 | OSMetaClassDeclareReservedUsedX86(IORegistryEntry, 3); |
216 | OSMetaClassDeclareReservedUsedX86(IORegistryEntry, 4); |
217 | OSMetaClassDeclareReservedUsedX86(IORegistryEntry, 5); |
218 | #endif |
219 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 6); |
220 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 7); |
221 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 8); |
222 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 9); |
223 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 10); |
224 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 11); |
225 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 12); |
226 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 13); |
227 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 14); |
228 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 15); |
229 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 16); |
230 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 17); |
231 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 18); |
232 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 19); |
233 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 20); |
234 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 21); |
235 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 22); |
236 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 23); |
237 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 24); |
238 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 25); |
239 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 26); |
240 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 27); |
241 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 28); |
242 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 29); |
243 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 30); |
244 | OSMetaClassDeclareReservedUnused(IORegistryEntry, 31); |
245 | |
246 | public: |
247 | |
248 | /* Registry accessors */ |
249 | |
250 | /*! @function getRegistryRoot |
251 | * @abstract Returns a pointer to the root instance of the registry. |
252 | * @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. |
253 | * @result A pointer to the IORegistryEntry root instance. It should not be released by the caller. */ |
254 | |
255 | static IORegistryEntry * getRegistryRoot( void ); |
256 | |
257 | /*! @function getGenerationCount |
258 | * @abstract Returns an generation count for all registry changing operations. |
259 | * @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. |
260 | * @result An integer generation count. */ |
261 | |
262 | static SInt32 getGenerationCount( void ); |
263 | |
264 | /*! @function getPlane |
265 | * @abstract Looks up the plane object by a C-string name. |
266 | * @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. |
267 | * @result A pointer to the plane object, or zero if no such plane exists. The returned plane should not be released. */ |
268 | |
269 | static const IORegistryPlane * getPlane( const char * name ); |
270 | |
271 | /* Registry Entry allocation & init */ |
272 | |
273 | /*! @function init |
274 | * @abstract Standard init method for all IORegistryEntry subclasses. |
275 | * @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. |
276 | * @param dictionary 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. |
277 | * @result true on success, or false on a resource failure. */ |
278 | |
279 | virtual bool init( OSDictionary * dictionary = NULL ); |
280 | |
281 | /*! @function free |
282 | * @abstract Standard free method for all IORegistryEntry subclasses. |
283 | * @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. */ |
284 | |
285 | virtual void free( void ) APPLE_KEXT_OVERRIDE; |
286 | |
287 | /*! @function setPropertyTable |
288 | * @abstract Replace a registry entry's property table. |
289 | * @discussion This method will release the current property table of a the entry and replace it with another, retaining the new property table. |
290 | * @param dict The new dictionary to be used as the entry's property table. */ |
291 | |
292 | virtual void setPropertyTable( OSDictionary * dict ); |
293 | |
294 | /* Synchronized property accessors; wrappers to OSDictionary |
295 | * plus property creation helpers */ |
296 | |
297 | /*! @function setProperty |
298 | * @abstract Synchronized method to add a property to a registry entry's property table. |
299 | * @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. |
300 | * @param aKey The properties name as an OSSymbol. |
301 | * @param anObject The property value. |
302 | * @result true on success or false on a resource failure. */ |
303 | |
304 | virtual bool setProperty(const OSSymbol * aKey, |
305 | OSObject * anObject); |
306 | |
307 | #ifdef KERNEL_PRIVATE |
308 | OSObject * setIndexedProperty(uint32_t index, OSObject * anObject); |
309 | OSObject * getIndexedProperty(uint32_t index) const; |
310 | #endif /* KERNEL_PRIVATE */ |
311 | |
312 | /*! @function setProperty |
313 | * @abstract Synchronized method to add a property to a registry entry's property table. |
314 | * @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. |
315 | * @param aKey The property's name as an OSString. |
316 | * @param anObject The property value. |
317 | * @result true on success or false on a resource failure. */ |
318 | |
319 | virtual bool setProperty(const OSString * aKey, OSObject * anObject); |
320 | |
321 | /*! @function setProperty |
322 | * @abstract Synchronized method to add a property to a registry entry's property table. |
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. |
324 | * @param aKey The property's name as a C-string. |
325 | * @param anObject The property value. |
326 | * @result true on success or false on a resource failure. */ |
327 | |
328 | virtual bool setProperty(const char * aKey, OSObject * anObject); |
329 | |
330 | /*! @function setProperty |
331 | * @abstract Synchronized method to construct and add a OSString property to a registry entry's property table. |
332 | * @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. |
333 | * @param aKey The property's name as a C-string. |
334 | * @param aString The property value as a C-string. |
335 | * @result true on success or false on a resource failure. */ |
336 | |
337 | virtual bool setProperty(const char * aKey, const char * aString); |
338 | |
339 | /*! @function setProperty |
340 | * @abstract Synchronized method to construct and add an OSBoolean property to a registry entry's property table. |
341 | * @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. |
342 | * @param aKey The property's name as a C-string. |
343 | * @param aBoolean The property's boolean value. |
344 | * @result true on success or false on a resource failure. */ |
345 | |
346 | virtual bool setProperty(const char * aKey, bool aBoolean); |
347 | |
348 | /*! @function setProperty |
349 | * @abstract Synchronized method to construct and add an OSNumber property to a registry entry's property table. |
350 | * @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. |
351 | * @param aKey The property's name as a C-string. |
352 | * @param aValue The property's numeric value. |
353 | * @param aNumberOfBits The property's size in bits, for OSNumber. |
354 | * @result true on success or false on a resource failure. */ |
355 | |
356 | virtual bool setProperty( const char * aKey, |
357 | unsigned long long aValue, |
358 | unsigned int aNumberOfBits); |
359 | |
360 | /*! @function setProperty |
361 | * @abstract Synchronized method to construct and add an OSData property to a registry entry's property table. |
362 | * @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. |
363 | * @param aKey The property's name as a C-string. |
364 | * @param bytes The property's value as a pointer. OSData will copy this data. |
365 | * @param length The property's size in bytes, for OSData. |
366 | * @result true on success or false on a resource failure. */ |
367 | |
368 | virtual bool setProperty( const char * aKey, |
369 | void * bytes, |
370 | unsigned int length); |
371 | |
372 | /*! @function removeProperty |
373 | * @abstract Synchronized method to remove a property from a registry entry's property table. |
374 | * @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. |
375 | * @param aKey The property's name as an OSSymbol. */ |
376 | |
377 | virtual void removeProperty( const OSSymbol * aKey); |
378 | |
379 | /*! @function removeProperty |
380 | * @abstract Synchronized method to remove a property from a registry entry's property table. |
381 | * @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. |
382 | * @param aKey The property's name as an OSString. */ |
383 | |
384 | virtual void removeProperty( const OSString * aKey); |
385 | |
386 | /*! @function removeProperty |
387 | * @abstract Synchronized method to remove a property from a registry entry's property table. |
388 | * @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. |
389 | * @param aKey The property's name as a C-string. */ |
390 | |
391 | virtual void removeProperty( const char * aKey); |
392 | |
393 | /*! @function getProperty |
394 | * @abstract Synchronized method to obtain a property from a registry entry's property table. |
395 | * @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. |
396 | * @param aKey The property's name as an OSSymbol. |
397 | * @result The property value found, or zero. */ |
398 | |
399 | virtual OSObject * getProperty( const OSSymbol * aKey) const APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR; |
400 | |
401 | /*! @function getProperty |
402 | * @abstract Synchronized method to obtain a property from a registry entry's property table. |
403 | * @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. |
404 | * @param aKey The property's name as an OSString. |
405 | * @result The property value found, or zero. */ |
406 | |
407 | virtual OSObject * getProperty( const OSString * aKey) const APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR; |
408 | |
409 | /*! @function getProperty |
410 | * @abstract Synchronized method to obtain a property from a registry entry's property table. |
411 | * @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. |
412 | * @param aKey The property's name as a C-string. |
413 | * @result The property value found, or zero. */ |
414 | |
415 | virtual OSObject * getProperty( const char * aKey) const APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR; |
416 | |
417 | /*! @function propertyExists |
418 | * @abstract Synchronized method to check if a property exists in a registry entry's property table. |
419 | * @discussion This method will check if a property exists in a registry entry's property table. This method is synchronized with other IORegistryEntry accesses to the property table. |
420 | * @param aKey The property's name as an OSSymbol. |
421 | * @result True if the property value found. */ |
422 | |
423 | bool propertyExists(const OSSymbol * aKey); |
424 | |
425 | /*! @function propertyExists |
426 | * @abstract Synchronized method to check if a property exists in a registry entry's property table. |
427 | * @discussion This method will check if a property exists in a registry entry's property table. This method is synchronized with other IORegistryEntry accesses to the property table. |
428 | * @param aKey The property's name as an OSString. |
429 | * @result True if the property value found. */ |
430 | |
431 | bool propertyExists(const OSString * aKey); |
432 | |
433 | /*! @function propertyExists |
434 | * @abstract Synchronized method to check if a property exists in a registry entry's property table. |
435 | * @discussion This method will check if a property exists in a registry entry's property table. This method is synchronized with other IORegistryEntry accesses to the property table. |
436 | * @param aKey The property's name as a C-string. |
437 | * @result True if the property value found. */ |
438 | |
439 | bool propertyExists(const char * aKey); |
440 | |
441 | /*! @function propertyHasValue |
442 | * @abstract Synchronized method to check if a property in a registry entry's property table has a given value. |
443 | * @discussion This method will check if a property exists in a registry entry's property table and compares with isEqualTo() the supplied value. This method is synchronized with other IORegistryEntry accesses to the property table. |
444 | * @param aKey The property's name as an OSSymbol. |
445 | * @param value The property's value to be compared. |
446 | * @result True if the property value was found and isEqualTo() the supplied value. */ |
447 | |
448 | bool propertyHasValue(const OSSymbol * aKey, |
449 | const OSObject * value); |
450 | |
451 | /*! @function propertyHasValue |
452 | * @abstract Synchronized method to check if a property in a registry entry's property table has a given value. |
453 | * @discussion This method will check if a property exists in a registry entry's property table and compares with isEqualTo() the supplied value. This method is synchronized with other IORegistryEntry accesses to the property table. |
454 | * @param aKey The property's name as an OSString. |
455 | * @param value The property's value to be compared. |
456 | * @result True if the property value was found and isEqualTo() the supplied value. */ |
457 | |
458 | bool propertyHasValue(const OSString * aKey, |
459 | const OSObject * value); |
460 | |
461 | /*! @function propertyHasValue |
462 | * @abstract Synchronized method to check if a property in a registry entry's property table has a given value. |
463 | * @discussion This method will check if a property exists in a registry entry's property table and compares with isEqualTo() the supplied value. This method is synchronized with other IORegistryEntry accesses to the property table. |
464 | * @param aKey The property's name as a C-string. |
465 | * @param value The property's value to be compared. |
466 | * @result True if the property value was found and isEqualTo() the supplied value. */ |
467 | |
468 | bool propertyHasValue(const char * aKey, |
469 | const OSObject * value); |
470 | |
471 | /*! @function getProperty |
472 | * @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy. |
473 | * @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). |
474 | * @param aKey The property's name as an OSSymbol. |
475 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
476 | * @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. |
477 | * @result The property value found, or zero. */ |
478 | |
479 | virtual OSObject * getProperty( const OSSymbol * aKey, |
480 | const IORegistryPlane * plane, |
481 | IOOptionBits options = |
482 | kIORegistryIterateRecursively | |
483 | kIORegistryIterateParents) const APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR; |
484 | |
485 | /*! @function getProperty |
486 | * @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy. |
487 | * @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). |
488 | * @param aKey The property's name as an OSString. |
489 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
490 | * @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. |
491 | * @result The property value found, or zero. */ |
492 | |
493 | virtual OSObject * getProperty( const OSString * aKey, |
494 | const IORegistryPlane * plane, |
495 | IOOptionBits options = |
496 | kIORegistryIterateRecursively | |
497 | kIORegistryIterateParents) const APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR; |
498 | |
499 | /*! @function getProperty |
500 | * @abstract Synchronized method to obtain a property from a registry entry or one of its parents (or children) in the hierarchy. |
501 | * @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). |
502 | * @param aKey The property's name as a C-string. |
503 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
504 | * @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. |
505 | * @result The property value found, or zero. */ |
506 | |
507 | virtual OSObject * getProperty( const char * aKey, |
508 | const IORegistryPlane * plane, |
509 | IOOptionBits options = |
510 | kIORegistryIterateRecursively | |
511 | kIORegistryIterateParents) const APPLE_KEXT_DEPRECATED_WITH_SHARED_PTR; |
512 | |
513 | /*! @function propertyExists |
514 | * @abstract Synchronized method to check if a property exists from a registry entry or one of its parents (or children) in the hierarchy. |
515 | * @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 return true. 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). |
516 | * @param aKey The property's name as an OSSymbol. |
517 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
518 | * @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard propertyExists() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children. |
519 | * @result True if the property was found. */ |
520 | |
521 | bool propertyExists( const OSSymbol * aKey, |
522 | const IORegistryPlane * plane, |
523 | uint32_t options = |
524 | kIORegistryIterateRecursively | |
525 | kIORegistryIterateParents) const; |
526 | |
527 | /*! @function propertyExists |
528 | * @abstract Synchronized method to check if a property exists from a registry entry or one of its parents (or children) in the hierarchy. |
529 | * @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 return true. 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). |
530 | * @param aKey The property's name as an OSString. |
531 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
532 | * @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard propertyExists() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children. |
533 | * @result True if the property was found. */ |
534 | |
535 | bool propertyExists( const OSString * aKey, |
536 | const IORegistryPlane * plane, |
537 | uint32_t options = |
538 | kIORegistryIterateRecursively | |
539 | kIORegistryIterateParents) const; |
540 | |
541 | /*! @function propertyExists |
542 | * @abstract Synchronized method to check if a property exists from a registry entry or one of its parents (or children) in the hierarchy. |
543 | * @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 return true. 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). |
544 | * @param aKey The property's name as a C-string. |
545 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
546 | * @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard propertyExists() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children. |
547 | * @result True if the property was found. */ |
548 | |
549 | bool propertyExists( const char * aKey, |
550 | const IORegistryPlane * plane, |
551 | uint32_t options = |
552 | kIORegistryIterateRecursively | |
553 | kIORegistryIterateParents) const; |
554 | |
555 | /*! @function propertyHasValue |
556 | * @abstract Synchronized method to check if a property has a given value from a registry entry or one of its parents (or children) in the hierarchy. |
557 | * @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 return true if the property isEqualTo() the supplied value. 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). |
558 | * @param aKey The property's name as an OSSymbol. |
559 | * @param value The property value to be compared. |
560 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
561 | * @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard propertyExists() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children. |
562 | * @result True if the property was found and isEqualTo() the supplied value. */ |
563 | |
564 | bool propertyHasValue( const OSSymbol * aKey, |
565 | const OSObject * value, |
566 | const IORegistryPlane * plane, |
567 | uint32_t options = |
568 | kIORegistryIterateRecursively | |
569 | kIORegistryIterateParents) const; |
570 | |
571 | /*! @function propertyHasValue |
572 | * @abstract Synchronized method to check if a property has a given value from a registry entry or one of its parents (or children) in the hierarchy. |
573 | * @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 return true if the property isEqualTo() the supplied value. 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). |
574 | * @param aKey The property's name as an OSString. |
575 | * @param value The property value to be compared. |
576 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
577 | * @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard propertyExists() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children. |
578 | * @result True if the property was found and isEqualTo() the supplied value. */ |
579 | |
580 | bool propertyHasValue( const OSString * aKey, |
581 | const OSObject * value, |
582 | const IORegistryPlane * plane, |
583 | uint32_t options = |
584 | kIORegistryIterateRecursively | |
585 | kIORegistryIterateParents) const; |
586 | |
587 | /*! @function propertyHasValue |
588 | * @abstract Synchronized method to check if a property has a given value from a registry entry or one of its parents (or children) in the hierarchy. |
589 | * @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 return true if the property isEqualTo() the supplied value. 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). |
590 | * @param aKey The property's name as a C-string. |
591 | * @param value The property value to be compared. |
592 | * @param plane The plane to iterate over, eg. gIOServicePlane. |
593 | * @param options kIORegistryIterateRecursively may be set to recurse automatically into the registry hierarchy. Without this option, this method degenerates into the standard propertyExists() call. kIORegistryIterateParents may be set to iterate the parents of the entry, in place of the children. |
594 | * @result True if the property was found and isEqualTo() the supplied value. */ |
595 | |
596 | bool propertyHasValue( const char * aKey, |
597 | const OSObject * value, |
598 | const IORegistryPlane * plane, |
599 | uint32_t options = |
600 | kIORegistryIterateRecursively | |
601 | kIORegistryIterateParents) const; |
602 | |
603 | |
604 | /*! @function copyProperty |
605 | * @abstract Synchronized method to obtain a property from a registry entry's property table. |
606 | * @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. |
607 | * @param aKey The property's name as an OSSymbol. |
608 | * @result The property value found, or zero. It should be released by the caller. */ |
609 | |
610 | virtual OSPtr<OSObject> copyProperty( const OSSymbol * aKey) const; |
611 | |
612 | /*! @function copyProperty |
613 | * @abstract Synchronized method to obtain a property from a registry entry's property table. |
614 | * @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. |
615 | * @param aKey The property's name as an OSString. |
616 | * @result The property value found, or zero. It should be released by the caller. */ |
617 | |
618 | virtual OSPtr<OSObject> copyProperty( const OSString * aKey) const; |
619 | |
620 | /*! @function copyProperty |
621 | * @abstract Synchronized method to obtain a property from a registry entry's property table. |
622 | * @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. |
623 | * @param aKey The property's name as a C-string. |
624 | * @result The property value found, or zero. It should be released by the caller. */ |
625 | |
626 | virtual OSPtr<OSObject> copyProperty( const char * aKey) const; |
627 | |
628 | /*! @function dictionaryWithProperties |
629 | * @abstract Synchronized method to obtain copy a registry entry's property table. |
630 | * @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. |
631 | * @result The created dictionary, or zero on a resource value. It should be released by the caller. */ |
632 | |
633 | virtual OSPtr<OSDictionary> dictionaryWithProperties( void ) const; |
634 | |
635 | /*! @function serializeProperties |
636 | * @abstract Synchronized method to serialize a registry entry's property table. |
637 | * @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. |
638 | * @param serialize The OSSerialize instance representing the serialization request. |
639 | * @result True on success, false otherwise. */ |
640 | |
641 | virtual bool serializeProperties( OSSerialize * serialize ) const; |
642 | |
643 | /* Unsynchronized(!) property table access */ |
644 | |
645 | /*! @function getPropertyTable |
646 | * @abstract Unsynchronized accessor to a registry entry's property table. |
647 | * @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. |
648 | * @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. */ |
649 | |
650 | /* inline */ OSDictionary * getPropertyTable( void ) const; |
651 | /* { return(fPropertyTable); } */ |
652 | |
653 | /* Set properties from user level, to be overridden if supported */ |
654 | |
655 | /*! @function setProperties |
656 | * @abstract Optionally supported external method to set properties in a registry entry. |
657 | * @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. |
658 | * @param properties Any OSObject subclass, to be interpreted by the implementing method - for example an OSDictionary, OSData etc. may all be appropriate. |
659 | * @result An IOReturn code to be returned to the caller. */ |
660 | |
661 | virtual IOReturn setProperties( OSObject * properties ); |
662 | |
663 | /* Topology */ |
664 | |
665 | /*! @function getParentIterator |
666 | * @abstract Returns an iterator over an registry entry's parent entries in a specified plane. |
667 | * @param plane The plane object. |
668 | * @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. */ |
669 | |
670 | virtual OSPtr<OSIterator> getParentIterator( const IORegistryPlane * plane ) |
671 | const; |
672 | virtual void applyToParents( IORegistryEntryApplierFunction applier, |
673 | void * context, |
674 | const IORegistryPlane * plane ) const; |
675 | |
676 | /*! @function getParentEntry |
677 | * @abstract Returns an registry entry's first parent entry in a plane. |
678 | * @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. |
679 | * @param plane The plane object. |
680 | * @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. */ |
681 | |
682 | virtual IORegistryEntry * getParentEntry( const IORegistryPlane * plane ) const; |
683 | |
684 | /*! @function getChildIterator |
685 | * @abstract Returns an iterator over an registry entry's child entries in a plane. |
686 | * @discussion This method creates an iterator which will return each of a registry entry's child entries in a specified plane. |
687 | * @param plane The plane object. |
688 | * @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. */ |
689 | |
690 | virtual OSPtr<OSIterator> getChildIterator( const IORegistryPlane * plane ) |
691 | const; |
692 | |
693 | #if XNU_KERNEL_PRIVATE |
694 | uint32_t getChildCount( const IORegistryPlane * plane ) const; |
695 | OSPtr<OSArray> copyPropertyKeys(void) const; |
696 | #endif |
697 | |
698 | virtual void applyToChildren( IORegistryEntryApplierFunction applier, |
699 | void * context, |
700 | const IORegistryPlane * plane ) const; |
701 | |
702 | /*! @function getChildEntry |
703 | * @abstract Returns an registry entry's first child entry in a plane. |
704 | * @discussion This function will return the child which first attached to a registry entry. |
705 | * @param plane The plane object. |
706 | * @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. */ |
707 | |
708 | virtual IORegistryEntry * getChildEntry( const IORegistryPlane * plane ) const; |
709 | |
710 | /*! @function isChild |
711 | * @abstract Determines whether a registry entry is the child of another in a plane. |
712 | * @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. |
713 | * @param child The possible child registry entry. |
714 | * @param plane The plane object. |
715 | * @param onlyChild If true, check also if the child is the only child. |
716 | * @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. */ |
717 | |
718 | virtual bool isChild( IORegistryEntry * child, |
719 | const IORegistryPlane * plane, |
720 | bool onlyChild = false ) const; |
721 | |
722 | /*! @function isParent |
723 | * @abstract Determines whether a registry entry is the parent of another in a plane. |
724 | * @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. |
725 | * @param parent The possible parent registry entry. |
726 | * @param plane The plane object. |
727 | * @param onlyParent If true, check also if the parent is the only parent. |
728 | * @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. */ |
729 | |
730 | virtual bool isParent( IORegistryEntry * parent, |
731 | const IORegistryPlane * plane, |
732 | bool onlyParent = false ) const; |
733 | |
734 | /*! @function inPlane |
735 | * @abstract Determines whether a registry entry is attached in a plane. |
736 | * @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. |
737 | * @param plane The plane object, 0 indicates any plane. |
738 | * @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. */ |
739 | |
740 | virtual bool inPlane( const IORegistryPlane * plane = NULL) const; |
741 | |
742 | /*! @function getDepth |
743 | * @abstract Counts the maximum number of entries between an entry and the registry root, in a plane. |
744 | * @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. |
745 | * @param plane The plane object. |
746 | * @result The maximum number of entries between the entry and the root. Zero is returned if the entry is not attached in the plane. */ |
747 | |
748 | virtual unsigned int getDepth( const IORegistryPlane * plane ) const; |
749 | |
750 | /* Attach / detach */ |
751 | |
752 | /*! @function attachToParent |
753 | * @abstract Attaches a entry to a parent entry in a plane. |
754 | * @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. |
755 | * @param parent The registry entry to attach to. |
756 | * @param plane The plane object. |
757 | * @result true on success, or false on a resource failure, or if the parent is the same as the child. */ |
758 | |
759 | virtual bool attachToParent( IORegistryEntry * parent, |
760 | const IORegistryPlane * plane ); |
761 | |
762 | /*! @function detachFromParent |
763 | * @abstract Detaches an entry from a parent entry in a plane. |
764 | * @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. |
765 | * @param parent The registry entry to detach from. |
766 | * @param plane The plane object. */ |
767 | |
768 | virtual void detachFromParent( IORegistryEntry * parent, |
769 | const IORegistryPlane * plane ); |
770 | |
771 | /*! @function attachToChild |
772 | * @abstract Method called in the parent entry when a child attaches. |
773 | * @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. |
774 | * @param child The registry entry being attached. |
775 | * @param plane The plane object. |
776 | * @result true on success, or false on a resource failure, or if the parent is the same as the child. */ |
777 | |
778 | virtual bool attachToChild( IORegistryEntry * child, |
779 | const IORegistryPlane * plane ); |
780 | |
781 | /*! @function detachFromChild |
782 | * @abstract Detaches a child entry from its parent in a plane. |
783 | * @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. |
784 | * @param child The registry entry to detach. |
785 | * @param plane The plane object. */ |
786 | |
787 | virtual void detachFromChild( IORegistryEntry * child, |
788 | const IORegistryPlane * plane ); |
789 | |
790 | /*! @function detachAbove |
791 | * @abstract Detaches an entry from all its parent entries in a plane. |
792 | * @discussion This method calls detachFromParent in the entry for each of its parent entries in the plane. |
793 | * @param plane The plane object. */ |
794 | |
795 | virtual void detachAbove( const IORegistryPlane * plane ); |
796 | |
797 | /*! @function detachAll |
798 | * @abstract Detaches an entry and all its children recursively in a plane. |
799 | * @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. |
800 | * @param plane The plane object. */ |
801 | |
802 | virtual void detachAll( const IORegistryPlane * plane ); |
803 | |
804 | /* Name, location and path accessors */ |
805 | |
806 | /*! @function getName |
807 | * @abstract Returns the name assigned to the registry entry as a C-string. |
808 | * @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. |
809 | * @param plane The plane object, or zero for the global name. |
810 | * @result A C-string name, valid while the entry is retained. */ |
811 | |
812 | virtual const char * getName( const IORegistryPlane * plane = NULL ) const; |
813 | |
814 | /*! @function copyName |
815 | * @abstract Returns the name assigned to the registry entry as an OSSymbol. |
816 | * @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. |
817 | * @param plane The plane object, or zero for the global name. |
818 | * @result A reference to an OSSymbol for the name, which should be released by the caller. */ |
819 | |
820 | virtual OSPtr<const OSSymbol> copyName( |
821 | const IORegistryPlane * plane = NULL ) const; |
822 | |
823 | /*! @function compareNames |
824 | * @abstract Compares the name of the entry with one or more names, and optionally returns the matching name. |
825 | * @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. |
826 | * @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. |
827 | * @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. |
828 | * @result True if one of the names compared true with the entry's global name. */ |
829 | |
830 | virtual bool compareNames( OSObject * name, OSString ** matched = NULL ) const; |
831 | |
832 | bool compareNames( OSObject * name, OSSharedPtr<OSString>& matched) const; |
833 | |
834 | /*! @function compareName |
835 | * @abstract Compares the name of the entry with one name, and optionally returns the matching name. |
836 | * @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. |
837 | * @param name The name to compare with as an OSString. |
838 | * @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. |
839 | * @result True if the name compared true with the entry's global name. */ |
840 | |
841 | virtual bool compareName( OSString * name, OSString ** matched = NULL ) const; |
842 | |
843 | bool compareName( OSString * name, OSSharedPtr<OSString>& matched) const; |
844 | |
845 | /*! @function setName |
846 | * @abstract Sets a name for the registry entry, in a particular plane, or globally. |
847 | * @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. |
848 | * @param name An OSSymbol which will be retained. |
849 | * @param plane The plane object, or zero to set the global name. */ |
850 | |
851 | virtual void setName( const OSSymbol * name, |
852 | const IORegistryPlane * plane = NULL ); |
853 | |
854 | /*! @function setName |
855 | * @abstract Sets a name for the registry entry, in a particular plane, or globally. |
856 | * @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. |
857 | * @param name A const C-string name which will be copied. |
858 | * @param plane The plane object, or zero to set the global name. */ |
859 | |
860 | virtual void setName( const char * name, |
861 | const IORegistryPlane * plane = NULL ); |
862 | |
863 | /*! @function getLocation |
864 | * @abstract Returns the location string assigned to the registry entry as a C-string. |
865 | * @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. |
866 | * @param plane The plane object, or zero for the global name. |
867 | * @result A C-string location string, valid while the entry is retained, or zero. */ |
868 | |
869 | virtual const char * getLocation( const IORegistryPlane * plane = NULL ) const; |
870 | |
871 | /*! @function copyLocation |
872 | * @abstract Returns the location string assigned to the registry entry as an OSSymbol. |
873 | * @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. |
874 | * @param plane The plane object, or zero for the global name. |
875 | * @result A reference to an OSSymbol for the location if one exists, which should be released by the caller, or zero. */ |
876 | |
877 | virtual OSPtr<const OSSymbol> copyLocation( |
878 | const IORegistryPlane * plane = NULL ) const; |
879 | |
880 | /*! @function setLocation |
881 | * @abstract Sets a location string for the registry entry, in a particular plane, or globally. |
882 | * @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. |
883 | * @param location A C-string location string which will be copied, or an OSSymbol which will be retained. |
884 | * @param plane The plane object, or zero to set the global location string. */ |
885 | |
886 | virtual void setLocation( const OSSymbol * location, |
887 | const IORegistryPlane * plane = NULL ); |
888 | virtual void setLocation( const char * location, |
889 | const IORegistryPlane * plane = NULL ); |
890 | |
891 | /*! @function getPath |
892 | * @abstract Create a path for a registry entry. |
893 | * @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. |
894 | * @param path A char buffer allocated by the caller. |
895 | * @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. |
896 | * @param plane The plane object. |
897 | * @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. */ |
898 | |
899 | virtual bool getPath( char * path, int * length, |
900 | const IORegistryPlane * plane) const; |
901 | |
902 | /*! @function getPathComponent |
903 | * @abstract Create a path component for a registry entry. |
904 | * @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. |
905 | * @param path A char buffer allocated by the caller. |
906 | * @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. |
907 | * @param plane The plane object. |
908 | * @result true if the path fits into the supplied buffer or false on a overflow. */ |
909 | |
910 | virtual bool getPathComponent( char * path, int * length, |
911 | const IORegistryPlane * plane ) const; |
912 | |
913 | /*! @function fromPath |
914 | * @abstract Looks up a registry entry by path. |
915 | * @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. |
916 | * @param path A C-string path. |
917 | * @param plane The plane to lookup up the path, or zero, in which case the path must begin with the plane name. |
918 | * @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. |
919 | * @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. |
920 | * @param fromEntry The lookup will proceed rooted at this entry if non-zero, otherwise it proceeds from the root of the plane. |
921 | * @result A retained registry entry is returned on success, or zero on failure. The caller should release the entry. */ |
922 | |
923 | static OSPtr<IORegistryEntry> fromPath( const char * path, |
924 | const IORegistryPlane * plane = NULL, |
925 | char * residualPath = NULL, |
926 | int * residualLength = NULL, |
927 | IORegistryEntry * fromEntry = NULL ); |
928 | |
929 | /*! @function fromPath |
930 | * @abstract Looks up a registry entry by relative path. |
931 | * @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. |
932 | * @param path See IORegistryEntry::fromPath. |
933 | * @param plane See IORegistryEntry::fromPath. |
934 | * @param residualPath See IORegistryEntry::fromPath. |
935 | * @param residualLength See IORegistryEntry::fromPath. |
936 | * @result See IORegistryEntry::fromPath. */ |
937 | |
938 | virtual OSPtr<IORegistryEntry> childFromPath( const char * path, |
939 | const IORegistryPlane * plane = NULL, |
940 | char * residualPath = NULL, |
941 | int * residualLength = NULL ); |
942 | |
943 | /*! @function dealiasPath |
944 | * @abstract Strips any aliases from the head of path and returns the full path. |
945 | * @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. |
946 | * @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. |
947 | * @param plane A plane object must be specified. |
948 | * @result A C-string pointer to the value of the alias if one is found, or zero if not. */ |
949 | |
950 | static const char * dealiasPath( const char ** opath, |
951 | const IORegistryPlane * plane ); |
952 | |
953 | /*! @function makePlane |
954 | * @abstract Constructs an IORegistryPlane object. |
955 | * @discussion Most planes in IOKit are created by the OS, although other planes may be created. |
956 | * @param name A C-string name for the new plane, to be copied. |
957 | * @result A new instance of an IORegistryPlane, or zero on failure. */ |
958 | |
959 | static OSPtr<const IORegistryPlane> makePlane( const char * name ); |
960 | |
961 | /*! @abstract Returns an ID for the registry entry that is global to all tasks. |
962 | * @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. |
963 | * @result An ID for the registry entry, assigned when the entry is first attached in the registry. */ |
964 | |
965 | uint64_t getRegistryEntryID( void ); |
966 | |
967 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
968 | /* * * * * * * * * * * * internals * * * * * * * * * * * */ |
969 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
970 | |
971 | virtual bool init( IORegistryEntry * from, |
972 | const IORegistryPlane * inPlane ); |
973 | |
974 | #ifdef XNU_KERNEL_PRIVATE |
975 | public: |
976 | #else |
977 | private: |
978 | #endif |
979 | static LIBKERN_RETURNS_NOT_RETAINED IORegistryEntry * initialize( void ); |
980 | |
981 | #ifdef XNU_KERNEL_PRIVATE |
982 | SInt32 getRegistryEntryGenerationCount( void ) const; |
983 | void setName(const OSString * name, |
984 | const IORegistryPlane * plane = NULL); |
985 | #endif |
986 | |
987 | private: |
988 | inline bool arrayMember( OSArray * set, |
989 | const IORegistryEntry * member, |
990 | unsigned int * index = NULL ) const; |
991 | |
992 | bool makeLink( IORegistryEntry * to, |
993 | unsigned int relation, |
994 | const IORegistryPlane * plane ) const; |
995 | void breakLink( IORegistryEntry * to, |
996 | unsigned int relation, |
997 | const IORegistryPlane * plane ) const; |
998 | |
999 | APPLE_KEXT_COMPATIBILITY_VIRTUAL |
1000 | OSArray * getParentSetReference( const IORegistryPlane * plane ) |
1001 | const; |
1002 | |
1003 | APPLE_KEXT_COMPATIBILITY_VIRTUAL |
1004 | OSArray * getChildSetReference( const IORegistryPlane * plane ) |
1005 | const; |
1006 | |
1007 | APPLE_KEXT_COMPATIBILITY_VIRTUAL |
1008 | IORegistryEntry * getChildFromComponent( const char ** path, |
1009 | const IORegistryPlane * plane ); |
1010 | |
1011 | APPLE_KEXT_COMPATIBILITY_VIRTUAL |
1012 | LIBKERN_RETURNS_NOT_RETAINED const OSSymbol * hasAlias( |
1013 | const IORegistryPlane * plane, |
1014 | char * opath = NULL, int * length = NULL ) const; |
1015 | |
1016 | APPLE_KEXT_COMPATIBILITY_VIRTUAL |
1017 | const char * matchPathLocation( const char * cmp, |
1018 | const IORegistryPlane * plane ); |
1019 | }; |
1020 | |
1021 | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ |
1022 | |
1023 | /*! @class IORegistryIterator : public OSIterator |
1024 | * @abstract An iterator over the registry. |
1025 | * @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. */ |
1026 | |
1027 | class IORegistryIterator : public OSIterator |
1028 | { |
1029 | OSDeclareAbstractStructors(IORegistryIterator); |
1030 | |
1031 | private: |
1032 | struct IORegCursor { |
1033 | IORegCursor * next; |
1034 | IORegistryEntry * current; |
1035 | OSIterator * iter; |
1036 | }; |
1037 | IORegCursor start; |
1038 | IORegCursor * where; |
1039 | IORegistryEntry * root; |
1040 | OSOrderedSet * done; |
1041 | const IORegistryPlane * plane; |
1042 | IOOptionBits options; |
1043 | |
1044 | virtual void free( void ) APPLE_KEXT_OVERRIDE; |
1045 | |
1046 | public: |
1047 | /*! @function iterateOver |
1048 | * @abstract Create an iterator rooted at a given registry entry. |
1049 | * @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. |
1050 | * @param start The root entry to begin the iteration at. |
1051 | * @param plane A plane object must be specified. |
1052 | * @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. |
1053 | * @result A created IORegistryIterator instance, to be released by the caller when it has finished with it. */ |
1054 | |
1055 | static OSPtr<IORegistryIterator> iterateOver( IORegistryEntry * start, |
1056 | const IORegistryPlane * plane, |
1057 | IOOptionBits options = 0 ); |
1058 | |
1059 | /*! @function iterateOver |
1060 | * @abstract Create an iterator rooted at the registry root. |
1061 | * @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. |
1062 | * @param plane A plane object must be specified. |
1063 | * @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. |
1064 | * @result A created IORegistryIterator instance, to be released by the caller when it has finished with it. */ |
1065 | |
1066 | static OSPtr<IORegistryIterator> iterateOver( const IORegistryPlane * plane, |
1067 | IOOptionBits options = 0 ); |
1068 | |
1069 | /*! @function getNextObject |
1070 | * @abstract Return the next object in the registry iteration. |
1071 | * @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. |
1072 | * @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. */ |
1073 | |
1074 | virtual IORegistryEntry * getNextObject( void ) APPLE_KEXT_OVERRIDE; |
1075 | |
1076 | /*! @function getNextObjectFlat |
1077 | * @abstract Return the next object in the registry iteration, ignoring the kIORegistryIterateRecursively option. |
1078 | * @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. |
1079 | * @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. */ |
1080 | |
1081 | virtual IORegistryEntry * getNextObjectFlat( void ); |
1082 | |
1083 | /*! @function getNextObjectRecursive |
1084 | * @abstract Return the next object in the registry iteration, and enter it. |
1085 | * @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. |
1086 | * @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. */ |
1087 | |
1088 | virtual IORegistryEntry * getNextObjectRecursive( void ); |
1089 | |
1090 | /*! @function getCurrentEntry |
1091 | * @abstract Return the current entry in the registry iteration. |
1092 | * @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. |
1093 | * @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. */ |
1094 | |
1095 | virtual IORegistryEntry * getCurrentEntry( void ); |
1096 | |
1097 | /*! @function enterEntry |
1098 | * @abstract Recurse into the current entry in the registry iteration. |
1099 | * @discussion This method makes the current entry, ie. the last entry returned by getNextObject et al., the root in a new level of recursion. */ |
1100 | |
1101 | virtual void enterEntry( void ); |
1102 | |
1103 | /*! @function enterEntry |
1104 | * @abstract Recurse into the current entry in the registry iteration. |
1105 | * @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. |
1106 | * @param plane The new plane to switch into. */ |
1107 | |
1108 | virtual void enterEntry( const IORegistryPlane * plane ); |
1109 | |
1110 | /*! @function exitEntry |
1111 | * @abstract Exits a level of recursion, restoring the current entry. |
1112 | * @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. |
1113 | * @result true if a level of recursion was undone, false if no recursive levels are left in the iteration. */ |
1114 | |
1115 | virtual bool exitEntry( void ); |
1116 | |
1117 | /*! @function reset |
1118 | * @abstract Exits all levels of recursion, restoring the iterator to its state at creation. |
1119 | * @discussion This method exits all levels of recursion, and restores the iterator to its state at creation. */ |
1120 | |
1121 | virtual void reset( void ) APPLE_KEXT_OVERRIDE; |
1122 | |
1123 | /*! @function isValid |
1124 | * @abstract Checks that no registry changes have invalidated the iteration. |
1125 | * @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. |
1126 | * @result false if the iterator has been invalidated by changes to the registry, true otherwise. */ |
1127 | |
1128 | virtual bool isValid( void ) APPLE_KEXT_OVERRIDE; |
1129 | |
1130 | /*! @function iterateAll |
1131 | * @abstract Iterates all entries (with getNextObject) and returns a set of all returned entries. |
1132 | * @discussion This method will reset, then iterate all entries in the iteration (with getNextObject). |
1133 | * @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. */ |
1134 | |
1135 | virtual OSPtr<OSOrderedSet> iterateAll( void ); |
1136 | }; |
1137 | |
1138 | #endif /* _IOKIT_IOREGISTRYENTRY_H */ |
1139 | |