Generic nodes are an alternative to standard drivers in RTEMS.
More...
Generic nodes are an alternative to standard drivers in RTEMS.
The handlers of a generic node are called with less overhead compared to the standard driver operations. The usage of file system node handlers enable more features like support for fsync() and fdatasync(). The generic nodes use the reference counting of the IMFS. This provides automatic node destruction when the last reference vanishes.
◆ IMFS_GENERIC_INITIALIZER
#define IMFS_GENERIC_INITIALIZER |
( |
|
handlers, |
|
|
|
init, |
|
|
|
destroy |
|
) |
| |
Value:{ \
( handlers ), \
( init ), \
IMFS_node_remove_default, \
( destroy ) \
}
Initializer for a generic node control.
- Parameters
-
[in] | handlers | The file system node handlers. |
[in] | init | The node initialization method. |
[in] | destroy | The node destruction method. |
◆ IMFS_node_control_destroy
typedef void(* IMFS_node_control_destroy) (IMFS_jnode_t *node) |
◆ IMFS_node_control_initialize
◆ IMFS_node_control_remove
Prepares the removal of an IMFS node from its parent directory.
- Parameters
-
- Return values
-
node | Successful operation. |
NULL | An error occurred. The errno indicates the error. This will abort the removal operation. |
- See also
- IMFS_node_control and IMFS_node_remove_default().
◆ IMFS_make_generic_node()
int IMFS_make_generic_node |
( |
const char * |
path, |
|
|
mode_t |
mode, |
|
|
const IMFS_node_control * |
node_control, |
|
|
void * |
context |
|
) |
| |
Makes a generic IMFS node.
- Parameters
-
[in] | path | The path to the new generic IMFS node. |
[in] | mode | The node mode. |
[in] | node_control | The node control. |
[in] | context | The node control handler context. |
- Return values
-
0 | Successful operation. |
-1 | An error occurred. The errno indicates the error. |
#include <sys/stat.h>
#include <assert.h>
#include <fcntl.h>
...
};
{
context = IMFS_generic_get_context_by_node(node);
return node;
}
{
void *
context = IMFS_generic_get_context_by_node(node);
}
&some_node_handlers,
some_node_init,
some_node_destroy
);
void example(void *some_node_context)
{
int rv;
"/path/to/some/generic/node",
S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
&some_node_control,
some_node_context
);
assert(rv == 0);
}
◆ IMFS_node_destroy_default()
◆ IMFS_node_initialize_default()
Returns the node and does nothing else.
- Parameters
-
[in] | node | The IMFS node. |
[in] | arg | The user provided argument pointer. It is not used. |
- Return values
-
node | Returns always the node passed as parameter. |
- See also
- IMFS_node_control.
◆ IMFS_node_initialize_generic()
Returns the node and sets the generic node context.
- Parameters
-
[in] | node | The IMFS node. |
[in] | arg | The user provided argument pointer. It must contain the generic context. |
- Return values
-
node | Returns always the node passed as parameter. |
- See also
- IMFS_node_control.
◆ IMFS_node_remove_default()
Returns the node and does nothing else.
- Parameters
-
- Return values
-
node | Returns always the node passed as parameter. |
- See also
- IMFS_node_control.