Commit Graph

1503 Commits

Author SHA1 Message Date
Matias N
8a9f995d40 procfs: make array const to reduce memory use 2020-12-07 16:55:00 -05:00
YAMAMOTO Takashi
97b86d5848 fs/spiffs/src/spiffs_core.c: Don't assume finfo() is a macro 2020-12-06 09:03:09 -06:00
YAMAMOTO Takashi
45444edc16 fs/nxffs/nxffs_write.c: Fix a syslog format 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
5bead4aa37 fs/nxffs/nxffs_unlink.c: Fix syslog formats 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
c9d8570040 fs/nxffs/nxffs_reformat.c: Fix a syslog format 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
78356a7df2 fs/nxffs/nxffs_read.c: Fix a syslog format 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
e891e0aaa6 fs/nxffs/nxffs_pack.c: Fix syslog formats 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
0a99d1396e fs/nxffs/nxffs_open.c: Fix syslog formats 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
da67e80ca9 fs/nxffs/nxffs_inode.c: Fix syslog formats 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
d0dd04e24a fs/nxffs/nxffs_inode.c: Appease nxstyle 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
942b1e925d fs/nxffs/nxffs_initialize.c: Fix syslog formats 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
f6ca8bfe45 fs/nxffs/nxffs_dirent.c: Fix a syslog format 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
75d0077cd1 fs/nxffs/nxffs_blockstats.c: Fix syslog formats 2020-12-05 08:13:32 -06:00
YAMAMOTO Takashi
01e0c41759 fs/nxffs/nxffs_blockstats.c: Appease nxstyle 2020-12-05 08:13:32 -06:00
chao.an
c56785bd0d style/Makefile: remove unnecessary trailing whitespace
N/A

Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-28 12:20:30 +01:00
YAMAMOTO Takashi
cde04a6523 fs/unionfs/fs_unionfs.c: Fix syslog formats 2020-11-25 05:11:26 -08:00
YAMAMOTO Takashi
e58a966dd6 fs/binfs/fs_binfs.c: Fix a syslog format 2020-11-25 05:11:26 -08: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
YAMAMOTO Takashi
0dee21503d fs/spiffs/src/spiffs_mtd.c: Fix syslog formats 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
be013cc338 fs/spiffs/src/spiffs_gc.c: Fix syslog formats 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
a6b4c1b755 fs/spiffs/src/spiffs_core.c: Fix syslog formats 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
88bc46f4a6 fs/spiffs/src/spiffs_vfs.c: Fix syslog formats 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
c0b4076d3b fs/userfs/fs_userfs.c: Fix syslog formats 2020-11-24 22:31:33 -08:00
YAMAMOTO Takashi
4911b1121b fs/cromfs/fs_cromfs.c: Fix a syslog format 2020-11-24 22:31:33 -08:00
Matias N
d5b6ec450f Parallelize depend file generation 2020-11-22 09:02:59 -03:00
YAMAMOTO Takashi
13e55ce0d4 fs/romfs/fs_romfsutil.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
67fbbf935b fs/romfs/fs_romfs.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
ae45a66d70 fs/nxffs/nxffs_write.c: Fix a syslog format 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
d543f7f16f fs/nxffs/nxffs_stat.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
7df9d89d54 fs/nxffs/nxffs_reformat.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
d28d5a29c2 fs/nxffs/nxffs_reformat.c: Appease nxstyle 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
d22c8a2a31 fs/nxffs/nxffs_read.c: Fix a syslog format 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
3f2390e781 fs/nxffs/nxffs_read.c: Appease nxstyle 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
889c33277c fs/nxffs/nxffs_pack.c: Fix a syslog format 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
660db6b248 fs/nxffs/nxffs_pack.c: Appease nxstyle 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
99407f4ab9 fs/nxffs/nxffs_open.c: Fix a syslog format 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
e1a8f8a736 fs/nxffs/nxffs_open.c: Appease nxstyle 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
35c30c2c4a fs/nxffs/nxffs_cache.c: Fix syslog formats 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
042881eed3 fs/nxffs/nxffs_cache.c: Appease nxstyle 2020-11-21 19:38:32 -08:00
YAMAMOTO Takashi
ac6b08c8e9 fs/spiffs/src/spiffs_mtd.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
38e6f68535 fs/spiffs/src/spiffs_core.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
3aa29095b2 fs/spiffs/src/spiffs_vfs.c: Fix a syslog format 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
f940c3d7a4 fs/fat/fs_fat32util.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
8ce63a47fc fs/vfs/fs_epoll.c: Fix syslog formats 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
ad0ee4fbeb fs/binfs/fs_binfs.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
da1b593485 fs/romfs/fs_romfs.c: Fix syslog format errors 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
bc9e28eb35 fs/mmap/fs_mmap.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi
0b48fed6ee fs/spiffs/src/spiffs_core.c: Appease nxstyle 2020-11-20 22:22:53 -08:00
Brennan Ashton
9393572aea Revert "fs/nxffs: Fix scan good block slowly and scan an invalid block"
This reverts commit 97be116a39.

