Commit Graph

1503 Commits

Author SHA1 Message Date
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
Xiang Xiao
929292f57b mqueue: Add nxmq_open/nxmq_close/nxmq_unlink function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
390f9a5fb7 fs/vfs: Add nx_dup and nx_dup2 function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
1da8cd6b89 fs/vfs: Add nx_poll function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Xiang Xiao
4c680bfadc fs/vfs: Rename fdesc_poll to fs_poll
and reorder the function declaration

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
4b5360362e fs/vfs: Add nx_ioctl/nx_fcntl function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
65308eabb4 fs/vfs: Add nx_stat function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
6418d13b92 fs/vfs: Add nx_close function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
7980673b59 fs/vfs: Add nx_seek function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-03 12:15:54 -06:00
Xiang Xiao
261ce70e94 rpmsg/hostfs: fix: taking address of packed member may result in an unaligned pointer value
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 12:22:03 -03:00
Xiang Xiao
1c024a6d39 Remove the argument from get_errno
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 12:22:03 -03:00
Xiang Xiao
f8a809eb5b Fix nxstyle issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Xiang Xiao
eca7059785 Refine __KERNEL__ and CONFIG_BUILD_xxx usage in the code base
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-01 10:43:47 -03:00
Oxore
aeebbd0803 fs_tmpfs.c: Shorten long lines according to codestyle 2020-04-30 01:04:33 -07:00
Oxore
1dcf2c7ca3 tmpfs: Fix tmpfs_foreach recursively removing files in directories
Fixes #912
2020-04-30 01:04:33 -07:00
liuhaitao
fe0ba38580 fs/littlefs: upgrade littlefs to v2.2.1
Since littlefs is in active development, it's not a good idea to use its
source code files directly. So upgrade littlefs v2.2.1 by using the littlefs
tar.gz release package instead.

Change-Id: I16d9cf0b6bca700a54ca86ed11d7c8c7f27a898f
Signed-off-by: liuhaitao <liuhaitao@xiaomi.com>
2020-04-23 09:31:21 -06:00
Xiang Xiao
d3c4879113 Fix nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-04-13 12:01:39 -06:00
Xiang Xiao
b22e3b9e28 nuttx: Fix the nightly build warning
lpc2148_spi1.c:142:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type 'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
  142 |   .send              = spi_send,
      |                        ^~~~~~~~
lpc2148_spi1.c:142:24: note: (near initialization for 'g_spiops.send')

In file included from ieee802154/mac802154_bind.c:49:
ieee802154/mac802154_internal.h: In function 'mac802154_setdevmode':
ieee802154/mac802154_internal.h:788:42: warning: converting a packed 'enum ieee802154_devmode_e' pointer (alignment 1) to a 'const union ieee802154_attr_u' pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  788 |                         (FAR const union ieee802154_attr_u *)&mode);
      |                                          ^~~~~~~~~~~~~~~~~

chip/stm32_hciuart.c: In function 'hciuart_read':
chip/stm32_hciuart.c:2104:30: warning: statement with no effect [-Wunused-value]
 2104 |                       ntotal == (ssize_t)ret;
      |                       ~~~~~~~^~~~~~~~~~~~~~~

wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_auth_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:579:23: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  579 |   type = bcmf_getle32(&event->type);
      |                       ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:580:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  580 |   status = bcmf_getle32(&event->status);
      |                         ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c: In function 'bcmf_wl_scan_event_handler':
wireless/ieee80211/bcm43xxx/bcmf_driver.c:619:25: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  619 |   status = bcmf_getle32(&event->status);
      |                         ^~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_driver.c:620:35: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  620 |   escan_result_len = bcmf_getle32(&event->len);
      |                                   ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/bcmf_bdc.c: In function 'bcmf_bdc_process_event_frame':
wireless/ieee80211/bcm43xxx/bcmf_bdc.c:166:27: warning: taking address of packed member of 'struct bcmf_event_s' may result in an unaligned pointer value [-Waddress-of-packed-member]
  166 |   event_id = bcmf_getle32(&event_msg->event.type);
      |                           ^~~~~~~~~~~~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_direct':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:157:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  157 |   ret = SDIO_RECVR5(dev, SD_ACMD52, (uint32_t *)&resp);
      |   ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c: In function 'sdio_io_rw_extended':
wireless/ieee80211/bcm43xxx/mmc_sdio.c:239:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  239 |           ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |           ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:244:11: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  244 |           ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |           ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:257:7: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  257 |       ret = SDIO_RECVR5(dev, SD_ACMD53, (uint32_t *)&resp);
      |       ^~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:265:3: warning: converting a packed 'struct sdio_resp_R5' pointer (alignment 1) to a 'uint32_t' {aka 'unsigned int'} pointer (alignment 4) may result in an unaligned pointer value [-Waddress-of-packed-member]
  265 |   SDIO_RECVR1(dev, SD_ACMD52ABRT, (uint32_t *)&resp);
      |   ^~~~~~~~~~~
wireless/ieee80211/bcm43xxx/mmc_sdio.c:79:28: note: defined here
   79 | begin_packed_struct struct sdio_resp_R5
      |                            ^~~~~~~~~~~~

chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:2860:7: warning: unused variable 'ret' [-Wunused-variable]
 2860 |   int ret;
      |       ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:3044:7: warning: unused variable 'ret' [-Wunused-variable]
 3044 |   int ret;
      |       ^~~

