Xenomai
3.0.5
|
Snapshot vfile operation descriptor. More...
Data Fields | |
int(* | rewind )(struct xnvfile_snapshot_iterator *it) |
void *(* | begin )(struct xnvfile_snapshot_iterator *it) |
void(* | end )(struct xnvfile_snapshot_iterator *it, void *buf) |
int(* | next )(struct xnvfile_snapshot_iterator *it, void *data) |
int(* | show )(struct xnvfile_snapshot_iterator *it, void *data) |
ssize_t(* | store )(struct xnvfile_input *input) |
Snapshot vfile operation descriptor.
This structure describes the operations available with a snapshot-driven vfile. It defines handlers for returning a printable snapshot of some Xenomai object contents upon a user-space read request, and for updating this object upon a user-space write request.
void*(* xnvfile_snapshot_ops::begin) (struct xnvfile_snapshot_iterator *it) |
This handler should allocate the snapshot buffer to hold records during the data collection phase. When specified, all records collected via the next()handler" will be written to a cell from the memory area returned by begin().
it | A pointer to the current snapshot iterator. |
void(* xnvfile_snapshot_ops::end) (struct xnvfile_snapshot_iterator *it, void *buf) |
This handler releases the memory buffer previously obtained from begin(). It is usually called after the snapshot data has been output by show(), but it may also be called before rewinding the vfile after a revision change, to release the dropped buffer.
it | A pointer to the current snapshot iterator. |
buf | A pointer to the buffer to release. |
int(* xnvfile_snapshot_ops::next) (struct xnvfile_snapshot_iterator *it, void *data) |
This handler fetches the next record, as part of the snapshot data to be sent back to the reader via the show().
it | A pointer to the current snapshot iterator. |
data | A pointer to the record to fill in. |
int(* xnvfile_snapshot_ops::rewind) (struct xnvfile_snapshot_iterator *it) |
This handler (re-)initializes the data collection, moving the seek pointer at the first record. When the file revision tag is touched while collecting data, the current reading is aborted, all collected data dropped, and the vfile is eventually rewound.
it | A pointer to the current snapshot iterator. Two useful information can be retrieved from this iterator in this context: |
int(* xnvfile_snapshot_ops::show) (struct xnvfile_snapshot_iterator *it, void *data) |
This handler should format and output a record from the collected data.
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 snapshot iterator. |
data | A pointer to the record to format then output. The first call to the handler is always passed a NULL data pointer; 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_snapshot_ops::store) (struct xnvfile_input *input) |
This handler receives data written to the vfile, likely for updating the associated Xenomai object's state, 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. |