You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/27 18:50:06 UTC
[incubator-nuttx-apps] 03/03: nshlib: cmd_nfsmount support the
mount with TCP protocol
This is an automated email from the ASF dual-hosted git repository.
gnutt pushed a commit to branch pr107
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit 08d4527f9ed38775be1223adbfee2ed0a2086c21
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Fri Feb 28 01:39:16 2020 +0800
nshlib: cmd_nfsmount support the mount with TCP protocol
and make TCP as the default like Linux
Change-Id: Ic65862483f7c4e5d14c6849ff7184f64be7fc8da
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
nshlib/nsh_command.c | 2 +-
nshlib/nsh_mntcmds.c | 11 ++++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index 5e84024..f078f4c 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -361,7 +361,7 @@ static const struct cmdmap_s g_cmdmap[] =
#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_NET) && \
defined(CONFIG_NFS)
# ifndef CONFIG_NSH_DISABLE_NFSMOUNT
- { "nfsmount", cmd_nfsmount, 4, 4, "<server-address> <mount-point> <remote-path>" },
+ { "nfsmount", cmd_nfsmount, 4, 5, "<server-address> <mount-point> <remote-path> [udp]" },
# endif
#endif
diff --git a/nshlib/nsh_mntcmds.c b/nshlib/nsh_mntcmds.c
index 0e4a1df..085ead4 100644
--- a/nshlib/nsh_mntcmds.c
+++ b/nshlib/nsh_mntcmds.c
@@ -45,6 +45,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -334,7 +335,15 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
return ERROR;
}
- data.sotype = SOCK_DGRAM;
+ if (argc > 4 && strcmp(argv[4], "udp") == 0)
+ {
+ data.sotype = SOCK_DGRAM;
+ }
+ else
+ {
+ data.sotype = SOCK_STREAM;
+ }
+
data.path = rpath;
data.flags = 0; /* 0=Use all defaults */