Commit Graph

178 Commits

Author SHA1 Message Date
Xiang Xiao dd631265c4 fs: Add g_ prefix for all global mountpt_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
Fotis Panagiotopoulos ab1b3c0337 Added missing checks in strdup'ed strings. 2023-04-19 02:49:31 +08:00
Xiang Xiao 3aab2a2e73 fs/nxffs: Fix typo(nxem_wait->nxmutex_lock) error in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-07 09:06:06 +03:00
Gustavo Henrique Nihei e6b204f438 nuttx: Use MIN/MAX definitions from "sys/param.h"
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2023-02-01 23:47:44 +08:00
Xiang Xiao b0a0ba3ad7 fs: Move mmap callback before truncate in [file|mountpt]_operations
since mmap may exist in block_operations, but truncate may not,
moving mmap beforee truncate could make three struct more compatible

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02:00
Jukka Laitinen f33dc4df3f Change FIOC_MMAP into file operation call
- Add mmap into file_operations and remove it from ioctl definitions.
- Add mm_map structure definitions to support future unmapping
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
Jukka Laitinen 41e9df2f3e Add ftruncate into file operation calls
- Add truncate into file_operations
- Move truncate to be common for mountpt_operations and file_operations
- Modify all drivers to initialize the operations struct accordingly

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-02 11:23:20 -03:00
anjiahao d7b4e91dda Call nxsem_destroy or nxmutex_destry in the error path
1.Don't check the return value of nxsem_init or nxmutex_init
2.Fix some style issue

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-30 13:56:52 +01:00
Xiang Xiao dca5a3483f drivers: Destroy mutex and sem in the error path
also correct the order to ensure the memory free is last step

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
anjiahao dee38ce3e8 arch: Replace critical section with nxmutex in i2c/spi/1wire initialization
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
anjiahao d1d46335df Replace nxsem API when used as a lock with nxmutex API
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-17 15:59:46 +09:00
Xiang Xiao bdeaea3742 Remove the unnessary empty line after label
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-30 17:54:56 +02:00
Xiang Xiao 2b37909c9e libc: Move crc8.h, crc16.h and crc32.h from include to include/nuttx
to avoid the conflict with the 3rd party library

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-13 13:28:24 +03:00
Jiuzhu Dong fe17f747a7 fs/directory: move private directory information to filesystem
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong 90db4daca9 fs/directory: update readdir interface for all filesystem
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
zhouliang3 1f53a058fa nuttx:Change fs strncpy to strlcpy to avoid losing'\0'
Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
2021-12-30 18:06:00 +08:00
Xiang Xiao 307cc61893 fs: Add fchstat and chstat callback into mountpt_operations
and implement all status related change function. the individual
file system change will provide in other upcoming patchset.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8fde9db8eba9586e9c8da078b67e020c26623cf4
2021-07-29 06:33:49 -03:00
Xiang Xiao 0148e1d501 fs: Support the root file system attributes(mode, uid, gid and time)
Note: all attributes is guarded by PSEUDOFS_ATTRIBUTES to save the space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I664d60382e356068fd920f08aca5b4a49d8d92a9
2021-07-14 10:35:15 -03:00
Alin Jerpelea f9fb182809 Author: Gregory Nutt: update licenses to Apache
Update files from Gregory Nutt to Apache 2.0 license.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-05 12:15:56 -03:00
Alin Jerpelea a544c3f499 fs: nxffs: nxstyle error fix
Fix nxstyle errors to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-05 12:15:56 -03:00
Jiuzhu Dong 13100cf248 fs/readdir: Must reserve a byte for the NUL terminator
Change-Id: I1df0c278d289b90cc54512c0ee256a95549785ca
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-01-26 18:22:35 -08:00
Juha Niskanen cd41ed9b6d fs: fully parenthesize MIN and MAX macros
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2020-12-08 12:58:40 -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
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
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
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
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
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