This commit broke nxffs.  This leaves the first block as empty which
then exposes another bug where when the pack is called because we
have reached the end of flash and need to look for deleted inodes
we search the first block find no inode and assume that there
are no more inodes.  This then results in corrupting the filesystem
by writing over existing inodes.

This can be seen by runing the sim:nxffs configuration.
Prior to this commit the first pass of writing files would look like
this:
NXFFS Dump:
  BLOCK:OFFS  TYPE  STATE   LENGTH
      0:5     INODE OK       2680
      0:78    DATA  OK        424
      1:5     DATA  OK        497
      2:5     DATA  OK        497
      3:5     DATA  OK        497
      4:5     DATA  OK        497
      5:5     DATA  OK        268
      5:283   INODE OK       7410
      5:425   DATA  OK         77
      6:5     DATA  OK        497

With this commit:
NXFFS Dump:
  BLOCK:OFFS  TYPE  STATE   LENGTH
      0:0     BLOCK ERASED    512
      1:5     INODE OK       6394
      1:39    DATA  OK        463
      2:5     DATA  OK        497
      3:5     DATA  OK        497

Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-11-19 18:08:41 -08:00
dongjiuzhu
c22ab31728 fs: flashback to release all file descriptors in group to increase debugging time.
Change-Id: I47851f7e679addf36077c491ef7d1a5a29d1c2be
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-11-17 18:54:31 -08:00
YAMAMOTO Takashi
4f514f41d4 fs/procfs/fs_procfsiobinfo.c: Add a missing entry for can
Found by the following compiler warning:

    procfs/fs_procfsiobinfo.c: In function 'iobinfo_read':
    procfs/fs_procfsiobinfo.c:344:20: error: '%-16s' directive argument is null [-Werror=format-overflow=]
      344 |       linesize   = snprintf(iobfile->line, IOBINFO_LINELEN,
          |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      345 |                             "\n%-16s%16lu%16lu\n",
          |                             ~~~~~~~~~~~~~~~~~~~~~~
      346 |                             g_iob_user_names[IOBUSER_GLOBAL],
          |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      347 |                             (unsigned long)userstats->totalconsumed,
          |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      348 |                             (unsigned long)userstats->totalproduced);
          |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
95a9843284 fs/procfs/fs_procfsproc.c: Fix prinf format warnings 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
f1bc94bd32 fs/procfs/fs_procfscpuload.c: Fix printf format warnings 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
48765a7160 fs/smartfs/smartfs_procfs.c: Fix printf format warnings 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
008d411fc3 fs/procfs/fs_procfsproc.c: Fix a printf format warning 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
08b4cb6517 fs/procfs/fs_procfsuptime.c: Fix a printf format 2020-11-16 08:29:00 -08:00
YAMAMOTO Takashi
711371a855 fs/procfs/fs_procfsiobinfo.c: Appease nxstyle 2020-11-16 05:46:53 -08:00
chao.an
6aee468d72 eventfd: remove the unique minor limit
The unique minor limit of 255 will overflow easily in
some scenarios where eventfd needs to be create/destroy
frequently:

  while (1)
    {
      fd = eventfd(0, 0);  // minor++
      sleep(1);
      close(fd);
    }

