Commit Graph

1551 Commits

Author SHA1 Message Date
Xiang Xiao a262eebe34 libc: Rename match to fnmatch
specified here:
https://pubs.opengroup.org/onlinepubs/007904875/functions/fnmatch.html

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-02 08:23:35 -03: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
Jiuzhu Dong 11faf0cb20 fs/inode: add sanity check for inode to avoid nullpointer
Change-Id: Ib2c74ba308b8f15756fac4e69632c296243eb4ab
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-25 23:01:37 -07:00
jordi f3af6edf93 Kconfig: add quotes in source to clean warnings from setconfig
To avoid the setconfig warning "style: quotes recommended around xxx in
source xxx"
2021-07-23 02:32:19 -07:00
Masayuki Ishikawa e5dafc825d fs: mount: Change the format for df
Summary:
- This commit changes the format for df to support big
  storage up to 2TB.

Impact:
- None

Testing:
- Tested with spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-07-19 04:26:44 -07:00
Masayuki Ishikawa cfd1c28606 fs, include: Use fsblkcnt_t and fsfilcnt_t instead of off_t
Summary:
- On Linux, fsblkcnt_t and fsfilcnt_t are used in struct statfs
- This commit applies the same logic

Impact:
- None

Testing:
- Tested with spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-07-19 04:26:44 -07:00
Masayuki Ishikawa a3f1abfb45 fs: nfs: Fix statfs for NFS
Summary:
- I noticed that the results of the df command are incorrect for NFS.
- Finally, I found that obj_attributes is not needed to
  communicate with the NFS server on Linux
- This commit fixes this issue

Impact:
- None

Testing:
- Tested with spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-07-19 04:26:44 -07:00
Xiang Xiao 02a6966ad5 fs: mkdir return EEXIST if the path already exist
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie1808697b860974367c17e0ba614ca5cae79f324
2021-07-18 10:25:54 -03:00
Xiang Xiao 7053707e0a fs/tmpfs: Handle the tail '/' correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia2beeaced2de9c38afefd92a2ddc13dfb4919c45
2021-07-18 10:25:54 -03:00
Xiang Xiao 663104a2e9 fs: Simplify sendfile implementation
and avoid call nx_ file API in the kernel space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Id951ca161df2c2ee267dc4b5a0d7dfa67df4c1e6
2021-07-17 07:39:15 -03:00
Xiang Xiao 2e0901fcaa net: Add file_socket function
and move the socket special process from fstat/nx_vfcntl/ to file_fstat/file_vfcntl

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia10341538488ba3a8444df8e73fb5257b2a1f512
2021-07-17 07:39:15 -03:00
Xiang Xiao a44f62ddf7 fs: should only apply umask to the userspace caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I608e3107aaf3d85045958163a742a1ef1107de91
2021-07-17 13:58:58 +09:00
Xiang Xiao a0f2f6c362 fs: Move umask to task_info_s
and implement the related semantic correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0587341e2c505e41b5e24e55dba039ed200d65f2
2021-07-14 10:35:15 -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
Xiang Xiao 1f3a8b5adf Fix mmap compiler error when CONFIG_FS_RAMMAP equals y
fs_munmap.c:122:15: error: ‘struct fs_rammap_s’ has no member named ‘kernel’
fs_rammap.c:110:52: error: expected ‘:’ before ‘;’ token

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-13 14:39:14 -03:00
Xiang Xiao 30135b5f18 vfs: stat_recursive should return -ENOSYS if stat callback is NULL
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic342b6fff112d24c7355ddc8aa0937dfc544f1b4
2021-07-13 11:32:52 -03:00
Xiang Xiao d539998446 fs: fstat shouldn't follow the symbol link
since the decision is already done at open time(from path to fd)

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Idc1df3c1d7fe60927b0643173f3f40895aaffd4c
2021-07-13 10:05:50 -03:00
Xiang Xiao c3c4053263 fs/profs: Add ordblks in meminfo_progmem
forget in commit:
Author: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Date:   Wed Apr 28 11:05:20 2021 +0800

    cmd/free: add nused/nfree field in command free

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-12 16:49:56 -03:00
Xiang Xiao 7ef29ecce6 profs: Print StackAlloc by procfs_snprintf
since snprintf return the wrong number in case of insufficient buffer

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-12 16:49:56 -03:00
hujie1 025bddfc6c nuttx: littlefs_close should return value bugfix
N/A