chip/stm32_i2c.c:722:12: warning: 'stm32_i2c_sem_wait_noncancelable' defined but not used [-Wunused-function]
  722 | static int stm32_i2c_sem_wait_noncancelable(FAR struct i2c_master_s *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wireless/gs2200m.c: In function 'gs2200m_read':
wireless/gs2200m.c:727:20: warning: passing argument 1 of 'nxsem_wait' from incompatible pointer type [-Wincompatible-pointer-types]
  727 |   ret = nxsem_wait(dev);
      |                    ^~~
      |                    |
      |                    struct gs2200m_dev_s *

.config:1207:warning: symbol value '' invalid for TESTING_OSTEST_FPUSIZE

platform/audio/cxd56_audio_analog.c:69:13: warning: inline function 'cxd56_audio_clock_is_enabled' declared but never defined
   69 | inline bool cxd56_audio_clock_is_enabled(void);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:68:13: warning: inline function 'cxd56_audio_clock_disable' declared but never defined
   68 | inline void cxd56_audio_clock_disable(void);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~
platform/audio/cxd56_audio_analog.c:67:13: warning: inline function 'cxd56_audio_clock_enable' declared but never defined
   67 | inline void cxd56_audio_clock_enable(uint32_t clk, uint32_t div);
      |             ^~~~~~~~~~~~~~~~~~~~~~~~

chip/stm32_adc.c: In function 'adc_reset':
chip/stm32_adc.c:1348:7: warning: unused variable 'ret' [-Wunused-variable]
 1348 |   int ret;
      |       ^~~
chip/stm32_adc.c: In function 'adc_shutdown':
chip/stm32_adc.c:1496:7: warning: unused variable 'ret' [-Wunused-variable]
 1496 |   int ret;
      |       ^~~

chip/stm32_i2c.c:729:12: warning: 'stm32_i2c_sem_wait_uninterruptble' defined but not used [-Wunused-function]
  729 | static int stm32_i2c_sem_wait_uninterruptble(FAR struct i2c_master_s *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

wireless/lpwan/sx127x/sx127x.c:147:52: warning: missing terminating ' character
  147 | #  warning OOK support is not complete, RX+TX doesn't work yet!
      |                                                    ^

str71_spi.c:435:24: warning: initialization of 'uint32_t (*)(struct spi_dev_s *, uint32_t)' {aka 'unsigned int (*)(struct spi_dev_s *, unsigned int)'} from incompatible pointer type
                                               'uint16_t (*)(struct spi_dev_s *, uint16_t)' {aka 'short unsigned int (*)(struct spi_dev_s *, short unsigned int)'} [-Wincompatible-pointer-types]
  435 |   .send              = spi_send,
      |                        ^~~~~~~~
str71_spi.c:435:24: note: (near initialization for 'g_spiops.send')

chip/pic32mx-lowconsole.c:147:24: warning: 'pic32mx_getreg' defined but not used [-Wunused-function]
 static inline uint32_t pic32mx_getreg(uintptr_t uart_base,
                        ^
chip/pic32mx-gpio.c:113:20: warning: 'pic32mx_value' defined but not used [-Wunused-function]
 static inline bool pic32mx_value(uint16_t pinset)
                    ^
chip/pic32mz-gpio.c:124:20: warning: 'pic32mz_value' defined but not used [-Wunused-function]
 static inline bool pic32mz_value(pinset_t pinset)
                    ^
chip/pic32mx-usbdev.c:3065:1: warning: 'pic32mx_epreserved' defined but not used [-Wunused-function]
 pic32mx_epreserved(struct pic32mx_usbdev_s *priv, int epno)
 ^

mmcsd/mmcsd_spi.c: In function 'mmcsd_mediachanged':
mmcsd/mmcsd_spi.c:1938:7: warning: 'return' with a value, in function returning void
       return ret;
       ^

In file included from partition/fs_partition.c:42:0:
partition/partition.h:66:19: warning: 'read_partition_block' defined but not used [-Wunused-function]
 static inline int read_partition_block(FAR struct partition_state_s *state,
                   ^

local/local_netpoll.c: In function 'local_pollsetup':
local/local_netpoll.c:305:1: warning: label 'pollerr' defined but not used [-Wunused-label]
 pollerr:
 ^~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: If3ea8f32b878aa218072130f7c3018f0d3c1aca5
2020-04-13 12:01:39 -06:00
YAMAMOTO Takashi
87f2e578ac Fix typos in comments 2020-04-13 09:50:32 -06:00
Gregory Nutt
ca2b0a3657 Fix more warnings noted in PR checks
arp/arp_notify.c:132:43: warning: for loop has empty body [-Wempty-body]
           prev = curr, curr = curr->nt_flink);
                                              ^

    sixlowpan/sixlowpan_tcpsend.c:806:31: warning: implicit conversion from 'unsigned int' to 'uint16_t' (aka 'unsigned short') changes value from 4294967295 to 65535 [-Wconstant-conversion]
                                  _SO_TIMEOUT(psock->s_sndtimeo));
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Numerous warnings like:

    ieee802154_getreq.c:93:3: warning: implicit declaration of function 'memcpy' is invalid in C99 [-Wimplicit-function-declaration]
      IEEE802154_EADDRCOPY(eaddr, req.attrval.mac.eaddr);
      ^

    nxfonts/nxfonts_cache.c:839:35: warning: for loop has empty body [-Wempty-body]
               fcache = fcache->flink);

    bluetooth/bluetooth_finddev.c💯11: warning: implicit declaration of function 'memcmp' is invalid in C99 [-Wimplicit-function-declaration]
          if (BLUETOOTH_ADDRCMP(dev->d_mac.radio.nv_addr, match->bf_addr))
              ^

    rwbuffer.c:559:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
      if (rwb->rhmaxblocks > 0 && rwb->rhnblocks > 0)
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2020-04-13 02:09:34 +08:00
Gregory Nutt
72104c182c nxstyle fixes
Run all files modified by PR 766 through nxstyle and fix any resulting complaints.

NOTE:  Numerous "Mixed case identifier" errors in arch/arm/src/cxd56xx/cxd56_gnss.c were not fixed because this problem is of much larger scope than this file.
2020-04-11 21:19:47 +01:00
Gregory Nutt
67ec3d7926 Remove CONFIG_CAN_PASS_STRUCT
This commit resolves issue #620:

Remove CONFIG_CAN_PASS_STRUCTS #620

The configuration option CONFIG_CAN_PASS_STRUCTS was added many years ago to support an old version of the SDCC compiler. That compiler is currently used only with the Z80 and Z180 targets. The limitation of that old compiler was that it could not pass structures or unions as either inputs or outputs. For example:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    struct mallinfo mallinfo(void);
    #else
    int      mallinfo(FAR struct mallinfo *info);
    #endif

And even leads to violation of a few POSIX interfaces like:

    #ifdef CONFIG_CAN_PASS_STRUCTS
    int  sigqueue(int pid, int signo, union sigval value);
    #else
    int  sigqueue(int pid, int signo, FAR void *sival_ptr);
    #endif

This breaks the 1st INVIOLABLES rule:

Strict POSIX compliance
-----------------------

  o Strict conformance to the portable standard OS interface as defined at
    OpenGroup.org.
  o A deeply embedded system requires some special support.  Special
    support must be minimized.
  o The portable interface must never be compromised only for the sake of
    expediency.
  o Expediency or even improved performance are not justifications for
   violation of the strict POSIX interface

Also, it appears that the current SDCC compilers have resolve this issue and so, perhaps, this is no longer a problem: z88dk/z88dk#1132

NOTE:  This commit cannot pass the PR checks because it depends on matching changes to the apps/ directory.
2020-04-11 21:19:47 +01:00
hartmannathan
bfc153ca27
Fix typos in comments and documentation (#750)
* Fix typos in comments and documentation
2020-04-08 06:45:35 -06:00
YAMAMOTO Takashi
e811677747 Fix a fatal typo in a recent change
A typo in:
    commit ae401cecdd
    ("Check return from nxsem_wait_initialize()")
2020-04-01 11:30:45 +01: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
Ouss4
910ebbf5b0 fs/fat/fs_fat32util.c: return was missing from the last PR. 2020-03-30 17:13:13 +02:00
Ouss4
ba8bc4c80c fs/: Check return of nxsem_wait_uninterruptible. 2020-03-30 08:08:07 -06:00
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
Xiang Xiao
afb40d87fb fs/mmap/fs_mmap.c: Add support for MAP_PRIVATE. 2019-11-23 08:07:04 -06:00
Juha Niskanen
a085a0a70b fs/smartfs/smartfs_smart.c: Honor O_APPEND on writes. Also document pwrite() bug/limitation. 2019-11-05 07:32:23 -06:00
Juha Niskanen
3268eb882e fs/smartfs/smartfs_smart.c: Fix O_CREAT without O_TRUNC truncating existing file. Also nothing in POSIX says that O_APPEND should prevent O_TRUNC. 2019-11-05 07:28:24 -06:00
Xiang Xiao
383ce02442 drivers/rptun/rptun.c and fs/hostfs/hostfs_rpmsg.c: Fix 64-bit build issue in rpmsg driver. 2019-11-03 07:28:17 -06:00
Guiding Li
8b92305265 This commit brings in the drivers needed to support OpenAMP. These changes were ported from https://github.com/FishsemiCode/nuttx. The current state: Most drivers do now compile but are not yet verfied.
This port was effort of a number of people, I rather arbitrarily gave authorship to Guiding Li because he has the largest number of fundamental quashed commits from the Xiamoi repository.

Squashed commit of the following:

Author: Xiang Xiao <xiaoxiang@pinecone.net>
    include/nuttx/b2c.h and libx/libc/string:  Add non-standard string functions to deal with cases where there are more than 8-bits in a type char.

Author: Gregory Nutt <gnutt@nuttx.org>
    Fix several build issues/missing definitiona needed for OpenAMP build in drivers/.
    Add OpenAMP code has been reviewed and ran through tools/nxstyle (with all reports accounted for).

Author: Xiang Xiao <xiaoxiang@xiaomi.com>
    tools/:  Fix the minor issue in Makefile

Author: Gregory Nutt <gnutt@nuttx.org>
    drivers/rptun/rptun.c:  Review for coding standard.  Run against tools/nxstyle.
    tools/LibTargets.mk:  Fix some TABs that were turned into spaces by a copy-paste.
    fs/hostfs:  Add configure and build support for hostfs RPC.
    drivers/timer:  Add configure and build support for syslog RTC.
    drivers/syslog:  Add configure and build support for syslog RPC.
    drivers/serial:  Add configure and build support for serial RPC.
    Kconfig, tools/*.mk. openamp/:  Add basic OpenAMP build support.
    drivers/rptun:  Add configure and build support for OpenAMP tunnel drivers.
    drivers/net:  Update Make.defs and Kconfig for OpenSDA support.
    Remove drivers/clk/clk-rpmsg.c drivers/power/rpmsg_regulator.c.  These depend on upstreaming support for a new subsystem based on the clk/regulator is model from Linux.  Removed because we want to separate the activities.  We will just try to get the basic OpenAMP support in place for now.
    Remove drivers/misc/misc_rpmsg.c and include/nuttx/misc/misc_rpmsg.h.  These are specific to the Xiaomi application.

Author: zhuyanlin <zhuyanlin@pinecone.net>
    This commit brings in the OpenAMP OS driver/RPC components from https://github.com/FishsemiCode/nuttx.  Initial commit is source files only.  Additional changes to Kconfig and Make.defs files still needed.

Author: Jianli Dong <dongjianli@pinecone.net>
    This commit brings in the OpenAMP OS driver/RPC components from https://github.com/FishsemiCode/nuttx.  Initial commit is source files only.  Additional changes to Kconfig and Make.defs files still needed.

Author: Guiding Li <liguiding@pinecone.net>
    This commit brings in the OpenAMP OS driver/RPC components from https://github.com/FishsemiCode/nuttx.  Initial commit is source files only.  Additional changes to Kconfig and Make.defs files still needed.
2019-11-02 11:30:33 -06:00
ligd
77bf9b09a1 fs/driver/fs_findmtddriver.c: Fix compile failed if NO CONFIG_MTD. 2019-10-29 08:16:27 -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
Xiang Xiao
3bc62f1ccc Change space to tab and help to ---help--- in Kconfig files. 2019-10-05 21:39:12 -06:00
Nathan Hartman
46aaec7ba0 Fix minor typos in docs and comments. 2019-09-29 12:52:20 -06:00
Juha Niskanen
5c853cd1dc libs/libc/unistd/lib_getcwd.c: remove stray sched_unlock(). Also fixes several typos. 2019-09-20 06:23:48 -06:00
Juha Niskanen
e8b5dd4528 Fix use of undefined pp-token #errror, other typos. 2019-09-19 18:19:18 -06:00
Juha Niskanen
ebc6f51641 Fix some typos 2019-09-17 10:46:23 -06:00
Gregory Nutt
cc694e9862 Fix some new warnings found in build testing. 2019-09-10 08:20:53 -06:00
Gregory Nutt
7871e983b8 net/tcp/tcp_send.c: Commit a52ceac13e broke IPv4 sending. In cp_send.c:tcp_ipv4_sendcomplete(), ‘ipv4->vhl’ now needs to be configured before call to tcp_ipv4_chksum(). Noted by Jussi Kivilinna in comit comments. 2019-09-06 09:48:42 -06:00
David Alessio
5be824e0ea Merged in david_alessio/nuttx/bugfix/cpuload-missing-lf (pull request #1026)
add missing LF to cpuload

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-26 19:41:20 +00:00
Gregory Nutt
8b62bc96f5 Updates from review and testing of commit a0867a7f4f. 2019-08-26 09:46:05 -06:00
David Alessio
a0867a7f4f Merged in david_alessio/nuttx/feature/add-git-revision (pull request #1020)
report git info on /proc/gitrev

* report git info on /proc/gitrev

    git info reported: branch, version, git hash, hostname, usr, build date

* use existing .version and procfs for git info

* reduce script's coupling

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-26 15:09:33 +00:00
Gregory Nutt
b41093b020 fs/procfs/fs_procfsiobinfo.c: Correct use of C11 features in common code. 2019-08-24 17:51:05 -06:00
Gregory Nutt
dd97fb991b This commit moves shared builtin information out of binfmt/libbuiltin and into libs/libc/builtin where it can be shared. This should permit builtin application in the PROTECTED build where binfmt/libbuiltin is not available in user space.
Squashed commit of the following:

    Correct some additional compile-related issues.

    Move  include/nuttx/binfmt/builtin.h to include/nuttx/lib/builtin.h.  Move apps/builtin/lib_builtin_forindex.c to libs/libc/builtin/lib_builtin_forindex.c.

    Move binfmt/libbuiltin to libs/libc/builtin.  There are calls made directly from apps/nshlib into this logic and hence, must be part of a library that can be shared between the OS and applications.
2019-08-23 09:07:40 -06:00
Gregory Nutt
425a2d1b2c fs/procfs/fs_procfsiobinfo.c: Fix error found in build testing. Needs to include nuttx/mm/iob.h. 2019-08-19 12:16:53 -06:00
Anthony Merlino
70404ed0dc Merged in antmerlino/nuttx/iobinstrumentation (pull request #1001)
Iobinstrumentation

* mm/iob: Introduces producer/consumer id to every iob call. This is so that the calls can be instrumented to monitor the IOB resources.

* iob instrumentation - Merges producer/consumer enumeration for simpler IOB user.

* fs/procfs: Starts adding support for /proc/iobinfo

* fs/procfs: Finishes first pass of simple IOB user stastics and /proc/iobinfo entry

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-08-16 22:42:25 +00:00
Gregory Nutt
240926c995 Beginning to update comments to reflect new organization of the boards/ sub-directory. 2019-08-08 08:46:54 -06:00
David Sidrane
7a85cf1728 fs/procfs/fs_procfsuptime: Fixed type warning. 2019-08-07 07:56:10 -06:00
김정찬
a12f80fb90 sched/mqueue/mq_desclose.c: Add a test to verify that message queue is closed by the same task group that opened it. If not, then list corruption would result. This test is only performed if CONFIG_DEBUG_FEATURES is enabled since it should not normally be an issue: It would be a strange programming practice to open a message queue in open task group, then close it in another. 2019-08-05 18:30:07 -06:00
Gregory Nutt
615c0ea7ee Change naming configs/ to boards in comments, Documentation, etc. Still a few more to go. 2019-08-05 07:13:48 -06:00
Gregory Nutt
8e321aba84 sched/: Correct some naming. The NuttX task groups have been using the acroynum 'gid' and also the type 'gid_t' for the the task group ID. That is incorrect. Than naming is reserved for use with group permissions. So these were all named to grpid and grpid_t so that it is clearer that these refer to NuttX task group IDs, and not to group permissions. 2019-08-02 10:01:30 -06:00
athan Hartman
6d7e0feea1 Remove 'executable' bit on several files 2019-08-01 14:13:55 -06:00
Michael Jung
d1afc02c50 fs/dirent/fs_opendir.c: Fix typo and style. opendir() did set errno to a negative value in one error case. Fixed some coding style issues found by nxstyle. 2019-07-31 07:18:07 -06:00
Gregory Nutt
1fd6c432fc configs/makerlisp/nsh/defconfig: Enable Procfs, RTC, and SPI-based SD support. Various fixes under arch/z80/src/ez80 for a clean compile. 2019-06-16 14:45:38 -06:00
Dave Marples
5179fa9a64 drivers/serial/serial.c: Limit the number of times that the poll semaphore is incrmented. 2019-06-13 16:23:04 -06:00
Gregory Nutt
ee9e8c6bc2 udp\udp_callback.c: Fix another C89 compatibility problem. Empty initializers are not permitted. Caused ez80 build failure. 2019-06-03 09:23:19 -06:00
Gregory Nutt
f60301665b fs/procfs/fs_procfs.c: procfs_initialize() is used only within fs/procfs/fs_procfs.c and, hence, should be marked 'static'. 2019-05-25 14:12:00 -06:00
Gregory Nutt
035842b3ed Fix an error and more warnings found in build testing. 2019-05-25 12:13:27 -06:00
Gregory Nutt
b49be4bb20 Squashed commit of the following:
arch/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    sched/ audio/ crypto/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    Documentation/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    fs/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    graphics/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    net/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    drivers/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    include/, syscall/, wireless/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    configs/:  Remove all references to CONFIG_DISABLE_POLL.  Standard POSIX poll can no longer be disabled.
2019-05-21 18:57:54 -06:00
Gregory Nutt
abf6965c24 Squashed commit of the following:
libs/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    syscall/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    wireless/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    Documentation/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    include/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    drivers/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    sched/:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    configs:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/xtensa:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/z80:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/x86:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/renesas and arch/risc-v:  Remove references to CONFIG_DISABLE_SIGNALS.  Signals can no longer be disabled.
    arch/or1k:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/misoc:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/mips:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/avr:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
    arch/arm:  Remove all references to CONFIG_DISABLE_SIGNALS.  Signals are always enabled.
2019-04-29 14:52:05 -06:00
YanLin Zhu
c6dd9274e6 fs/littlefs/lfs.c: Fix lfs_format bug. In superblock disk root-block assignment, the second must be root[1]. 2019-04-04 06:35:24 -06:00
Xiang Xiao
579b38b760 fs/mount and fs/unionfs: Support mount unionfs from nsh command. 2019-03-19 08:39:05 -06:00
Xiang Xiao
41ed2e153a fs/littlefs/lfs_vfs.c: Lookahead should use bit unit not byte unit. 2019-03-19 08:21:17 -06:00
Matthew Koch
1b325342f4 Merged in mjkoch/nuttx/mjkoch (pull request #841)
Correct a few tpyos

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-03-17 19:42:44 +00:00
Sebastien Lorquet
0e6f093e2a fs/procfs/fs_procfsuptime.c: Fix procfs typo. 2019-03-14 16:56:43 -06:00
Gregory Nutt
419c4cb6be A little more progress toward the implementation of per-window framebuffers. Still missing:
- Logic that generates the low lever framebuffer renderers for the per-window framebuffers,
- The logic that picks off the per-window framebuffer updates from normal graphics device updates.  This logic must update both the per-window framebuffer and the graphics device (from the framebuffer).

Squashed commit of the following:

    graphics:  Add logic to allocate the per-window framebuffer.

    graphics:  A few fragmentary thoughts on how a per-window framebuffer could be represented and allocated.
2019-03-14 11:20:14 -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
Gregory Nutt
dc8c814ca3 Squashed commit of the following:
Fixed coding standard error in several files.  Use of while( is incorrect; a space is required between while and (.  Also ran tools/nxstyle and fix thoses complaints as well in most files.

    Changes to comply with coding standard.  Mostly focused on files with missing space after keyword in if(, switch(, and for(.  Offending files also got changes to comply with tools nxstyle.  If there were logs of nxstyle complaints, the file also got a taste of tools/indent.sh.  Still need to fix occurrences of while( with missing space.  There are a lot of them.
2019-02-27 08:41:08 -06:00
Gregory Nutt
b5e6af60ac tools/nxstyle.c: Add check for multiple definitions of local variables on a line. 2019-02-14 18:33:23 -06:00
Gregory Nutt
efe65749ce Fix condition logic: The setup seems to support a network without sockets. That is not the case.
Squashed commit of the following:

    sched/sched/sched_getsockets.c:  Fix an error in conditional compilation.
    fs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NSOCKET_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    syscall/:  Remove all conditional logic based on CONFIG_NSOCKET_DESCRIPTORS == 0
    tools/:  Fixups for CONFIG_NSOCKET_DESCRIPTORS no longer used to disable sockets.
2019-02-11 15:47:25 -06:00
Gregory Nutt
a64869aa67 CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.
Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
2019-02-11 12:09:26 -06:00
Gregory Nutt
7ec13a3b4f Fix a few typos and wrap some long lines. 2019-02-09 10:00:37 -06:00
Xiang Xiao
b9c55919b2 fs/littlefs/lfs_vfs.c: Fix typographical errors in the VFS wrapper. 2019-01-29 07:39:25 -06:00
Xiang Xiao
af5e479fb5 fs/littlefs: VFS wrapper improvement: (1) Support block device interface, (2) support ioctl, stat and sync file operation, (3) support forceformat and autoformat option, (4) update file->f_pos and dir->fd_position, (5)remote the internal struct from dir, and (6) emove mtd byte read/write requirement. 2019-01-27 12:31:28 -06:00
Xiang Xiao
c511ff7ea2 fs/littlefs: Fix a minor issue found in code review: (1) Replace printf to finfo/fwarn/ferr, (2) Replace malloc/free to kmm_malloc/kmm_free, (3) define LFS_NAME_MAX to NAME_MAX, (4) Check the big endian using CONFIG_ENDIAN_BIG. 2019-01-27 12:16:02 -06:00
ligd
6ba29a93b6 fs/hostfs/hostfs.c: Remove the unnecessary use of host_stat() in hostfs_bind() 2019-01-27 12:10:19 -06:00
Xiang Xiao
5708a1ac73 fs/mount and fs/romfs: Add support to mount a ROMFS volume using an MTD driver interface using the standard mount() operation. 2019-01-27 12:07:37 -06:00
Xiang Xiao
e57f7cf6ae Critical Section Monitor (sched/ and fs/procfs: Remove SCHED_IRQMONITOR_GETTIME to simplify the clock source selection: (1) Use up_critmon_gettime if SCHED_IRQMONITOR, (2) Call clock_systimespec if SCHED_TICKLESS, (3) Don't collect timing info for all other cases and move up_critmon_* to arch.h avoid the duplicated declaration. 2019-01-27 10:13:28 -06:00
Xiang Xiao
964f0ab304 aio_cancel need signal caller after the succeed and fix minor issue in the error handler 2019-01-27 09:39:33 -06:00
Xiang Xiao
fb63c0a293 sched/signal and related changes to other OS subsystems. 2019-01-27 09:28:59 -06:00
David Sidrane
ffd37a0175 fs/vfs/fs_open.c: Fix not returning failure for block_proxy() call. 2019-01-25 06:23:34 -06:00
Gregory Nutt
2ea2ae6456 fs/littlefs/lfs.c: Fix some issues introduced in previous commit. 2019-01-10 07:13:47 -06:00
Gregory Nutt
444ff759cd fs/littlefs: Make all struct and enum names conform to the NuttX coding standard. 2019-01-10 06:37:53 -06:00
Gregory Nutt
a76773acf1 fs/littlefs: Fix a few more long lines reported by tools/nxstyle.c 2019-01-09 17:38:29 -06:00
Gregory Nutt
ae7646ee91 fs/littlefs: Correct some additional coding style problems reported by tools/nxstyle.c. Not all are easily fixed, however, due to some unusual parameter passing using by the original author. 2019-01-09 17:34:48 -06:00
Gregory Nutt
fcb5273250 fs/littlefs: Correct compilation errors when -std=c89 added to command line. 2019-01-09 15:17:42 -06:00
Gregory Nutt
61d92c216a fs/littlefs: Make sure that ARM is included in BSD license. 2019-01-09 15:00:37 -06:00
lihaichen
87a5e4cd2d Addes the ARM mbed littlefs to NuttX
Squashed commit of the following:

Author: Gregory Nutt <gnutt@nuttx.org>
    fs/littlefs:  Fix some compilation errors.
    fs/littlefs:  Brings code a little closer to NuttX coding standard.  Not 100%, but closer.
    fs/littlefs:  Convert all C++ style comments to C comments.

Author: lihaichen <li8303@163.com>

    fs/littlefs:  Adds port of the mbed littlefs.

    depends on !DISABLE_MOUNTPOINT && MTD_BYTE_WRITE

        register_mtddriver("/dev/w25", mtd, 0755, NULL);
        mount("/dev/w25", "/w25", "littlefs", 0, NULL);
2019-01-09 14:26:51 -06:00
Gregory Nutt
15688c4331 Revert "fs/fat/fs_fat32.c: Fixes issue when seeking to end of file where we move one too many clusters ahead due to < vs <= logic. This causes us to move past the last cluster in the file."
This reverts commit 7ffe023766.

This change is reverted because it introduces other problems when seeking around the file.
2019-01-05 16:43:47 -06:00
Anthony Merlino
7ffe023766 fs/fat/fs_fat32.c: Fixes issue when seeking to end of file where we move one too many clusters ahead due to < vs <= logic. This causes us to move past the last cluster in the file. 2019-01-05 14:55:59 -06:00
Gregory Nutt
0cd5a232ea Fix a few typos. 2018-12-27 08:45:26 -06:00
Daniel P. Carvalho
60575d3436 fs/nxffs/nxffs_ioctl.c: Pass unrecognized IOCTL commands to the contained MTD driver. 2018-12-12 18:23:03 -06:00
David Sidrane
010d5da4e6 fs/vfs: dup() and dup2() were broken some time back. fs_dupfd() was return returing OK on success, not fit the file descriptor of the duplicated fd. 2018-12-10 13:25:52 -06:00
David Sidrane
b30db5dcb0 fs/cromfs/fs_cromfs.c: Fixes hardfault 2018-12-06 16:42:20 -06:00
David Sidrane
5433ec589b fs/driver/fs_blockpartition.c: Fix void pointer warning.
libs/libc/unistd/lib_daemon.c:  Fix compiler error is streams disabled.
sched/irq/irq_procfs.c:  Fix warning
sched/task/task_vfork.c: Fix void * math warning
2018-12-03 17:54:21 -06:00
Xiang Xiao
1e0e1ae856 fs/procfs: Remove the unnecessary critical section 2018-11-29 12:51:34 -06:00
Gregory Nutt
095b597d34 sched/sched and fs/procfs: Fix some bus in critical section monitor found in testing 2018-11-24 17:58:35 -06:00
Gregory Nutt
807d5bb4ae Critical Section Monitor: Add low level timer support for simulation. Fix serial bugs and logic errors in initial implementation. Still does not work; takes assertions. 2018-11-24 15:07:12 -06:00
Gregory Nutt
85c31fd4a2 fs/procfs/fs_procfscritmon.c and sched/sched/sched_critmonitor.c: Add support for global pre-emption and global critical sections to monitor as suggested by Xiang Xaio. 2018-11-24 13:33:37 -06:00
Gregory Nutt
fc6084f311 Squashed commit of the following:
fs/procfs/fs_procfsproc:  Extended the process ID ProcFS output to show per-thread maximum time for pre-emption disabled and maximum time within a critical section.

    sched/sched/sched_critmonitor.c:  Adds data collection logic in support of monitoring critical sections and pre-emption state.
2018-11-24 10:32:45 -06:00
Gregory Nutt
97b0235d77 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":
I see the following behaviour on NuttX 7.26, where I have SD card mounted on /flash and a directory called "frm" on it:

opendir("/flash")  returns  (DIR *) 0x1000c580
opendir("/flash/") returns (DIR *) 0x1000c5d0
opendir("/flash/frm")  returns (DIR *) 0x1000c620
opendir("/flash/frm/")  returns (DIR *) 0x0

From POSIX specs for opendir(): "A pathname ... that ends with one or more trailing slashes shall be resolved as if a single dot character ( '.' ) were appended to the pathname."

So for mount points, opendir() works correctly, but for FAT32 filesystem it fails to open directory if the path has a trailing slash. I'm not quite sure how to cleanly fix this. Stripping the trailing slash in opendir() would require allocating a separate buffer, while fixing it in the FAT32 code seems somewhat complex due to the short/long filename logic.

It is not a big issue for me, I'm just going to fix it on the application side. But still a small portability and standards compliance issue.

NOTE: You would not see this problem if you call opendir() indirectly in NSH (like 'ls -R /') because NSH contains logic to remove trailing '/' characters from paths.
2018-11-16 11:45:18 -06:00
Gregory Nutt
9d09b5aad7 Eliminate a warning found in build testing. 2018-11-09 13:23:12 -06:00
Xiang Xiao
d2cfd398ba Fix compiler error and warning when CONFIG_NET_SENDFILE=y 2018-11-09 11:17:43 -06:00
Gregory Nutt
31485356b8 Updates based on coding style review of PR 755 2018-11-09 07:51:43 -06:00
Petteri Aimonen
96da659c0b Merged in paimonen/nuttx/pullreq_FAT_improvements (pull request #755)
Pullreq FAT improvements

* NuttX: Add CONFIG_FAT_LFN_ALIAS_HASH to speed up creating long filenames.

    Long filenames on FAT filesystems have associated 8.3 character alias
    short filenames. The traditional form of these is FILENA~1.EXT with
    a running count of the number of similar names. However creating this
    unique count can take several seconds if there are many similarly named
    files in the directory. Enabling FAT_LFN_ALIAS_HASH uses an alternative
    format of FI0123~1.TXT where the four digits are a hash of the original
    filename. This method is similar to what is used by Windows 2000 and
    later.

* NuttX: Add CONFIG_FAT_LFN_ALIAS_TRAILCHARS alternative format for 8.3 filenames.

    Traditional format for long filename 8.3 aliases takes first 6
    characters of long filename. If this option is set to N > 0,
    NuttX will instead take first 6-N and last N characters to form
    the short name. This is useful for filenames like "datafile12.txt"
    where the first characters would always remain the same.

* NuttX: FAT32: Fix file date corruption in fat_truncate().

* NuttX: if SD card wait seems to be a long one, give time for other threads to run.

Approved-by: GregoryN <gnutt@nuttx.org>
2018-11-09 13:46:16 +00:00
zhangyuan7
a7d9d4bc1e drivers/serial/uart_16550.c: Fox UART flow control issue. UART_MCR_RTS need be high even UART_MCR_AFCE is enabled 2018-11-08 10:21:16 -06:00
iuhaitao
82e0b0328b fs/procfs: Add /proc/version support to get version info 2018-11-08 10:13:45 -06:00
Xiang Xiao
2f63becbc8 fs/driver: Add register_mtdpartition() for MTD partition 2018-11-08 10:03:07 -06:00
Xiang Xiao
e674edfa19 fd/dirent, fs/driver/, and fs/vfs: Make MTD device accessible via a character driver proxy like block devices 2018-11-08 09:59:18 -06:00
Xiang Xiao
f40a1c6749 fs/mount/fs_mount.c mount: Add support for mounting a file system with either a block or an MTD driver. 2018-11-08 09:51:06 -06:00
Xiang Xiao
247414c6ad drivers/mtd and other MTD drivers: Remove mtd_procfsoperations since we can now get the same information from inode 2018-11-08 09:46:11 -06:00
Xiang Xiao
d32d9d4b24 fs/partition: Try MTDIOC_GEOMETRY IOCTL before bops's geometry
fs/driver/fs_blockpartition.c:  Support MTD IOCTL
2018-11-08 09:41:54 -06:00
Xiang Xiao
a9ff43d93c fs/aio, libs/libc/aio, sched/mqueue, sched/timer, and sched/signal: Remove the code duplication for SIGEV_THREAD. 2018-11-08 08:19:17 -06:00
Gregory Nutt
706b20a49f fs/vfs/fs_read.c: Elimnate a warning noted by Anonymouns in Issue 124. 2018-10-12 14:58:21 -06:00
Gregory Nutt
4391b51cd3 fs/procfs/fs_procfsproc.c: Change output of the env file so that it looks more like output from the 'env' command. Documentation/NuttShell.html: Document the new NSH 'env' command. 2018-09-30 11:15:28 -06:00
Gregory Nutt
a037aeec5d Trivial update to a comments and to SPIFFS comments and debug output. 2018-09-30 07:15:15 -06:00
Gregory Nutt
d23c5e0d61 fs/spiffs: Add a check for an error in a return value. Improve some working in the TODO list. 2018-09-29 17:19:04 -06:00
Gregory Nutt
cc539d7f95 fs/spiffs: Need to flush cache to FLASH when closing file. Also updates TODO list. 2018-09-29 15:04:11 -06:00
Gregory Nutt
d8bfb4e3a2 fs/spiffs: Fix some disagreement between the NuttX wrapper and the core SPIFFS with regard to meaning of a return value. This was causing more writes than necessary and wasting FLASH space. 2018-09-29 11:01:46 -06:00
Gregory Nutt
5fad655982 configs/sim/spiffs/defconfig: Remove CONFIG_EXPERIMENTAL. 2018-09-28 20:05:42 -06:00
Gregory Nutt
6a12213fbb fs/spiffs: I have been test with apps/examples/fstest which provides a good exercise but of the FS internals but not of the user interface. I build an SPIFFS aware NSH configuration and found and fixed a number of glaring usability errors: (1) Missing logic to stat the SPIFFS root directory, (2) Confusion in use to two similarly named struct field... caused files to be unexpectedly deleted. (3) Fixed a sempahore deadlock condition. And (5) Fix /procfs/mount. It was unaware of the SPIFFS file system type. 2018-09-28 17:35:25 -06:00
Gregory Nutt
e90723307e fs/spiffs: Fix an error in who the deferred 'unlink' is handling in close(). Modify read() and write behavior() so that they do not return so many partial reads and writes. 2018-09-28 13:21:44 -06:00
Gregory Nutt
294456fa20 fs/spiffs: Add logic to dump the logical context of the FLASH. 2018-09-28 11:23:42 -06:00
Gregory Nutt
2ca8c6682c fs/spiffs: fs/spiffs: Fix several bugs: (1) Fix bad statfs return values. (2) Fix an error in spiffs_unlink(). Fix an in error detection logic when closing a file. 2018-09-27 19:29:00 -06:00
Gregory Nutt
2d2dd5e9e3 fs/spiffs: Fix bad check for return value. In NuttX all values greater than or equeal to 0 are successes. 2018-09-27 14:24:46 -06:00
Gregory Nutt
1273f727c0 File System IOCTLs: Three new IOCTLS were added for SPIFFS, two of which were duplicates. 2018-09-27 12:25:23 -06:00
Gregory Nutt
65ef3acf70 fs/spiffs: Still uses some internal error codes that should be replaced with errors from errno.h. For now, I just added a mapping function before any value is returned to the caller: And of these detailed internal errors are simply mapped to -EFTYPE. Most are related to improper internal data structures so -ETYPE is possibly appropriate. Aslo SPIFFs is no longer is EXPERIMENTAL. Many things work but I the code is very immature and many things will not work. 2018-09-27 11:33:09 -06:00
Gregory Nutt
554745946d fs/spiffs: The MTD interfaces needs its own, dedicated page buffer for read-modify-write operations. It cannot share the normal 'working' page buffer because it is sometimes in-use when the MTD interface needs it. Also and more DEBUG output and controls for the MTD interface. 2018-09-27 09:35:58 -06:00
Gregory Nutt
7a2f70495a fs/spiffs: Fix yet another interface with NuttX MTD. This time, the calculation of the number of whole blocks. 2018-09-26 20:00:25 -06:00
Gregory Nutt
5cc68ad3b8 fs/spiffs: Fix yet another interface with NuttX MTD. This time, the calculatio of the terminal block number. 2018-09-26 18:30:46 -06:00
Gregory Nutt
b4488a0549 fs/spiffs: Fix an error in write operation. examples/fstest now gets further before errors occur, but still does not work correctly. 2018-09-26 18:00:46 -06:00
Gregory Nutt
31e6fb561b fs/spiffs: Costmetic name changes more more consistency. 2018-09-26 15:50:55 -06:00
Gregory Nutt
d59893a456 fs/spiffs: Fixes yet another SPIFFS/MTD interfacing bug. 2018-09-26 15:16:38 -06:00
Gregory Nutt
63ba200957 fs/spiffs: Correct error in MTD multi-block read/write logic. 2018-09-26 12:29:42 -06:00
Gregory Nutt
6d2cce99e1 fs/spiffs: Fix more problems found in testing. It is getting closer but examples/fstest is still showing problem. 2018-09-26 10:05:43 -06:00
Gregory Nutt
71eac2d530 fs/spiffs: Correct the MTD block write logic. 2018-09-25 18:05:45 -06:00
Gregory Nutt
9984e209ab fs/spiffs: Various fixes from initial testing. Still lots of issues. Also changes from further review to get better naming consistency and functional partitioning. 2018-09-25 16:19:03 -06:00
Gregory Nutt
8373784afe Squashed commit of the following:
fs/spiffs:  Finished review, update, and repartitioning of spiffs_core.c.

    fs/spiffs:  Converted macro SPIFFS_VALIDATE_OBJIX to a function.

    fs/spiffs:  Move SPIFFS_VALIDATE_DATA and SPIFFS_CHECK_RES macros inline.
2018-09-25 12:15:24 -06:00
Gregory Nutt
ec498d2660 This commit brings in an inital port of the SPIFFS flash file system into NuttX. The file system is still untested at this point (and subject to some additional review). It is, however, marked EXPERIMENTAL should this should not cause a problem for anyone.
Squashed commit of the following:

    fs/spiffs:  Fix last compilation issue.  Now compiles without error.  It is still not quite ready for testing as there is additional code review that must be be performed.  It is now marked as EXPERIMENTAL so that it can be brought onto the master branch with little risk.

    fs/spiffs:  Remove some dead code.

    fs/spiffs:  Weak start of analysis of spiffs_nucleus.c.  Renamed to spiffs_core.c

    fs/spiffs:  Rename spiffs_nucleus.c to spiffs_core.c

    fs/spiffs:  Remove spiffs_config.h.  All configuration settings are now available in the SPIFFS Kconfig options.

    fs/spiffs:  Finished review, update, and repartitioning of spiffs_check.c.  Added spiffs_check.h.

    fs/spiffs:  Finished review, update, and repartitioning of spiffs_cache.c.  Added spiffs_cache.h.

    fs/spiffs:  Clean up some defines used in debug output statements.

    fs/spiffs:  Finished review, update, and repartitioning of spiffs_gc.c.  Added spiffs_gc.h.

    fs/spiffs:  Now that VFS interface is completed, I have begun the long march of repartitioning the remaining functionality, reviewing logic, identifying dead code, and cleaning up loose ends.

    fs/spiffs:  Initial integration of MTD interface, replacing the SPIFFS native flash interface.  Lots of open issues such as the use of pages vs. blocks vs. erase blocks and units of addresses, offsets, and lengths that are passed in function calls.  Remove SPIFFS_USE_MAGIC support.  That option (which default to OFF anyway), wrote a magic value at the beginning of every sector and support verifiable identification of the file system.  It was not being and used and removing it makes life simpler.

    fs/spiffs:  Remove semaphore lock on the file object structure.  Ultimately, the file access must modify the volume and access the volume structue which also has a exclusivity lock.  So use of the volume lock alone should be sufficient.

    Integrated the SPIFFS rename logic into the NuttX VFS.  Removed non-standard application calls or convert them to IOCTL commands.  These were converted to IOCTL commands:  (1) integrity check, (2) garbage collection, and (3) format flash.  These were removed:  (1) Integrity check callback.  These provided a lot of good information about the state of the file system, but such callbacks are not compatible with a POSIX compliant file system.  (2) Index maps.  The index maps were a performance improvement feature.  The user could provide the memory and request that a region of a a file use that memory for improved lookup performance when accessing parts of the file.  The fallback is the less performance lookup by traversing the FLASH memory.  (3) Removed the quick garbage collection interface (the code is still used internally).  Only the full garbage collection is available to the user application via IOCTL.

    configs/sim/spiffs:  A simulator configuration to use for testing SPIFFS.

    fs/spiffs:  Integrate SPIFFS logic into NuttX VFS bind() and unbind() methods.

    fs/mount/fs_mount.c:  Add SPIFFS to the list of drivers that require MTD vs block drivers.

    fs/spiffs:  Trivial changes, mostly from analysis of how to integrate the rename() VFS method.

    fs/spiffs:  Connect NuttX VFS unlink method to the SPIFFS_remove() function.  Lots of name-changing.

    fs/spiffs:  Remove non-standard errno support.  Remove bogus SPIFFS_LOCK() and SPIFFS_UNLOCK() macros.

    fs/spiffs:  Add NuttX VFS implementation for statfs() method.  Clean up some of the accumulating compilation problems.

    fs/spiffs:  Add stat(), truncate() methods.  Dummy out unsupport mkdir() and rmdir() methods.

    fs/spiffs:  Replace some of the custom error numbers with standard error numbers.

    fs/spiffs:  Hooks read(), write(), fstat(), ioctl(), opendir(), closedir(), rewindif(), and readdir() into the NuttX VFS.

    fs/spiffs:  Beginning the organization to work with the NuttX VFS.  Lots of things are get broken!

    fs/spiffs:  Add spiffs.c which will be the interface between SPIFFS and NuttX.  No very close at present, however.

    fs/spiffs:  Clean up some compile problems introduced by coding standard changes.

    fs/spiffs:  A little closer to NuttX coding standard.

    fs/spiffs:  Ran tools/indent.sh against all files.  Closer to NuttX coding standard, but needs a lot more effort to be fully compliant.

    fs/spiffs:  This commit brings in version 0.3.7 of Peter Anderson's SPIFFS.  The initial commit includes the core FS files (with some definitions destributed to their correct header files) and hooks into the build system.
2018-09-24 18:05:09 -06:00
Gregory Nutt
91410573ef fs/mount/fs_mount.c: Correct an error introduced in the last commit (but only when file systems that need MTD drivers are included. 2018-09-22 14:39:11 -06:00
Gregory Nutt
992b293122 Squashed commit of the following:
fs/driver and fs/mount:  Add mount() support for file systems that require MTD drivers (vs. block drivers).
    fs/drivers:  Add support for named MTD drivers in the psuedo file system.  This will, eventually, allow us to mount file systems that need MTD drivers without having to fake an intervening block driver.
2018-09-22 14:20:18 -06:00
Gregory Nutt
913d013d8f Revert last change to the TODO list. There is no issue. 2018-09-19 12:15:04 -06:00
Gregory Nutt
94f26c0220 fs/inode/fs_fileclose.c: Move file_close() a separate file. It no longer makes since for it to cohabitate with file_detach(). 2018-09-15 13:19:14 -06:00
Gregory Nutt
3a4984a40b Rename file_close_detached() to juse file_close() for better consistency in naming. 2018-09-15 13:04:56 -06:00
Gregory Nutt
a7fd58c4db Squashed commit of the following:
many locations:  Change occurences of open() followed by file_detach() to file_open().  Change most non-controversion calls to open() to nx_open().

    fs/inode/fs_fileopen.c:  Flesh out file_open() with some interim, placeholder logic.

    fs/inode/fs_fileopen.c:  Add a framework for a file_open() implementation (no real logic in place yet).

    fs/vfs/fs_open.c:  Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable.
2018-09-15 10:49:41 -06:00
EunBong Song
a279815434 fs/smartfs/smartfs_smart.c: Current sector should have a space for next entry size. If not, we should move to next sector. 2018-09-14 06:36:55 -06:00
Gregory Nutt
fc127fd297 sched/signal: Add a generic signal notification facility. Modify the custom IOB available notifier so that it is now just a wrapper around this generic signal notification. This generic signal notification faility will, eventually, be used to support network polling.
Squashed commit of the following:

    mm/iob:  The IOB available notifier is now just a wrapper around the common signal notifier.

    sched/signal:  Add a generic signal notification facility.

    sched/signal/sig_evthread.c:  More trivial naming changes.

    sched/signal:  Rename nxsig_notification() to nxsig_evthread() to make forthcoming naming additions more consistent.
2018-09-09 08:32:37 -06:00
Gregory Nutt
33e3fb7a70 Correct mispellings of pseudo. Update some comments in signal.h. 2018-09-05 11:56:14 -06:00