remove the unique minor limit.

Change-Id: I0ea1c825ce9b542c883166cb3e72574455ffdd0d
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-11 18:26:59 -08:00
Xiang Xiao
84b90e00f0 libc/stdio: Preallocate the stdin, stdout and stderr
to handle the uninitialized stdin/stdout/stderr gracefully
report here:
https://github.com/apache/incubator-nuttx/issues/2203

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-11-11 09:56:10 -08:00
Juha Niskanen
ca7a7ccbeb Fix some typos in comments
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-11-08 18:58:20 +01:00
Juha Niskanen
1577726f05 fs/inode/fs_fileopen.c: use nx_close instead of close
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-10-28 09:11:50 -07:00
dongjiuzhu
d452a05910 pollnotify: we should send poll events before semaphore incrementes.
There is a good case on sim platform:
When we input some cmd and click enter key to start application in terminal,
this context will change to application from IDLE loop. Althrough entey key '\r'
has been received to recv buffer and complete post semaphore of reader, but
pollnotify may not be called because context change. So when application run
poll function, because no events happend and poll enter wait, context will
again change to IDLE loop, this pollnotify of IDLE loop will run to send poll
events, poll function of applicaton will wake up. It's wrong!

Change-Id: I812a889f2e90781a9c3cb4b0251cccc4d32bebd1
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-10-26 08:27:09 -03:00
dongjiuzhu
bcf3381d06 epoll_create: mofidy return value for epoll_create1
Change-Id: I422d7640c37105e1120db18b29d56547f447846f
Signed-off-by: dongjiuzhu <dongjiuzhu1@xiaomi.com>
2020-10-25 11:06:37 -07: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
zhongan
5aa0e302a4 fs: add missing macro 'CONFIG_FS_HOSTFS' for 'NODFS_SUPPORT'.
When just enable 'CONFIG_FS_HOSTFS', NODFS_SUPPORT may not enable.

Change-Id: I8317f18bf3ceae873e29c027561948c17b4aab38
Signed-off-by: zhongan <zhongan@xiaomi.com>
2020-10-17 23:22:35 +08:00
Nathan Hartman
80ce7800a9 Sources and Docs: Fix typos and nxstyle issues
Documentation/contributing/coding_style.rst:

    * Fix repeated words: ("this this").
    * Remove trailing spaces.

boards/z80/z80/z80sim/README.txt:

    * Fix repeated words: ("this this") and rewrap lines.

graphics/Kconfig,
libs/libc/math/Kconfig:

    * Fix repeated words: ("this this").

arch/arm/src/armv7-a/arm_assert.c,
arch/arm/src/armv7-r/arm_assert.c,
arch/arm/src/imxrt/imxrt_enet.c,
arch/arm/src/kinetis/kinetis_enet.c,
arch/arm/src/kinetis/kinetis_flexcan.c,
arch/arm/src/s32k1xx/s32k1xx_enet.c,
arch/arm/src/s32k1xx/s32k1xx_flexcan.c,
arch/arm/src/stm32/stm32_pwm.c,
arch/arm/src/stm32h7/stm32_pwm.c,
arch/arm/src/stm32l4/stm32l4_pwm.c,
arch/renesas/src/rx65n/rx65n_usbdev.c,
binfmt/libnxflat/libnxflat_bind.c,
drivers/pipes/pipe_common.c,
net/igmp/igmp_input.c,
net/tcp/tcp_conn.c,
sched/sched/sched_roundrobin.c:

    * Fix typo in comment ("this this").

