POSIX-layer data structures

There are three data structures that relate to the POSIX-layer support routines. Note that as far as the base layer is concerned, you can use any data structures you want; it's the POSIX layer that requires you to conform to a certain content and layout. The benefits delivered by the POSIX layer are well worth this tiny constraint. As we'll see later, you can add your own content to the structures as well.

The three data structures are illustrated in the following diagram, showing some clients using a resource manager that happens to manifest two devices:

Figure 1. Data structures: the big picture.

The data structures (defined in <sys/iofunc.h>) are:

iofunc_ocb_t—OCB structure
Contains information on a per-file-descriptor basis
iofunc_attr_t—attributes structure
Contains information on a per-device basis
iofunc_mount_t—mount structure
Contains information on a per-mountpoint basis

When we talked about the I/O and connect tables, you saw the OCB and attributes structures—in the I/O tables, the OCB structure was the last parameter passed. The attributes structure was passed as the handle in the connect table functions (third argument). The mount structure is usually a global structure and is bound to the attributes structure “by hand” (in the initialization code that you supply for your resource manager).

Note: Be sure to #include <sys/iofunc.h> before <sys/resmgr.h>, or else the data structures won't be defined properly.