From 5f93ae9dd23b7c77f5196c48c4ba3eccf1af2984 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 10 Aug 2022 03:35:34 +0800 Subject: [PATCH] fs/rpmsg: Move the server initialization to fs_initialize Signed-off-by: Xiang Xiao --- boards/sim/sim/sim/README.txt | 2 +- boards/sim/sim/sim/configs/rpserver/defconfig | 2 +- boards/sim/sim/sim/src/sim_bringup.c | 5 --- fs/fs_initialize.c | 5 +++ fs/rpmsgfs/Kconfig | 7 +++ fs/rpmsgfs/Make.defs | 4 ++ fs/rpmsgfs/rpmsgfs.c | 1 - fs/rpmsgfs/rpmsgfs.h | 6 +++ fs/rpmsgfs/rpmsgfs_client.c | 1 - fs/rpmsgfs/rpmsgfs_server.c | 1 - include/nuttx/fs/rpmsgfs.h | 45 ------------------- 11 files changed, 24 insertions(+), 55 deletions(-) delete mode 100644 include/nuttx/fs/rpmsgfs.h diff --git a/boards/sim/sim/sim/README.txt b/boards/sim/sim/sim/README.txt index 53aef33b32..5f2316bd98 100644 --- a/boards/sim/sim/sim/README.txt +++ b/boards/sim/sim/sim/README.txt @@ -1059,7 +1059,7 @@ rpserver 3.RpmsgFS Source: - include/nuttx/fs/rpmsgfs.h + fs/rpmsgfs/rpmsgfs.h fs/rpmsgfs/rpmsgfs.c fs/rpmsgfs/rpmsgfs_client.c fs/rpmsgfs/rpmsgfs_server.c diff --git a/boards/sim/sim/sim/configs/rpserver/defconfig b/boards/sim/sim/sim/configs/rpserver/defconfig index e065496a42..c040e4140f 100644 --- a/boards/sim/sim/sim/configs/rpserver/defconfig +++ b/boards/sim/sim/sim/configs/rpserver/defconfig @@ -19,7 +19,7 @@ CONFIG_DEV_SIMPLE_ADDRENV=y CONFIG_EXAMPLES_RPMSGSOCKET=y CONFIG_FS_HOSTFS=y CONFIG_FS_PROCFS=y -CONFIG_FS_RPMSGFS=y +CONFIG_FS_RPMSGFS_SERVER=y CONFIG_IDLETHREAD_STACKSIZE=4096 CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INPUT=y diff --git a/boards/sim/sim/sim/src/sim_bringup.c b/boards/sim/sim/sim/src/sim_bringup.c index 4932cfe10e..0b57627215 100644 --- a/boards/sim/sim/sim/src/sim_bringup.c +++ b/boards/sim/sim/sim/src/sim_bringup.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -447,10 +446,6 @@ int sim_bringup(void) #else up_rptun_init("server-proxy", "server", false); #endif - -#if defined(CONFIG_FS_RPMSGFS) && defined(CONFIG_SIM_RPTUN_MASTER) - rpmsgfs_server_init(); -#endif #endif #ifdef CONFIG_SIM_WTGAHRS2_UARTN diff --git a/fs/fs_initialize.c b/fs/fs_initialize.c index 48cdbdce3b..f04aee4e70 100644 --- a/fs/fs_initialize.c +++ b/fs/fs_initialize.c @@ -24,6 +24,7 @@ #include +#include "rpmsgfs/rpmsgfs.h" #include "inode/inode.h" #include "aio/aio.h" @@ -52,4 +53,8 @@ void fs_initialize(void) aio_initialize(); #endif + +#ifdef CONFIG_FS_RPMSGFS_SERVER + rpmsgfs_server_init(); +#endif } diff --git a/fs/rpmsgfs/Kconfig b/fs/rpmsgfs/Kconfig index d59a588eb3..457686d506 100644 --- a/fs/rpmsgfs/Kconfig +++ b/fs/rpmsgfs/Kconfig @@ -10,3 +10,10 @@ config FS_RPMSGFS ---help--- Use rpmsg file system to mount remote directories to local. This the method for user to use remote file like own core. + +config FS_RPMSGFS_SERVER + bool "RPMSG File Server" + default n + depends on RPTUN + ---help--- + Initialize rpmsg file system server automatically. diff --git a/fs/rpmsgfs/Make.defs b/fs/rpmsgfs/Make.defs index aea7bf0022..e6d806f642 100644 --- a/fs/rpmsgfs/Make.defs +++ b/fs/rpmsgfs/Make.defs @@ -26,3 +26,7 @@ VPATH += :rpmsgfs ifeq ($(CONFIG_FS_RPMSGFS),y) CSRCS += rpmsgfs.c rpmsgfs_client.c rpmsgfs_server.c endif + +ifeq ($(CONFIG_FS_RPMSGFS_SERVER),y) +CSRCS += rpmsgfs_server.c +endif diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c index 520f63df71..8ac89cd9f4 100644 --- a/fs/rpmsgfs/rpmsgfs.c +++ b/fs/rpmsgfs/rpmsgfs.c @@ -39,7 +39,6 @@ #include #include #include -#include #include "rpmsgfs.h" diff --git a/fs/rpmsgfs/rpmsgfs.h b/fs/rpmsgfs/rpmsgfs.h index fe102c9d9d..6b9d2384af 100644 --- a/fs/rpmsgfs/rpmsgfs.h +++ b/fs/rpmsgfs/rpmsgfs.h @@ -245,4 +245,10 @@ int rpmsgfs_client_stat(FAR void *handle, FAR const char *path, int rpmsgfs_client_chstat(FAR void *handle, FAR const char *path, FAR const struct stat *buf, int flags); +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int rpmsgfs_server_init(void); + #endif /* __FS_RPMSGFS_RPMSGFS_H */ diff --git a/fs/rpmsgfs/rpmsgfs_client.c b/fs/rpmsgfs/rpmsgfs_client.c index dd8ccfa1bb..5be444be98 100644 --- a/fs/rpmsgfs/rpmsgfs_client.c +++ b/fs/rpmsgfs/rpmsgfs_client.c @@ -30,7 +30,6 @@ #include #include -#include #include #include diff --git a/fs/rpmsgfs/rpmsgfs_server.c b/fs/rpmsgfs/rpmsgfs_server.c index e34631933b..4fce36c38d 100644 --- a/fs/rpmsgfs/rpmsgfs_server.c +++ b/fs/rpmsgfs/rpmsgfs_server.c @@ -33,7 +33,6 @@ #include #include -#include #include #include "rpmsgfs.h" diff --git a/include/nuttx/fs/rpmsgfs.h b/include/nuttx/fs/rpmsgfs.h deleted file mode 100644 index 76de3de524..0000000000 --- a/include/nuttx/fs/rpmsgfs.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** - * include/nuttx/fs/rpmsgfs.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_HOSTFS_H -#define __INCLUDE_NUTTX_FS_HOSTFS_H - -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - -#ifdef __cplusplus -#define EXTERN extern "C" -extern "C" -{ -#else -#define EXTERN extern -#endif - -#ifdef CONFIG_FS_RPMSGFS -int rpmsgfs_server_init(void); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __INCLUDE_NUTTX_FS_HOSTFS_H */