arch/arm/src/cxd56xx/cxd56_usbdev.c,
arch/arm/src/lc823450/lc823450_usbdev.c:

    * Fix typo in comment and rewrap lines.

arch/arm/src/imxrt/imxrt_usbdev.c,
arch/arm/src/stm32/stm32_dac.c,
arch/arm/src/stm32f0l0g0/stm32_pwm.c,
arch/arm/src/stm32f7/stm32_pwm.c,
arch/arm/src/tiva/lm/lm4f_gpio.h,
fs/nxffs/nxffs_write.c,
include/nuttx/analog/pga11x.h,
include/nuttx/usb/usbdev.h,
net/mld/mld_join.c:

    * Fix typo in comment ("this this").
    * Fix nxstyle issues.
2020-10-02 04:54:52 +02:00
Xiang Xiao
b422f49fa7 fs: Skip the enumeration of root directory in foreach_inode
ensure the behaviour same before:
commit b76c4672d6 (origin/root)
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Tue Sep 15 17:42:42 2020 +0800

    vfs: Create a node as the root of pseudo file system

    to remove the special process for root

    Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-30 12:26:57 +02:00
Xiang Xiao
66057a4612 fs: Add the relative path support
all functions which accept the path argument should support the relative path:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-24 03:13:27 -07:00
Xiang Xiao
de45e8647a Revert "s/dirent: Corrects a problem with opendir() noted by Petteri Aimonen in Bitbucket Issue 132: "opendir() fails for FAT filesystem with trailing slash in path":"
because:
1.The name of directory may terminated by the whitespace
2.inode_search can handle the trailing '/' correctly
3.Let fix the issue in FAT filesystem instead

This reverts commit 97b0235d77.
2020-09-22 23:05:10 +01:00
Xiang Xiao
8567637378 fs/fat: Handle the tail '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I72c4d018c174d094d777941d0679ad792a1f5527
2020-09-22 23:05:10 +01:00
Xiang Xiao
43f0070582 fs: Simplify the symbol link process in inode_search
avoid the recursive call by moving the path catenation into _inode_search

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-22 16:39:47 +08:00
chao.an
9241725312 fs/munmap: export the symbols to avoid build break on C++ syntax
base/metrics/persistent_memory_allocator.cc:1009:18: error: expected id-expression before ‘-’ token
 1009 |   int result = ::munmap(memory, size);
      |                  ^~~~~~

Change-Id: I24e55c18d09553d3acc341a27063d01489d905ec
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-09-18 20:05:10 -07:00
Xiang Xiao
b76c4672d6 vfs: Create a node as the root of pseudo file system
to remove the special process for root

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-16 11:44:57 -07:00
Yoshinori Sugino
5eefe8609c fs/vfs/fs_ioctl.c: Call F_GETFD to avoid clear other flag we will add in the future 2020-09-16 02:31:33 -07:00
Yoshinori Sugino
d4ec1ababd fs/vfs/fs_ioctl.c: Add FIOCLEX/FIONCLEX support 2020-09-16 02:31:33 -07:00
Xiang Xiao
6584bfa361 fs: Add static to stat_recursive
since it is called in one source file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-16 01:06:53 -07:00
Xiang Xiao
1e848e5d8b fs: Call RELEASE_SEARCH to free resource in pseudorename
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-16 01:06:53 -07:00
Xiang Xiao
59fbd35609 fs: rename the mountpoint should go through pseudorename branch
to avoid this type of error:
mount -t procfs /a/b
mv /a/b /
mv: rename failed: 88

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-09-15 23:07:20 -07:00
Xiang Xiao
b0797263ca libc/stdio: Allocate file_struct dynamically
1.Reduce the default size of task_group_s(~512B each task)
2.Scale better between simple and complex application

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia872137504fddcf64d89c48d6f0593d76d582710
2020-09-11 17:58:17 +08:00
liuhaitao
bf06776f7c fs/vfs: reuse file_dup2 directly in file_dup to fix segfault issue
Or close the fd2 return by dup() would segment fault since filep->f_priv
null access.

