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)
#define DCMD_FSYS_DIRECT_IO_OLD  __DIOT(_DCMD_FSYS, 15, struct fs_directio_old)

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;
        paddr64_t       paddr;
        uint64_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 the above with zero or more of the following:

  • FS_DIO_SYNC — subsequent operations are complete only when the data has been successfully transferred
  • FS_DIO_MAP_PHYS — map physical memory
paddr
The physical address of where to read or write the data.
vaddr
The virtual address of where to read or write the data.
Note: The fs_directio_old structure is similar to fs_directio, except that the paddr member is of type paddr32_t, and the vaddr member is of type uint32_t. If you want this form of the structure, use DCMD_FSYS_DIRECT_IO_OLD.

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