Commit Graph

1227 Commits

Author SHA1 Message Date
Gregory Nutt
a4d6af8343 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/inode.  Utility functions under fs/incode were modified so the changes do extend to other fs/ sub-directories as well.
2020-03-30 01:33:31 +01:00
Gregory Nutt
156963a903 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/tmpfs and fs/spiffs.  Still do do:  The rest of fs/ and all of drivers/ and arch/.
2020-03-29 22:11:13 +01:00
Gregory Nutt
5c0e8e88b1 Revert "Makefile: move INCDIROPT to common place (#625)"
This reverts commit b9ace36fcc.

This change was added by PR 625 but has a serious logic flaw.  It removes all occurrences of INCDIROPT and replaces it with a definition in tools/Config.mk:

    else ifeq ($(WINTOOL),y)
      DEFINE = "$(TOPDIR)/tools/define.sh"
      INCDIR = "$(TOPDIR)/tools/incdir.sh" -w

This logic flaw is the Config.mk is included in all Make.defs files BEFORE WINTOOL is defined.  As a result, the definition is wrong in many places when building under Cygwin with a Windows native toolchain.
2020-03-26 08:50:29 -07:00
Xiang Xiao
b9ace36fcc
Makefile: move INCDIROPT to common place (#625) 2020-03-26 08:09:59 -06:00
YAMAMOTO Takashi
1ffa009c8b Revert "Don't generate .depend anymore"
This reverts commit 79af7fbf4e.

Because:

* btashton reported some issues in local builds:

  https://github.com/apache/incubator-nuttx/pull/603#issuecomment-602264860

* this might be related to the current CI breakage:

  > /bin/sh: 1: /__w/incubator-nuttx/incubator-nuttx/nuttx/tools/mkdeps: not found
2020-03-22 23:07:29 -05:00
Xiang Xiao
79af7fbf4e
Don't generate .depend anymore 2020-03-22 18:15:29 +00:00
Gregory Nutt
547a3cb3d9 Run all .c and .h files in previous commits through nxstyle. 2020-03-22 08:24:07 -05: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
Nathan Hartman
a5e643b0cd Fix typos in comments and documentation. 2020-03-16 20:01:11 -06:00
Pelle Windestam
7dd5356055 nxstyle: fixed various nxstyle warnings 2020-03-09 08:56:59 -06:00
Gregory Nutt
c8b39b48bb z20x: w25boot configuration nees CONFIG_FS_WRITABLE
boards/z80/ez80/z20x/configs/w25boot/defconfig:  needs CONFIG_FS_WRITABLE=y

Style cleanup / Correct file header

  drivers/bch/bchdev_register.c, drivers/mtd/ftl.c, and fs/driver/fs_findblockdriver.c:
  Run through nxstyle; replace BSD-3 license with Apache 2.0
2020-03-07 16:59:38 -03: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
liuhaitao
3ee9180691 fs/littlefs: correct some code format in lfs.h by running checkpatch.sh 2020-03-06 11:56:41 -06: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
chao.an
d07afc934e fcntl: add O_CLOEXEC/FD_CLOEXEC support 2020-02-20 08:20:38 -06:00
chao.an
58599e8e2e fs/vfs/fs_ioctl.c: Add FIONBIO support 2020-02-19 12:08:08 -06:00
YAMAMOTO Takashi
882c82a038 Fix typos in comments 2020-02-12 14:07:56 +01:00
Xiang Xiao
a8de37fbec Ensure all source code end with one and only one newline
by this command:
git ls-files -z | while IFS= read -rd '' f; do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
2020-02-08 07:25:56 -06:00
Xiang Xiao
c5b1554d84 Remove NETDEV_LOOPBACK option, NET_LOOPBACK is enough 2020-02-02 08:25:06 -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
9f9566c0eb Rename net_clone/net_dupsd[2] to psock_dup2/net_dup[2] like vfs 2020-01-31 13:45:14 -06:00
Xiang Xiao
80277d1630
Refine the preprocessor conditional guard style (#190) 2020-01-31 19:07:39 +01: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
YAMAMOTO Takashi
83354983c3 Fix "with with" typos
In many cases, remove one of them.
In a few places, it looks like a typo of "width" actually.
2020-01-27 08:46:46 +01:00
Juha Niskanen
a762c06ed9 Fix typos and some incorrect comments
Author: Alan Carvalho de Assis <acassis@gmail.com>

    Run nxstyle against .c and .h files and fix it

Author: Juha Niskanen <juha.niskanen@haltian.com>

    Fix typos and some incorrect comments
2020-01-20 09:32:36 -03:00
patacongo
f00569816f Fix a few errors concerning use of section block comments in .c files: (#95)
1. No .c file should include a "Public Types" section.  Only a header file can define a public type.  A .c file can only define a private type.  Several files contained private type definitions.  The section that they were defined in, however, was incorrectly named "Public Types."  Those were easilty changed to "Private Types" which is what they are.

2. No .c file should include a "Public Function Prototypes" section.  All global function prototypes should be provided via a header file and never declared with a .c file.

For No. 2, I corrected as many cases as was reasonable for the time that I had available.  But there are still a dozen or so .c files that declare "Public Function Prototypes" within a .c file.  This is bad programming style.  These declarations should all be moved to the proper header files.
2020-01-14 00:37:54 +01:00
Xiang Xiao
346336bb9e Make the read ahead buffer unselectable
Here is the email loop talk about why it is better to remove the option:
https://groups.google.com/forum/#!topic/nuttx/AaNkS7oU6R0

Change-Id: Ib66c037752149ad4b2787ef447f966c77aa12aad
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-01-11 08:24:49 -06:00
Alin Jerpelea
3e45517599 Fix buffer overrun and memory leak on smartfs and improvement to cxd56xx
Author: Alan Carvalho de Assis <acassis@gmail.com>

    Check all .c and .h against nxstyle and fix it.

Author: Alin Jerpelea <alin.jerpelea@sony.com>

    fs: smartfs: Fix over capacity write

    When the remaining capacity of flash is one sector, if a new root
    directory is created by file open, then the root directory's chain is
    broken and it causes to SmartFS filesystem crash. Once this fatal
    problem occurs, it's impossible to recover even if the system reboot.
    Fix it by finally update link of root directory.

    fs: smartfs: Fix buffer overrun

    fs: smartfs: Fix uninitialized variable warnings

    fs: smartfs: Memory leak fix

    boards: cxd56xx: Update spresense board.h

    - Fix PMIC assignment
    - Add specific pin configurations for spresense
    - Remove unnecessary definitions

    arch: cxd56xx: Add ITM syslog init at startup

    arch: cxd56xx: Enable DMA settings dynamically
2020-01-08 07:51:11 -03:00
Alin Jerpelea
a8d63c0cec various fixes (#49)
* libs: libc: math: Fix tanh() math functions
* drivers: mtd: smart: Fix trivial debug message in smartfs
* binfmt: libelf: Fix fd not closed on error
* binfmt: Fix stack memory leak on error
* fs: romfs: Fix private data not free on error
* sched: group: Fix reference after free memory
* sched: clock: Fix clock sync

Fix clock sync when CONFIG_RTC_HIRES is enabled
2020-01-07 09:06:02 -06:00
junmin-kim
aad99a5f17 Fix typo in the file_read description (#44)
Signed-off-by: junmin-kim <junmindd.kim@samsung.com>
2020-01-07 07:07:39 -03: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
Xinhe Zhou
25b788a9ed fs/vfs/fs_open.c: Fix error in nx_vopen() function. 'va_start' is used in function with fixed args. 'va_start'/'va_end' should not be used in nx_vopen function, because it has fixed arguments. 2019-12-14 07:38:36 -06:00
Gregory Nutt
a4a23ef584 arch/sim/src/sim/up_hostfs.c, fs/hostfs/hostfs_rpmsg.c, include/nuttx/fs/hostfs.h: Sync nuttx_stat_s consistent with standard struct. Standard struct stat layout changed with commit ea577f1ddd31b3f67405cbb2a57806c47dd4dd63. 2019-12-13 08:35:00 -06:00
anchao
1c91aec6ae tools/ and fs/procfs: Simplify .version file generation
1.merge CONFIG_GIT_REVISION_STR into CONFIG_VERSION_BUILD
2.merge gen_getrev.sh into version.sh
3.generate version number if needed

Here is a sample output:
nsh> uname -a
NuttX  8.2 59fd8e12d3-dirty Dec 12 2019 15:48:00 sim sim
nsh> cat /proc/version
NuttX version 8.2 59fd8e12d3-dirty Dec 12 2019 15:48:01
2019-12-12 11:17:11 -06:00
Xiang Xiao
1d60bc20a9 fs/procfs/Kconfig: Change the default value of FS_PROCFS_EXCLUDE_VERSION to n like other similar option. 2019-12-12 11:12:37 -06:00
Junmin Kim
e06329f5e7 fs/vfs/fs_open.c: Fix description of nx_open and nx_vopen comments indicate that they return zero on success when, in fact, they return the new file descriptor. 2019-12-12 08:24:14 -06:00
Nathan Hartman
9655730ef8 Fix various typos and spelling errors. 2019-12-12 07:41:51 -06:00
Gregory Nutt
0ef5500e01 /fs/inode: Add checks for NULL pointers as recommended by Junmin Kim <trimind0210@gmail.com>. 2019-12-10 07:50:27 -06:00
Ouss4
c9b4da61b0 fs/littlefs/lfs.c: Eliminate a warning about a local variable redefinition. 2019-12-08 08:06:49 -06:00
Gregory Nutt
b599aa0cee fs/cromfs/fs_cromfs.c: Back out an erroneous change I made during a code review. Noted by Jussi Kivilinna. 2019-12-02 08:44:50 -06:00
Gregory Nutt
d2af57169b tools/nxstyle.c: Fix a rare false alarm that could occur if a variable or function name begins with the sub-string 'union' or 'struct'. misc fixes under fs/ and sched/ from application of current version of nxstyle. 2019-12-01 13:01:16 -06:00
Xiang Xiao
b7b85251cf fs/mmap/fs_munmap.c: Fix 'warning: variable 'newaddr' set but not used' 2019-11-27 07:51:35 -06:00