Change-Id: I285c86f54bbb486d6c2c5aea53952f69083dca72
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-09-09 07:49:40 -07:00
Nathan Hartman
91b52c38f9 Fix wrong executable bit on two source files
boards/arm/cxd56xx/drivers/audio/cxd56_audio_bca_reg.h:

    * Remove erroneous executable bit.

fs/tmpfs/fs_tmpfs.c:

    * Remove erroneous executable bit.
2020-08-31 19:19:14 +01:00
anatasluo
ab37b14972 fs/tmpfs: Remove duplicated code
Signed-off-by: anatasluo <luolongjuna@gmail.com>
2020-08-31 10:41:30 +08:00
Xiang Xiao
389b45359d epoll: Don't save fd into the field of epoll_data_t
since epoll_data_t is reserved to the caller and
then shouldn't be touched by the implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-25 21:06:48 +01:00
Xiang Xiao
a354b9a9d1 fs/vfs: Implement EPOLLONESHOT flag
https://linux.die.net/man/2/epoll_ctl:
EPOLLONESHOT (since Linux 2.6.2)
Sets the one-shot behavior for the associated file descriptor.
This means that after an event is pulled out with epoll_wait(2)
the associated file descriptor is internally disabled and
no other events will be reported by the epoll interface.
The user must call epoll_ctl() with EPOLL_CTL_MOD to
rearm the file descriptor with a new event mask.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I6c0dc93e1cdae0e8cea5b487c7005de2da2c2ec3
2020-08-25 21:06:48 +01:00
Xiang Xiao
6c9ff72b9a fs/vfs: Implement epoll_pwait API
specified here:
https://linux.die.net/man/2/epoll_pwait

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I20106fdbe4f403ded7eab43f3523edd262e1d9a3
2020-08-25 21:06:48 +01:00
Xiang Xiao
ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
Gregory Nutt
e880bc9a71 Remove unused, non-modular procfs reference
fs/procfs/fs_procfs.c contained an unused reference to an STM32 procfs structure.  This is wrong in two ways:  (1) There should be not STM32 references outside of arch/arm and boards/arm and (2) the declare STM32 structure is not used anyway.
2020-08-22 16:22:18 +01:00
Esteban Zamora
8beb1edbda Fix inverted errno in mq_open
Signed-off-by: Esteban Zamora <esteban.zamora@hpe.com>
2020-08-20 20:35:16 -03:00
spiriou
0ddefd7c69 fs/vfs/fs_epoll: fix epoll_wait function 2020-08-20 11:49:20 -05:00
David Sidrane
2953880f5c fs_cromfs: Removed DEBUGASSERT on non-exiting var node 2020-08-20 14:10:02 +01:00
chao.an
6176e33ed2 fs/littlefs: enable the low level log only on debug mode
Change-Id: I2fa95e2f1e861f76bb394a06344d90fac28ae195
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-18 12:13:32 +01:00
chao.an
b89737395b vfs/epoll: add epoll_create1(2) implement
Linux Programmer's Manual

NAME
       epoll_create, epoll_create1 - open an epoll file descriptor

...
SYNOPSIS
       #include <sys/epoll.h>

       int epoll_create1(int flags);
...

   epoll_create1()
       If flags is 0, then, other than the fact that the obsolete
       size argument is dropped, epoll_create1() is the same as
       epoll_create(). The following value can be included in flags
       to obtain different behavior:

       EPOLL_CLOEXEC
              Set the close-on-exec (FD_CLOEXEC) flag on the new file
              descriptor. See the description of the O_CLOEXEC flag in
              open(2) for reasons why this may be useful.

