mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 04:51:15 +08:00
2010-05-31 Chris Johns <chrisj@rtems.org>
* 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.
This commit is contained in:
@@ -1,3 +1,53 @@
|
||||
2010-05-31 Chris Johns <chrisj@rtems.org>
|
||||
|
||||
* 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.
|
||||
|
||||
2010-05-29 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
PR 1531/newlib:
|
||||
|
||||
@@ -52,6 +52,11 @@ struct rtems_filesystem_location_info_tt
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry;
|
||||
};
|
||||
|
||||
/*
|
||||
* Return the mount table entry for a path location.
|
||||
*/
|
||||
#define rtems_filesystem_location_mount(_pl) ((_pl)->mt_entry)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/bdpart.h>
|
||||
#include <rtems/dosfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
|
||||
rtems_status_code rtems_bdpart_mount(
|
||||
@@ -99,11 +98,11 @@ rtems_status_code rtems_bdpart_mount(
|
||||
|
||||
/* Mount */
|
||||
rv = mount(
|
||||
NULL,
|
||||
&msdos_ops,
|
||||
0,
|
||||
logical_disk_name,
|
||||
mount_point
|
||||
mount_point,
|
||||
"msdos",
|
||||
0,
|
||||
NULL
|
||||
);
|
||||
if (rv != 0) {
|
||||
rmdir( mount_point);
|
||||
|
||||
@@ -44,7 +44,7 @@ ASSOCIATION_C_FILES = src/assoclocalbyname.c \
|
||||
src/assocremotebylocal.c src/assocremotebyname.c
|
||||
|
||||
BASE_FS_C_FILES = src/base_fs.c src/mount.c src/unmount.c src/libio.c \
|
||||
src/libio_init.c \
|
||||
src/mount-mgr.c src/libio_init.c \
|
||||
src/libio_sockets.c src/eval.c src/fs_null_handlers.c src/privateenv.c \
|
||||
src/open_dev_console.c src/__usrenv.c
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -271,8 +271,6 @@ int rtems_filesystem_prefix_separators(
|
||||
|
||||
void rtems_filesystem_initialize(void);
|
||||
|
||||
int init_fs_mount_table(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
void rtems_filesystem_initialize( void )
|
||||
{
|
||||
int status;
|
||||
rtems_filesystem_mount_table_entry_t *entry;
|
||||
const rtems_filesystem_mount_table_t *mt;
|
||||
rtems_filesystem_location_info_t loc;
|
||||
|
||||
@@ -46,9 +45,6 @@ void rtems_filesystem_initialize( void )
|
||||
|
||||
rtems_filesystem_umask = 022;
|
||||
|
||||
|
||||
init_fs_mount_table();
|
||||
|
||||
/*
|
||||
* mount the first filesystem.
|
||||
*/
|
||||
@@ -58,8 +54,7 @@ void rtems_filesystem_initialize( void )
|
||||
|
||||
mt = &rtems_filesystem_mount_table[0];
|
||||
|
||||
status = mount(
|
||||
&entry, mt->fs_ops, mt->fsoptions, mt->device, mt->mount_point );
|
||||
status = mount( mt->device, mt->mount_point, mt->type, mt->fsoptions, NULL );
|
||||
|
||||
if ( status == -1 )
|
||||
rtems_fatal_error_occurred( 0xABCD0002 );
|
||||
@@ -86,7 +81,6 @@ void rtems_filesystem_initialize( void )
|
||||
*
|
||||
* Till Straumann, 10/25/2002
|
||||
*/
|
||||
rtems_filesystem_root = entry->mt_fs_root;
|
||||
/* Clone the root pathloc */
|
||||
rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
|
||||
rtems_filesystem_root = loc;
|
||||
|
||||
+173
-116
@@ -33,24 +33,72 @@
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
|
||||
rtems_chain_control rtems_filesystem_mount_table_control;
|
||||
/*
|
||||
* External defined by confdefs.h or the user.
|
||||
*/
|
||||
extern const rtems_filesystem_table_t configuration_filesystem_table[];
|
||||
|
||||
/*
|
||||
* Prototypes that probably should be somewhere else.
|
||||
* Points to a list of filesystems added at runtime.
|
||||
*/
|
||||
rtems_chain_control *rtems_filesystem_table;
|
||||
|
||||
/*
|
||||
* Mount table list.
|
||||
*/
|
||||
rtems_chain_control rtems_filesystem_mount_table_control;
|
||||
bool rtems_filesystem_mount_table_control_init;
|
||||
|
||||
/*
|
||||
* Default pathconfs.
|
||||
*/
|
||||
const rtems_filesystem_limits_and_options_t rtems_filesystem_default_pathconf = {
|
||||
5, /* link_max: count */
|
||||
128, /* max_canon: max formatted input line size */
|
||||
7, /* max_input: max input line size */
|
||||
255, /* name_max: max name */
|
||||
255, /* path_max: max path */
|
||||
1024, /* pipe_buf: pipe buffer size */
|
||||
0, /* posix_async_io: async IO supported on fs, 0=no, 1=yes */
|
||||
0 , /* posix_chown_restrictions: can chown: 0=no, 1=yes */
|
||||
1, /* posix_no_trunc: error on filenames > max name, 0=no, 1=yes */
|
||||
0, /* posix_prio_io: priority IO, 0=no, 1=yes */
|
||||
0, /* posix_sync_io: file can be sync'ed, 0=no, 1=yes */
|
||||
0 /* posix_vdisable: special char processing, 0=no, 1=yes */
|
||||
};
|
||||
|
||||
/*
|
||||
* Is_node_fs_root
|
||||
*
|
||||
* This routine will run through the entries that currently exist in the
|
||||
* mount table chain. For each entry in the mount table chain it will
|
||||
* compare the mount tables root node to the node describing the selected
|
||||
* mount point. If any match is found true is returned else false is
|
||||
* returned.
|
||||
*
|
||||
*/
|
||||
|
||||
int init_fs_mount_table( void );
|
||||
static bool Is_node_fs_root(
|
||||
rtems_filesystem_location_info_t *loc
|
||||
);
|
||||
)
|
||||
{
|
||||
rtems_chain_node *the_node;
|
||||
rtems_filesystem_mount_table_entry_t *the_mount_entry;
|
||||
|
||||
|
||||
/*
|
||||
* XXX
|
||||
*/
|
||||
|
||||
#define FOUND 0
|
||||
#define NOT_FOUND -1
|
||||
/*
|
||||
* For each mount table entry
|
||||
*/
|
||||
if ( rtems_filesystem_mount_table_control_init ) {
|
||||
for ( the_node = rtems_chain_first( &rtems_filesystem_mount_table_control );
|
||||
!rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node );
|
||||
the_node = rtems_chain_next( the_node ) ) {
|
||||
the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node;
|
||||
if ( the_mount_entry->mt_fs_root.node_access == loc->node_access )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* mount
|
||||
@@ -68,27 +116,25 @@ static bool Is_node_fs_root(
|
||||
*/
|
||||
|
||||
int mount(
|
||||
rtems_filesystem_mount_table_entry_t **mt_entry,
|
||||
const rtems_filesystem_operations_table *fs_ops,
|
||||
rtems_filesystem_options_t options,
|
||||
const char *device,
|
||||
const char *mount_point
|
||||
)
|
||||
const char *source,
|
||||
const char *target,
|
||||
const char *filesystemtype,
|
||||
rtems_filesystem_options_t options,
|
||||
const void *data
|
||||
)
|
||||
{
|
||||
const rtems_filesystem_table_t *entry;
|
||||
rtems_filesystem_location_info_t loc;
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry = NULL;
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry = NULL;
|
||||
rtems_filesystem_location_info_t *loc_to_free = NULL;
|
||||
size_t size;
|
||||
|
||||
/* XXX add code to check for required operations */
|
||||
|
||||
/*
|
||||
* Is there a file system operations table?
|
||||
* If mount is ever called we allocate the mount table control structure.
|
||||
*/
|
||||
|
||||
if ( fs_ops == NULL ) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
if ( !rtems_filesystem_mount_table_control_init ) {
|
||||
rtems_filesystem_mount_table_control_init = true;
|
||||
rtems_chain_initialize_empty ( &rtems_filesystem_mount_table_control );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -101,45 +147,88 @@ int mount(
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Do they support being mounted at all ? */
|
||||
if ( !fs_ops->fsmount_me_h ) {
|
||||
errno = ENOTSUP;
|
||||
goto cleanup_and_bail;
|
||||
/*
|
||||
* Check the type.
|
||||
*/
|
||||
if (!filesystemtype) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (strlen(filesystemtype) >= 128) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check the configuration table filesystems then check any runtime added
|
||||
* file systems.
|
||||
*/
|
||||
entry = &configuration_filesystem_table[0];
|
||||
while (entry->type) {
|
||||
if (strcmp (filesystemtype, entry->type) == 0)
|
||||
break;
|
||||
++entry;
|
||||
}
|
||||
|
||||
if (!entry->type) {
|
||||
entry = NULL;
|
||||
if (rtems_filesystem_table) {
|
||||
rtems_chain_node *the_node;
|
||||
for (the_node = rtems_chain_first(rtems_filesystem_table);
|
||||
!rtems_chain_is_tail(rtems_filesystem_table, the_node);
|
||||
the_node = rtems_chain_next(the_node)) {
|
||||
entry = &(((rtems_filesystem_table_node_t*) the_node)->entry);
|
||||
if (strcmp (filesystemtype, entry->type) == 0)
|
||||
break;
|
||||
entry = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!entry)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate a mount table entry
|
||||
*/
|
||||
|
||||
size = sizeof(rtems_filesystem_mount_table_entry_t);
|
||||
if ( device )
|
||||
size += strlen( device ) + 1;
|
||||
temp_mt_entry = malloc( size );
|
||||
size = sizeof(rtems_filesystem_mount_table_entry_t);
|
||||
if ( source )
|
||||
size += strlen( source ) + 1;
|
||||
|
||||
mt_entry = malloc( size );
|
||||
if ( !mt_entry ) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( !temp_mt_entry ) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry;
|
||||
temp_mt_entry->options = options;
|
||||
if ( device ) {
|
||||
temp_mt_entry->dev =
|
||||
(char *)temp_mt_entry + sizeof( rtems_filesystem_mount_table_entry_t );
|
||||
strcpy( temp_mt_entry->dev, device );
|
||||
} else
|
||||
temp_mt_entry->dev = 0;
|
||||
memset( mt_entry, 0, size );
|
||||
|
||||
mt_entry->mt_fs_root.mt_entry = mt_entry;
|
||||
mt_entry->type = entry->type;
|
||||
mt_entry->options = options;
|
||||
mt_entry->pathconf_limits_and_options = rtems_filesystem_default_pathconf;
|
||||
|
||||
if ( source ) {
|
||||
mt_entry->dev =
|
||||
(char *)mt_entry + sizeof( rtems_filesystem_mount_table_entry_t );
|
||||
strcpy( mt_entry->dev, source );
|
||||
} else
|
||||
mt_entry->dev = 0;
|
||||
|
||||
/*
|
||||
* The mount_point should be a directory with read/write/execute
|
||||
* permissions in the existing tree.
|
||||
*/
|
||||
|
||||
if ( mount_point ) {
|
||||
if ( target ) {
|
||||
|
||||
if ( rtems_filesystem_evaluate_path(
|
||||
mount_point, strlen( mount_point ), RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
|
||||
target, strlen( target ), RTEMS_LIBIO_PERMS_RWX, &loc, true ) == -1 )
|
||||
goto cleanup_and_bail;
|
||||
|
||||
loc_to_free = &loc;
|
||||
@@ -179,11 +268,11 @@ int mount(
|
||||
* traverse the tree.
|
||||
*/
|
||||
|
||||
temp_mt_entry->mt_point_node.node_access = loc.node_access;
|
||||
temp_mt_entry->mt_point_node.handlers = loc.handlers;
|
||||
temp_mt_entry->mt_point_node.ops = loc.ops;
|
||||
temp_mt_entry->mt_point_node.mt_entry = loc.mt_entry;
|
||||
|
||||
mt_entry->mt_point_node.node_access = loc.node_access;
|
||||
mt_entry->mt_point_node.handlers = loc.handlers;
|
||||
mt_entry->mt_point_node.ops = loc.ops;
|
||||
mt_entry->mt_point_node.mt_entry = loc.mt_entry;
|
||||
|
||||
/*
|
||||
* This link to the parent is only done when we are dealing with system
|
||||
* below the base file system
|
||||
@@ -194,31 +283,45 @@ int mount(
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
|
||||
if ( loc.ops->mount_h( temp_mt_entry ) ) {
|
||||
if ( loc.ops->mount_h( mt_entry ) ) {
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
|
||||
mt_entry->target = strdup( target );
|
||||
} else {
|
||||
|
||||
/*
|
||||
* Do we already have a base file system ?
|
||||
*/
|
||||
if ( !rtems_chain_is_empty( &rtems_filesystem_mount_table_control ) ) {
|
||||
errno = EINVAL;
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is a mount of the base file system --> The
|
||||
* mt_point_node.node_access will be set to null to indicate that this
|
||||
* is the root of the entire file system.
|
||||
*/
|
||||
|
||||
temp_mt_entry->mt_fs_root.node_access = NULL;
|
||||
temp_mt_entry->mt_fs_root.handlers = NULL;
|
||||
temp_mt_entry->mt_fs_root.ops = NULL;
|
||||
mt_entry->mt_fs_root.node_access = NULL;
|
||||
mt_entry->mt_fs_root.handlers = NULL;
|
||||
mt_entry->mt_fs_root.ops = NULL;
|
||||
|
||||
temp_mt_entry->mt_point_node.node_access = NULL;
|
||||
temp_mt_entry->mt_point_node.handlers = NULL;
|
||||
temp_mt_entry->mt_point_node.ops = NULL;
|
||||
temp_mt_entry->mt_point_node.mt_entry = NULL;
|
||||
mt_entry->mt_point_node.node_access = NULL;
|
||||
mt_entry->mt_point_node.handlers = NULL;
|
||||
mt_entry->mt_point_node.ops = NULL;
|
||||
mt_entry->mt_point_node.mt_entry = NULL;
|
||||
|
||||
mt_entry->target = "/";
|
||||
}
|
||||
|
||||
if ( fs_ops->fsmount_me_h( temp_mt_entry ) ) {
|
||||
/* try to undo the mount operation */
|
||||
if ( loc.ops->unmount_h ) {
|
||||
loc.ops->unmount_h( temp_mt_entry );
|
||||
if ( entry->mount_h( mt_entry, data ) ) {
|
||||
/*
|
||||
* Try to undo the mount operation
|
||||
*/
|
||||
if ( loc.ops->unmount_h ) {
|
||||
loc.ops->unmount_h( mt_entry );
|
||||
}
|
||||
goto cleanup_and_bail;
|
||||
}
|
||||
@@ -226,18 +329,18 @@ int mount(
|
||||
/*
|
||||
* Add the mount table entry to the mount table chain
|
||||
*/
|
||||
|
||||
rtems_chain_append( &rtems_filesystem_mount_table_control,
|
||||
&temp_mt_entry->Node );
|
||||
&mt_entry->Node );
|
||||
|
||||
if ( mt_entry )
|
||||
*mt_entry = temp_mt_entry;
|
||||
if ( !target )
|
||||
rtems_filesystem_root = mt_entry->mt_fs_root;
|
||||
|
||||
return 0;
|
||||
|
||||
cleanup_and_bail:
|
||||
|
||||
free( temp_mt_entry );
|
||||
free( (void*) mt_entry->target );
|
||||
free( mt_entry );
|
||||
|
||||
if ( loc_to_free )
|
||||
rtems_filesystem_freenode( loc_to_free );
|
||||
@@ -245,49 +348,3 @@ cleanup_and_bail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* init_fs_mount_table
|
||||
*
|
||||
* This routine will initialize the chain control element that manages the
|
||||
* mount table chain.
|
||||
*/
|
||||
|
||||
int init_fs_mount_table(void)
|
||||
{
|
||||
rtems_chain_initialize_empty ( &rtems_filesystem_mount_table_control );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is_node_fs_root
|
||||
*
|
||||
* This routine will run through the entries that currently exist in the
|
||||
* mount table chain. For each entry in the mount table chain it will
|
||||
* compare the mount tables root node to the node describing the selected
|
||||
* mount point. If any match is found true is returned else false is
|
||||
* returned.
|
||||
*
|
||||
*/
|
||||
|
||||
static bool Is_node_fs_root(
|
||||
rtems_filesystem_location_info_t *loc
|
||||
)
|
||||
{
|
||||
rtems_chain_node *the_node;
|
||||
rtems_filesystem_mount_table_entry_t *the_mount_entry;
|
||||
|
||||
/*
|
||||
* For each mount table entry
|
||||
*/
|
||||
|
||||
for ( the_node = rtems_filesystem_mount_table_control.first;
|
||||
!rtems_chain_is_tail( &rtems_filesystem_mount_table_control, the_node );
|
||||
the_node = the_node->next ) {
|
||||
the_mount_entry = (rtems_filesystem_mount_table_entry_t *) the_node;
|
||||
if ( the_mount_entry->mt_fs_root.node_access == loc->node_access )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Instantatiate a private user environment for the calling thread.
|
||||
* Instantiate a private user environment for the calling thread.
|
||||
*
|
||||
* Submitted by: fernando.ruiz@ctv.es (correo@fernando-ruiz.com)
|
||||
*
|
||||
@@ -24,12 +24,6 @@
|
||||
#include <rtems/libio.h>
|
||||
#include <rtems/libio_.h>
|
||||
|
||||
extern rtems_chain_control rtems_filesystem_mount_table_control;
|
||||
|
||||
#define THE_ROOT_FS_LOC \
|
||||
(((rtems_filesystem_mount_table_entry_t*)\
|
||||
rtems_filesystem_mount_table_control.first)->mt_fs_root)
|
||||
|
||||
/* cleanup a user environment
|
||||
* NOTE: this must be called with
|
||||
* thread dispatching disabled!
|
||||
@@ -82,13 +76,11 @@ rtems_status_code rtems_libio_set_private_env(void) {
|
||||
*rtems_current_user_env = rtems_global_user_env; /* get the global values*/
|
||||
rtems_current_user_env->task_id=task_id; /* mark the local values*/
|
||||
|
||||
/* get a clean root */
|
||||
rtems_filesystem_root = THE_ROOT_FS_LOC;
|
||||
|
||||
/* Clone the pathlocs. In contrast to most other
|
||||
* code we must _not_ free the original locs because
|
||||
* what we are trying to do here is forking off
|
||||
* clones.
|
||||
* clones. The reason is a pathloc can be allocated by the
|
||||
* file system and needs to be freed when deleting the environment.
|
||||
*/
|
||||
|
||||
rtems_filesystem_evaluate_path("/", 1, 0, &loc, 0);
|
||||
|
||||
@@ -213,6 +213,7 @@ int unmount(
|
||||
*/
|
||||
|
||||
rtems_filesystem_freenode( fs_mount_loc );
|
||||
free( (void*) mt_entry->target );
|
||||
free( mt_entry );
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -50,22 +50,6 @@ extern int rtems_deviceio_errno(rtems_status_code code);
|
||||
|
||||
extern uint32_t rtems_device_table_size;
|
||||
|
||||
|
||||
/**
|
||||
* The following defines the device-only filesystem operating
|
||||
* handlers.
|
||||
*/
|
||||
|
||||
extern rtems_filesystem_operations_table devFS_ops;
|
||||
|
||||
/**
|
||||
* The following defines the device-only filesystem operating
|
||||
* handlers.
|
||||
*/
|
||||
|
||||
extern rtems_filesystem_file_handlers_r devFS_file_handlers;
|
||||
|
||||
|
||||
/**
|
||||
* This handler maps open operation to rtems_io_open.
|
||||
* @param iop This is the RTEMS's internal representation of file.
|
||||
@@ -257,14 +241,16 @@ extern int devFS_mknod(
|
||||
* initializing it to a known state, and set device file operation
|
||||
* handlers. After this, the device-only filesytem is ready for use
|
||||
*
|
||||
* @param temp_mt_entry
|
||||
* @param mt_entry The filesystem mount table entry.
|
||||
* @param data Filesystem specific data.
|
||||
* @retval upon success, this routine returns 0; otherwise it returns
|
||||
* -1 and errno is set to proper value. The only error is when malloc
|
||||
* failed, and errno is set to NOMEM.
|
||||
*/
|
||||
|
||||
extern int devFS_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data
|
||||
);
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,20 @@
|
||||
#include <assert.h>
|
||||
#include "devfs.h"
|
||||
|
||||
/**
|
||||
* The following defines the device-only filesystem operating
|
||||
* handlers.
|
||||
*/
|
||||
|
||||
extern rtems_filesystem_operations_table devFS_ops;
|
||||
|
||||
/**
|
||||
* The following defines the device-only filesystem operating
|
||||
* handlers.
|
||||
*/
|
||||
|
||||
extern rtems_filesystem_file_handlers_r devFS_file_handlers;
|
||||
|
||||
int devFS_evaluate_path(
|
||||
const char *pathname,
|
||||
size_t pathnamelen,
|
||||
|
||||
@@ -59,7 +59,8 @@ rtems_filesystem_file_handlers_r devFS_file_handlers =
|
||||
|
||||
|
||||
int devFS_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry,
|
||||
const void *data
|
||||
)
|
||||
{
|
||||
rtems_device_name_t *device_name_table;
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern rtems_filesystem_operations_table msdos_ops;
|
||||
int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data);
|
||||
|
||||
#define MSDOS_FMT_FATANY 0
|
||||
#define MSDOS_FMT_FAT12 1
|
||||
|
||||
@@ -223,8 +223,6 @@ typedef enum msdos_token_types_e
|
||||
#define MSDOS_DPS512_NUM 16
|
||||
|
||||
/* Prototypes */
|
||||
int msdos_initialize(rtems_filesystem_mount_table_entry_t *temp_mt_entry);
|
||||
|
||||
int msdos_shut_down(rtems_filesystem_mount_table_entry_t *temp_mt_entry);
|
||||
|
||||
int msdos_eval_path(
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endif
|
||||
|
||||
#include <rtems/libio_.h>
|
||||
#include "dosfs.h"
|
||||
#include "msdos.h"
|
||||
|
||||
const rtems_filesystem_operations_table msdos_ops = {
|
||||
@@ -28,7 +29,7 @@ const rtems_filesystem_operations_table msdos_ops = {
|
||||
.chown_h = NULL,
|
||||
.freenod_h = msdos_free_node_info,
|
||||
.mount_h = NULL,
|
||||
.fsmount_me_h = msdos_initialize,
|
||||
.fsmount_me_h = rtems_dosfs_initialize,
|
||||
.unmount_h = NULL,
|
||||
.fsunmount_me_h = msdos_shut_down,
|
||||
.utime_h = NULL,
|
||||
@@ -50,11 +51,12 @@ const rtems_filesystem_operations_table msdos_ops = {
|
||||
* RC_OK on success, or -1 if error occured (errno set apropriately).
|
||||
*
|
||||
*/
|
||||
int msdos_initialize(rtems_filesystem_mount_table_entry_t *temp_mt_entry)
|
||||
int rtems_dosfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = msdos_initialize_support(temp_mt_entry,
|
||||
rc = msdos_initialize_support(mt_entry,
|
||||
&msdos_ops,
|
||||
&msdos_file_handlers,
|
||||
&msdos_dir_handlers);
|
||||
|
||||
@@ -255,11 +255,13 @@ extern const rtems_filesystem_limits_and_options_t IMFS_LIMITS_AND_OPTIONS;
|
||||
*/
|
||||
|
||||
extern int IMFS_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data
|
||||
);
|
||||
|
||||
extern int miniIMFS_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data
|
||||
);
|
||||
|
||||
extern int IMFS_initialize_support(
|
||||
|
||||
@@ -490,7 +490,7 @@ int IMFS_eval_path(
|
||||
size_t pathnamelen, /* IN */
|
||||
int flags, /* IN */
|
||||
rtems_filesystem_location_info_t *pathloc /* IN/OUT */
|
||||
)
|
||||
)
|
||||
{
|
||||
int i = 0;
|
||||
int len;
|
||||
@@ -531,40 +531,40 @@ int IMFS_eval_path(
|
||||
if ( type != IMFS_NO_MORE_PATH )
|
||||
if ( node->type == IMFS_DIRECTORY )
|
||||
if ( !IMFS_evaluate_permission( pathloc, RTEMS_LIBIO_PERMS_SEARCH ) )
|
||||
rtems_set_errno_and_return_minus_one( EACCES );
|
||||
rtems_set_errno_and_return_minus_one( EACCES );
|
||||
|
||||
node = pathloc->node_access;
|
||||
|
||||
switch( type ) {
|
||||
case IMFS_UP_DIR:
|
||||
/*
|
||||
* Am I at the root of all filesystems? (chroot'ed?)
|
||||
*/
|
||||
/*
|
||||
* Am I at the root of all filesystems? (chroot'ed?)
|
||||
*/
|
||||
|
||||
if ( pathloc->node_access == rtems_filesystem_root.node_access )
|
||||
break; /* Throw out the .. in this case */
|
||||
if ( pathloc->node_access == rtems_filesystem_root.node_access )
|
||||
break; /* Throw out the .. in this case */
|
||||
|
||||
/*
|
||||
* Am I at the root of this mounted filesystem?
|
||||
*/
|
||||
/*
|
||||
* Am I at the root of this mounted filesystem?
|
||||
*/
|
||||
|
||||
if (pathloc->node_access ==
|
||||
pathloc->mt_entry->mt_fs_root.node_access) {
|
||||
|
||||
/*
|
||||
* Am I at the root of all filesystems?
|
||||
*/
|
||||
* Am I at the root of all filesystems?
|
||||
*/
|
||||
|
||||
if ( pathloc->node_access == rtems_filesystem_root.node_access ) {
|
||||
break; /* Throw out the .. in this case */
|
||||
} else {
|
||||
} else {
|
||||
newloc = pathloc->mt_entry->mt_point_node;
|
||||
*pathloc = newloc;
|
||||
return (*pathloc->ops->evalpath_h)(&(pathname[i-len]),
|
||||
pathnamelen+len,
|
||||
flags,pathloc);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
|
||||
if ( !node->Parent )
|
||||
rtems_set_errno_and_return_minus_one( ENOENT );
|
||||
@@ -572,17 +572,17 @@ int IMFS_eval_path(
|
||||
node = node->Parent;
|
||||
pathloc->node_access = node;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
pathloc->node_access = node;
|
||||
break;
|
||||
|
||||
case IMFS_NAME:
|
||||
/*
|
||||
* If we are at a link follow it.
|
||||
*/
|
||||
/*
|
||||
* If we are at a link follow it.
|
||||
*/
|
||||
|
||||
if ( node->type == IMFS_HARD_LINK ) {
|
||||
if ( node->type == IMFS_HARD_LINK ) {
|
||||
|
||||
IMFS_evaluate_hard_link( pathloc, 0 );
|
||||
|
||||
@@ -590,26 +590,26 @@ int IMFS_eval_path(
|
||||
if ( !node )
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
|
||||
} else if ( node->type == IMFS_SYM_LINK ) {
|
||||
} else if ( node->type == IMFS_SYM_LINK ) {
|
||||
|
||||
result = IMFS_evaluate_sym_link( pathloc, 0 );
|
||||
|
||||
node = pathloc->node_access;
|
||||
if ( result == -1 )
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Only a directory can be decended into.
|
||||
*/
|
||||
/*
|
||||
* Only a directory can be decended into.
|
||||
*/
|
||||
|
||||
if ( node->type != IMFS_DIRECTORY )
|
||||
if ( node->type != IMFS_DIRECTORY )
|
||||
rtems_set_errno_and_return_minus_one( ENOTDIR );
|
||||
|
||||
/*
|
||||
* If we are at a node that is a mount point. Set loc to the
|
||||
* new fs root node and let them finish evaluating the path.
|
||||
*/
|
||||
/*
|
||||
* If we are at a node that is a mount point. Set loc to the
|
||||
* new fs root node and let them finish evaluating the path.
|
||||
*/
|
||||
|
||||
if ( node->info.directory.mt_fs != NULL ) {
|
||||
newloc = node->info.directory.mt_fs->mt_fs_root;
|
||||
@@ -617,19 +617,19 @@ int IMFS_eval_path(
|
||||
return (*pathloc->ops->evalpath_h)( &pathname[i-len],
|
||||
pathnamelen+len,
|
||||
flags, pathloc );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Otherwise find the token name in the present location.
|
||||
*/
|
||||
/*
|
||||
* Otherwise find the token name in the present location.
|
||||
*/
|
||||
|
||||
node = IMFS_find_match_in_dir( node, token );
|
||||
if ( !node )
|
||||
rtems_set_errno_and_return_minus_one( ENOENT );
|
||||
|
||||
/*
|
||||
* Set the node access to the point we have found.
|
||||
*/
|
||||
/*
|
||||
* Set the node access to the point we have found.
|
||||
*/
|
||||
|
||||
pathloc->node_access = node;
|
||||
break;
|
||||
|
||||
@@ -59,7 +59,8 @@ const rtems_filesystem_operations_table IMFS_ops = {
|
||||
*/
|
||||
|
||||
int IMFS_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry,
|
||||
const void *data
|
||||
)
|
||||
{
|
||||
return IMFS_initialize_support(
|
||||
|
||||
@@ -59,7 +59,8 @@ const rtems_filesystem_operations_table miniIMFS_ops = {
|
||||
*/
|
||||
|
||||
int miniIMFS_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry
|
||||
rtems_filesystem_mount_table_entry_t *temp_mt_entry,
|
||||
const void *data
|
||||
)
|
||||
{
|
||||
return IMFS_initialize_support(
|
||||
|
||||
@@ -70,6 +70,10 @@
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* RPCIO driver interface.
|
||||
* If you need RPCIO for other purposes than NFS
|
||||
* you may want to include <rpcio.h>
|
||||
@@ -82,7 +86,9 @@
|
||||
*/
|
||||
extern rtems_task_priority rpciodPriority;
|
||||
|
||||
/* Initialize the driver
|
||||
/* Initialize the driver.
|
||||
*
|
||||
* Note, called in nfsfs initialise when mount is called.
|
||||
*
|
||||
* RETURNS: 0 on success, -1 on failure
|
||||
*/
|
||||
@@ -103,6 +109,8 @@ rpcUdpCleanup(void);
|
||||
* NOTE: The RPCIO driver must have been initialized prior to
|
||||
* calling this.
|
||||
*
|
||||
* Note, called in nfsfs initialise when mount is called with defaults.
|
||||
*
|
||||
* ARGS: depth of the small and big
|
||||
* transaction pools, i.e. how
|
||||
* many transactions (buffers)
|
||||
@@ -131,22 +139,12 @@ nfsCleanup(void);
|
||||
int
|
||||
nfsMountsShow(FILE *f);
|
||||
|
||||
/* convenience wrapper
|
||||
*
|
||||
* NOTE: this routine calls NON-REENTRANT
|
||||
* gethostbyname() if the host is
|
||||
* not in 'dot' notation.
|
||||
/*
|
||||
* Filesystem mount table mount handler. Do not call, use the mount call.
|
||||
*/
|
||||
int
|
||||
nfsMount(char *uidhost, char *path, char *mntpoint);
|
||||
|
||||
/* Alternatively, a pointer to the filesystem operations
|
||||
* table can be supplied to the native RTEMS (NON-POSIX!)
|
||||
* 'mount()' call.
|
||||
* Supply a "<host.in.ip.dot.notation>:<path>" string
|
||||
* for 'device' argument to 'mount()'.
|
||||
*/
|
||||
extern struct _rtems_filesystem_operations_table nfs_fs_ops;
|
||||
int
|
||||
rtems_nfsfs_initialize(rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data);
|
||||
|
||||
/* A utility routine to find the path leading to a
|
||||
* rtems_filesystem_location_info_t node.
|
||||
@@ -174,4 +172,9 @@ nfsSetTimeout(uint32_t timeout_ms);
|
||||
/* Read current timeout (in milliseconds) */
|
||||
uint32_t
|
||||
nfsGetTimeout(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
/* Author: Till Straumann <strauman@slac.stanford.edu> 2002 */
|
||||
|
||||
/* Hacked on by others. */
|
||||
|
||||
/*
|
||||
* Authorship
|
||||
* ----------
|
||||
@@ -1193,8 +1195,7 @@ updateAttr(NfsNode node, int force)
|
||||
}
|
||||
|
||||
/*
|
||||
* IP address helper. Note that we avoid
|
||||
* gethostbyname() since it's not reentrant.
|
||||
* IP address helper.
|
||||
*
|
||||
* initialize a sockaddr_in from a
|
||||
* [<uid>'.'<gid>'@']<host>':'<path>" string and let
|
||||
@@ -1211,7 +1212,8 @@ buildIpAddr(u_long *puid, u_long *pgid,
|
||||
char **pHost, struct sockaddr_in *psa,
|
||||
char **pPath)
|
||||
{
|
||||
char host[30];
|
||||
struct hostent *h;
|
||||
char host[64];
|
||||
char *chpt = *pPath;
|
||||
char *path;
|
||||
int len;
|
||||
@@ -1238,7 +1240,7 @@ int len;
|
||||
|
||||
/* split the device name which is in the form
|
||||
*
|
||||
* <host_ip> ':' <path>
|
||||
* <host> ':' <path>
|
||||
*
|
||||
* into its components using a local buffer
|
||||
*/
|
||||
@@ -1254,11 +1256,19 @@ int len;
|
||||
strncpy(host, chpt, len);
|
||||
host[len]=0;
|
||||
|
||||
if ( ! inet_pton(AF_INET, host, &psa->sin_addr) ) {
|
||||
errno = ENXIO;
|
||||
/* BEGIN OF NON-THREAD SAFE REGION */
|
||||
|
||||
h = gethostbyname(host);
|
||||
|
||||
if ( !h ) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy(&psa->sin_addr, h->h_addr, sizeof (struct in_addr));
|
||||
|
||||
/* END OF NON-THREAD SAFE REGION */
|
||||
|
||||
psa->sin_family = AF_INET;
|
||||
psa->sin_port = 0;
|
||||
*pPath = path;
|
||||
@@ -1898,9 +1908,9 @@ struct rtems_filesystem_mount_table_entry_tt {
|
||||
#endif
|
||||
|
||||
|
||||
/* This op is called as the last step of mounting this FS */
|
||||
STATIC int nfs_fsmount_me(
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry
|
||||
int rtems_nfsfs_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data
|
||||
)
|
||||
{
|
||||
char *host;
|
||||
@@ -1917,11 +1927,20 @@ RpcUdpServer nfsServer = 0;
|
||||
int e = -1;
|
||||
char *path = mt_entry->dev;
|
||||
|
||||
if (rpcUdpInit () < 0) {
|
||||
fprintf (stderr, "error: initialising RPC\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
nfsInit(0, 0);
|
||||
|
||||
#if 0
|
||||
printf("Trying to mount %s on %s\n",path,mntpoint);
|
||||
#endif
|
||||
|
||||
if ( buildIpAddr(&uid, &gid, &host, &saddr, &path) )
|
||||
return -1;
|
||||
|
||||
|
||||
#ifdef NFS_V2_PORT
|
||||
/* if the portmapper fails, retry a fixed port */
|
||||
for (retry = 1, saddr.sin_port = 0, stat = RPC_FAILED;
|
||||
@@ -2460,7 +2479,7 @@ struct _rtems_filesystem_operations_table nfs_fs_ops = {
|
||||
nfs_chown, /* OPTIONAL; may be NULL */
|
||||
nfs_freenode, /* OPTIONAL; may be NULL; (release node_access) */
|
||||
nfs_mount, /* OPTIONAL; may be NULL */
|
||||
nfs_fsmount_me, /* OPTIONAL; may be NULL -- but this makes NO SENSE */
|
||||
rtems_nfsfs_initialize, /* OPTIONAL; may be NULL -- not used anymore */
|
||||
nfs_unmount, /* OPTIONAL; may be NULL */
|
||||
nfs_fsunmount_me, /* OPTIONAL; may be NULL */
|
||||
nfs_utime, /* OPTIONAL; may be NULL */
|
||||
@@ -3228,6 +3247,8 @@ Nfs nfs;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
CCJ_REMOVE_MOUNT
|
||||
/* convenience wrapper
|
||||
*
|
||||
* NOTE: this routine calls NON-REENTRANT
|
||||
@@ -3237,7 +3258,6 @@ Nfs nfs;
|
||||
int
|
||||
nfsMount(char *uidhost, char *path, char *mntpoint)
|
||||
{
|
||||
rtems_filesystem_mount_table_entry_t *mtab;
|
||||
struct stat st;
|
||||
int devl;
|
||||
char *host;
|
||||
@@ -3310,11 +3330,11 @@ char *dev = 0;
|
||||
|
||||
printf("Trying to mount %s on %s\n",dev,mntpoint);
|
||||
|
||||
if (mount(&mtab,
|
||||
&nfs_fs_ops,
|
||||
RTEMS_FILESYSTEM_READ_WRITE,
|
||||
dev,
|
||||
mntpoint)) {
|
||||
if (mount(dev,
|
||||
mntpoint,
|
||||
"nfs",
|
||||
RTEMS_FILESYSTEM_READ_WRITE,
|
||||
NULL)) {
|
||||
perror("nfsMount - mount");
|
||||
goto cleanup;
|
||||
}
|
||||
@@ -3325,6 +3345,7 @@ cleanup:
|
||||
free(dev);
|
||||
return rval;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* HERE COMES A REALLY UGLY HACK */
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ rtems_rfs_rtems_eval_path (const char* path,
|
||||
node_len = 0;
|
||||
while (!rtems_filesystem_is_separator (*path) &&
|
||||
(*path != '\0') && pathlen &&
|
||||
(node_len + 1 < rtems_rfs_fs_max_name (fs)))
|
||||
((node_len + 1) < rtems_rfs_fs_max_name (fs)))
|
||||
{
|
||||
path++;
|
||||
pathlen--;
|
||||
@@ -1214,7 +1214,8 @@ const rtems_filesystem_file_handlers_r rtems_rfs_rtems_link_handlers =
|
||||
* Forward decl for the ops table.
|
||||
*/
|
||||
|
||||
int rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t *mt_entry);
|
||||
int rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t *mt_entry,
|
||||
const void *data);
|
||||
int rtems_rfs_rtems_shutdown (rtems_filesystem_mount_table_entry_t *mt_entry);
|
||||
|
||||
/**
|
||||
@@ -1247,7 +1248,8 @@ const rtems_filesystem_operations_table rtems_rfs_ops =
|
||||
*/
|
||||
|
||||
int
|
||||
rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t* mt_entry)
|
||||
rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t* mt_entry,
|
||||
const void* data)
|
||||
{
|
||||
rtems_rfs_rtems_private* rtems;
|
||||
rtems_rfs_file_system* fs;
|
||||
|
||||
@@ -22,14 +22,9 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/fs.h>
|
||||
|
||||
/**
|
||||
* File ops table for the RFS file system.
|
||||
*/
|
||||
const rtems_filesystem_operations_table rtems_rfs_ops;
|
||||
|
||||
/**
|
||||
* Initialise the RFS File system.
|
||||
*/
|
||||
int rtems_rfs_initialise (rtems_filesystem_mount_table_entry_t *mt_entry);
|
||||
int rtems_rfs_rtems_initialise (rtems_filesystem_mount_table_entry_t *mt_entry);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -76,7 +76,7 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \
|
||||
shell/main_id.c shell/main_logoff.c shell/main_ln.c shell/main_ls.c \
|
||||
shell/main_mallocinfo.c shell/main_mdump.c shell/main_medit.c \
|
||||
shell/main_mfill.c shell/main_mkdir.c shell/main_mount.c \
|
||||
shell/main_mount_msdos.c shell/main_mmove.c shell/main_msdosfmt.c \
|
||||
shell/main_mmove.c shell/main_msdosfmt.c \
|
||||
shell/main_mv.c shell/main_mwdump.c shell/main_perioduse.c \
|
||||
shell/main_pwd.c shell/main_rm.c shell/main_rmdir.c shell/main_sleep.c \
|
||||
shell/main_stackuse.c shell/main_tty.c shell/main_umask.c \
|
||||
@@ -95,14 +95,13 @@ libshell_a_SOURCES = shell/cat_file.c shell/cmds.c shell/internal.h \
|
||||
shell/dd-misc.c shell/dd-position.c \
|
||||
shell/main_hexdump.c shell/hexdump-conv.c shell/hexdump-display.c \
|
||||
shell/hexdump-odsyntax.c shell/hexdump-parse.c shell/hexsyntax.c \
|
||||
shell/main_time.c shell/main_mknod.c shell/main_mount_rfs.c \
|
||||
shell/main_time.c shell/main_mknod.c \
|
||||
shell/main_setenv.c shell/main_getenv.c shell/main_unsetenv.c \
|
||||
shell/main_mkrfs.c shell/main_debugrfs.c
|
||||
|
||||
if LIBNETWORKING
|
||||
libshell_a_SOURCES += shell/main_mount_ftp.c shell/main_mount_tftp.c \
|
||||
shell/main_ifconfig.c shell/main_route.c shell/main_netstats.c \
|
||||
shell/main_mount_nfs.c
|
||||
libshell_a_SOURCES += \
|
||||
shell/main_ifconfig.c shell/main_route.c shell/main_netstats.c
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -118,82 +118,81 @@ int rtems_fsmount_create_mount_point
|
||||
int rtems_fsmount
|
||||
(
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Purpose: |
|
||||
| This function will create the mount points listed and mount the file |
|
||||
| systems listed in the calling parameters |
|
||||
+---------------------------------------------------------------------------+
|
||||
| Input Parameters: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
const rtems_fstab_entry *fstab_ptr,
|
||||
size_t fstab_count,
|
||||
size_t *fail_idx
|
||||
| Purpose: |
|
||||
| This function will create the mount points listed and mount the file |
|
||||
| systems listed in the calling parameters |
|
||||
+---------------------------------------------------------------------------+
|
||||
| Input Parameters: |
|
||||
\*-------------------------------------------------------------------------*/
|
||||
const rtems_fstab_entry *fstab_ptr,
|
||||
size_t fstab_count,
|
||||
size_t *fail_idx
|
||||
)
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Return Value: |
|
||||
| 0, if success, -1 and errno if failed |
|
||||
\*=========================================================================*/
|
||||
| Return Value: |
|
||||
| 0, if success, -1 and errno if failed |
|
||||
\*=========================================================================*/
|
||||
{
|
||||
int rc = 0;
|
||||
int tmp_rc;
|
||||
size_t fstab_idx = 0;
|
||||
rtems_filesystem_mount_table_entry_t *tmp_mt_entry;
|
||||
bool terminate = false;
|
||||
|
||||
/*
|
||||
* scan through all fstab entries;
|
||||
*/
|
||||
while (!terminate &&
|
||||
(fstab_idx < fstab_count)) {
|
||||
(fstab_idx < fstab_count)) {
|
||||
tmp_rc = 0;
|
||||
/*
|
||||
* create mount point
|
||||
*/
|
||||
if (tmp_rc == 0) {
|
||||
tmp_rc = rtems_fsmount_create_mount_point(fstab_ptr->mount_point);
|
||||
tmp_rc = rtems_fsmount_create_mount_point(fstab_ptr->target);
|
||||
if (tmp_rc != 0) {
|
||||
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNTPNT_CRTERR)) {
|
||||
fprintf(stdout,"fsmount: creation of mount point \"%s\" failed: %s\n",
|
||||
fstab_ptr->mount_point,
|
||||
strerror(errno));
|
||||
}
|
||||
if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNTPNT_CRTERR)) {
|
||||
terminate = true;
|
||||
rc = tmp_rc;
|
||||
}
|
||||
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNTPNT_CRTERR)) {
|
||||
fprintf(stdout,"fsmount: creation of mount point \"%s\" failed: %s\n",
|
||||
fstab_ptr->target,
|
||||
strerror(errno));
|
||||
}
|
||||
if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNTPNT_CRTERR)) {
|
||||
terminate = true;
|
||||
rc = tmp_rc;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* mount device to given mount point
|
||||
*/
|
||||
if (tmp_rc == 0) {
|
||||
tmp_rc = mount(&tmp_mt_entry,
|
||||
fstab_ptr->fs_ops,
|
||||
fstab_ptr->mount_options,
|
||||
fstab_ptr->dev,
|
||||
fstab_ptr->mount_point);
|
||||
tmp_rc = mount(fstab_ptr->source,
|
||||
fstab_ptr->target,
|
||||
fstab_ptr->type,
|
||||
fstab_ptr->options,
|
||||
NULL);
|
||||
if (tmp_rc != 0) {
|
||||
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_FAILED)) {
|
||||
fprintf(stdout,"fsmount: mounting of \"%s\" to"
|
||||
" \"%s\" failed: %s\n",
|
||||
fstab_ptr->dev,
|
||||
fstab_ptr->mount_point,
|
||||
strerror(errno));
|
||||
}
|
||||
if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_FAILED)) {
|
||||
terminate = true;
|
||||
rc = tmp_rc;
|
||||
}
|
||||
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_FAILED)) {
|
||||
fprintf(stdout,"fsmount: mounting of \"%s\" to"
|
||||
" \"%s\" failed: %s\n",
|
||||
fstab_ptr->source,
|
||||
fstab_ptr->target,
|
||||
strerror(errno));
|
||||
}
|
||||
if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_FAILED)) {
|
||||
terminate = true;
|
||||
rc = tmp_rc;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_OK)) {
|
||||
fprintf(stdout,"fsmount: mounting of \"%s\" to"
|
||||
" \"%s\" succeeded\n",
|
||||
fstab_ptr->dev,
|
||||
fstab_ptr->mount_point);
|
||||
}
|
||||
if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_OK)) {
|
||||
terminate = true;
|
||||
}
|
||||
if (0 != (fstab_ptr->report_reasons & FSMOUNT_MNT_OK)) {
|
||||
fprintf(stdout,"fsmount: mounting of \"%s\" to"
|
||||
" \"%s\" succeeded\n",
|
||||
fstab_ptr->source,
|
||||
fstab_ptr->target);
|
||||
}
|
||||
if (0 != (fstab_ptr->abort_reasons & FSMOUNT_MNT_OK)) {
|
||||
terminate = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -90,24 +90,24 @@ typedef enum {
|
||||
*/
|
||||
typedef struct {
|
||||
/**
|
||||
* Device file path.
|
||||
* Source for the mount.
|
||||
*/
|
||||
const char *dev;
|
||||
const char *source;
|
||||
|
||||
/**
|
||||
* Mount point path.
|
||||
* Target for the mount.
|
||||
*/
|
||||
const char *mount_point;
|
||||
const char *target;
|
||||
|
||||
/**
|
||||
* File system operations.
|
||||
*/
|
||||
const rtems_filesystem_operations_table *fs_ops;
|
||||
const char *type;
|
||||
|
||||
/**
|
||||
* File system mount options.
|
||||
*/
|
||||
rtems_filesystem_options_t mount_options;
|
||||
rtems_filesystem_options_t options;
|
||||
|
||||
/**
|
||||
* Report @ref rtems_fstab_conditions "condition flags".
|
||||
@@ -128,7 +128,7 @@ typedef struct {
|
||||
*
|
||||
* @see rtems_fsmount().
|
||||
*/
|
||||
int rtems_fsmount_create_mount_point( const char *mount_point);
|
||||
int rtems_fsmount_create_mount_point(const char *mount_point);
|
||||
|
||||
/**
|
||||
* Mounts the file systems listed in the file system mount table @a fstab of
|
||||
@@ -160,23 +160,22 @@ int rtems_fsmount_create_mount_point( const char *mount_point);
|
||||
*
|
||||
* #include <rtems.h>
|
||||
* #include <rtems/bdpart.h>
|
||||
* #include <rtems/dosfs.h>
|
||||
* #include <rtems/error.h>
|
||||
* #include <rtems/fsmount.h>
|
||||
*
|
||||
* static const rtems_fstab_entry fstab [] = {
|
||||
* {
|
||||
* .dev = "/dev/sd-card-a",
|
||||
* .mount_point = "/mnt",
|
||||
* .fs_ops = &msdos_ops,
|
||||
* .mount_options = RTEMS_FILESYSTEM_READ_WRITE,
|
||||
* .source = "/dev/sd-card-a",
|
||||
* .target = "/mnt",
|
||||
* .type = "dosfs",
|
||||
* .options = RTEMS_FILESYSTEM_READ_WRITE,
|
||||
* .report_reasons = RTEMS_FSTAB_ANY,
|
||||
* .abort_reasons = RTEMS_FSTAB_OK
|
||||
* }, {
|
||||
* .dev = "/dev/sd-card-a1",
|
||||
* .mount_point = "/mnt",
|
||||
* .fs_ops = &msdos_ops,
|
||||
* .mount_options = RTEMS_FILESYSTEM_READ_WRITE,
|
||||
* .source = "/dev/sd-card-a1",
|
||||
* .target = "/mnt",
|
||||
* .type = "dosfs",
|
||||
* .options = RTEMS_FILESYSTEM_READ_WRITE,
|
||||
* .report_reasons = RTEMS_FSTAB_ANY,
|
||||
* .abort_reasons = RTEMS_FSTAB_NONE
|
||||
* }
|
||||
|
||||
@@ -24,74 +24,24 @@
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/shellconfig.h>
|
||||
#include <rtems/dosfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include <rtems/libio.h>
|
||||
#include "internal.h"
|
||||
|
||||
static rtems_chain_control filesystems;
|
||||
static bool fs_init;
|
||||
|
||||
static void rtems_shell_mount_fsys_init(void)
|
||||
{
|
||||
if (!fs_init)
|
||||
{
|
||||
rtems_chain_initialize_empty (&filesystems);
|
||||
fs_init = true;
|
||||
}
|
||||
}
|
||||
|
||||
void rtems_shell_mount_add_fsys(rtems_shell_filesystems_t* fs)
|
||||
{
|
||||
rtems_shell_mount_fsys_init();
|
||||
rtems_chain_append (&filesystems, &fs->link);
|
||||
}
|
||||
|
||||
void rtems_shell_mount_del_fsys(rtems_shell_filesystems_t* fs)
|
||||
{
|
||||
if (fs_init)
|
||||
rtems_chain_extract (&fs->link);
|
||||
}
|
||||
|
||||
int rtems_shell_libc_mounter(
|
||||
const char* driver,
|
||||
const char* path,
|
||||
rtems_shell_filesystems_t* fs,
|
||||
rtems_filesystem_options_t options)
|
||||
{
|
||||
rtems_filesystem_mount_table_entry_t* mt_entry;
|
||||
/*
|
||||
* Mount the disk.
|
||||
*/
|
||||
|
||||
if (mount (&mt_entry, fs->fs_ops, options, (char*) driver, (char*) path) < 0)
|
||||
{
|
||||
fprintf (stderr, "mount: mount failed: %s\n", strerror (errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define NUMOF(_i) (sizeof (_i) / sizeof (_i[0]))
|
||||
|
||||
int rtems_shell_main_mount(
|
||||
int argc,
|
||||
char *argv[]
|
||||
)
|
||||
{
|
||||
rtems_filesystem_options_t options = RTEMS_FILESYSTEM_READ_WRITE;
|
||||
rtems_shell_filesystems_t* fs = NULL;
|
||||
char* driver = NULL;
|
||||
char* mount_point = NULL;
|
||||
char* type = NULL;
|
||||
char* source = NULL;
|
||||
char* target = NULL;
|
||||
char* fsoptions = NULL;
|
||||
int arg;
|
||||
|
||||
rtems_shell_mount_fsys_init();
|
||||
|
||||
for (arg = 1; arg < argc; arg++) {
|
||||
if (argv[arg][0] == '-') {
|
||||
if (argv[arg][1] == 't') {
|
||||
rtems_shell_filesystems_t** a;
|
||||
|
||||
arg++;
|
||||
if (arg == argc) {
|
||||
fprintf(
|
||||
@@ -101,71 +51,58 @@ int rtems_shell_main_mount(
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (a = rtems_shell_Mount_filesystems; *a; a++) {
|
||||
if (strcmp (argv[arg], (*a)->name) == 0) {
|
||||
fs = *a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs && !rtems_chain_is_empty(&filesystems)) {
|
||||
rtems_chain_node* node = filesystems.first;
|
||||
while (!rtems_chain_is_tail (&filesystems, node)) {
|
||||
rtems_shell_filesystems_t* f = (rtems_shell_filesystems_t*)node;
|
||||
if (strcmp (argv[arg], f->name) == 0) {
|
||||
fs = f;
|
||||
break;
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
type = argv[arg];
|
||||
} else if (argv[arg][1] == 'r') {
|
||||
options = RTEMS_FILESYSTEM_READ_ONLY;
|
||||
} else if (argv[arg][1] == 'L') {
|
||||
rtems_shell_filesystems_t** a;
|
||||
fprintf (stderr, "File systems: ");
|
||||
for (a = rtems_shell_Mount_filesystems; *a; a++)
|
||||
if (*a)
|
||||
fprintf (stderr, "%s ", (*a)->name);
|
||||
if (!rtems_chain_is_empty(&filesystems)) {
|
||||
rtems_chain_node* node = filesystems.first;
|
||||
while (!rtems_chain_is_tail (&filesystems, node)) {
|
||||
rtems_shell_filesystems_t* f = (rtems_shell_filesystems_t*)node;
|
||||
fprintf (stderr, "%s ", f->name);
|
||||
node = node->next;
|
||||
}
|
||||
const rtems_filesystem_table_t* fs;
|
||||
fs = rtems_filesystem_table_first();
|
||||
printf ("File systems: ");
|
||||
while (fs) {
|
||||
printf ("%s ", fs->type);
|
||||
fs = rtems_filesystem_table_next(fs);
|
||||
}
|
||||
fprintf (stderr, "\n");
|
||||
return 1;
|
||||
printf ("\n");
|
||||
return 0;
|
||||
} else if (argv[arg][1] == 'o') {
|
||||
arg++;
|
||||
if (arg == argc) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s: -o needs a list if filesystem options.\n",
|
||||
argv[0]
|
||||
);
|
||||
return 1;
|
||||
}
|
||||
fsoptions = argv[arg];
|
||||
} else {
|
||||
fprintf (stderr, "unknown option: %s\n", argv[arg]);
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
if (!driver)
|
||||
driver = argv[arg];
|
||||
else if (!mount_point)
|
||||
mount_point = argv[arg];
|
||||
if (!source)
|
||||
source = argv[arg];
|
||||
else if (!target)
|
||||
target = argv[arg];
|
||||
else {
|
||||
fprintf (
|
||||
stderr, "mount: driver and mount only require: %s\n", argv[arg]);
|
||||
stderr, "mount: source and mount only require: %s\n", argv[arg]);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fs == NULL) {
|
||||
if (!type) {
|
||||
fprintf (stderr, "mount: no file-system; see the -L option\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (fs->driver_needed && !driver) {
|
||||
fprintf (stderr, "mount: no driver\n");
|
||||
if (!source) {
|
||||
fprintf (stderr, "mount: no source\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!mount_point) {
|
||||
if (!target) {
|
||||
fprintf (stderr, "mount: no mount point\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -174,19 +111,21 @@ int rtems_shell_main_mount(
|
||||
* Mount the disk.
|
||||
*/
|
||||
|
||||
if (fs->mounter (driver, mount_point, fs, options))
|
||||
if (mount (source, target, type, options, fsoptions) < 0) {
|
||||
fprintf (stderr, "error: %s\n", strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf ("mounted %s -> %s\n", driver, mount_point);
|
||||
printf ("mounted %s -> %s\n", source, target);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_MOUNT_Command = {
|
||||
"mount", /* name */
|
||||
"mount [-t fstype] [-r] [-L] device path # mount disk", /* usage */
|
||||
"files", /* topic */
|
||||
rtems_shell_main_mount, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
"mount", /* name */
|
||||
"mount [-t type] [-r] [-L] source target", /* usage */
|
||||
"files", /* topic */
|
||||
rtems_shell_main_mount, /* command */
|
||||
NULL, /* alias */
|
||||
NULL /* next */
|
||||
};
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/dosfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include <rtems/ftpfs.h>
|
||||
|
||||
rtems_shell_filesystems_t rtems_shell_Mount_FTP = {
|
||||
name: "ftp",
|
||||
driver_needed: 1,
|
||||
fs_ops: &rtems_ftpfs_ops,
|
||||
mounter: rtems_shell_libc_mounter
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/dosfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
rtems_shell_filesystems_t rtems_shell_Mount_MSDOS = {
|
||||
name: "msdos",
|
||||
driver_needed: 1,
|
||||
fs_ops: &msdos_ops,
|
||||
mounter: rtems_shell_libc_mounter
|
||||
};
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/rtems-rfs.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
rtems_shell_filesystems_t rtems_shell_Mount_RFS = {
|
||||
name: "rfs",
|
||||
driver_needed: 1,
|
||||
fs_ops: &rtems_rfs_ops,
|
||||
mounter: rtems_shell_libc_mounter
|
||||
};
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Shell Command Implmentation
|
||||
*
|
||||
* Author: Fernando RUIZ CASAS
|
||||
* Work: fernando.ruiz@ctv.es
|
||||
* Home: correo@fernando-ruiz.com
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.rtems.com/license/LICENSE.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <rtems.h>
|
||||
#include <rtems/shell.h>
|
||||
#include <rtems/fsmount.h>
|
||||
#include "internal.h"
|
||||
|
||||
#include <rtems/ftpfs.h>
|
||||
#include <rtems/tftp.h>
|
||||
|
||||
rtems_shell_filesystems_t rtems_shell_Mount_TFTP = {
|
||||
name: "tftp",
|
||||
driver_needed: 0,
|
||||
fs_ops: &rtems_tftp_ops,
|
||||
mounter: rtems_shell_libc_mounter
|
||||
};
|
||||
@@ -91,17 +91,6 @@ extern rtems_shell_alias_t rtems_shell_EXIT_Alias;
|
||||
|
||||
extern rtems_shell_alias_t *rtems_shell_Initial_aliases[];
|
||||
|
||||
/*
|
||||
* Externs for mount command helpers
|
||||
*/
|
||||
extern rtems_shell_filesystems_t rtems_shell_Mount_RFS;
|
||||
extern rtems_shell_filesystems_t rtems_shell_Mount_MSDOS;
|
||||
extern rtems_shell_filesystems_t rtems_shell_Mount_TFTP;
|
||||
extern rtems_shell_filesystems_t rtems_shell_Mount_FTP;
|
||||
extern rtems_shell_filesystems_t rtems_shell_Mount_NFS;
|
||||
|
||||
extern rtems_shell_filesystems_t *rtems_shell_Mount_filesystems[];
|
||||
|
||||
/*
|
||||
* If we are configured to alias a command, then make sure the underlying
|
||||
* command is configured.
|
||||
@@ -444,34 +433,6 @@ extern rtems_shell_filesystems_t *rtems_shell_Mount_filesystems[];
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* The mount command's support file system types.
|
||||
*/
|
||||
#if (defined(CONFIGURE_SHELL_COMMANDS_ALL) && \
|
||||
!defined(CONFIGURE_SHELL_COMMAND_NO_MOUNT)) || \
|
||||
defined(CONFIGURE_SHELL_COMMAND_MOUNT)
|
||||
rtems_shell_filesystems_t *rtems_shell_Mount_filesystems[] = {
|
||||
#if defined(CONFIGURE_SHELL_MOUNT_RFS)
|
||||
&rtems_shell_Mount_RFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_SHELL_MOUNT_MSDOS)
|
||||
&rtems_shell_Mount_MSDOS,
|
||||
#endif
|
||||
#if RTEMS_NETWORKING
|
||||
#if defined(CONFIGURE_SHELL_MOUNT_TFTP)
|
||||
&rtems_shell_Mount_TFTP,
|
||||
#endif
|
||||
#if defined(CONFIGURE_SHELL_MOUNT_FTP)
|
||||
&rtems_shell_Mount_FTP,
|
||||
#endif
|
||||
#if defined(CONFIGURE_SHELL_MOUNT_NFS)
|
||||
&rtems_shell_Mount_NFS,
|
||||
#endif
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -130,6 +130,8 @@ static int rtems_ftpfs_set_connection_timeout(
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
CCJ_REMOVE_MOUNT
|
||||
rtems_status_code rtems_ftpfs_mount(const char *mount_point)
|
||||
{
|
||||
int rv = 0;
|
||||
@@ -156,6 +158,7 @@ rtems_status_code rtems_ftpfs_mount(const char *mount_point)
|
||||
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static rtems_status_code rtems_ftpfs_do_ioctl(
|
||||
const char *mount_point,
|
||||
@@ -234,19 +237,6 @@ rtems_status_code rtems_ftpfs_set_timeout(
|
||||
);
|
||||
}
|
||||
|
||||
int rtems_bsdnet_initialize_ftp_filesystem(void)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
|
||||
sc = rtems_ftpfs_mount(NULL);
|
||||
|
||||
if (sc == RTEMS_SUCCESSFUL) {
|
||||
return 0;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (*rtems_ftpfs_reply_parser)(
|
||||
const char * /* reply fragment */,
|
||||
size_t /* reply fragment length */,
|
||||
@@ -1232,8 +1222,9 @@ static rtems_filesystem_node_types_t rtems_ftpfs_node_type(
|
||||
return RTEMS_FILESYSTEM_MEMORY_FILE;
|
||||
}
|
||||
|
||||
static int rtems_ftpfs_mount_me(
|
||||
rtems_filesystem_mount_table_entry_t *e
|
||||
int rtems_ftpfs_initialize(
|
||||
rtems_filesystem_mount_table_entry_t *e,
|
||||
const void *d
|
||||
)
|
||||
{
|
||||
rtems_ftpfs_mount_entry *me = malloc(sizeof(rtems_ftpfs_mount_entry));
|
||||
@@ -1337,7 +1328,7 @@ const rtems_filesystem_operations_table rtems_ftpfs_ops = {
|
||||
.chown_h = NULL,
|
||||
.freenod_h = rtems_ftpfs_free_node,
|
||||
.mount_h = NULL,
|
||||
.fsmount_me_h = rtems_ftpfs_mount_me,
|
||||
.fsmount_me_h = rtems_ftpfs_initialize,
|
||||
.unmount_h = NULL,
|
||||
.fsunmount_me_h = rtems_ftpfs_unmount_me,
|
||||
.utime_h = NULL,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -98,16 +98,6 @@ typedef enum {
|
||||
*/
|
||||
extern const rtems_filesystem_operations_table rtems_ftpfs_ops;
|
||||
|
||||
/**
|
||||
* Creates the mount point @a mount_point and mounts the FTP file system.
|
||||
*
|
||||
* If @a mount_point is @c NULL the default mount point
|
||||
* @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT will be used.
|
||||
*
|
||||
* It is mounted with read and write access.
|
||||
*/
|
||||
rtems_status_code rtems_ftpfs_mount( const char *mount_point);
|
||||
|
||||
/**
|
||||
* Returns in @a verbose if the verbose mode is enabled or disabled for the
|
||||
* file system at @a mount_point.
|
||||
@@ -160,15 +150,12 @@ rtems_status_code rtems_ftpfs_set_timeout(
|
||||
|
||||
/**
|
||||
* Creates the default mount point @ref RTEMS_FTPFS_MOUNT_POINT_DEFAULT and
|
||||
* mounts the FTP file system.
|
||||
* mounts the FTP file system. Do not call directly, use mount.xs
|
||||
*
|
||||
* It is mounted with read and write access.
|
||||
*
|
||||
* On success, zero is returned. On error, -1 is returned.
|
||||
*
|
||||
* @deprecated Use rtems_ftpfs_mount() instead.
|
||||
*/
|
||||
int rtems_bsdnet_initialize_ftp_filesystem( void);
|
||||
int rtems_ftpfs_initialize(rtems_filesystem_mount_table_entry_t *e,
|
||||
const void *d);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
* To open `/bootfiles/image' on `hostname' for reading:
|
||||
* fd = open ("/TFTP/hostname/bootfiles/image", O_RDONLY);
|
||||
*
|
||||
* The `hostname' must be four dot-separated decimal values.
|
||||
* The 'TFTP' is the mount path and the `hostname' must be four dot-separated
|
||||
* decimal values.
|
||||
*/
|
||||
|
||||
#ifndef _RTEMS_TFTP_H
|
||||
@@ -32,6 +33,11 @@ extern "C" {
|
||||
|
||||
#include <rtems/libio.h>
|
||||
|
||||
/*
|
||||
* Filesystem Mount table entry.
|
||||
*/
|
||||
int rtems_tftpfs_initialize(rtems_filesystem_mount_table_entry_t *temp_mt_entry);
|
||||
|
||||
/*
|
||||
* Filesystem initialization routine
|
||||
*/
|
||||
|
||||
+232
-26
@@ -174,13 +174,192 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
|
||||
extern int rtems_telnetd_maximum_ptys;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Filesystems and Mount Table Configuration.
|
||||
*
|
||||
* Defines to control the file system:
|
||||
*
|
||||
* CONFIGURE_APPLICATION_DISABLE_FILESYSTEM:
|
||||
* Disable the RTEMS filesystems. You get an empty DEVFS.
|
||||
*
|
||||
* CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM:
|
||||
* Use the DEVFS as the root file system. Limited functions are
|
||||
* provided when this is used.
|
||||
*
|
||||
* CONFIGURE_FILESYSTEM_ALL:
|
||||
* Add file filesystems to the default filesystem table.
|
||||
*
|
||||
* List of available file systems. You can define as many as you like:
|
||||
* CONFIGURE_FILESYSTEM_miniIMFS - MiniIMFS, use DEVFS now
|
||||
* CONFIGURE_FILESYSTEM_IMFS - In Memory File System (IMFS)
|
||||
* CONFIGURE_FILESYSTEM_DEVFS - Device File System (DSVFS)
|
||||
* CONFIGURE_FILESYSTEM_TFTPFS - TFTP File System, networking enabled
|
||||
* CONFIGURE_FILESYSTEM_FTPFS - FTP File System, networking enabled
|
||||
* CONFIGURE_FILESYSTEM_NFSFS - Network File System, networking enabled
|
||||
* CONFIGURE_FILESYSTEM_DOSFS - DOS File System, uses libblock
|
||||
* CONFIGURE_FILESYSTEM_RFS - RTEMS File System (RFS), uses libblock
|
||||
*
|
||||
* Combinations:
|
||||
*
|
||||
* - If nothing is defined the base file system is the IMFS.
|
||||
*
|
||||
* - If CONFIGURE_APPLICATION_DISABLE_FILESYSTEM is defined all filesystem
|
||||
* are disabled by force and an empty DEVFS is created.
|
||||
*
|
||||
* - If CONFIGURE_USE_DEV_AS_BASE_FILESYSTEM is defined all filesystem
|
||||
* are disabled by force and DEVFS is defined.
|
||||
*/
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
#ifdef CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
|
||||
#if defined(RTEMS_COVERAGE)
|
||||
uint32_t rtems_device_table_size = 0;
|
||||
|
||||
/*
|
||||
* Include all file systems. Do this before checking if the filesystem has
|
||||
* been disabled.
|
||||
*/
|
||||
#ifdef CONFIGURE_FILESYSTEM_ALL
|
||||
#define CONFIGURE_FILESYSTEM_miniIMFS
|
||||
#define CONFIGURE_FILESYSTEM_IMFS
|
||||
#define CONFIGURE_FILESYSTEM_DEVFS
|
||||
#define CONFIGURE_FILESYSTEM_TFTPFS
|
||||
#define CONFIGURE_FILESYSTEM_FTPFS
|
||||
#define CONFIGURE_FILESYSTEM_NFSFS
|
||||
#define CONFIGURE_FILESYSTEM_DOSFS
|
||||
#define CONFIGURE_FILESYSTEM_RFS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If disabling the file system undef everything. If DEVFS as the base
|
||||
* filesystem undefine all other filesystems because you cannot mount other
|
||||
* filesystems.
|
||||
*/
|
||||
#if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) || \
|
||||
defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
|
||||
#if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM)
|
||||
#undef CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM
|
||||
#endif
|
||||
#undef CONFIGURE_FILESYSTEM_miniIMFS
|
||||
#undef CONFIGURE_FILESYSTEM_IMFS
|
||||
#undef CONFIGURE_FILESYSTEM_DEVFS
|
||||
#undef CONFIGURE_FILESYSTEM_TFTPFS
|
||||
#undef CONFIGURE_FILESYSTEM_FTPFS
|
||||
#undef CONFIGURE_FILESYSTEM_NFSFS
|
||||
#undef CONFIGURE_FILESYSTEM_DOSFS
|
||||
#undef CONFIGURE_FILESYSTEM_RFS
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If the base filesystem is DEVFS define it else define IMFS.
|
||||
* We will have either DEVFS or IMFS defined after this.
|
||||
*/
|
||||
#if defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM) && \
|
||||
!defined(CONFIGURE_FILESYSTEM_DEVFS)
|
||||
#define CONFIGURE_FILESYSTEM_DEVFS
|
||||
#elif !defined(CONFIGURE_FILESYSTEM_IMFS)
|
||||
#define CONFIGURE_FILESYSTEM_IMFS
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* IMFS
|
||||
*/
|
||||
#include <rtems/imfs.h>
|
||||
|
||||
/**
|
||||
* This specifies the number of bytes per block for files within the IMFS.
|
||||
* There are a maximum number of blocks per file so this dictates the maximum
|
||||
* size of a file. This has to be balanced with the unused portion of each
|
||||
* block that might be wasted.
|
||||
*/
|
||||
#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
|
||||
#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \
|
||||
IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
int imfs_rq_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
|
||||
#endif /* CONFIGURE_INIT */
|
||||
|
||||
/**
|
||||
* This defines the miniIMFS file system table entry.
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_miniIMFS)
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_miniIMFS { "mimfs", miniIMFS_initialize }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* This defines the IMFS file system table entry.
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_IMFS)
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_IMFS { "imfs", IMFS_initialize }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* DEVFS
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_DEVFS)
|
||||
#include <rtems/devfs.h>
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_DEVFS { "devfs", devFS_initialize }
|
||||
#endif
|
||||
|
||||
#ifdef RTEMS_NETWORKING
|
||||
/**
|
||||
* FTPFS
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_FTPFS)
|
||||
#include <rtems/ftpfs.h>
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_FTPFS { "ftpfs", rtems_ftpfs_initialize }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* TFTPFS
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_TFTPFS)
|
||||
#include <rtems/tftp.h>
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_TFTPFS { "tftpfs", rtems_tftpfs_initialize }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* NFSFS
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_NFSFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_NFSFS)
|
||||
#include <librtemsNfs.h>
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_NFSFS { "nfs", rtems_nfsfs_initialize }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* DOSFS
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_DOSFS)
|
||||
#include <rtems/dosfs.h>
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_DOSFS { "dosfs", rtems_dosfs_initialize }
|
||||
#endif
|
||||
|
||||
/**
|
||||
* RFS
|
||||
*/
|
||||
#if !defined(CONFIGURE_FILESYSTEM_ENTRY_RFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_RFS)
|
||||
#include <rtems/rtems-rfs.h>
|
||||
#define CONFIGURE_FILESYSTEM_ENTRY_RFS { "rfs", rtems_rfs_rtems_initialise }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
|
||||
/*
|
||||
* DEVFS variables.
|
||||
*/
|
||||
#if defined(CONFIGURE_APPLICATION_DISABLE_FILESYSTEM) && !defined(RTEMS_COVERAGE)
|
||||
#define CONFIGURE_MEMORY_FOR_DEVFS 0
|
||||
#elif defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
|
||||
#elif defined(CONFIGURE_FILESYSTEM_DEVFS)
|
||||
#ifndef CONFIGURE_MAXIMUM_DEVICES
|
||||
#define CONFIGURE_MAXIMUM_DEVICES 4
|
||||
#endif
|
||||
@@ -195,28 +374,54 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
|
||||
#else
|
||||
#define CONFIGURE_MEMORY_FOR_DEVFS 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Mount Table Configuration
|
||||
*/
|
||||
#include <rtems/imfs.h>
|
||||
/**
|
||||
* Table termination record.
|
||||
*/
|
||||
#define CONFIGURE_FILESYSTEM_NULL { NULL, NULL }
|
||||
|
||||
/**
|
||||
* This specifies the number of bytes per block for files within
|
||||
* the IMFS. There are a maximum number of blocks per file so
|
||||
* this dictates the maximum size of a file. This has to be balanced
|
||||
* with the unused portion of each block that might be wasted.
|
||||
*/
|
||||
#ifndef CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK
|
||||
#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK \
|
||||
IMFS_MEMFILE_DEFAULT_BYTES_PER_BLOCK
|
||||
#endif
|
||||
#ifdef CONFIGURE_INIT
|
||||
int imfs_rq_memfile_bytes_per_block = CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK;
|
||||
#endif /* CONFIGURE_INIT */
|
||||
/**
|
||||
* The default file system table. Must be terminated with the NULL entry if
|
||||
* you provide your own.
|
||||
*/
|
||||
#ifndef CONFIGURE_HAS_OWN_FILESYSTEM_TABLE
|
||||
const rtems_filesystem_table_t configuration_filesystem_table[] = {
|
||||
#if defined(CONFIGURE_FILESYSTEM_miniIMFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_miniIMFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_miniIMFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_FILESYSTEM_IMFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_IMFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_IMFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_FILESYSTEM_DEVFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_DEVFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_DEVFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_FILESYSTEM_TFTPFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_TFTPFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_TFTPFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_FILESYSTEM_FTPFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_FTPFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_FTPFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_FILESYSTEM_NFSFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_NFSFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_NFSFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_FILESYSTEM_DOSFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_DOSFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_DOSFS,
|
||||
#endif
|
||||
#if defined(CONFIGURE_FILESYSTEM_RFS) && \
|
||||
defined(CONFIGURE_FILESYSTEM_ENTRY_RFS)
|
||||
CONFIGURE_FILESYSTEM_ENTRY_RFS,
|
||||
#endif
|
||||
CONFIGURE_FILESYSTEM_NULL
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIGURE_INIT
|
||||
/**
|
||||
* This disables the inclusion of pipe support in the full IMFS.
|
||||
*
|
||||
@@ -234,11 +439,11 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
|
||||
#ifndef CONFIGURE_HAS_OWN_MOUNT_TABLE
|
||||
const rtems_filesystem_mount_table_t configuration_mount_table = {
|
||||
#ifdef CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
|
||||
&IMFS_ops,
|
||||
"imfs",
|
||||
#elif defined(CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM)
|
||||
&devFS_ops,
|
||||
"devfs",
|
||||
#else /* using miniIMFS as base filesystem */
|
||||
&miniIMFS_ops,
|
||||
"mimfs",
|
||||
#endif
|
||||
RTEMS_FILESYSTEM_READ_WRITE,
|
||||
NULL,
|
||||
@@ -249,6 +454,7 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
|
||||
*rtems_filesystem_mount_table = &configuration_mount_table;
|
||||
const int rtems_filesystem_mount_table_size = 1;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user