Change-Id: I5fea016fe01ac0e87ddeabdae67d36ab4125ea55
2021-07-12 10:05:49 -03:00
Jiuzhu Dong 9b1f554429 sched: Dynamically extend the pid hash table
Change-Id: I3a719bc575cd408cd530a39efa203f507b44fa9c
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-11 19:42:30 -07:00
Xiang Xiao 2fa1e55628 libc: Implement ttyname and ttyname_r
Note: this patch can get file path from root pseudo file handle,
but a general infrastructure is setup for other file system too.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I86cd79ebb741f2f43fdd398bb7498c40687d949b
2021-07-09 18:23:34 -03:00
zhouliang3 b7653e2fae fs: Add parent node of inode
N/A

Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
Change-Id: I006c6172ced8edd47b9d4661880e04d3a4274854
2021-07-09 18:23:34 -03:00
Xiang Xiao ee767021b3 fs: Remove the inernal st_count field from struct stat
it's more simple to reuse the resolve argument as the recursive count

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I826b2fef3af8b12aae230e4766ab09f8de988f8a
2021-07-09 16:38:51 -03:00
Xiang Xiao 643ee82e9c fs: pseudorename should call inode_release in the error path
to avoid the memory leak

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I8f7e4c8fb89188614d03dcf383a1707f25c65174
2021-07-09 15:18:32 -03:00
Xiang Xiao 13651cde99 fs: Move the default ioctl handle from nx_vioctl to file_vioctl
ensure the behaviour is same in all ioctl function variant

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ie67cfbc579004c8488ef5004c9be7fb179e77041
2021-07-08 09:17:04 -03:00
Xiang Xiao d5c1979aad fs/procfs: layout the output of meminfo correctly
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ic30e70772e19a43e2ad3b298e3ba1ac77f2f2219
2021-07-06 05:39:02 -07:00
Xiang Xiao 8612af4ae5 fs: Implement file_mmap and file_munmap API
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-06 11:18:13 +09:00
Xiang Xiao 2b0b298ab6 fs/mmap: Remove rammap_initialize declaration
Forget in patch:
commit ec30d6ef6b
Author: Xiang Xiao <xiaoxiang@xiaomi.com>
Date:   Thu Jun 24 01:42:11 2021 +0800

    fs: Initialize fs_allmaps_s::exclsem in declaration directly

    and then remove rammap_initialize and caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-07-06 11:18:13 +09:00
Xiang Xiao 7b54b7502c fs/tmpfs: Account the filename in the allocation block
and caclulate the available block more accurately

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ia6382239f422970771ccefbd6e461241a5f995a5
2021-07-04 18:51:12 -03:00
Xiang Xiao 6a09ed09f1 fs/tmpfs: Remove the temporary strdup in all place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I224cc9d4ec5fd08937f9f2ddfff022866090be29
2021-07-04 18:51:12 -03:00
Xiang Xiao c406e03cfe fs/tmpfs: Fix the memory corruption when reallocate tmpfs_directory_s
since it's hard to adjust all childern to point back the new parent
location. Let's allocate the dynamical part(e.g. tdo_entry) separately
and remove the back pointer.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I53afb8336360b7845bd8ecb5aa908acea20e7797
2021-07-04 18:51:12 -03:00
Nathan Hartman ce20211357 Fix various typos in comments and documentation
Fix typos in these files:
    * Documentation/components/drivers/character/foc.rst
    * Documentation/guides/cpp_cmake.rst
    * Kconfig
    * arch/arm/src/imxrt/imxrt_lpspi.c
    * arch/arm/src/kinetis/kinetis_spi.c
    * arch/arm/src/kl/kl_spi.c
    * arch/arm/src/lpc31xx/lpc31_spi.c
    * arch/arm/src/nrf52/nrf52_radio.h
    * arch/arm/src/s32k1xx/s32k1xx_lpspi.c
    * arch/arm/src/stm32/Kconfig
    * arch/arm/src/stm32/stm32_adc.c
    * arch/arm/src/stm32/stm32_foc.c
    * arch/arm/src/stm32/stm32_foc.h
    * arch/arm/src/stm32/stm32_pwm.c
    * arch/arm/src/stm32/stm32_spi.c
    * arch/arm/src/stm32f0l0g0/stm32_spi.c
    * arch/arm/src/stm32f7/Kconfig
    * arch/arm/src/stm32f7/stm32_spi.c
    * arch/arm/src/stm32h7/Kconfig
    * arch/arm/src/stm32h7/stm32_allocateheap.c
    * arch/arm/src/stm32h7/stm32_fmc.c
    * arch/arm/src/stm32h7/stm32_fmc.h
    * arch/arm/src/stm32h7/stm32_pwm.c
    * arch/arm/src/stm32h7/stm32_qspi.c
    * arch/arm/src/stm32h7/stm32_spi.c
    * arch/arm/src/stm32l4/stm32l4_pwm.c
    * arch/arm/src/stm32l4/stm32l4_spi.c
    * arch/arm/src/stm32l5/Kconfig
    * arch/arm/src/stm32l5/stm32l5_spi.c
    * arch/renesas/src/rx65n/rx65n_dtc.c
    * arch/renesas/src/rx65n/rx65n_usbdev.c
    * arch/risc-v/src/rv32m1/rv32m1_serial.c
    * boards/arm/stm32/b-g431b-esc1/src/stm32_foc.c
    * boards/arm/stm32/nucleo-f103rb/src/stm32_foc_ihm07m1.c
    * boards/arm/stm32/nucleo-f302r8/src/stm32_foc_ihm07m1.c
    * boards/arm/stm32h7/nucleo-h743zi2/README.txt
    * boards/risc-v/rv32m1/rv32m1-vega/README.txt
    * boards/sim/sim/sim/scripts/Make.defs
    * drivers/1wire/1wire.c
    * drivers/1wire/1wire_internal.h
    * drivers/lcd/Kconfig
    * drivers/syslog/ramlog.c
    * fs/fat/Kconfig
    * libs/libc/debug/Kconfig
    * libs/libc/machine/Kconfig
    * libs/libc/stdio/lib_libvsprintf.c
    * libs/libc/stdlib/lib_div.c
    * libs/libc/stdlib/lib_ldiv.c
    * libs/libc/stdlib/lib_lldiv.c
    * libs/libdsp/lib_observer.c