https://man7.org/linux/man-pages/man7/epoll.7.html
2020-08-17 23:41:13 -05:00
Xiang Xiao
85428036ab fs/vfs: Don't check CONFIG_NFILE_STREAMS for mkdir/rename/rmdir/fs_unlink
since these function don't depend on standard input/output function

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I011a387a1e2c1360e8f37716d512bd32f93ad467
2020-08-17 00:16:26 +01:00
Xiang Xiao
acca9fcc3b sched/wdog: Remove MAX_WDOGPARMS and related stuff
since the variable arguments are error prone and seldom used.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-14 08:19:50 -06:00
Xiang Xiao
a0ce81d659 sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
2020-08-11 12:28:55 -06:00
Gregory Nutt
b256b2055f Add support to hard links to CROMFS
This will resolve numerous problems with the way that hard links, in particular "." and ".." are handled.  Instead of trying to fudge the stat flags, the correct implementation is to follow the hard link to the final link target node.  That is what must determine the attributes of the directory entry.
2020-08-11 07:48:08 -07:00
Gregory Nutt
32e98790c0 Correct ROMFS hardlink handling
This PR corrects an error in the ROMFS file system.  The error occurred after following a hard link (depending on how the ROMFS image is organized).  The error occurred because some of the information buffered before following the links was stale and, hence, out of sync after following the hard link.  This would cause random errors when paths containing hardlinks were used with ROMFS.

This PR resolves Issue #1543.  Please compare the following output with the output in Issue #1543 to see how the problem was resolved:

    NuttShell (NSH) NuttX-9.1.0
    nsh> mount
      /etc type romfs
      /proc type procfs
      /tmp type vfat
    nsh> ls -Rl /etc
    /etc:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d
    /etc/init.d:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS
    nsh> ls -l /etc/init.d/.
    /etc/init.d/.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      71 rcS

    nsh> ls -l /etc/init.d/..
    /etc/init.d/..:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh> ls -l /etc/init.d/../.
    /etc/init.d/../.:
     dr-xr-xr-x       0 .
     dr-xr-xr-x       0 ..
     -r-xr-xr-x      20 group
     dr-xr-xr-x       0 init.d/
     -r-xr-xr-x      35 passwd
    nsh>
2020-08-10 07:32:06 -07:00
Xiang Xiao
4c706771c3 sched/wdog: Replace all callback argument from uint32_t to wdparm_t
and alwasy cast the argument of wd_start to wdparm_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-08 17:30:26 -03:00
David Sidrane
2eccc960a9 fs_cromfs:Remove duplicate case intorduced by 67ef70d 2020-08-04 21:20:25 -05:00
Xiang Xiao
0e610caec8 fs/procfs: Handle /proc/xxx/group/ correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic9f4c38a3baf199712c5497c094dc7af84deee2c
2020-08-03 21:00:18 +01:00
Xiang Xiao
1bad139f88 fs/romfs: Support the path with tail '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I7ea668e50e68cb384d013349a2c8cfc2844f3b73
2020-08-03 21:00:18 +01:00
spiriou
a4a9eb2f5a fs/vfs: Add file descriptor based events support 2020-07-31 15:09:35 -06:00
Johannes Schock
070f4ed7e9 FAT Filesystem: UTF8 support for long filenames, bugfixes.
New CONFIG_FAT_LFN_UTF8: UTF8 strings are converted to UCS2-LFN
Bugfix in fat_createalias: space is now also converted to underbar.
Change (bugfix) in fat_getlfname: init characters (0xff) and '\0' are rewound as well.
2020-07-31 18:01:02 -03:00
YAMAMOTO Takashi
e22dffba8e fs/mqueue/mq_close.c: Remove a redundant assignment
Found by clang-check:

mqueue/mq_close.c:127:21: warning: Value stored to 'rtcb' during its initialization is never read
  FAR struct tcb_s *rtcb = (FAR struct tcb_s *)nxsched_self();
                    ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
YAMAMOTO Takashi
1078210f7f fs/mount/fs_mount.c: Remove a redandunt assignment
Found by clang-check:

mount/fs_mount.c:287:8: warning: Although the value stored to 'ret' is used in
      the enclosing expression, the value is never actually read from 'ret'
      (ret = find_blockdriver(source, mountflags, &drvr_inode)) >= 0)
       ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 08:59:46 +02:00
