Extending the attributes structure

You may wish to extend the attributes structure in cases where you need to store additional device information. Since the attributes structure is associated on a "per-device" basis, this means that any extra information you store there will be accessible to all OCBs that reference that device (since the OCB contains a pointer to the attributes structure). Often things like serial baud rate, etc. are stored in extended attributes structures.

Extending the attributes structure is much simpler than dealing with extended OCBs, simply because attributes structures are allocated and deallocated by your code anyway.

You have to perform the same "trick" of overriding the header files with the "new" attributes structure as we did with the extended OCB above:

#define IOFUNC_ATTR_T struct my_attr
#include <sys/iofunc.h>

Next you actually define the contents of your extended attribute structures. Note that the extended attribute structure must have the "normal" attribute structure encapsulated as the very first element, just as we did with the extended OCB (and for the same reasons).