nshlib: cmd_nfsmount support the mount with TCP protocol

And make TCP as the default like Linux
This commit is contained in:
Xiang Xiao 2020-02-28 01:39:16 +08:00 committed by Gregory Nutt
parent 26a5fb0e74
commit 5f273b2c5c
2 changed files with 16 additions and 7 deletions

View File

@ -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 <gnutt@nuttx.org>
*
* 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, "<server-address> <mount-point> <remote-path>" },
{ "nfsmount", cmd_nfsmount, 4, 5, "<server-address> <mount-point> <remote-path> [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;
}
/****************************************************************************

View File

@ -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 */