diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-26 20:17:13 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-10-26 20:17:13 +0000 |
commit | 657e1bf66b9406cd4c18af1265443e9ebf006f39 (patch) | |
tree | c56bea6d27d9a6a19ac1f139839545db8b63347c /c/src/lib/libc/imfs_init.c | |
parent | Patch from Gerwin Pfab <pb@schenk.isar.de> to leave dispatching (diff) | |
download | rtems-657e1bf66b9406cd4c18af1265443e9ebf006f39.tar.bz2 |
Added initial cut at miniIMFS which leaves out memfile and directory
readdir support. The next step is to add a mount table and configure
either the miniIMFS or the full IMFS at the application level.
Diffstat (limited to 'c/src/lib/libc/imfs_init.c')
-rw-r--r-- | c/src/lib/libc/imfs_init.c | 106 |
1 files changed, 8 insertions, 98 deletions
diff --git a/c/src/lib/libc/imfs_init.c b/c/src/lib/libc/imfs_init.c index a38fa89c33..8f44a4e2cd 100644 --- a/c/src/lib/libc/imfs_init.c +++ b/c/src/lib/libc/imfs_init.c @@ -26,7 +26,7 @@ #include <stdio.h> #endif -/* +/* * IMFS file system operations table */ @@ -44,7 +44,7 @@ rtems_filesystem_operations_table IMFS_ops = { IMFS_initialize, IMFS_unmount, IMFS_fsunmount, - IMFS_utime, + IMFS_utime, IMFS_evaluate_link, IMFS_symlink, IMFS_readlink @@ -58,101 +58,11 @@ int IMFS_initialize( rtems_filesystem_mount_table_entry_t *temp_mt_entry ) { - IMFS_fs_info_t *fs_info; - IMFS_jnode_t *jnode; - - /* - * Create the root node - */ - - temp_mt_entry->mt_fs_root.node_access = IMFS_create_node( - NULL, - IMFS_DIRECTORY, - "", - ( S_IRWXO | S_IRWXG| S_IRWXU ), - NULL - ); - - temp_mt_entry->mt_fs_root.handlers = &IMFS_directory_handlers; - temp_mt_entry->mt_fs_root.ops = &IMFS_ops; - temp_mt_entry->pathconf_limits_and_options = IMFS_LIMITS_AND_OPTIONS; - - /* - * Create custom file system data. - */ - fs_info = calloc( 1, sizeof( IMFS_fs_info_t ) ); - if ( !fs_info ){ - free(temp_mt_entry->mt_fs_root.node_access); - return 1; - } - temp_mt_entry->fs_info = fs_info; - - /* - * Set st_ino for the root to 1. - */ - - fs_info->ino_count = 1; - - jnode = temp_mt_entry->mt_fs_root.node_access; - jnode->st_ino = fs_info->ino_count; - - return 0; -} - -#define jnode_get_control( jnode ) \ - (&jnode->info.directory.Entries) - -#define jnode_has_no_children( jnode ) \ - Chain_Is_empty( jnode_get_control( jnode ) ) - -#define jnode_has_children( jnode ) \ - ( ! jnode_has_no_children( jnode ) ) - -#define jnode_get_first_child( jnode ) \ - ((IMFS_jnode_t *)( Chain_Head( jnode_get_control( jnode ) )->next)) - - -int IMFS_fsunmount( - rtems_filesystem_mount_table_entry_t *temp_mt_entry -) -{ - IMFS_jnode_t *jnode; - IMFS_jnode_t *next; - rtems_filesystem_location_info_t loc; - int result = 0; - - /* - * Traverse tree that starts at the mt_fs_root and deallocate memory - * associated memory space - */ - - jnode = (IMFS_jnode_t *)temp_mt_entry->mt_fs_root.node_access; - - do { - next = jnode->Parent; - loc.node_access = (void *)jnode; - - if ( jnode->type != IMFS_DIRECTORY ) { - result = IMFS_unlink( &loc ); - if (result != 0) - return -1; - jnode = next; - } else if ( jnode_has_no_children( jnode ) ) { - result = IMFS_unlink( &loc ); - if (result != 0) - return -1; - jnode = next; - } - if ( jnode != NULL ) { - if ( jnode->type == IMFS_DIRECTORY ) { - if ( jnode_has_children( jnode ) ) - jnode = jnode_get_first_child( jnode ); - } - } - } while (jnode != NULL); - + IMFS_initialize_support( + temp_mt_entry, + &IMFS_ops, + &IMFS_memfile_handlers, + &IMFS_directory_handlers + ); return 0; } - - - |