Xenomai
3.1
|
Regular vfile operation descriptor. More...
Data Fields | |
int(* | rewind )(struct xnvfile_regular_iterator *it) |
void *(* | begin )(struct xnvfile_regular_iterator *it) |
void *(* | next )(struct xnvfile_regular_iterator *it) |
void(* | end )(struct xnvfile_regular_iterator *it) |
int(* | show )(struct xnvfile_regular_iterator *it, void *data) |
ssize_t(* | store )(struct xnvfile_input *input) |
Regular vfile operation descriptor.
This structure describes the operations available with a regular vfile. It defines handlers for sending back formatted kernel data upon a user-space read request, and for obtaining user data upon a user-space write request.
void*(* xnvfile_regular_ops::begin) (struct xnvfile_regular_iterator *it) |
This handler should prepare for iterating over the records upon a read request, starting from the specified position.
it | A pointer to the current vfile iterator. On entry, it->pos is set to the (0-based) position of the first record to output. This handler may be called multiple times with different position requests. |
void(* xnvfile_regular_ops::end) (struct xnvfile_regular_iterator *it) |
void*(* xnvfile_regular_ops::next) (struct xnvfile_regular_iterator *it) |
This handler should return the address of the next record to format and output by the show()handler".
it | A pointer to the current vfile iterator. On entry, it->pos is set to the (0-based) position of the next record to output. |
int(* xnvfile_regular_ops::rewind) (struct xnvfile_regular_iterator *it) |
This handler is called only once, when the virtual file is opened, before the begin() handler is invoked.
it | A pointer to the vfile iterator which will be used to read the file contents. |
int(* xnvfile_regular_ops::show) (struct xnvfile_regular_iterator *it, void *data) |
This handler should format and output a record.
xnvfile_printf(), xnvfile_write(), xnvfile_puts() and xnvfile_putc() are available to format and/or emit the output. All routines take the iterator argument it as their first parameter.
it | A pointer to the current vfile iterator. |
data | A pointer to the record to format then output. The first call to the handler may receive a NULL data pointer, depending on the presence and/or return of a hander; the show handler should test this special value to output any header that fits, prior to receiving more calls with actual records. |
ssize_t(* xnvfile_regular_ops::store) (struct xnvfile_input *input) |
This handler receives data written to the vfile, likely for updating some kernel setting, or triggering any other action which fits. This is the only handler which deals with the write-side of a vfile. It is called when writing to the /proc entry of the vfile from a user-space process.
The input data is described by a descriptor passed to the handler, which may be subsequently passed to parsing helper routines. For instance, xnvfile_get_string() will accept the input descriptor for returning the written data as a null-terminated character string. On the other hand, xnvfile_get_integer() will attempt to return a long integer from the input data.
input | A pointer to an input descriptor. It refers to an opaque data from the handler's standpoint. |