From 29e92b090c8bc35745aa5c89231ce806bcb11e57 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Mon, 31 May 2010 13:56:37 +0000 Subject: 2010-05-31 Chris Johns * libcsupport/Makefile.am: Add mount-mgr.c. * libcsupport/src/mount-mgr.c: New. * include/rtems/fs.h: Added rtems_filesystem_location_mount. * libcsupport/include/rtems/libio.h, libcsupport/src/mount.c: New mount interface. It is similar to Linux. * libcsupport/include/rtems/libio_.h: Remove the init_fs_mount_table call. * libcsupport/src/base_fs.c: Remove init_fs_mount_table_call. Use the new mount call. Remove setting the root node in the global pathloc. Mount does this now. * libcsupport/src/privateenv.c: Remove the hack to set the root mount table entry in the environment. * libcsupport/src/unmount.cL Free the target string. * libblock/src/bdpart-mount.c: New mount API. * libfs/src/devfs/devfs.h, libfs/src/devfs/devfs_init.c, libfs/src/dosfs/dosfs.h, libfs/src/dosfs/msdos.h, libfs/src/dosfs/msdos_init.c, libfs/src/imfs/imfs.h, libfs/src/imfs/imfs_eval.c, libfs/src/imfs/imfs_init.c, libfs/src/imfs/miniimfs_init.c, libfs/src/nfsclient/src/librtemsNfs.h, libfs/src/rfs/rtems-rfs-rtems.c, libfs/src/rfs/rtems-rfs.h, libnetworking/lib/ftpfs.c, libnetworking/rtems/ftpfs.h, libnetworking/rtems/tftp.h: New mount_h API. * libfs/src/devfs/devfs_eval.c: Local include of extern ops. * libfs/src/nfsclient/src/nfs.c: New mount API. Removed the mount me call and fixed the initialisation to happen when mounting. * libmisc/Makefile.am, libmisc/shell/shellconfig.h: Remove mount filesystem files. * libmisc/fsmount/fsmount.c, libmisc/fsmount/fsmount.h: Updated to the new mount table values. * libmisc/shell/main_mount_ftp.c, libmisc/shell/main_mount_msdos.c, libmisc/shell/main_mount_rfs.c, libmisc/shell/main_mount_tftp.c: Removed. * libmisc/shell/main_mount.c: Use the new mount API. Also access the file system table for the file system types. * libnetworking/lib/tftpDriver.c: Updated to the new mount API. Fixed to allow mounting from any mount point. Also can now have more than file system mounted. * sapi/include/confdefs.h: Add file system configuration support. --- cpukit/libcsupport/include/rtems/libio.h | 138 +++++++++++++++++++++++++------ 1 file changed, 115 insertions(+), 23 deletions(-) (limited to 'cpukit/libcsupport/include/rtems/libio.h') diff --git a/cpukit/libcsupport/include/rtems/libio.h b/cpukit/libcsupport/include/rtems/libio.h index fb96e07b22..4f45ee47ac 100644 --- a/cpukit/libcsupport/include/rtems/libio.h +++ b/cpukit/libcsupport/include/rtems/libio.h @@ -209,23 +209,24 @@ typedef int (*rtems_filesystem_freenode_t)( ); typedef int (* rtems_filesystem_mount_t ) ( - rtems_filesystem_mount_table_entry_t *mt_entry /* in */ + rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ ); typedef int (* rtems_filesystem_fsmount_me_t )( - rtems_filesystem_mount_table_entry_t *mt_entry + rtems_filesystem_mount_table_entry_t *mt_entry, /* IN */ + const void *data /* IN */ ); typedef int (* rtems_filesystem_unmount_t ) ( - rtems_filesystem_mount_table_entry_t *mt_entry /* in */ + rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ ); typedef int (* rtems_filesystem_fsunmount_me_t ) ( - rtems_filesystem_mount_table_entry_t *mt_entry /* in */ + rtems_filesystem_mount_table_entry_t *mt_entry /* IN */ ); typedef rtems_filesystem_node_types_t (* rtems_filesystem_node_type_t) ( - rtems_filesystem_location_info_t *pathloc /* in */ + rtems_filesystem_location_info_t *pathloc /* IN */ ); typedef int (* rtems_filesystem_utime_t)( @@ -291,6 +292,62 @@ struct _rtems_filesystem_operations_table { rtems_filesystem_statvfs_t statvfs_h; }; +/* + * File system table used by mount to manage file systems. + */ +typedef struct _rtems_filesystem_table { + const char *type; + rtems_filesystem_fsmount_me_t mount_h; +} rtems_filesystem_table_t; + +/* + * File system table runtime loaded nodes. + */ +typedef struct _rtems_filesystem_table_node { + rtems_chain_node node; + rtems_filesystem_table_t entry; +} rtems_filesystem_table_node_t; + +/* + * Get the first entry in the filesystem table. + */ +const rtems_filesystem_table_t* rtems_filesystem_table_first( void ); + +/* + * Get the next entry in the file system table. + */ +const rtems_filesystem_table_t* +rtems_filesystem_table_next( rtems_filesystem_table_t *entry ); + +/* + * Get the first entry in the mount table. + */ +rtems_filesystem_mount_table_entry_t* +rtems_filesystem_mounts_first( void ); + +/* + * Get the next entry in the mount table. + */ +rtems_filesystem_mount_table_entry_t* +rtems_filesystem_mounts_next( rtems_filesystem_mount_table_entry_t *entry ); + +/* + * Register a file system. + */ +int +rtems_filesystem_register( + const char *type, + rtems_filesystem_fsmount_me_t mount_h +); + +/* + * Unregister a file system. + */ +int +rtems_filesystem_unregister( + const char *type +); + #if 0 /* Now in exec/include/rtems/fs.h */ @@ -313,20 +370,25 @@ struct rtems_filesystem_location_info_tt */ typedef struct { - int link_max; - int max_canon; - int max_input; - int name_max; - int path_max; - int pipe_buf; - int posix_async_io; - int posix_chown_restrictions; - int posix_no_trunc; - int posix_prio_io; - int posix_sync_io; - int posix_vdisable; + int link_max; /* count */ + int max_canon; /* max formatted input line size */ + int max_input; /* max input line size */ + int name_max; /* max name length */ + int path_max; /* max path */ + int pipe_buf; /* pipe buffer size */ + int posix_async_io; /* async IO supported on fs, 0=no, 1=yes */ + int posix_chown_restrictions; /* can chown: 0=no, 1=yes */ + int posix_no_trunc; /* error on names > max name, 0=no, 1=yes */ + int posix_prio_io; /* priority IO, 0=no, 1=yes */ + int posix_sync_io; /* file can be sync'ed, 0=no, 1=yes */ + int posix_vdisable; /* special char processing, 0=no, 1=yes */ } rtems_filesystem_limits_and_options_t; +/* + * Default pathconf settings. Override in a filesystem. + */ +extern const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf; + /* * Structure for a mount table entry. */ @@ -340,6 +402,16 @@ struct rtems_filesystem_mount_table_entry_tt { rtems_filesystem_limits_and_options_t pathconf_limits_and_options; + /* + * The target or mount point of the file system. + */ + const char *target; + + /* + * The type of filesystem or the name of the filesystem. + */ + const char *type; + /* * When someone adds a mounted filesystem on a real device, * this will need to be used. @@ -350,6 +422,26 @@ struct rtems_filesystem_mount_table_entry_tt { char *dev; }; +/** + * The pathconf setting for a file system. + */ +#define rtems_filesystem_pathconf(_mte) ((_mte)->pathconf_limits_and_options) + +/** + * The type of file system. Its name. + */ +#define rtems_filesystem_type(_mte) ((_mte)->type) + +/** + * The mount point of a file system. + */ +#define rtems_filesystem_mount_point(_mte) ((_mte)->target) + +/** + * The device entry of a file system. + */ +#define rtems_filesystem_mount_device(_mte) ((_mte)->dev) + /* * Valid RTEMS file systems options */ @@ -637,11 +729,11 @@ int unmount( ); int mount( - rtems_filesystem_mount_table_entry_t **mt_entry, - const rtems_filesystem_operations_table *fs_ops, - rtems_filesystem_options_t fsoptions, - const char *device, - const char *mount_point + const char *source, + const char *target, + const char *filesystemtype, + rtems_filesystem_options_t options, + const void *data ); /* @@ -649,7 +741,7 @@ int mount( */ typedef struct { - const rtems_filesystem_operations_table *fs_ops; + const char *type; rtems_filesystem_options_t fsoptions; const char *device; const char *mount_point; -- cgit v1.2.3