Resize file I/O function handler
QNX SDP8.0Getting Started with the QNX OSDeveloperUser
Prototype:
int (*space) ( resmgr_context_t *ctp,
io_space_t *msg,
RESMGR_OCB_T *ocb )
Classification:
I/ODefault handler:
noneHelper functions:
iofunc_space_verify()Client functions:
fcntl(), ftruncate(), ltrunc(), posix_fallocate()Messages:
_IO_SPACEData structure:
struct _io_space {
uint16_t type;
uint16_t combine_len;
uint16_t subtype;
short whence;
uint64_t start;
uint64_t len;
};
typedef union {
struct _io_space i;
uint64_t o;
} io_space_t;
Description:
This is used to allocate or free space occupied by the resource. The subtype parameter indicates the type of operation:
- F_ALLOCSP
- Allocate storage space, fully assigning any physical space (rather than potentially failing later when it's written to). This corresponds to posix_fallocate().
- F_FREESP
- Free storage space.
- F_GROWSP
- Extend a resource, without necessarily guaranteeing that physical space is available. F_GROWSP is similar to F_ALLOCSP but permits lazy allocation by a sparse file implementation. This corresponds to ftruncate().
Most resource managers can (and should) treat F_ALLOCSP and F_GROWSP identically.
The combination of whence and start give the location where the beginning of the allocation or deallocation should occur; the member len indicates the size of the operation.
Returns:
The number of bytes (size of the resource) via the helper macro _RESMGR_STATUS().Referenced by:
resmgr_io_funcs_t I/O tablePermission checking:
The iofunc_space_verify() helper function verifies that the file is opened with write permissions and that the filesystem is not read only. If the file is executable and has the set user ID bit set, iofunc_space_verify() only allows the operation if the caller is root. There is no default handler.
Page updated: