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

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;
}
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 */