YAMAMOTO Takashi
dc6b61caf9 fs/romfs/fs_romfs.c: Remove redundant assignments
Found by clang-check:

romfs/fs_romfs.c:431:7: warning: Value stored to 'bytesread' is never read
      bytesread  = 0;
      ^            ~
romfs/fs_romfs.c:455:11: warning: Value stored to 'sector' is never read
          sector    += nsectors;
          ^            ~~~~~~~~
2 warnings generated.
2020-07-30 08:59:46 +02:00
YAMAMOTO Takashi
ba4a7107df fs/hostfs/hostfs.c: Remove a redundant assignment
Found by clang-check:

hostfs/hostfs.c:1081:3: warning: Value stored to 'ret' is never read
  ret = OK; /* Assume success */
  ^     ~~
1 warning generated.
2020-07-30 08:59:46 +02:00
YAMAMOTO Takashi
9dcc6f6da6 fs/driver/fs_blockproxy.c: Fix an error handling
Found by clang-check:

driver/fs_blockproxy.c:202:7: warning: Value stored to 'ret' is never read
      ret = -errno;
      ^     ~~~~~~
1 warning generated.
2020-07-29 21:13:20 -07:00
Xiang Xiao
338244dbac procfs: Get version info from uname instead
unify the version into one place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I988fb40d3f460b0291114c60edb04db3aabb38f1
2020-07-30 10:33:08 +09:00
SPRESENSE
e249a2f82f Makefile: Fix Make.dep not updated by config changes
Make.dep file should be updated by .config changed after first make.
There are 2 cases affected for this problem:

 1) Add source files by config symbol
 2) Include header files in #ifdef directive

These 2 cases may not be included in Make.dep and this may prevent the
differential build from working correctly.
2020-07-28 03:59:45 -05:00
SPRESENSE
89a79b03cf fs/smartfs: Fix file size corruption when opening with overwriting mode
If a existing file is opened with overwriting mode e.g. fopen(file, "w+"),
the file size will be incorrect after writing any data to the file.
This bug is caused by previous commit 10903b5, and its changes should be
limited to only O_APPEND mode.
2020-07-22 04:22:22 -05:00
Dong Heng
97be116a39 fs/nxffs: Fix scan good block slowly and scan an invalid block 2020-07-20 10:23:58 -03:00
Brennan Ashton
3a58926d01 Cast pointer to uintptr prior to ulong for ioctl
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-07-19 15:49:13 -03: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
Xiang Xiao
67ef70d460 vfs/dirread: Should return the same file type as lstat
by extend the possible value of d_type for the special file

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-07 13:41:10 +01:00
Xiang Xiao
91ed14c631 vfs/stat: Make the flag defintion more confirm POSIX standard
specified here:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_stat.h.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-07-07 13:41:10 +01:00
Xiang Xiao
651eefc8f7 fs: Rename link to symlink
since the current implementation is really a symoblic link not hard link

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I59d30d0a620b0b5714fe91bbe90d4405cf53d187
2020-07-01 11:58:12 +02:00
Xiang Xiao
b598ab43d7 fs: Implement lstat function
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/lstat.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Iefc23a02d425ff84fa4027aea7da1181b01eced7
2020-06-30 13:09:58 -06:00
chao.an
f56e0e004b fs/setfd: correct the return value
Change-Id: I766f3760e7167a579b73673c44b70847ee06850b
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-24 13:48:41 +01:00
Matias Nitsche
8c74a31fe2 vfs: fix support for PTY when CONFIG_NET is not enabled 2020-06-16 09:56:21 +08:00
Peter van der Perk
55d9e5f7af net: Add SocketCAN support 2020-06-15 08:07:19 -06:00
Gregory Nutt
0f7c2d6fbf fs/fat: Run all .c and .h files through nxstyle
Run all .c and .h files through nxstyle and correct all reported issues.
2020-05-31 12:43:55 -04:00
vau
20615a9f65 Do not rewrite the root directory if it has not changed 2020-05-31 09:08:22 -06: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
1c002e1049 fs/vfs/fs_fstat: Correct fstat() for proxied block and MTD drivers.
Block and MTD drivers may be opened and managed as though they were character drivers.  But this is really sleight of hand; there is a hidden character driver proxy that mediates the interface to the block and MTD drivers in this case.

