89#define IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK 128
90 extern const size_t imfs_memfile_bytes_per_block;
92#define IMFS_MEMFILE_BYTES_PER_BLOCK imfs_memfile_bytes_per_block
93#define IMFS_MEMFILE_BLOCK_SLOTS \
94 (IMFS_MEMFILE_BYTES_PER_BLOCK / sizeof(void *))
96typedef uint8_t *block_p;
97typedef block_p *block_ptr;
102#define FIRST_INDIRECT (0)
103#define LAST_INDIRECT (IMFS_MEMFILE_BLOCK_SLOTS - 1)
105#define FIRST_DOUBLY_INDIRECT (LAST_INDIRECT + 1)
106#define LAST_DOUBLY_INDIRECT \
108 (IMFS_MEMFILE_BLOCK_SLOTS * IMFS_MEMFILE_BLOCK_SLOTS))
110#define FIRST_TRIPLY_INDIRECT (LAST_DOUBLY_INDIRECT + 1)
111#define LAST_TRIPLY_INDIRECT \
112 (LAST_DOUBLY_INDIRECT +\
113 (IMFS_MEMFILE_BLOCK_SLOTS * \
114 IMFS_MEMFILE_BLOCK_SLOTS * IMFS_MEMFILE_BLOCK_SLOTS))
116#define IMFS_MEMFILE_MAXIMUM_SIZE \
117 ((LAST_TRIPLY_INDIRECT + 1) * IMFS_MEMFILE_BYTES_PER_BLOCK)
264#define IMFS_NAME_MAX _POSIX_NAME_MAX
277 unsigned short reference_count;
292typedef void *(*IMFS_memfile_allocator)(void);
341#define IMFS_MEMFILE_DEFAULT_OPS \
343 .allocate_block = IMFS_default_allocate_block, \
344 .free_block = IMFS_default_deallocate_block, \
345 .get_free_space = IMFS_default_free_space \
378 block_ptr doubly_indirect;
379 block_ptr triply_indirect;
474extern int IMFS_initialize(
479extern int IMFS_initialize_support(
543 const char *mountpoint,
544 const void *tar_image,
573extern int IMFS_stat_file(
656static inline bool IMFS_is_imfs_instance(
670#define IMFS_NODE_CONTROL_INITIALIZER( handlers, init, destroy ) \
674 IMFS_node_remove_default, \
690#define IMFS_NODE_INITIALIZER( node_control, name, namelen, mode ) \
720static inline void IMFS_node_preinitialize(
728 node->control = node_control;
730 node->namelen = namelen;
731 node->st_mode = mode;
749extern int IMFS_make_node(
794#define IMFS_GENERIC_INITIALIZER( handlers, init, destroy ) \
795 IMFS_NODE_CONTROL_INITIALIZER( handlers, init, destroy )
804#define IMFS_GENERIC_CONTROL_INITIALIZER( handlers, init, destroy ) \
805 IMFS_NODE_CONTROL_INITIALIZER( handlers, init, destroy )
817#define IMFS_GENERIC_NODE_INITIALIZER( node_control, name, namelen, mode ) \
818 { IMFS_NODE_INITIALIZER( node_control, name, namelen, mode ), NULL }
833static inline void IMFS_generic_node_preinitialize(
841 IMFS_node_preinitialize( &node->Node, node_control, name, namelen, mode );
944extern ssize_t IMFS_memfile_write(
947 const unsigned char *source,
961extern int device_open(
963 const char *pathname,
968extern int device_close(
972extern ssize_t device_read(
978extern ssize_t device_write(
984extern int device_ioctl(
986 ioctl_command_t command,
990extern int device_ftruncate(
1006 struct timespec
times[2]
1095 #define IMFS_assert(_x) assert(_x)
1097 #define IMFS_assert(_x)
1104 loc->handlers = node->control->handlers;
1107static inline void IMFS_add_to_directory(
1114 entry_node->Parent = dir_node;
1115 rtems_chain_append_unprotected( &dir->Entries, &entry_node->Node );
1118static inline void IMFS_remove_from_directory(
IMFS_jnode_t *node )
1120 IMFS_assert( node->Parent != NULL );
1121 node->Parent = NULL;
1122 rtems_chain_extract_unprotected( &node->Node );
1125static inline bool IMFS_is_directory(
const IMFS_jnode_t *node )
1127 return S_ISDIR( node->st_mode );
1130#define IMFS_STAT_FMT_HARD_LINK 0
1132static inline bool IMFS_is_hard_link( mode_t mode )
1134 return ( mode & S_IFMT ) == IMFS_STAT_FMT_HARD_LINK;
1137static inline ino_t IMFS_node_to_ino(
const IMFS_jnode_t *node )
1139 return (ino_t) ((uintptr_t) node);
1149static inline void *IMFS_generic_get_context_by_node(
1155 return generic->context;
1158static inline void *IMFS_generic_get_context_by_location(
1162 return loc->node_access_2;
1165static inline void *IMFS_generic_get_context_by_iop(
1169 return IMFS_generic_get_context_by_location( &iop->pathinfo );
1172static inline dev_t IMFS_generic_get_device_identifier_by_node(
1176 return rtems_filesystem_make_dev_t_from_pointer( node );
clock_t times(struct tms *ptms)
Definition: __times.c:97
This header file provides the interfaces of the Assert Handler.
void IMFS_do_nothing_destroy(IMFS_jnode_t *node)
Does nothing.
Definition: imfs_node.c:125
IMFS_jnode_t * IMFS_node_initialize_default(IMFS_jnode_t *node, void *arg)
Returns the node and does nothing else.
Definition: imfs_initsupp.c:100
IMFS_jnode_t * IMFS_node_remove_default(IMFS_jnode_t *node)
Returns the node and does nothing else.
Definition: imfs_node.c:118
void(* IMFS_node_control_destroy)(IMFS_jnode_t *node)
Destroys an IMFS node.
Definition: imfs.h:218
IMFS_jnode_t *(* IMFS_node_control_remove)(IMFS_jnode_t *node)
Prepares the removal of an IMFS node from its parent directory.
Definition: imfs.h:192
IMFS_jnode_t * IMFS_node_initialize_generic(IMFS_jnode_t *node, void *arg)
Returns the node and sets the generic node context.
Definition: imfs_make_generic_node.c:44
IMFS_jnode_t *(* IMFS_node_control_initialize)(IMFS_jnode_t *node, void *arg)
Initializes an IMFS node.
Definition: imfs.h:140
int IMFS_make_generic_node(const char *path, mode_t mode, const IMFS_node_control *node_control, void *context)
Makes a generic IMFS node.
Definition: imfs_make_generic_node.c:56
void IMFS_node_destroy_default(IMFS_jnode_t *node)
Frees the node.
Definition: imfs_node_destroy_default.c:44
int IMFS_statvfs(const rtems_filesystem_location_info_t *loc, struct statvfs *buf)
Sets buf with the IMFS statistics.
Definition: imfs_statvfs.c:41
int IMFS_chown(const rtems_filesystem_location_info_t *loc, uid_t owner, gid_t group)
Change the owner of IMFS.
Definition: imfs_chown.c:47
int IMFS_rmnod(const rtems_filesystem_location_info_t *parentloc, const rtems_filesystem_location_info_t *loc)
IMFS node removal handler.
Definition: imfs_rmnod.c:46
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.
Definition: imfs_link.c:45
void IMFS_default_deallocate_block(void *)
The default imfs block deallocator.
Definition: imfs_memfile.c:860
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.
Definition: imfs_rename.c:69
void *(* IMFS_memfile_allocator)(void)
The type of allocator function pointer.
Definition: imfs.h:292
void IMFS_fsunmount(rtems_filesystem_mount_table_entry_t *mt_entry)
Unmount this instance of IMFS.
Definition: imfs_fsunmount.c:55
int IMFS_mount(rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
Mount an IMFS.
Definition: imfs_mount.c:46
int IMFS_make_linearfile(const char *path, mode_t mode, const void *data, size_t size)
Makes a linear IMFS file.
Definition: imfs_make_linfile.c:34
void * IMFS_default_allocate_block(void)
The default imfs block allocator.
Definition: imfs_memfile.c:855
int rtems_tarfs_load(const char *mountpoint, const void *tar_image, size_t tar_size)
RTEMS load tarfs.
Definition: imfs_load_tar.c:46
void IMFS_node_free(const rtems_filesystem_location_info_t *loc)
Free an IMFS node.
Definition: imfs_node.c:107
int IMFS_unmount(rtems_filesystem_mount_table_entry_t *mt_entry)
Unmount an IMFS.
Definition: imfs_unmount.c:46
void IMFS_node_destroy(IMFS_jnode_t *node)
Destroy an IMFS node.
Definition: imfs_node.c:100
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.
Definition: imfs_symlink.c:47
int IMFS_add_node(const char *path, IMFS_jnode_t *node, void *arg)
Adds an IMFS node.
Definition: imfs_add_node.c:42
int IMFS_node_clone(rtems_filesystem_location_info_t *loc)
Clone an IMFS node.
Definition: imfs_node.c:91
size_t IMFS_default_free_space(void)
The default free space calculator.
Definition: imfs_memfile.c:865
int IMFS_utimens(const rtems_filesystem_location_info_t *loc, struct timespec times[2])
Set IMFS file access and modification times.
Definition: imfs_utimens.c:44
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.
Definition: imfs_mknod.c:63
void IMFS_eval_path(rtems_filesystem_eval_path_context_t *ctx)
IMFS evaluation node support.
Definition: imfs_eval.c:199
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.
Definition: imfs_creat.c:45
void(* IMFS_memfile_deallocator)(void *memory)
The type of deallocator function pointer.
Definition: imfs.h:297
int IMFS_stat(const rtems_filesystem_location_info_t *loc, struct stat *buf)
Perform a status processing for the IMFS.
Definition: imfs_stat.c:46
size_t(* IMFS_memfile_free_space)(void)
The get_free_space function pointer.
Definition: imfs.h:304
ssize_t IMFS_readlink(const rtems_filesystem_location_info_t *loc, char *buf, size_t bufsize)
Put IMFS symbolic link into buffer.
Definition: imfs_symlink.c:76
int IMFS_fchmod(const rtems_filesystem_location_info_t *loc, mode_t mode)
Change the IMFS file mode.
Definition: imfs_fchmod.c:43
void IMFS_eval_path_devfs(rtems_filesystem_eval_path_context_t *ctx)
IMFS device filesystem evaluation node support.
Definition: imfs_eval_devfs.c:123
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition: io.h:103
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition: io.h:115
LibIO Internal Interface.
POSIX FIFO/pipe File System Support.
This header file provides the statvfs() and fstatvfs() interfaces.
This structure represents a chain node.
Definition: chain.h:78
The ops table for user defined allocator-deallocator for IMFS memfile data blocks.
Definition: imfs.h:314
IMFS node control.
Definition: imfs.h:241
File system node operations table.
Definition: libio.h:1008
File system operations table.
Definition: libio.h:475
Definition: intercom.c:87
Path evaluation context.
Definition: libio.h:105
Contain file system specific information which is required to support fpathconf().
Definition: libio.h:1294
File system location.
Definition: fs.h:72
Mount table entry.
Definition: libio.h:1661
An open file data structure.
Definition: libio.h:1325
This union represents a chain control block.
Definition: chain.h:96