From 5f273b2c5c617720c71ce7aea86b87e130f52143 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Fri, 28 Feb 2020 01:39:16 +0800 Subject: [PATCH] nshlib: cmd_nfsmount support the mount with TCP protocol And make TCP as the default like Linux --- nshlib/nsh_command.c | 12 ++++++------ nshlib/nsh_mntcmds.c | 11 ++++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c index 5e8402469..45075a04e 100644 --- a/nshlib/nsh_command.c +++ b/nshlib/nsh_command.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_command.c * - * Copyright (C) 2007-2019 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2019, 2020 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -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, " " }, + { "nfsmount", cmd_nfsmount, 4, 5, " [udp]" }, # endif #endif @@ -693,7 +693,7 @@ static void help_showcmd(FAR struct nsh_vtbl_s *vtbl, { nsh_output(vtbl, " %s %s\n", cmdmap->cmd, cmdmap->usage); } - else + else { nsh_output(vtbl, " %s\n", cmdmap->cmd); } @@ -883,7 +883,7 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } else { - /* In verbose mode, show detailed help for all commands */ + /* In verbose mode, show detailed help for all commands */ #ifndef CONFIG_NSH_HELP_TERSE if (verbose) @@ -1027,8 +1027,8 @@ int nsh_command(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[]) } } - ret = handler(vtbl, argc, argv); - return ret; + ret = handler(vtbl, argc, argv); + return ret; } /**************************************************************************** diff --git a/nshlib/nsh_mntcmds.c b/nshlib/nsh_mntcmds.c index 0e4a1df5e..085ead4e6 100644 --- a/nshlib/nsh_mntcmds.c +++ b/nshlib/nsh_mntcmds.c @@ -45,6 +45,7 @@ #include #include +#include #include #include #include @@ -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 */