Resize file I/O function handler

Prototype:

int (*space) ( resmgr_context_t *ctp,
              io_space_t *msg,
              RESMGR_OCB_T *ocb ) 

Classification:

I/O

Default handler:

none

Helper functions:

iofunc_space_verify()

Client functions:

fcntl(), ftruncate(), ltrunc()

Messages:

_IO_SPACE

Data 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 whether to allocate (if set to F_ALLOCSP) or deallocate (if set to F_FREESP) storage space. 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 table

Permission 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.