2021-07-04 11:23:26 -05:00
GAEHWILER Reto 38eadbb575 FAT32 kconfig entry to enforce computation of free clusters at mount
Follow up commit for [1] in response to the request to make the mount
behaviour configurable whether the number of free clusters is read
from the fsinfo section or computed (as the white paper suggests).

Default is the original behaviour of NUTTX, just read fsinfo.

[1] https://github.com/apache/incubator-nuttx/pull/3760
2021-07-04 08:26:11 -05:00
ligd 6d3ccf37ab fs: move out nx_close from filelock
If the close is blocked(like net close timeout 5s),
then other file operation can't access in this 5s.

Change-Id: Ia6c4ec88d90db0330134d0aaa30e94cb71c8a066
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-03 07:25:51 -05:00
ligd 2d32a52353 sched_critmon: add thread run time to critmonitor
Change-Id: Ib44e45f0f9a1b249b4067db324c9dbdf0cf3f288
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 08:25:02 -05:00
ligd dbdb24e2e0 procfs: fix cat status error when meet long thread name
nsh> cat /proc/3/status
Name:       init123456789987654Type:       Task
Group:      3
State:      Running

Change-Id: Iddef8fa1fe3a02d407244f46fa05e3f35dd7c84e
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 08:25:02 -05:00
ligd 2c775bb0c9 fs/procfs: fix heap overflow when snprintf meet long string
Change-Id: I90f2d9fab55b6e69f159855af3d6dbcb81142eb8
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-07-02 08:25:02 -05:00
Jiuzhu Dong 554310bd78 fs/fs_dup2: correct check before dup
Change-Id: I2387ab447f0d8ed9429960922a72de35b2730acb
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-02 04:54:43 -05:00
Jiuzhu Dong f57ba35151 fs/procfs: add StackAlloc field for task stack info
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-07-02 04:51:55 -05:00
Xiang Xiao 06215be327 mmap: Implement the minial but reasonable mlock/munlock/mprotect
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I538e0d78ecd0680374a2e0f56adbc61d7a4e6d1f
2021-07-01 08:06:54 +09:00
Xiang Xiao ec30d6ef6b fs: Initialize fs_allmaps_s::exclsem in declaration directly
and then remove rammap_initialize and caller

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Ife9f04d409b3a14a3be4bbb61c23da6e7a9f8a3d
2021-07-01 08:06:54 +09:00
Masayuki Ishikawa abc2767b0d fs: nfs: Reconnect to the NFS server in TCP mode
Summary:
- I noticed that an NFS connection is automatically dropped.
- Actually, this happens in TCP mode if no traffic happens
  for 600 seconds.
- I confirmed that the NFS client on Ubuntu automatically
  reconnects to the NFS server when an RPC call failed.
- This commit adds the same behavior to fix the issue.

Impact:
- NFS client in TCP mode

Testing:
- Tested with spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-06-28 01:11:52 -05:00
Xiang Xiao ae9b5fd306 Replace mktime with timegm in rtc and fs driver
since kernel component should use UTC instead local time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: Icf939e1ab0af8e577105f539d2553bc67b3b3d10
2021-06-23 13:43:32 -03:00
Xiang Xiao 2e49e1bc5c mtd: Add MTDIOC_FLUSH IOCTL like MTDIOC_XIPBASE
since the old design reuse BIOC_FLUSH for
MTD device which make some confusion

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-15 13:26:45 -03:00
chao.an 0d8e5b66fd net/sock: move the psock calloc out of sockfd_allocate
Signed-off-by: chao.an <anchao@xiaomi.com>
2021-06-11 05:00:21 -05:00
Xiang Xiao 5b2a17b892 Include assert.h in necessary place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-08 13:06:08 -07:00
Xiang Xiao 2e54df0f35 Don't include assert.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Xiang Xiao d7f96003cf Don't include debug.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-01 06:42:02 +09:00
Alin Jerpelea 75797039fb fs: update licenses to Apache
Gregory Nutt is the copyright holder for those files and he has submitted the
SGA as a result we can migrate the licenses to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-05-27 08:07:25 +09:00