summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/fsmount
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2010-05-31 13:56:37 +0000
committerChris Johns <chrisj@rtems.org>2010-05-31 13:56:37 +0000
commit29e92b090c8bc35745aa5c89231ce806bcb11e57 (patch)
treea253c33b1654609acfbd5216797976dce3b0748f /cpukit/libmisc/fsmount
parent2010-05-31 Joel Sherrill <joel.sherrilL@OARcorp.com> (diff)
downloadrtems-29e92b090c8bc35745aa5c89231ce806bcb11e57.tar.bz2
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.
Diffstat (limited to 'cpukit/libmisc/fsmount')
-rw-r--r--cpukit/libmisc/fsmount/fsmount.c97
-rw-r--r--cpukit/libmisc/fsmount/fsmount.h31
2 files changed, 63 insertions, 65 deletions
diff --git a/cpukit/libmisc/fsmount/fsmount.c b/cpukit/libmisc/fsmount/fsmount.c
index 2adfcb5d09..5fa52e99f2 100644
--- a/cpukit/libmisc/fsmount/fsmount.c
+++ b/cpukit/libmisc/fsmount/fsmount.c
@@ -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;
+ }
}
}
/*
diff --git a/cpukit/libmisc/fsmount/fsmount.h b/cpukit/libmisc/fsmount/fsmount.h
index 0841a6fe49..15597c31ff 100644
--- a/cpukit/libmisc/fsmount/fsmount.h
+++ b/cpukit/libmisc/fsmount/fsmount.h
@@ -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
* }