Commit Graph

179 Commits

Author SHA1 Message Date
Xiang Xiao d7cb4567e6 fs/nfs: Support fchstat and chstat callback
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-10 21:28:52 +09:00
Xiang Xiao 580de38832 fs/nfs: Return nanosecond from nfs_fstat and nfs_stat callback
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-10 21:28:52 +09:00
Xiang Xiao 7a60efab35 fs/nfs: Support 64bit file length
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-10 21:28:52 +09:00
Xiang Xiao 307cc61893 fs: Add fchstat and chstat callback into mountpt_operations
and implement all status related change function. the individual
file system change will provide in other upcoming patchset.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8fde9db8eba9586e9c8da078b67e020c26623cf4
2021-07-29 06:33:49 -03:00
Masayuki Ishikawa a3f1abfb45 fs: nfs: Fix statfs for NFS
Summary:
- I noticed that the results of the df command are incorrect for NFS.
- Finally, I found that obj_attributes is not needed to
  communicate with the NFS server on Linux
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-07-19 04:26:44 -07:00
Masayuki Ishikawa abc2767b0d fs: nfs: Reconnect to the NFS server in TCP mode
Summary:
- I noticed that an NFS connection is automatically dropped.
- Actually, this happens in TCP mode if no traffic happens
  for 600 seconds.
- I confirmed that the NFS client on Ubuntu automatically
  reconnects to the NFS server when an RPC call failed.
- This commit adds the same behavior to fix the issue.

Impact:
- NFS client in TCP mode

Testing:
- Tested with spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-06-28 01:11:52 -05:00
Masayuki Ishikawa e1b14271c8 fs: nfs: Do not bind to a local port in TCP mode
Summary:
- Since binding to a local port is not necessary in TCP mode,
  it should be done only in UDP mode

Impact:
- None

