From a5413386562c28b75ea26bd64cc8ab9f264d99f3 Mon Sep 17 00:00:00 2001 From: zhangfanfan2 Date: Thu, 24 Dec 2020 14:48:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B8=ADmount=20nfs=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- syscall/fs_syscall.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/syscall/fs_syscall.c b/syscall/fs_syscall.c index 71e5fceb..fc582f2a 100644 --- a/syscall/fs_syscall.c +++ b/syscall/fs_syscall.c @@ -500,6 +500,26 @@ out: return 0; } +#ifdef LOSCFG_FS_NFS +static int NfsMountRef(const char *serverIpAndPath, const char *mountPath, + unsigned int uid, unsigned int gid) __attribute__((weakref("nfs_mount"))); + +static int NfsMount(const char *serverIpAndPath, const char *mountPath, + unsigned int uid, unsigned int gid) +{ + int ret; + + if ((serverIpAndPath == NULL) || (mountPath == NULL)) { + return -EINVAL; + } + ret = NfsMountRef(serverIpAndPath, mountPath, uid, gid); + if (ret < 0) { + ret = -get_errno(); + } + return ret; +} +#endif + int SysMount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data) { @@ -534,6 +554,12 @@ int SysMount(const char *source, const char *target, const char *filesystemtype, goto OUT; } } +#ifdef LOSCFG_FS_NFS + if (strcmp(fstypeRet, "nfs") == 0) { + ret = NfsMount(sourceRet, targetRet, 0, 0); + goto OUT; + } +#endif } ret = mount(sourceRet, targetRet, (filesystemtype ? fstypeRet : NULL), mountflags, data);