This section introduces some basic data types that are used throughout the Driver Services Library.
typedef unsigned long ByteCount;
typedef unsigned long ItemCount;
typedef long OSStatus;
typedef unsigned long OptionBits;
For a description of OSStatus, see Error Returns.
The constant kNilOptions (= 0) is provided for clarity.
IDs are used whenever you create, manipulate, or destroy a object. All IDs are derived from the type KernelID :
typedef struct OpaqueRef *KernelID;
You should use the derived ID types whenever possible to make your code more readable.
Note
Derived ID types are all 32-bit opaque identifiers that specify various kernel resources. There is a separate ID type for each kind of resource--for example, separate types for TaskID and AddressSpaceID. All kernel services that create or allocate a resource return an ID; the ID is later used to specify the resource to perform operations on it or delete it. These IDs are opaque because the value of the ID tells you nothing--you can't tell from an ID which resource it identifies without calling the kernel, you can't tell what ID you'll get back the next time you create a resource, and you can't tell the relationship between any two resources by the relationship between their IDs. When a resource is deleted, its ID usually becomes invalid for a long time. This helps your code catch errors, because if you accidentally use an ID for a resource that has been deleted, chances are you'll get an error instead of doing something to a different resource.