Testing:
- Tested with NFS server on Ubuntu 18.04 (x86_64)
- Tested with spresense:rndis (defconfig will be updated later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-05-13 22:33:12 -03:00
Masayuki Ishikawa 2873f33bc4 fs: nfs: Fix to read a large packet in TCP mode
Summary:
- I noticed that receiving a read large packet (e.g. 2KB) in TCP
  mode does not work correctly
- Actually, rpcclnt_receive() only received up to MSS
- This commit fixes this issue

Impact:
- TCP mode only

Testing:
- Tested with Ubuntu 18.04 (x86_64)
- Tested with spresense:rndis (defconfig will be updated later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-05-13 22:33:12 -03:00
Masayuki Ishikawa f0372dde6a fs: nfs: Fix rpcclnt_send() in TCP mode
Summary:
- I noticed that NFS over TCP does not work with Ubuntu 18.04
- Finally, I found that the record marking packet should not
  be sent separately
- This commit fixes this issue

Impact:
- TCP mode only

Testing:
- Tested with NFS server on Ubuntu 18.04 (x86_64)
- Tested with spresense:rndis (defconfig will be updated later)

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-05-13 22:33:12 -03:00
Alin Jerpelea 7dc5db49fc fs: nxstyle fixes
Fix for several errors reported by the nxstyle tool

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-04-03 09:37:06 -05:00
Gustavo Henrique Nihei 47cb41c92f makefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
Gustavo Henrique Nihei 76acb32e29 Fix typos reported by codespell 2021-02-25 11:31:49 -08:00
Alin Jerpelea f9fb182809 Author: Gregory Nutt: update licenses to Apache
Update files from Gregory Nutt to Apache 2.0 license.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-05 12:15:56 -03:00
YAMAMOTO Takashi e8695d61ca fs/nfs/nfs_vfsops.c: Fix syslog formats
The following nxstyle errors are not new.
(macros like SIZEOF_rpc_reply_readdir)

fs/nfs/nfs_vfsops.c:848:12: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:1020:16: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:1420:13: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:1818:11: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:1819:11: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:1830:8: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:1851:42: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:2049:54: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:2115:58: error: Mixed case identifier found
fs/nfs/nfs_vfsops.c:2172:54: error: Mixed case identifier found
2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi 73dd8a1ba2 fs/nfs/nfs_util.c: Fix syslog formats
The following nxstyle error is a false positive.
https://github.com/apache/incubator-nuttx/issues/387

fs/nfs/nfs_util.c:70:39: error: C++ style comment
2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi bed9c3b83d fs/nfs/rpc_clnt.c: Fix a syslog format 2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi 0a146273bf fs/nfs/rpc_clnt.c: Appease nxstyle
The following nxstyle errors are intentionally left
because they are parts of the copyright notices.

fs/nfs/rpc_clnt.c:46:80: error: Long line found
fs/nfs/rpc_clnt.c:63:78: error: Long line found
2020-11-25 05:11:26 -08:00
Xiang Xiao eb4121ce38 Change all 'Nuttx' to 'NuttX'
Unify the naming convention

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-10-20 01:45:06 -07:00
Xiang Xiao 9dff16e0e4 fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ieaf325c899d1c349d64dfa15bddcc32afd1fce42
2020-07-10 21:30:02 +01:00
Erdem Meydanli 20ef084712 Fix the indentation and spacing that don't conform to the coding standard. 2020-05-28 12:22:23 -06:00
Erdem Meydanli 7f018e7898 fs/nfs/nfs_proto.h: Use of uint64_t in the data types breaks NFS functionality.
The use of uint64_t primitive type in NFS structures forces the compiler to align data on an 8-byte boundary.
As a result of this, unwanted gaps being created, which causes NFS to fail. (e.g., nfs_read/initialize the request)
Using nfsuint64 instead of uint64_t fixes this issue.
2020-05-28 12:22:23 -06:00
Gregory Nutt fefd893b65 fs/nfs/nfs_util.c: Fix compilation error
The build gets broken when both the NFS and DEBUG_FS_ERROR configurations enabled. This tiny change fixes the compilation error.

Run file through nxstyle and correct issues.

NOTE:  This line:

    /* This logic just supports "//" sequences in the path name */

generates the false alarm error:

    fs/nfs/nfs_util.c:84:39: error: C++ style comment
2020-05-25 13:45:28 -06:00
Xiang Xiao 23668a4b9b build: Remove the empty variable assignment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 08:24:13 -06:00
Gregory Nutt ae401cecdd Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under fs/driver, fs/aio, fs/nfs, crypto/, and boards/.

Please note:  The modified file under fs/nfs generates several " Mixed case identifier found" errors.  Please ignore these.  These cannot be fixed without changes to numerous other files.  They also follow a non-standard convention that is used many files:  Using lower case structure names in custom SIZEOF_ definitions.
2020-03-30 17:09:45 +01:00
Gregory Nutt 2b532ae4a8 fs/: Remove support for CONFIG_FS_READABLE 2020-03-22 08:24:07 -05:00
Gregory Nutt 7a871e2f29 fs/: Remove support for CONFIG_FS_WRITABLE 2020-03-22 08:24:07 -05:00
Ouss4 ae060e1d98 fs/nfs/nfs_vfsops.c: Run nxstyle against the file. 2020-03-07 17:44:27 +00:00
Xiang Xiao 9836d17f3f nfs: fix warning: 'byteswritten' may be used uninitialized 2020-03-07 17:29:11 +00:00
Xiang Xiao de480b01b6 fs/nfs: Add the simplest RPCAUTH_UNIX support
Since most NFS server disable RPCAUTH_NULL to improve the security
2020-03-02 15:04:20 -06:00
Xiang Xiao 7794214a7d fs/nfs: Support both IPv6 and TCP
And correctly handle the retransmission
2020-03-02 15:04:07 -06:00
Xiang Xiao 6c77829940 fs/nfs: Should return the partial transfer bytes in nfs_read/nfs_write 2020-03-02 15:03:53 -06:00
Xiang Xiao 915f094a74 NFS bug fix and improvement (#412)
* fs/nfs: Remove all nfs_checkmount call.  The check just waste cpu cycle since nobody will set nm_mounted to false, and remove the unused fields(nm_mounted and n_flags) and related flags too
* fs/nfs: Fix the definition not confirm to RFC 1813 and other minor issue(unused, typo, duplication, alignment...)
* fs/nfs: Always represent error with negative number and remove the unused arguments from function
* fs/nfs: Set socket receive timeout with nfs_args->timeo and fix warning:

nfs/nfs.h:59:28: warning: large integer implicitly truncated to unsigned type [-Woverflow]
 #define NFS_TIMEO          (1 * NFS_HZ)   /* Default timeout = 1 second */
                            ^
nfs/nfs_vfsops.c:1857:23: note: in expansion of macro 'NFS_TIMEO'
   nprmt.timeo       = NFS_TIMEO;
                            ^
                       ^~~~~~~~~

* fs/nfs: Update the file attribute correctly in nfs_filetruncate and simplify the attrbitue conversion between NFSv3 and NuttX
* fs/nfs: Remove the unfinished and buggy EXCLUSIVE creation mode
* fs/nfs: Call nfs_fsinfo in nfs_bind instead of nfs_statfs since we should update the buffer size before transfer happen, and handle the attribute existence variance correctly.
* fs/nfs: Shouldn't insert node into list again in nfs_dup and fix other typo issue
* fs/nfs: Should skip . and .. in nfs_readdir
* fs/nfs: Remove the unnecessary dynamic allocation and the duplicated root handle storage
2020-03-01 14:55:01 -06:00
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Xiang Xiao 5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -06:00
Xiang Xiao 0b860726db Ensure psock_socket and psock_accept initialize s_crefs to 1
This simplifies the caller usage
2020-01-31 13:45:14 -06:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
Gregory Nutt c11c18858f fs/nfs/rpc_clnt.c: Fix a typo introduced with bd3cc792ff. 2019-10-27 15:39:08 -06:00
Gregory Nutt bd3cc792ff fs/: Run all .c files under fs/ through tools/nxstyle. 2019-10-27 11:48:14 -06:00
Juha Niskanen e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Gregory Nutt be3dd0bac6 fs/: Fix various coding standard issues found while testing tools/nxstyle.c 2019-03-01 15:01:04 -06:00
zhangyuan7 37b9bbbdef fs/nfs: Update nfs mount to VER3 2018-08-26 13:11:24 -06:00
Alan Carvalho de Assis 283b73edc5 Fix lots of typos in C comments and Kconfig help text 2018-07-08 18:24:45 -06:00
Michael Jung 800da58e6c fs/nfs/rpc_clnt.c: Commit 091e3f7 broke the NFS client. sendto() can (correctly) no lnoger by used with a connected UDP socket. In that case, send() must be used instead. 2018-05-02 13:53:51 -06:00
Gregory Nutt 1567b82429 Make sure that labeling is used consistently in all function headers (part 2). 2018-02-01 12:03:55 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt 39fe6a0dff Squashed commit of the following:
fs/nxffs:  Add partial implementation of the truncate method:  It extend files, but cannot yet shrink them.
    fs/smartfs:  Add partial implementation of the truncate method:  It extend files, but cannot yet shrink them.
    fs/fat:  Add partial implementation of the truncate method:  It extend files, but no yet shrink them.
    fs/nfs:  Add support for the truncate method to the NFS file system.
2018-01-04 10:54:54 -06:00
Gregory Nutt e4652bd3dc Squashed commit of the following:
fs: Add truncate() support for userfs
    fs/unionfs:  Add truncate() support to the unionfs
    fs/tmpfs:  Add ftruncate() support to tmpfs
    syscall/: Add system call support for ftruncate()
    net/route:  Adding ftruncate() support eliminates an issue in file-based routing table management.
    fs:  Add basic framework to support truncate() and ftruncate().  The infrastructure is complete.  Now, however, the actual implementation of ftruncate() will have to be done for each file system.
2018-01-03 16:03:56 -06:00
Michael Jung d46a7beef9 fs/nfs/nfs_vfsops.c: Fix buffer corruption. In case multiple read requests to the NFS server are required to fill up the user provided buffer, nfs_read might write behind the end of said buffer. This is fixed with this change. 2017-12-28 06:31:49 -06:00