resmgr_io_funcs_t
Table of POSIX-level I/O functions
Synopsis:
#include <sys/iofunc.h>
#include <sys/resmgr.h>
typedef struct _resmgr_io_funcs {
unsigned nfuncs;
int (*read) (resmgr_context_t *ctp, io_read_t *msg, RESMGR_OCB_T *ocb);
int (*write) (resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *ocb);
int (*close_ocb) (resmgr_context_t *ctp, void *reserved, RESMGR_OCB_T *ocb);
int (*stat) (resmgr_context_t *ctp, io_stat_t *msg, RESMGR_OCB_T *ocb);
int (*notify) (resmgr_context_t *ctp, io_notify_t *msg, RESMGR_OCB_T *ocb);
int (*devctl) (resmgr_context_t *ctp, io_devctl_t *msg, RESMGR_OCB_T *ocb);
int (*unblock) (resmgr_context_t *ctp, io_pulse_t *msg, RESMGR_OCB_T *ocb);
int (*pathconf) (resmgr_context_t *ctp, io_pathconf_t *msg, RESMGR_OCB_T *ocb);
int (*lseek) (resmgr_context_t *ctp, io_lseek_t *msg, RESMGR_OCB_T *ocb);
int (*chmod) (resmgr_context_t *ctp, io_chmod_t *msg, RESMGR_OCB_T *ocb);
int (*chown) (resmgr_context_t *ctp, io_chown_t *msg, RESMGR_OCB_T *ocb);
int (*utime) (resmgr_context_t *ctp, io_utime_t *msg, RESMGR_OCB_T *ocb);
int (*openfd) (resmgr_context_t *ctp, io_openfd_t *msg, RESMGR_OCB_T *ocb);
int (*fdinfo) (resmgr_context_t *ctp, io_fdinfo_t *msg, RESMGR_OCB_T *ocb);
int (*lock) (resmgr_context_t *ctp, io_lock_t *msg, RESMGR_OCB_T *ocb);
int (*space) (resmgr_context_t *ctp, io_space_t *msg, RESMGR_OCB_T *ocb);
int (*shutdown) (resmgr_context_t *ctp, io_shutdown_t *msg, RESMGR_OCB_T *ocb);
int (*mmap) (resmgr_context_t *ctp, io_mmap_t *msg, RESMGR_OCB_T *ocb);
int (*msg) (resmgr_context_t *ctp, io_msg_t *msg, RESMGR_OCB_T *ocb);
int (*reserved) (resmgr_context_t *ctp, void *msg, RESMGR_OCB_T *ocb);
int (*dup) (resmgr_context_t *ctp, io_dup_t *msg, RESMGR_OCB_T *ocb);
int (*close_dup) (resmgr_context_t *ctp, io_close_t *msg, RESMGR_OCB_T *ocb);
int (*lock_ocb) (resmgr_context_t *ctp, void *reserved, RESMGR_OCB_T *ocb);
int (*unlock_ocb) (resmgr_context_t *ctp, void *reserved, RESMGR_OCB_T *ocb);
int (*sync) (resmgr_context_t *ctp, io_sync_t *msg, RESMGR_OCB_T *ocb);
int (*power) (resmgr_context_t *ctp, io_power_t *msg, RESMGR_OCB_T *ocb);
int (*acl) (resmgr_context_t *ctp, io_acl_t *msg, RESMGR_OCB_T *ocb);
int (*pause) (resmgr_context_t *ctp, void *reserved, RESMGR_OCB_T *ocb);
int (*unpause) (resmgr_context_t *ctp, io_pulse_t *msg, RESMGR_OCB_T *ocb);
int (*read64) (resmgr_context_t *ctp, io_read_t *msg, RESMGR_OCB_T *ocb);
int (*write64) (resmgr_context_t *ctp, io_write_t *msg, RESMGR_OCB_T *ocb);
int (*notify64) (resmgr_context_t *ctp, io_notify_t *msg, RESMGR_OCB_T *ocb);
int (*utime64) (resmgr_context_t *ctp, io_utime_t *msg, RESMGR_OCB_T *ocb);
} resmgr_io_funcs_t;
#include
<sys/iofunc.h> before
<sys/resmgr.h>.
Description:
The resmgr_connect_funcs_t structure is a table of the POSIX-level I/O functions that are used by a resource manager. You can initialize this table by calling iofunc_func_init() and then overriding the defaults with your own functions.
This structure includes nfuncs, which indicates how many functions are in the table (in case the structure grows in the future), along with these functions:
Member: | Used to: | Default: |
---|---|---|
read | Handle _IO_READ messages | iofunc_read_default() |
write | Handle _IO_WRITE messages | iofunc_write_default() |
close_ocb | Handle the last close for an OCB | iofunc_close_ocb_default() |
stat | Handle _IO_STAT messages | iofunc_stat_default() |
notify | Handle _IO_NOTIFY messages | None |
devctl | Handle _IO_DEVCTL messages | iofunc_devctl_default() |
unblock | Unblock the client if an operation is interrupted | iofunc_unblock_default() |
pathconf | Handle _IO_PATHCONF messages | iofunc_pathconf_default() |
lseek | Handle _IO_LSEEK messages | iofunc_lseek_default() |
chmod | Handle _IO_CHMOD messages | iofunc_chmod_default() |
chown | Handle _IO_CHOWN messages | iofunc_chown_default() |
utime | Handle _IO_UTIME messages | iofunc_utime_default() |
openfd | Handle _IO_OPENFD messages | iofunc_openfd_default() |
fdinfo | Handle _IO_FDINFO messages | iofunc_fdinfo_default() |
lock | Handle _IO_LOCK messages | iofunc_lock_default()a |
space | Handle _IO_SPACE messages | None |
shutdown | Reserved | None |
mmap | Handle _IO_MMAP messages | iofunc_mmap_default()b |
msg | Handle _IO_MSG, a general-purpose messaging scheme to interact with the device | None |
reserved | Reserved | None |
dup | Handle _IO_DUP messages | None; handled by the base layer |
close_dup | Handle _IO_CLOSE messages | iofunc_close_dup_default() |
lock_ocb | Lock the attributes for a group of messages | iofunc_lock_ocb_default()c |
unlock_ocb | Unlock the attributes for a group of messages | iofunc_unlock_ocb_default()c |
sync | Handle _IO_SYNC messages | iofunc_sync_default() |
power | Reserved | None |
acl | Handle _IO_ACL (access control list) messages | iofunc_acl_default() |
pause | Called if an automatic reply (e.g., one triggered by returning _RESMGR_NPARTS(2) )
from an I/O function results in an EDEADLK. |
None |
unpause | Called if the dispatch framework receives a _PULSE_CODE_RESTART due to having made an implicit or explicit MsgPause() call after receiving an EDEADLK. | None |
read64 | Handle _IO_READ64 messages | None |
write64 | Handle _IO_WRITE64 messages | None |
notify64 | Handle _IO_NOTIFY64 messages | None |
utime64 | Handle _IO_UTIME64 messages | iofunc_utime_default() |
a If you don't want to support advisory file locks (e.g., flock()) in your resource manager, you should set lock to NULL. If you do choose to support file locking by calling iofunc_lock_default(), you must also call iofunc_close_dup_default() and iofunc_unblock_default().
b There's an extended mmap handler, iofunc_mmap_default_ext(), that you can use instead of iofunc_mmap_default() if your resource manager can pass additional information back to the memory manager.
c If your resource manager is single-threaded, you can reduce the overhead from unneccessary lock and unlock operations by setting both lock_ocb and unlock_ocb to NULL.