Xenomai
3.1
|
Virtual files provide a mean to export Xenomai object states to user-space, based on common kernel interfaces. More...
Data Structures | |
struct | xnvfile_lock_ops |
Vfile locking operations. More... | |
struct | xnvfile_regular_ops |
Regular vfile operation descriptor. More... | |
struct | xnvfile_regular_iterator |
Regular vfile iterator. More... | |
struct | xnvfile_snapshot_ops |
Snapshot vfile operation descriptor. More... | |
struct | xnvfile_rev_tag |
Snapshot revision tag. More... | |
struct | xnvfile_snapshot |
Snapshot vfile descriptor. More... | |
struct | xnvfile_snapshot_iterator |
Snapshot-driven vfile iterator. More... | |
Functions | |
int | xnvfile_init_snapshot (const char *name, struct xnvfile_snapshot *vfile, struct xnvfile_directory *parent) |
Initialize a snapshot-driven vfile. More... | |
int | xnvfile_init_regular (const char *name, struct xnvfile_regular *vfile, struct xnvfile_directory *parent) |
Initialize a regular vfile. More... | |
int | xnvfile_init_dir (const char *name, struct xnvfile_directory *vdir, struct xnvfile_directory *parent) |
Initialize a virtual directory entry. More... | |
int | xnvfile_init_link (const char *from, const char *to, struct xnvfile_link *vlink, struct xnvfile_directory *parent) |
Initialize a virtual link entry. More... | |
void | xnvfile_destroy (struct xnvfile *vfile) |
Removes a virtual file entry. More... | |
ssize_t | xnvfile_get_blob (struct xnvfile_input *input, void *data, size_t size) |
Read in a data bulk written to the vfile. More... | |
ssize_t | xnvfile_get_string (struct xnvfile_input *input, char *s, size_t maxlen) |
Read in a C-string written to the vfile. More... | |
ssize_t | xnvfile_get_integer (struct xnvfile_input *input, long *valp) |
Evaluate the string written to the vfile as a long integer. More... | |
Variables | |
struct xnvfile_directory | cobalt_vfroot |
Xenomai vfile root directory. More... | |
struct xnvfile_directory | cobalt_vfroot |
Xenomai vfile root directory. More... | |
Virtual files provide a mean to export Xenomai object states to user-space, based on common kernel interfaces.
This encapsulation is aimed at:
This virtual file implementation offers record-based read support based on seq_files, single-buffer write support, directory and link handling, all visible from the /proc namespace.
The vfile support exposes four filesystem object types:
Because a large number of records may have to be output, the data collection phase is not strictly atomic as a whole, but only protected at record level. The vfile implementation can be notified of updates to the underlying data set, and restart the collection from scratch until the snapshot is fully consistent.
void xnvfile_destroy | ( | struct xnvfile * | vfile | ) |
Removes a virtual file entry.
vfile | A pointer to the virtual file descriptor to remove. |
ssize_t xnvfile_get_blob | ( | struct xnvfile_input * | input, |
void * | data, | ||
size_t | size | ||
) |
Read in a data bulk written to the vfile.
When writing to a vfile, the associated store() handler from the snapshot-driven vfile or regular vfile is called, with a single argument describing the input data. xnvfile_get_blob() retrieves this data as an untyped binary blob, and copies it back to the caller's buffer.
input | A pointer to the input descriptor passed to the store() handler. |
data | The address of the destination buffer to copy the input data to. |
size | The maximum number of bytes to copy to the destination buffer. If size is larger than the actual data size, the input is truncated to size. |
ssize_t xnvfile_get_integer | ( | struct xnvfile_input * | input, |
long * | valp | ||
) |
Evaluate the string written to the vfile as a long integer.
When writing to a vfile, the associated store() handler from the snapshot-driven vfile or regular vfile is called, with a single argument describing the input data. xnvfile_get_integer() retrieves and interprets this data as a long integer, and copies the resulting value back to valp.
The long integer can be expressed in decimal, octal or hexadecimal bases depending on the prefix found.
input | A pointer to the input descriptor passed to the store() handler. |
valp | The address of a long integer variable to receive the value. |
ssize_t xnvfile_get_string | ( | struct xnvfile_input * | input, |
char * | s, | ||
size_t | maxlen | ||
) |
Read in a C-string written to the vfile.
When writing to a vfile, the associated store() handler from the snapshot-driven vfile or regular vfile is called, with a single argument describing the input data. xnvfile_get_string() retrieves this data as a null-terminated character string, and copies it back to the caller's buffer.
input | A pointer to the input descriptor passed to the store() handler. |
s | The address of the destination string buffer to copy the input data to. |
maxlen | The maximum number of bytes to copy to the destination buffer, including the ending null character. If maxlen is larger than the actual string length, the input is truncated to maxlen. |
int xnvfile_init_dir | ( | const char * | name, |
struct xnvfile_directory * | vdir, | ||
struct xnvfile_directory * | parent | ||
) |
Initialize a virtual directory entry.
name | The name which should appear in the pseudo-filesystem, identifying the vdir entry. |
vdir | A pointer to the virtual directory descriptor to initialize. |
parent | A pointer to a virtual directory descriptor standing for the parent directory of the new vdir. If NULL, the /proc root directory will be used. /proc/xenomai is mapped on the globally available cobalt_vfroot vdir. |
int xnvfile_init_link | ( | const char * | from, |
const char * | to, | ||
struct xnvfile_link * | vlink, | ||
struct xnvfile_directory * | parent | ||
) |
Initialize a virtual link entry.
from | The name which should appear in the pseudo-filesystem, identifying the vlink entry. |
to | The target file name which should be referred to symbolically by name. |
vlink | A pointer to the virtual link descriptor to initialize. |
parent | A pointer to a virtual directory descriptor standing for the parent directory of the new vlink. If NULL, the /proc root directory will be used. /proc/xenomai is mapped on the globally available cobalt_vfroot vdir. |
int xnvfile_init_regular | ( | const char * | name, |
struct xnvfile_regular * | vfile, | ||
struct xnvfile_directory * | parent | ||
) |
Initialize a regular vfile.
name | The name which should appear in the pseudo-filesystem, identifying the vfile entry. |
vfile | A pointer to a vfile descriptor to initialize from. The following fields in this structure should be filled in prior to call this routine: |
parent | A pointer to a virtual directory descriptor; the vfile entry will be created into this directory. If NULL, the /proc root directory will be used. /proc/xenomai is mapped on the globally available cobalt_vfroot vdir. |
int xnvfile_init_snapshot | ( | const char * | name, |
struct xnvfile_snapshot * | vfile, | ||
struct xnvfile_directory * | parent | ||
) |
Initialize a snapshot-driven vfile.
name | The name which should appear in the pseudo-filesystem, identifying the vfile entry. |
vfile | A pointer to a vfile descriptor to initialize from. The following fields in this structure should be filled in prior to call this routine: |
parent | A pointer to a virtual directory descriptor; the vfile entry will be created into this directory. If NULL, the /proc root directory will be used. /proc/xenomai is mapped on the globally available cobalt_vfroot vdir. |
struct xnvfile_directory cobalt_vfroot |
Xenomai vfile root directory.
This vdir maps the /proc/xenomai directory. It can be used to create a hierarchy of Xenomai-related vfiles under this root.
struct xnvfile_directory cobalt_vfroot |
Xenomai vfile root directory.
This vdir maps the /proc/xenomai directory. It can be used to create a hierarchy of Xenomai-related vfiles under this root.