fstat(), however, did not account for this.  It would report the characteristics of the proxy character driver, not of the underlying block or MTD driver.

This change corrects that.  fstat now checks if the character driver is such a proxy and, if so, reports the characteristics of the underlying block or MTD driver, not the proxy character driver.
2020-05-28 17:34:09 +01:00
Oleg Evseev
3b75201447 fs/vfs/fs_stat.c: correct style 2020-05-26 16:56:10 +08:00
Oleg
dd9d9878ad fs/vfs/fs_stat.c: fill file size for mtd inode
Now when stat() is calling for mtd device it also set size of file as number of bytes of all sectors related to this mtd device.
2020-05-25 13:53:50 -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
Oleg
e1dbb6b2a9 Update fs/vfs/fs_stat.c
Co-authored-by: patacongo <spudarnia@yahoo.com>
2020-05-25 10:10:52 -06:00
Oleg
f6c3296f76 fs/vfs/fs_stat.c: fill file size for block inode 2020-05-25 10:10:52 -06:00
Xiang Xiao
7e5b0f81e9 build: Replace -I with INCDIR
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-24 20:20:12 +01: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
Xiang Xiao
dd61d3d9f9 build: Remve the unnecessary .gitignore
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-23 18:00:40 +01:00
Gregory Nutt
154a87993f fs/vfs/fd_open.c: fs_fdopen() must not set errno
Functions within the OS must never set the errno value.  fs_fdopen() was setting the errno value.  Now, after some parameter changes, it reports errors via a negated errno integer return value as do most all other internal OS functions.
2020-05-23 15:22:09 +08:00
Xiang Xiao
1a95cce1a3 build: Move .config check to the top Makefile
remove the workaround to handle the inexistence of .config/Make.defs

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-20 17:57:34 +01:00
Xiang Xiao
5eae32577e build: Move INCDIROPT to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:02:55 -06:00
Gregory Nutt
57bc329aac Run nxstyle all .c and .h files modified by PR. 2020-05-17 14:01:00 -03:00
Gregory Nutt
a569006fd8 sched/: Make more naming consistent
Rename various functions per the quidelines of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions

    nxsem_setprotocol -> nxsem_set_protocol
    nxsem_getprotocol -> nxsem_get_protocol
    nxsem_getvalue -> nxsem_get_value
2020-05-17 14:01:00 -03:00
Xiang Xiao
517974787f Rename clock_systime[r|spec] to clock_systime_[ticks|timespec]
follow up the new naming convention:
https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-10 14:35:50 -06:00
Gregory Nutt
4b44b628ea Run nxstyle against all .c and .h files modified by this PR.
All complaints fixed except for those that were not possible to fix:

- Used of Mixed case identifier in ESP32 files.  These are references to Expressif ROM functions which are outside of the scope of NuttX.
2020-05-09 14:19:08 -03:00
Gregory Nutt
a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Xiang Xiao
b7d922960f Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Xiang Xiao
de33f86ae3 fs: Add nx_mount/nx_umount2 function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Xiang Xiao
4a3d28a957 fs: Move inode_checkflags from include/nuttx/fs/fs.h to fs/inode/inode.h
since this function is only used inside fs subsystem

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-08 07:20:49 -06:00
Xiang Xiao
d9d2fc0d0a debug: Reduce CONFIG_CPP_HAVE_VARARGS usage
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00
Xiang Xiao
6604cdb3f2 fs: Remove all LIBC_IOCTL_VARIADIC related stuff
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-05 08:27:58 -06:00