From 427e574bd19d1bb68eb616170f22e169e2fe35c5 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 26 Jul 2023 10:10:14 +0800 Subject: [PATCH] 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 --- fs/unionfs/Kconfig | 2 +- fs/unionfs/README.txt | 2 +- fs/unionfs/fs_unionfs.c | 73 ------------------------------- include/nuttx/fs/unionfs.h | 88 -------------------------------------- 4 files changed, 2 insertions(+), 163 deletions(-) delete mode 100644 include/nuttx/fs/unionfs.h diff --git a/fs/unionfs/Kconfig b/fs/unionfs/Kconfig index 6c6271692e..bdce40439f 100644 --- a/fs/unionfs/Kconfig +++ b/fs/unionfs/Kconfig @@ -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 diff --git a/fs/unionfs/README.txt b/fs/unionfs/README.txt index 78e2970fc3..7a4875db5f 100644 --- a/fs/unionfs/README.txt +++ b/fs/unionfs/README.txt @@ -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 diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index d6c732e021..53a726840c 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -42,7 +42,6 @@ #include #include -#include #include #include @@ -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 */ diff --git a/include/nuttx/fs/unionfs.h b/include/nuttx/fs/unionfs.h deleted file mode 100644 index 014b31f4eb..0000000000 --- a/include/nuttx/fs/unionfs.h +++ /dev/null @@ -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 - -#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 */