Perform direct I/O
#include <sys/dcmd_blk.h> #define DCMD_FSYS_DIRECT_IO __DIOT(_DCMD_FSYS, 15, struct fs_directio) #define DCMD_FSYS_DIRECT_IO_IOV __DIOT(_DCMD_FSYS, 38, struct fs_directio_iov) #define DCMD_FSYS_DIRECT_IO_OLD __DIOT(_DCMD_FSYS, 15, struct fs_directio_old)
Argument | Value |
---|---|
filedes | A file descriptor that you obtained by opening the device. |
dcmd | DCMD_FSYS_DIRECT_IO |
dev_data_ptr | A pointer to a struct fs_directio (see below) |
n_bytes | sizeof(struct fs_directio) |
dev_info_ptr | A pointer to a 32-bit signed integer. On success, the devctl() call populates this buffer with the number of bytes succesfully transferred. Pass NULL if you do not want this information. |
The DCMD_FSYS_DIRECT_IO command performs a direct I/O operation on a file. DCMD_FSYS_DIRECT_IO_IOV allows DCMD_FSYS_DIRECT_IO to be used when the client's buffers are not contiguous in memory.
The fs_directio structure is defined in <sys/dcmd_blk.h> as follows:
struct fs_directio { off64_t offset; uint32_t nbytes; uint32_t flags; paddr64_t paddr; uint64_t vaddr; };
The members include:
You can OR the above with zero or one or both of the following:
The fs_directio_iov structure is defined in <sys/dcmd_blk.h> as follows:
struct fs_directio_iov { off64_t offset; _Uint32t nbytes; _Uint32t flags; _Uint32t niov; __FLEXARY(struct __iovec64, iov); };
The offset and flags members are as for fs_directio.
None.
struct fs_directio dio; /* Send a zero-byte read to see if direct I/O is available on the fd: */ memset(&dio, 0, sizeof dio); dio.flags = _IO_FLAG_RD; if (devctl(fd, DCMD_FSYS_DIRECT_IO, &dio, sizeof dio, 0) == EOK) { /* Direct I/O is supported. */ }
devctl() in the QNX Neutrino C Library Reference