fs/unionfs: Remove unionfs_mount function

since the same function can be achieved by mount:
mount(NULL, "/mnt/unionfs", "unionfs", 0,
      "fspath1=/mnt/path1,prefix1=prefix1,"
      "fspath2=/mnt/path2,prefix2=prefix2");

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-07-26 10:10:14 +08:00 committed by Alan Carvalho de Assis
parent fc5e85da1b
commit 427e574bd1
4 changed files with 2 additions and 163 deletions

View file

@ -13,7 +13,7 @@ config FS_UNIONFS
1) Mount file system 1 at some location, say /mnt/file1
2) Mount file system 2 at some location, say /mnt/file2
3) Call unionfs_mount() to combine and overly /mnt/file1 and
3) Call mount() to combine and overly /mnt/file1 and
mnt/file2 as a new mount point, say /mnt/unionfs.
/mnt/file1 and /mnt/file2 will disappear and be replaced by the

View file

@ -9,7 +9,7 @@ fs/unionfs/README.txt
1) Mount file system 1 at some location, say /mnt/file1
2) Mount file system 2 at some location, say /mnt/file2
3) Call unionfs_mount() to combine and overly /mnt/file1 and mnt/file2
3) Call mount() to combine and overly /mnt/file1 and mnt/file2
as a new mount point, say /mnt/unionfs.
/mnt/file1 and /mnt/file2 will disappear and be replaced by the single

View file

@ -42,7 +42,6 @@
#include <nuttx/kmalloc.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/unionfs.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/mutex.h>
@ -2674,76 +2673,4 @@ errout_with_uinode:
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: unionfs_mount
*
* Description:
* Create and mount a union file system
*
* Input Parameters:
* fspath1 - The full path to the first file system mountpoint
* prefix1 - An optiona prefix that may be applied to make the first
* file system appear a some path below the unionfs mountpoint,
* fspath2 - The full path to the second file system mountpoint
* prefix2 - An optiona prefix that may be applied to make the first
* file system appear a some path below the unionfs mountpoint,
* mountpt - The full path to the mountpoint for the union file system
*
* Returned Value:
* Zero (OK) is returned if the union file system was correctly created and
* mounted. On any failure, a negated error value will be returned to
* indicate the nature of the failure.
*
****************************************************************************/
int unionfs_mount(FAR const char *fspath1, FAR const char *prefix1,
FAR const char *fspath2, FAR const char *prefix2,
FAR const char *mountpt)
{
FAR struct inode *mpinode;
int ret;
DEBUGASSERT(mountpt != NULL);
/* Mount the union FS. We should adapt the standard mount to do
* this using optional parameters. This custom mount should do the job
* for now, however.
*/
ret = inode_reserve(mountpt, 0777, &mpinode);
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:
*
* -EINVAL - 'path' is invalid for this operation
* -EEXIST - An inode already exists at 'path'
* -ENOMEM - Failed to allocate in-memory resources for the operation
*/
ferr("ERROR: Failed to reserve inode\n");
return ret;
}
/* Populate the inode with driver specific information. */
INODE_SET_MOUNTPT(mpinode);
mpinode->u.i_mops = &g_unionfs_operations;
/* Call unionfs_dobind to do the real work. */
ret = unionfs_dobind(fspath1, prefix1, fspath2, prefix2,
&mpinode->i_private);
if (ret < 0)
{
goto errout_with_mountpt;
}
return OK;
errout_with_mountpt:
inode_release(mpinode);
return ret;
}
#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_UNIONFS */

View file

@ -1,88 +0,0 @@
/****************************************************************************
* include/nuttx/fs/unionfs.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_FS_UNIONFS_H
#define __INCLUDE_NUTTX_FS_UNIONFS_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#ifdef CONFIG_FS_UNIONFS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Type Definitions
****************************************************************************/
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: unionfs_mount
*
* Description:
* Create and mount a union file system
*
* Input Parameters:
* fspath1 - The full path to the first file system mountpoint
* prefix1 - An optiona prefix that may be applied to make the first
* file system appear a some path below the unionfs mountpoint,
* fspath2 - The full path to the second file system mountpoint
* prefix2 - An optiona prefix that may be applied to make the first
* file system appear a some path below the unionfs mountpoint,
* mountpt - The full path to the mountpoint for the union file system
*
* Returned Value:
* Zero (OK) is returned if the union file system was correctly created and
* mounted. On any failure, a negated error value will be returned to
* indicate the nature of the failure.
*
****************************************************************************/
int unionfs_mount(FAR const char *fspath1, FAR const char *prefix1,
FAR const char *fspath2, FAR const char *prefix2,
FAR const char *mountpt);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_FS_UNIONFS */
#endif /* __INCLUDE_NUTTX_FS_UNIONFS_H */