DCMD_FSYS_DIRECT_IO

Perform direct I/O

Synopsis:

#include <sys/dcmd_blk.h>

#define DCMD_FSYS_DIRECT_IO   __DIOT(_DCMD_FSYS,  15, struct fs_directio)

Arguments to devctl():

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

Description:

This command performs a direct I/O operation on a file.

Input:

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:

offset
The offset in the file to start the operation at.
nbytes
The number of bytes you want to read or write.
flags
The type of operation; one of:
  • FS_DIO_READ — read-only
  • FS_DIO_WRITE — write-only

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.

paddr
The physical address of where to read or write the data.
vaddr
The virtual address of where to read or write the data.

Output:

None.

Example:

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. */
}

See also:

devctl() in the QNX Neutrino C Library Reference