Perform direct I/O
#include <sys/dcmd_blk.h> #define DCMD_FSYS_DIRECT_IO __DIOT(_DCMD_FSYS, 15, struct fs_directio)
| 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 | NULL |
This command performs a direct I/O operation on a file.
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;
paddr_t paddr;
caddr_t vaddr;
};
The members include:
You can OR either of these with FS_DIO_SYNC, to indicate that subsequent operations are complete only when the data has been successfully transferred.
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