I/O mount structure
Synopsis:
#include <sys/iofunc.h>
typedef struct _iofunc_funcs iofunc_funcs_t;
typedef struct _iofunc_mount {
uint32_t flags;
uint32_t conf;
dev_t dev;
int32_t blocksize;
iofunc_funcs_t *funcs;
void *power;
size_t size;
uint32_t ext_flags;
uint32_t timeres;
uint64_t reserved[4];
} iofunc_mount_t;
struct _iofunc_funcs {
unsigned nfuncs;
IOFUNC_OCB_T *(*ocb_calloc) (resmgr_context_t *ctp,
IOFUNC_ATTR_T *attr);
void (*ocb_free) (IOFUNC_OCB_T *ocb);
int (*attr_lock)(IOFUNC_ATTR_T *attr);
int (*attr_unlock)(IOFUNC_ATTR_T *attr);
int (*attr_trylock)(IOFUNC_ATTR_T *attr);
};
Description:
The iofunc_mount_t structure contains per-mountpoint data items that are global to the entire
mount device.
Unlike the attribute
(iofunc_attr_t)
and OCB
(iofunc_ocb_t)
structures, which are mandatory, use of this structure is optional, and it need be used only
if a resource manager needs to override some of the default settings it controls.
For example, you need to provide this structure for the following:
- a device that wants to support ACLs (almost everyone should)
- a resource manager that needs to use custom or extended OCB structures (fairly common)
(QNX Neutrino 7.0 or later) If you need to modify any members of the mount structure, use
iofunc_mount_init()
to initialize it.
For example, if your program saves files to a filesystem, you can use iofunc_mount_init() and
iofunc_mount_set_time()
to set a timestamp resolution for open files that matches the resolution the filesystem uses (a POSIX requirement).
The members of the mount structure, specifically the conf and flags members,
modify the behavior of some of the iofunc layer functions.
This structure contains at least the following members:
- flags
- A bitwise OR of mount flags, which include the following:
- IOFUNC_MOUNT_32BIT
- The offsets used by this resource manager are 32-bit (as opposed to the extended 64-bit offsets).
This flag indicates that offset in the OCB
and nbytes and inode in the attributes structure are 32-bit values.
In addition, you can define your own mount flags using the bits specified in
IOFUNC_MOUNT_FLAGS_PRIVATE (see <sys/iofunc.h>).
- conf
- A bitwise OR of configuration flags, which include the following:
- IOFUNC_PC_CHOWN_RESTRICTED
- Cause the default handler for the _IO_CHOWN message to behave in a manner defined by POSIX as
chown-restricted.
- IOFUNC_PC_NO_TRUNC
- Has no effect on the iofunc layer libraries,
but is returned by the iofunc layer's default _IO_PATHCONF handler.
- IOFUNC_PC_SYNC_IO
- Indicates that the resource manager supports synchronous I/O operations.
If this bit isn't set, the following may occur:
- IOFUNC_PC_LINK_DIR
- Controls whether or not it's possible to create hard links to directories.
If this bit isn't set, calls to
link()
and
unlink()
for directories fail;
if this bit is set, only root is allowed to link and unlink directories.
- IOFUNC_PC_ACL
- Indicates whether or not the resource manager supports access control lists.
Setting this bit enables ACL support for your resource manager in the resource manager library.
For more information about ACLs, see
Working with Access Control Lists (ACLs)
in the QNX Neutrino Programmer's Guide.
- IOFUNC_PC_EXT
- (QNX Neutrino 7.0 or later) The iofunc_mount_t structure includes
the size, ext_flags, and timeres members.
This bit is set automatically when you call
iofunc_mount_init()
to set the iofunc_mount_t structure.
Note that the options mentioned above for the conf
member are returned by the iofunc layer _IO_PATHCONF default handler.
- dev
- The device number for the filesystem.
This number is returned to the client's stat() function in the
struct stat
st_dev member.
- blocksize
- The block size of the device.
On resource managers that implement filesystems, this indicates the native blocksize of the disk, e.g., 512 bytes.
- funcs
- A pointer to a iofunc_funcs_t that specifies mount-specific handers.
The members include the following:
- nfuncs
- The number of functions present in the structure;
you should fill it with the manifest constant _IOFUNC_NFUNCS.
- ocb_calloc() and ocb_free()
- Allows you to override the OCBs on a per-mountpoint basis (see
Extending the OCB and attribute structures
in the Extending the POSIX-Layer Data Structures chapter of Writing a Resource Manager).
If these members are NULL, then the default library versions
(iofunc_ocb_calloc()
and
iofunc_ocb_free())
are used.
You must specify either both or neither of these functions; they operate as a matched pair.
- attr_lock(), attr_unlock(), and attr_trylock()
- Allows you to create customized versions of the functions that lock, unlock, and attempt to lock the
iofunc_attr_t
attribute structure.
These are the preferred way to modify the attribute locking behavior for a resource manager,
and are called by
iofunc_lock_ocb_default()
and
iofunc_unlock_ocb_default()
if they're supplied.
The lock and unlock operations are used as a pair, and if you supply either, you must supply both.
If you do override these, you may no longer use
iofunc_attr_lock()
and
iofunc_attr_unlock().
- power
- Reserved for future use.
- size
- (QNX Neutrino 7.0 or later) Contains the size of the iofunc_mount_t structure.
It's set by
iofunc_mount_init().
- ext_flags
- (QNX Neutrino 7.0 or later) Extends the range of possible flags values.
- timeres
- (QNX Neutrino 7.0 or later) Contains the timestamp resolution in nanoseconds for iofunc functions and structures.
It's set by
iofunc_mount_set_time().
- reserved
- Reserved for future use.