fs/mount and fs/unionfs: Support mount unionfs from nsh command.

This commit is contained in:
Xiang Xiao
2019-03-19 08:39:05 -06:00
committed by Gregory Nutt
parent 756c9f4eac
commit 579b38b760
2 changed files with 213 additions and 99 deletions
+15 -6
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/mount/fs_mount.c
*
* Copyright (C) 2007-2009, 2011-2013, 2015, 2017, 2018 Gregory Nutt. All
* Copyright (C) 2007-2009, 2011-2013, 2015, 2017-2019 Gregory Nutt. All
* rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
@@ -68,7 +68,8 @@
/* In the canonical case, a file system is bound to a block driver. However,
* some less typical cases a block driver is not required. Examples are
* pseudo file systems (like BINFS or PROCFS) and MTD file systems (like NXFFS).
* pseudo file systems (like BINFS or PROCFS) and MTD file systems (like
* NXFFS).
*
* These file systems all require block drivers:
*/
@@ -89,7 +90,7 @@
#if defined(CONFIG_FS_NXFFS) || defined(CONFIG_FS_BINFS) || \
defined(CONFIG_FS_PROCFS) || defined(CONFIG_NFS) || \
defined(CONFIG_FS_TMPFS) || defined(CONFIG_FS_USERFS) || \
defined(CONFIG_FS_CROMFS)
defined(CONFIG_FS_CROMFS) || defined(CONFIG_FS_UNIONFS)
# define NODFS_SUPPORT
#endif
@@ -196,6 +197,9 @@ extern const struct mountpt_operations hostfs_operations;
#ifdef CONFIG_FS_CROMFS
extern const struct mountpt_operations cromfs_operations;
#endif
#ifdef CONFIG_FS_UNIONFS
extern const struct mountpt_operations unionfs_operations;
#endif
static const struct fsmap_t g_nonbdfsmap[] =
{
@@ -222,6 +226,9 @@ static const struct fsmap_t g_nonbdfsmap[] =
#endif
#ifdef CONFIG_FS_CROMFS
{ "cromfs", &cromfs_operations },
#endif
#ifdef CONFIG_FS_UNIONFS
{ "unionfs", &unionfs_operations },
#endif
{ NULL, NULL },
};
@@ -398,12 +405,14 @@ int mount(FAR const char *source, FAR const char *target,
ret = inode_reserve(target, &mountpt_inode);
if (ret < 0)
{
/* inode_reserve can fail for a couple of reasons, but the most likely
* one is that the inode already exists. inode_reserve may return:
/* inode_reserve can fail for a couple of reasons, but the most
* likely one is that the inode already exists. inode_reserve may
* return:
*
* -EINVAL - 'path' is invalid for this operation
* -EEXIST - An inode already exists at 'path'
* -ENOMEM - Failed to allocate in-memory resources for the operation
* -ENOMEM - Failed to allocate in-memory resources for the
* operation
*/
ferr("ERROR: Failed to reserve inode for target %s\n", target);
+198 -93
View File
File diff suppressed because it is too large Load Diff