RTEMS
5.1
|
In-Memory File System Support. More...
Modules | |
IMFS Device IO Handler | |
Files | |
file | deviceio.c |
IMFS Device Node Handlers. | |
file | imfs_add_node.c |
IMFS Add a Node. | |
file | imfs_chown.c |
IMFS Change Owner. | |
file | imfs_config.c |
IMFS Limits and Options. | |
file | imfs_creat.c |
Create an IMFS Node. | |
file | imfs_dir.c |
file | imfs_dir_default.c |
file | imfs_dir_minimal.c |
file | imfs_eval.c |
Evaluation IMFS Node Support. | |
file | imfs_fchmod.c |
Change IMFS File Mode. | |
file | imfs_fifo.c |
FIFO Support. | |
file | imfs_fsunmount.c |
Unmount this Instance of IMFS. | |
file | imfs_handlers_device.c |
Device Operations Table. | |
file | imfs_initsupp.c |
IMFS Node Support. | |
file | imfs_linfile.c |
file | imfs_link.c |
IMFS Create a New Link Node. | |
file | imfs_load_tar.c |
RTEMS Load Tarfs. | |
file | imfs_make_generic_node.c |
IMFS Make a Generic Node. | |
file | imfs_memfile.c |
IMFS Memory File Handlers. | |
file | imfs_mknod.c |
Create a IMFS Node. | |
file | imfs_mount.c |
Mount an IMFS. | |
file | imfs_node.c |
IMFS Node Support. | |
file | imfs_node_destroy_default.c |
IMFS Default Node Destruction. | |
file | imfs_rename.c |
IMFS Rename. | |
file | imfs_rmnod.c |
IMFS Node Removal Handler. | |
file | imfs_stat.c |
IMFS Stat. | |
file | imfs_stat_file.c |
file | imfs_symlink.c |
IMFS Create a New Symbolic Link Node. | |
file | imfs_unmount.c |
Unmount an IMFS. | |
file | imfs_utime.c |
Set IMFS File Access and Modification Times. | |
Data Structures | |
struct | IMFS_jnode_tt |
struct | IMFS_directory_t |
struct | IMFS_device_t |
struct | IMFS_link_t |
struct | IMFS_sym_link_t |
struct | IMFS_filebase_t |
struct | IMFS_memfile_t |
struct | IMFS_linearfile_t |
union | IMFS_file_t |
struct | IMFS_fifo_t |
struct | IMFS_generic_t |
struct | IMFS_linearfile_context |
struct | IMFS_mknod_controls |
struct | IMFS_fs_info_t |
struct | IMFS_mount_data |
Macros | |
#define | IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK 128 |
#define | IMFS_MEMFILE_BYTES_PER_BLOCK imfs_memfile_bytes_per_block |
#define | IMFS_MEMFILE_BLOCK_SLOTS (IMFS_MEMFILE_BYTES_PER_BLOCK / sizeof(void *)) |
#define | FIRST_INDIRECT (0) |
#define | LAST_INDIRECT (IMFS_MEMFILE_BLOCK_SLOTS - 1) |
#define | FIRST_DOUBLY_INDIRECT (LAST_INDIRECT + 1) |
#define | LAST_DOUBLY_INDIRECT |
#define | FIRST_TRIPLY_INDIRECT (LAST_DOUBLY_INDIRECT + 1) |
#define | LAST_TRIPLY_INDIRECT |
#define | IMFS_MEMFILE_MAXIMUM_SIZE (LAST_TRIPLY_INDIRECT * IMFS_MEMFILE_BYTES_PER_BLOCK) |
#define | IMFS_NAME_MAX _POSIX_NAME_MAX |
#define | IMFS_NODE_CONTROL_INITIALIZER(handlers, init, destroy) |
Initializer for an IMFS node control. More... | |
#define | IMFS_NODE_INITIALIZER(node_control, name, namelen, mode) |
Initializer for an IMFS node. More... | |
#define | IMFS_assert(_x) |
#define | IMFS_STAT_FMT_HARD_LINK 0 |
Typedefs | |
typedef struct IMFS_jnode_tt | IMFS_jnode_t |
typedef uint8_t * | block_p |
typedef block_p * | block_ptr |
Functions | |
int | IMFS_initialize (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data) |
int | IMFS_initialize_support (rtems_filesystem_mount_table_entry_t *mt_entry, const void *data) |
void | IMFS_fsunmount (rtems_filesystem_mount_table_entry_t *mt_entry) |
Unmount this instance of IMFS. | |
int | rtems_tarfs_load (const char *mountpoint, uint8_t *tar_image, size_t tar_size) |
RTEMS load tarfs. More... | |
void | IMFS_node_destroy (IMFS_jnode_t *node) |
Destroy an IMFS node. | |
int | IMFS_node_clone (rtems_filesystem_location_info_t *loc) |
Clone an IMFS node. | |
void | IMFS_node_free (const rtems_filesystem_location_info_t *loc) |
Free an IMFS node. | |
int | IMFS_stat (const rtems_filesystem_location_info_t *loc, struct stat *buf) |
Perform a status processing for the IMFS. More... | |
int | IMFS_stat_file (const rtems_filesystem_location_info_t *loc, struct stat *buf) |
void | IMFS_eval_path (rtems_filesystem_eval_path_context_t *ctx) |
IMFS evaluation node support. | |
void | IMFS_eval_path_devfs (rtems_filesystem_eval_path_context_t *ctx) |
IMFS device filesystem evaluation node support. | |
int | IMFS_link (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *targetloc, const char *name, size_t namelen) |
Create a new IMFS link node. More... | |
int | IMFS_chown (const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group) |
Change the owner of IMFS. More... | |
int | IMFS_mknod (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, mode_t mode, dev_t dev) |
Create an IMFS node. More... | |
IMFS_jnode_t * | IMFS_initialize_node (IMFS_jnode_t *node, const IMFS_node_control *node_control, const char *name, size_t namelen, mode_t mode, void *arg) |
IMFS_jnode_t * | IMFS_create_node (const rtems_filesystem_location_info_t *parentloc, const IMFS_node_control *node_control, size_t node_size, const char *name, size_t namelen, mode_t mode, void *arg) |
Create an IMFS node. More... | |
int | IMFS_add_node (const char *path, IMFS_jnode_t *node, void *arg) |
Adds an IMFS node. More... | |
int | IMFS_make_node (const char *path, mode_t mode, const IMFS_node_control *node_control, size_t node_size, void *context) |
int | IMFS_make_linearfile (const char *path, mode_t mode, const void *data, size_t size) |
Makes a linear IMFS file. More... | |
int | IMFS_mount (rtems_filesystem_mount_table_entry_t *mt_entry) |
Mount an IMFS. | |
int | IMFS_unmount (rtems_filesystem_mount_table_entry_t *mt_entry) |
Unmount an IMFS. | |
int | IMFS_utime (const rtems_filesystem_location_info_t *loc, time_t actime, time_t modtime) |
Set IMFS file access and modification times. More... | |
int | IMFS_fchmod (const rtems_filesystem_location_info_t *loc, mode_t mode) |
Change the IMFS file mode. | |
int | IMFS_symlink (const rtems_filesystem_location_info_t *parentloc, const char *name, size_t namelen, const char *target) |
Create a new IMFS symbolic link node. More... | |
ssize_t | IMFS_readlink (const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize) |
Put IMFS symbolic link into buffer. More... | |
int | IMFS_rename (const rtems_filesystem_location_info_t *oldparentloc, const rtems_filesystem_location_info_t *oldloc, const rtems_filesystem_location_info_t *newparentloc, const char *name, size_t namelen) |
Rename the IMFS. More... | |
int | IMFS_rmnod (const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc) |
IMFS node removal handler. More... | |
Variables | |
const int | imfs_memfile_bytes_per_block |
const IMFS_mknod_control | IMFS_mknod_control_dir_default |
const IMFS_mknod_control | IMFS_mknod_control_dir_minimal |
const IMFS_mknod_control | IMFS_mknod_control_device |
const IMFS_mknod_control | IMFS_mknod_control_memfile |
const IMFS_node_control | IMFS_node_control_linfile |
const IMFS_mknod_control | IMFS_mknod_control_fifo |
const IMFS_mknod_control | IMFS_mknod_control_enosys |
const rtems_filesystem_limits_and_options_t | IMFS_LIMITS_AND_OPTIONS |
IMFS Memory File Handlers | |
This section contains the set of handlers used to process operations on IMFS memory file nodes. The memory files are created in memory using malloc'ed memory. Thus any data stored in one of these files is lost at system shutdown unless special arrangements to copy the data to some type of non-volailte storage are made by the application. | |
ssize_t | IMFS_memfile_write (IMFS_memfile_t *memfile, off_t start, const unsigned char *source, unsigned int length) |
IMFS Device Node Handlers | |
This section contains the set of handlers used to map operations on IMFS device nodes onto calls to the RTEMS Classic API IO Manager. | |
int | device_open (rtems_libio_t *iop, const char *pathname, int oflag, mode_t mode) |
int | device_close (rtems_libio_t *iop) |
ssize_t | device_read (rtems_libio_t *iop, void *buffer, size_t count) |
ssize_t | device_write (rtems_libio_t *iop, const void *buffer, size_t count) |
int | device_ioctl (rtems_libio_t *iop, ioctl_command_t command, void *buffer) |
int | device_ftruncate (rtems_libio_t *iop, off_t length) |
In-Memory File System Support.
#define IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK 128 |
IMFS "memfile" information
The data structure for the in-memory "memfiles" is based on classic UNIX.
block_ptr is a pointer to a block of IMFS_MEMFILE_BYTES_PER_BLOCK in length which could be data or a table of pointers to blocks.
Setting IMFS_MEMFILE_BYTES_PER_BLOCK to different values has a significant impact on the maximum file size supported as well as the amount of memory wasted due to internal file fragmentation. The following is a list of maximum file sizes based on various settings
#define IMFS_NODE_CONTROL_INITIALIZER | ( | handlers, | |
init, | |||
destroy | |||
) |
Initializer for an IMFS node control.
handlers | The file system node handlers. |
init | The node initialization method. |
destroy | The node destruction method. |
#define IMFS_NODE_INITIALIZER | ( | node_control, | |
name, | |||
namelen, | |||
mode | |||
) |
Initializer for an IMFS node.
Initialize the node control with IMFS_NODE_CONTROL_INITIALIZER().
node_control | The node control of the IMFS node. |
name | The name of the IMFS node. |
namelen | The length of the name of the IMFS node. |
mode | The mode of the IMFS node. |
#define LAST_DOUBLY_INDIRECT |
#define LAST_TRIPLY_INDIRECT |
int IMFS_add_node | ( | const char * | path, |
IMFS_jnode_t * | node, | ||
void * | arg | ||
) |
Adds an IMFS node.
Initialize the node with IMFS_NODE_INITIALIZER(), IMFS_node_preinitialize(), IMFS_GENERIC_NODE_INITIALIZER(), or IMFS_generic_node_preinitialize().
path | The path of parent directories for the IMFS node to add. |
node | The IMFS node to add. |
arg | The argument passed to the node initialization method. |
0 | Successful operation. |
-1 | An error occurred. The errno indicates the error. |
int IMFS_chown | ( | const rtems_filesystem_location_info_t * | loc, |
uid_t | owner, | ||
gid_t | group | ||
) |
Change the owner of IMFS.
This routine is the implementation of the chown() system call for the IMFS.
IMFS_jnode_t* IMFS_create_node | ( | const rtems_filesystem_location_info_t * | parentloc, |
const IMFS_node_control * | node_control, | ||
size_t | node_size, | ||
const char * | name, | ||
size_t | namelen, | ||
mode_t | mode, | ||
void * | arg | ||
) |
Create an IMFS node.
Create an IMFS filesystem node of an arbitrary type that is NOT the root directory node.
int IMFS_link | ( | const rtems_filesystem_location_info_t * | parentloc, |
const rtems_filesystem_location_info_t * | targetloc, | ||
const char * | name, | ||
size_t | namelen | ||
) |
Create a new IMFS link node.
The following rouine creates a new link node under parent with the name given in name. The link node is set to point to the node at to_loc.
int IMFS_make_linearfile | ( | const char * | path, |
mode_t | mode, | ||
const void * | data, | ||
size_t | size | ||
) |
Makes a linear IMFS file.
path | The path to the new linear IMFS file. |
mode | The file mode permissions. S_IFREG is set by the function. |
data | The begin of linear file data area. |
size | The size of the linear file data area in bytes. |
0 | Successful operation. |
-1 | An error occurred. The errno indicates the error. |
int IMFS_mknod | ( | const rtems_filesystem_location_info_t * | parentloc, |
const char * | name, | ||
size_t | namelen, | ||
mode_t | mode, | ||
dev_t | dev | ||
) |
Create an IMFS node.
Routine to create a node in the IMFS file system.
ssize_t IMFS_readlink | ( | const rtems_filesystem_location_info_t * | loc, |
char * | buf, | ||
size_t | bufsize | ||
) |
Put IMFS symbolic link into buffer.
The following rouine puts the symbolic links destination name into buff.
int IMFS_rename | ( | const rtems_filesystem_location_info_t * | oldparentloc, |
const rtems_filesystem_location_info_t * | oldloc, | ||
const rtems_filesystem_location_info_t * | newparentloc, | ||
const char * | name, | ||
size_t | namelen | ||
) |
Rename the IMFS.
The following rouine creates a new link node under parent with the name given in name and removes the old.
int IMFS_rmnod | ( | const rtems_filesystem_location_info_t * | parentloc, |
const rtems_filesystem_location_info_t * | loc | ||
) |
IMFS node removal handler.
This file contains the handler used to remove a node when a file type does not require special actions.
int IMFS_stat | ( | const rtems_filesystem_location_info_t * | loc, |
struct stat * | buf | ||
) |
Perform a status processing for the IMFS.
This routine provides a stat for the IMFS file system.
int IMFS_symlink | ( | const rtems_filesystem_location_info_t * | parentloc, |
const char * | name, | ||
size_t | namelen, | ||
const char * | target | ||
) |
Create a new IMFS symbolic link node.
The following rouine creates a new symbolic link node under parent with the name given in name. The node is set to point to the node at to_loc.
int IMFS_utime | ( | const rtems_filesystem_location_info_t * | loc, |
time_t | actime, | ||
time_t | modtime | ||
) |
Set IMFS file access and modification times.
This routine is the implementation of the utime() system call for the IMFS.
int rtems_tarfs_load | ( | const char * | mountpoint, |
uint8_t * | tar_image, | ||
size_t | tar_size | ||
) |
RTEMS load tarfs.
This file implements the "mount" procedure for tar-based IMFS extensions. The TAR is not actually mounted under the IMFS. Directories from the TAR file are created as usual in the IMFS. File entries are created as IMFS_LINEAR_FILE nodes with their nods pointing to addresses in the TAR image.
Here we create the mountpoint directory and load the tarfs at that node. Once the IMFS has been mounted, we work through the tar image and perform as follows:
TAR file format:
Checksum: