DCMD_ALL_FADVISE

Pass file advice to the filesystem

Synopsis:

#include <sys/dcmd_all.h>

#define DCMD_ALL_FADVISE __DIOT(_DCMD_ALL, 6, struct _fadvise)

Arguments to devctl():

Argument Value
filedes A file descriptor that you obtained by opening the device.
dcmd DCMD_ALL_FADVISE
dev_data_ptr A pointer to a struct _fadvise with the advice filled in (see below).
n_bytes sizeof(struct _fadvise)
dev_info_ptr NULL

Description:

This command passes file advice to the filesystem. Clients usually use the posix_fadvise() cover function to generate this request:

posix_fadvise(fd, offset, len, advice);

Input:

A pointer to a struct _fadvise with the advice filled in. This structure is defined as:

struct _fadvise {
        int                     advice;
        int                     spare;
        off64_t                 offset;
        off64_t                 len;
};

The members include the following:

advice
The advice you want to give; one of:
  • POSIX_FADV_NORMAL — the application has no advice to give on its behavior with respect to the specified data. This is the default characteristic if no advice is given for an open file.
  • POSIX_FADV_SEQUENTIAL — the application expects to access the specified data sequentially from lower offsets to higher offsets.
  • POSIX_FADV_RANDOM — the application expects to access the specified data in a random order.
  • POSIX_FADV_WILLNEED — the application expects to access the specified data in the near future.
  • POSIX_FADV_DONTNEED — the application expects that it will not access the specified data in the near future.
  • POSIX_FADV_NOREUSE — the application expects to access the specified data once and then not reuse it thereafter.
spare
Not used; set it to zero.
offset
The offset of the data that you want to provide advice about.
len
The length of the data.

Output:

None.

Example:

struct _fadvise		a;

a.advice = advice;
a.offset = offset;
a.len = len;
a.spare = 0;

if(devctl(fd, DCMD_ALL_FADVISE, &a, sizeof a, NULL) != EOK)
{
   /* Error */
}

See also:

devctl(), posix_fadvise() in the QNX Neutrino C Library Reference