summaryrefslogtreecommitdiff
path: root/nuttx/fs
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/fs')
-rw-r--r--nuttx/fs/binfs/fs_binfs.c5
-rw-r--r--nuttx/fs/fat/fs_fat32.c20
-rw-r--r--nuttx/fs/mount/fs_umount2.c17
-rw-r--r--nuttx/fs/nfs/nfs_vfsops.c15
-rw-r--r--nuttx/fs/nxffs/nxffs.h5
-rw-r--r--nuttx/fs/nxffs/nxffs_initialize.c14
-rw-r--r--nuttx/fs/procfs/fs_procfs.c8
-rw-r--r--nuttx/fs/romfs/fs_romfs.c13
-rw-r--r--nuttx/fs/smartfs/smartfs_smart.c13
9 files changed, 75 insertions, 35 deletions
diff --git a/nuttx/fs/binfs/fs_binfs.c b/nuttx/fs/binfs/fs_binfs.c
index a130a0199..a5cca2aa2 100644
--- a/nuttx/fs/binfs/fs_binfs.c
+++ b/nuttx/fs/binfs/fs_binfs.c
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/binfs/fs_binfs.c
*
- * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -370,7 +370,8 @@ static int binfs_bind(FAR struct inode *blkdriver, const void *data,
*
****************************************************************************/
-static int binfs_unbind(void *handle, FAR struct inode **blkdriver)
+static int binfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags)
{
fvdbg("Entry\n");
return OK;
diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c
index 5cb58463a..7dd24c733 100644
--- a/nuttx/fs/fat/fs_fat32.c
+++ b/nuttx/fs/fat/fs_fat32.c
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/fat/fs_fat32.c
*
- * Copyright (C) 2007-2009, 2011-2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References:
@@ -97,7 +97,8 @@ static int fat_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir);
static int fat_bind(FAR struct inode *blkdriver, const void *data,
void **handle);
-static int fat_unbind(void *handle, FAR struct inode **blkdriver);
+static int fat_unbind(void *handle, FAR struct inode **blkdriver,
+ unsigned int flags);
static int fat_statfs(struct inode *mountpt, struct statfs *buf);
static int fat_unlink(struct inode *mountpt, const char *relpath);
@@ -116,7 +117,7 @@ static int fat_stat(struct inode *mountpt, const char *relpath, struct stat
* Public Variables
****************************************************************************/
-/* See fs_mount.c -- this structure is explicitly externed there.
+/* See fs_mount.c -- this structure is explicitly extern'ed there.
* We use the old-fashioned kind of initializers so that this will compile
* with any compiler.
*/
@@ -197,7 +198,7 @@ static int fat_open(FAR struct file *filep, const char *relpath,
ret = fat_finddirentry(fs, &dirinfo, relpath);
- /* Three possibililities: (1) a node exists for the relpath and
+ /* Three possibilities: (1) a node exists for the relpath and
* dirinfo describes the directory entry of the entity, (2) the
* node does not exist, or (3) some error occurred.
*/
@@ -1795,7 +1796,8 @@ static int fat_bind(FAR struct inode *blkdriver, const void *data,
*
****************************************************************************/
-static int fat_unbind(void *handle, FAR struct inode **blkdriver)
+static int fat_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags)
{
struct fat_mountpt_s *fs = (struct fat_mountpt_s*)handle;
int ret;
@@ -1811,9 +1813,13 @@ static int fat_unbind(void *handle, FAR struct inode **blkdriver)
fat_semtake(fs);
if (fs->fs_head)
{
- /* We cannot unmount now.. there are open files */
+ /* We cannot unmount now.. there are open files
+ *
+ * This implementation currently only supports unmounting if there are
+ * no open file references.
+ */
- ret = -EBUSY;
+ ret = (flags != 0) ? -ENOSYS : -EBUSY;
}
else
{
diff --git a/nuttx/fs/mount/fs_umount2.c b/nuttx/fs/mount/fs_umount2.c
index 6d0609f9e..1611bb6dc 100644
--- a/nuttx/fs/mount/fs_umount2.c
+++ b/nuttx/fs/mount/fs_umount2.c
@@ -92,7 +92,7 @@ int umount2(FAR const char *target, unsigned int flags)
FAR struct inode *mountpt_inode;
FAR struct inode *blkdrvr_inode = NULL;
int errcode = OK;
- int status;
+ int ret;
/* Verify required pointer arguments */
@@ -137,15 +137,16 @@ int umount2(FAR const char *target, unsigned int flags)
*/
inode_semtake(); /* Hold the semaphore through the unbind logic */
- status = mountpt_inode->u.i_mops->unbind( mountpt_inode->i_private, &blkdrvr_inode);
- if (status < 0)
+ ret = mountpt_inode->u.i_mops->unbind(mountpt_inode->i_private,
+ &blkdrvr_inode, flags);
+ if (ret < 0)
{
/* The inode is unhappy with the blkdrvr for some reason */
- errcode = -status;
+ errcode = -ret;
goto errout_with_semaphore;
}
- else if (status > 0)
+ else if (ret > 0)
{
errcode = EBUSY;
goto errout_with_semaphore;
@@ -160,16 +161,16 @@ int umount2(FAR const char *target, unsigned int flags)
* there is still at least reference on it (from the mount)
*/
- status = inode_remove(target);
+ ret = inode_remove(target);
inode_semgive();
/* The return value of -EBUSY is normal (in fact, it should
* not be OK)
*/
- if (status != OK && status != -EBUSY)
+ if (ret != OK && ret != -EBUSY)
{
- errcode = -status;
+ errcode = -ret;
goto errout_with_mountpt;
}
diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c
index bb42093de..c9536f44a 100644
--- a/nuttx/fs/nfs/nfs_vfsops.c
+++ b/nuttx/fs/nfs/nfs_vfsops.c
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nfs/nfs_vfsops.c
*
- * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved.
* Author: Jose Pablo Rojas Vargas <jrojas@nx-engineering.com>
* Gregory Nutt <gnutt@nuttx.org>
@@ -144,7 +144,8 @@ static void nfs_decode_args(FAR struct nfs_mount_parameters *nprmt,
FAR struct nfs_args *argp);
static int nfs_bind(FAR struct inode *blkdriver, const void *data,
void **handle);
-static int nfs_unbind(void *handle, FAR struct inode **blkdriver);
+static int nfs_unbind(void *handle, FAR struct inode **blkdriver.
+ unsigned int flags);
static int nfs_statfs(struct inode *mountpt, struct statfs *buf);
static int nfs_remove(struct inode *mountpt, const char *relpath);
static int nfs_mkdir(struct inode *mountpt, const char *relpath,
@@ -1872,7 +1873,8 @@ bad:
*
****************************************************************************/
-int nfs_unbind(FAR void *handle, FAR struct inode **blkdriver)
+int nfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags)
{
FAR struct nfsmount *nmp = (FAR struct nfsmount *)handle;
int error;
@@ -1893,7 +1895,12 @@ int nfs_unbind(FAR void *handle, FAR struct inode **blkdriver)
if (nmp->nm_head != NULL)
{
fdbg("ERROR; There are open files: %p\n", nmp->nm_head);
- error = EBUSY;
+
+ /* This implementation currently only supports unmounting if there are
+ * no open file references.
+ */
+
+ error = (flags != 0) ? ENOSYS : EBUSY;
goto errout_with_semaphore;
}
diff --git a/nuttx/fs/nxffs/nxffs.h b/nuttx/fs/nxffs/nxffs.h
index 87bc06227..89adb6dac 100644
--- a/nuttx/fs/nxffs/nxffs.h
+++ b/nuttx/fs/nxffs/nxffs.h
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nxffs/nxffs.h
*
- * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References: Linux/Documentation/filesystems/romfs.txt
@@ -1098,7 +1098,8 @@ int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
int nxffs_rewinddir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
-int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver);
+int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags);
int nxffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf);
int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath,
FAR struct stat *buf);
diff --git a/nuttx/fs/nxffs/nxffs_initialize.c b/nuttx/fs/nxffs/nxffs_initialize.c
index d7d55f077..13081b6c1 100644
--- a/nuttx/fs/nxffs/nxffs_initialize.c
+++ b/nuttx/fs/nxffs/nxffs_initialize.c
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/nxffs/nxffs_initialize.c
*
- * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011, 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* References: Linux/Documentation/filesystems/romfs.txt
@@ -550,11 +550,21 @@ int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data,
*
****************************************************************************/
-int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver)
+int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags)
{
#ifndef CONFIG_NXFFS_PREALLOCATED
# error "No design to support dynamic allocation of volumes"
#else
+ /* This implementation currently only supports unmounting if there are no
+ * open file references.
+ */
+
+ if (flags != 0)
+ {
+ return -ENOSYS;
+ }
+
return g_volume.ofiles ? -EBUSY : OK;
#endif
}
diff --git a/nuttx/fs/procfs/fs_procfs.c b/nuttx/fs/procfs/fs_procfs.c
index 322573691..0ecab3540 100644
--- a/nuttx/fs/procfs/fs_procfs.c
+++ b/nuttx/fs/procfs/fs_procfs.c
@@ -1,7 +1,7 @@
/****************************************************************************
* fs/procfs/fs_procfs.c
*
- * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -170,7 +170,8 @@ static int procfs_rewinddir(FAR struct inode *mountpt,
static int procfs_bind(FAR struct inode *blkdriver,
FAR const void *data, FAR void **handle);
-static int procfs_unbind(FAR void *handle, FAR struct inode **blkdriver);
+static int procfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags);
static int procfs_statfs(FAR struct inode *mountpt,
FAR struct statfs *buf);
@@ -861,7 +862,8 @@ static int procfs_bind(FAR struct inode *blkdriver, const void *data,
*
****************************************************************************/
-static int procfs_unbind(void *handle, FAR struct inode **blkdriver)
+static int procfs_unbind(void *handle, FAR struct inode **blkdriver,
+ unsigned int flags)
{
return OK;
}
diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c
index c4f41f2d2..3a65adfc2 100644
--- a/nuttx/fs/romfs/fs_romfs.c
+++ b/nuttx/fs/romfs/fs_romfs.c
@@ -92,7 +92,8 @@ static int romfs_rewinddir(FAR struct inode *mountpt,
static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data,
FAR void **handle);
-static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver);
+static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags);
static int romfs_statfs(FAR struct inode *mountpt,
FAR struct statfs *buf);
@@ -977,7 +978,8 @@ errout_with_sem:
*
****************************************************************************/
-static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver)
+static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags)
{
FAR struct romfs_mountpt_s *rm = (FAR struct romfs_mountpt_s*)handle;
int ret;
@@ -999,7 +1001,12 @@ static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver)
/* We cannot unmount now.. there are open files */
fdbg("There are open files\n");
- ret = -EBUSY;
+
+ /* This implementation currently only supports unmounting if there are
+ * no open file references.
+ */
+
+ ret = (flags != 0) ? -ENOSYS : -EBUSY;
}
else
{
diff --git a/nuttx/fs/smartfs/smartfs_smart.c b/nuttx/fs/smartfs/smartfs_smart.c
index bf1490ee0..857c284e2 100644
--- a/nuttx/fs/smartfs/smartfs_smart.c
+++ b/nuttx/fs/smartfs/smartfs_smart.c
@@ -93,7 +93,8 @@ static int smartfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
static int smartfs_bind(FAR struct inode *blkdriver, const void *data,
void **handle);
-static int smartfs_unbind(void *handle, FAR struct inode **blkdriver);
+static int smartfs_unbind(void *handle, FAR struct inode **blkdriver,
+ unsigned int flags);
static int smartfs_statfs(struct inode *mountpt, struct statfs *buf);
static int smartfs_unlink(struct inode *mountpt, const char *relpath);
@@ -1544,7 +1545,8 @@ static int smartfs_bind(FAR struct inode *blkdriver, const void *data,
*
****************************************************************************/
-static int smartfs_unbind(void *handle, FAR struct inode **blkdriver)
+static int smartfs_unbind(FAR void *handle, FAR struct inode **blkdriver,
+ unsigned int flags)
{
struct smartfs_mountpt_s *fs = (struct smartfs_mountpt_s*)handle;
int ret;
@@ -1564,7 +1566,11 @@ static int smartfs_unbind(void *handle, FAR struct inode **blkdriver)
smartfs_semgive(fs);
- ret = -EBUSY;
+ /* This implementation currently only supports unmounting if there are
+ * no open file references.
+ */
+
+ return (flags != 0) ? -ENOSYS : -EBUSY;
}
else
{
@@ -1575,7 +1581,6 @@ static int smartfs_unbind(void *handle, FAR struct inode **blkdriver)
smartfs_semgive(fs);
kmm_free(fs);
-
return ret;
}