|
PatchworkOS
966e257
A non-POSIX operating system.
|
Helpers to implement ctl (control) file operations. More...
Helpers to implement ctl (control) file operations.
A ctl file is a special file that takes in commands as text input and performs actions based on those commands.
Commands should be formatted as follows:
Data Structures | |
| struct | ctl_t |
| Structure defining a ctl command. More... | |
Macros | |
| #define | CTL_STANDARD_WRITE_DEFINE(name, ...) |
| Helper macro to define a standard ctl write function. | |
| #define | CTL_STANDARD_OPS_DEFINE(name, ...) |
| Helper macro to define a standard ctl file operations structure. | |
Typedefs | |
| typedef uint64_t(* | ctl_func_t) (file_t *file, uint64_t, const char **) |
| Type definition for a ctl function. | |
Functions | |
| uint64_t | ctl_dispatch (ctl_t ctls[], file_t *file, const void *buffer, uint64_t count) |
| Dispatch a ctl command. | |
| #define CTL_STANDARD_WRITE_DEFINE | ( | name, | |
| ... | |||
| ) |
Helper macro to define a standard ctl write function.
This macro defines a write function that dispatches commands to a given array of ctl_t structures.
| name | The name of the ctl write function. |
| ... | The ctl array to dispatch commands to. |
| #define CTL_STANDARD_OPS_DEFINE | ( | name, | |
| ... | |||
| ) |
Helper macro to define a standard ctl file operations structure.
This macro defines a file operations structure with all standard ctl operations implemented.
| name | The name of the ctl file operations structure. |
| ... | The ctl array to dispatch commands to. |
Dispatch a ctl command.
| ctls | The array of ctl commands to dispatch to, terminated by an entry with a NULL name. |
| file | The file the ctl command was sent to. |
| buffer | The buffer containing the command and its arguments. |
| count | The number of bytes in the buffer. |
ERR and errno is set.