Commit Graph

2109 Commits

Author SHA1 Message Date
Saurav Pal 23b7dc0651 fs/mnemofs: Setup and VFS methods
The Setup and VFS methods for mnemofs, a NAND Flash File System.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-07-10 09:25:23 -03:00
Windrow14 479c393291 fs/fat/fs_fat32.[c|h]: fix fseek bug when file size is multiple of cluster size
Unbinding `ff_currentcluster` and `f_pos`:
1. Added `ff_pos` in `struct fat_file_s`.
2. Added function `fat_zero_cluster` for doing zeroing for gap
   between EOF and new position beyond EOF.
3. Added function `fat_get_sectors` for getting the sector where
   `f_pos` is located, allocting new cluster when `f_pos` is beyond
   EOF.
4. Modify function `fat_read`, and `fat_write` with above functions.
5. Remove redundant logics in `fat_seek` since now new cluster is
   allocated when writing instead of seeking.

Signed-off-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Jacky Cao <Jacky.Cao@sony.com>
Tested-by: Yinzhe Wu <Yinzhe.Wu@sony.com>
2024-07-06 19:00:01 +08:00
chao an f857004227 fs/procfs: refine file backtrace
remove backtrace arrary in stack

Signed-off-by: chao an <anchao@lixiang.com>
2024-06-30 17:30:42 +08:00
yinshengkai 5a31d52fd8 files: add files_dumplist api, replace dumponexit implementation
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-06-30 17:30:42 +08:00
Xu Xingliang b0698daaa4 fs: tweak backtrace for file open
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-30 17:30:42 +08:00
fangpeina 242b50f921 libc/execinfo: extract a common backtrace format function
Add a common method to format backtrace to buffer, so it can be used by both mm, fs and other possoble modules.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
2024-06-29 22:44:39 +08:00
Xu Xingliang 69d8a17dda fs: add backtrace to where file opens
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-24 23:53:59 +08:00
Stuart Ianna 3b4626acc8 fs/fat/fs_fat32.c Return EOF when reading past the end of the file.
When fseek is used to set the file pointer past the end of the file,
fread should return EOF. See #12496.
2024-06-24 22:14:07 +08:00
Xu Xingliang 85a7b94a2e driver: add note when driver registers
Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
2024-06-21 22:43:06 +08:00
Yanfeng Liu ce0c98f0fd fs/lock: prefer nxsched_self for modularity
Use of nxsched_self() is preferred from outside of the sched/ folder.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-06-09 20:22:02 +08:00
chao an e456c88c09 Revert "sched: replace some global variables to macro"
sched implementation not depends on macro abstraction, so revert below commit:

This reverts commit 4e62d0005a
This reverts commit 0f0c370520
This reverts commit ad0efd04ee

Signed-off-by: chao an <anchao@lixiang.com>
2024-06-06 22:00:25 +08:00
zhanghongyu ee4c25f34e sem_open: return error code, sem returned by parameter
pointer comparison is unsigned, when returning -errno will be converted
to a large positive number, can not enter the error handling branch,
therefore, the error code is returned directly and the sem is returned
through the parameters.

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2024-06-06 02:40:50 +08:00
Yanfeng Liu 49fbc262d0 procfs/meminfo: fit line width in 80 chars
This makes `free` output line width to fit in most terminals.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-04-24 16:33:32 +08:00
chenrun1 1c573da506 tmpfs:Add ioctl access path function
In tmpfs, we can get the file path corresponding to fd through ioctl

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-04-24 09:46:16 +08:00
Jorge Guzman 5e3cbd1165 stm32h7/linum-stm32h753bi: Add support to littlefs and nxffs with flash mem. via quadspi
Signed-off-by: Jorge Guzman <jorge.gzm@gmail.com>
2024-04-15 13:24:55 +08:00
Yanfeng Liu a5b5c963c7 fs/mmap: enable parameter checks always
These parameter checks should always be enabled.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-25 20:39:24 +08:00
chao an 0f0c370520 fs/inode: replace some global variables to macro
replace to macro will help to extend the scheduling implementation

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-21 18:53:14 +08:00
dongjiuzhu1 e0c18c05e8 fs/driver: using nx_unlink to call unlink ops to release some resource
if driver complete unlink ops, we need to call it to release some resource,
otherwise, it will only remove inode.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2024-03-14 11:53:30 +08:00
Yanfeng Liu 5bf6ea0c20 fs/mount: harden nx_mount logic
This adds variables initialization and empty device path checks to
harden logic of nx_mount.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-03-12 19:44:48 +08:00
chao an ec08031e4b sched/group: change type of task group member to single queue
Change the type of task group member to single list chain to
avoid accessing the memory allocator to improve the performance

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-07 12:39:29 +08:00
chao an d29748258b fs/inode: add pre-allocated task files to avoid allocator access
Pre-allocated files to avoid allocator access during thread creation
phase, For functional safety requirements, increase
CONFIG_NFILE_DESCRIPTORS_PER_BLOCK could also avoid allocator access
caused by the file descriptor exceeding the limit.

For Task Termination, the time consumption will be reduced ~3us (Tricore TC397 300MHZ):
10.65(us) -> 7.35(us)

NOTE:
This commit will not waste of extra heap, just pre-allocates the list of files for task_group.

Signed-off-by: chao an <anchao@lixiang.com>
2024-03-07 10:58:55 +08:00
hujun5 236ec9844f fs: dup3 should pass the fdcheck & fdsan
Signed-off-by: hujun5 <hujun5@xiaomi.com>
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
ligd 9f51c47c10 fs: remove un-useful memcpy() in nx_close_from_tcb()
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
ligd e1cd082c29 fs: enhance dup3() mulit-threads saftey
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
ligd 60b25556d4 fs: enhance file_allocate_from_tcb() mulit-threads saftey
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-07 09:08:48 +08:00
hujun5 577eb47966 fdcheck: Enable fdcheck to automatically detect ownership of fd
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2024-03-07 09:08:48 +08:00
Tiago Medicci Serrano 658dd94863 procfs: Change variable name to ease debugging 2024-03-05 09:45:49 +08:00
ligd fd2da7f4bc cpuload: change cpuload type to clock_t
Signed-off-by: ligd <liguiding1@xiaomi.com>
2024-03-03 02:15:40 +08:00
chao an 6d50274ebe nuttx/list: rename container_of to list_container_of from public header
Use private naming to avoid conflicts with user applications

In file included from libuv/src/unix/internal.h:25,
                 from libuv/src/unix/udp.c:23:
libuv/src/uv-common.h:57: warning: "container_of" redefined
   57 | #define container_of(ptr, type, member) \
      |
In file included from nuttx/include/nuttx/list.h:47,
                 from nuttx/include/nuttx/tls.h:40,
                 from nuttx/include/nuttx/sched.h:48,
                 from nuttx/include/nuttx/arch.h:87,
                 from nuttx/include/nuttx/userspace.h:35,
                 from nuttx/include/nuttx/mm/mm.h:30,
                 from nuttx/include/nuttx/kmalloc.h:34,
                 from nuttx/include/nuttx/lib/lib.h:31,
                 from nuttx/include/stdio.h:35,
                 from apps/system/libuv/libuv/include/uv.h:59,
                 from libuv/src/unix/udp.c:22:
nuttx/include/nuttx/nuttx.h:48: note: this is the location of the previous definition
   48 | #define container_of(ptr, type, member) \
      |

Signed-off-by: chao an <anchao@lixiang.com>
2024-02-29 19:44:54 +08:00
Yanfeng Liu 5b1486f9ce fs/procfs: add build config to /proc/version
Currently at runtime it is hard to know the exact build config of
the current NuttX instance. Thus it is inconvenient when there are
multiple configs for the same board. This patch attempts to solve
the issue by adding build config to /proc/version.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-26 21:46:28 +08:00
Masayuki Ishikawa e67d32a5ba Revert "fix variable set but not used"
This reverts commit d2d93ba58c.
2024-02-21 21:29:48 -08:00
chenrun1 ae730ac246 fs_lock:Avoid deadlock caused by KILL SIGNAL
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
chenrun1 6e3e03f6b0 fs/vfs:cmakelists add fs_lock config
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
Zhe Weng 14602be4cc fs/lock: Limit inode type for file locks
When we close a socket fd, it will call get path on sockets.
`close(socket_fd)` -> `file_closelk(filep)` -> `file_fcntl(F_GETPATH)`
It causes a heavy stack load for each socket close operation.
(We have `GETPATH` for sockets to be used for `fdinfo`)

But the socket fds are not intended to be used for file locks.
And so do some other file types, so we may just limit the usage of flock.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
2024-02-21 13:29:36 -03:00
chenrun1 8cdec83adb fs_locks:Fix getlk's l pid return
When there is no conflicting lock, getlk should not tamper with the l_pid content from the upper layer

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
chenrun1 5c6bd833ed fs_lock:Implementing file locks
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 13:29:36 -03:00
yinshengkai d2d93ba58c fix variable set but not used
These variables will trigger variable 'ret' set but not used warnings due to different configurations.

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2024-02-21 13:28:20 -03:00
chenrun1 7b37dd1224 littlefs/Make.defs:Add get path temp patch
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-02-21 06:15:39 -08:00
zhouliang3 161ae0ef5c fs/littlefs: Add to get the full path
Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
2024-02-21 06:15:39 -08:00
Saurav Pal 93d03d0418 fs: Add VFS docs
This commit adds VFS docmentation, and details about the VFS interface.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-02-20 18:28:09 -08:00
Takeyoshi Kikuchi 716a95934d fs: fat: fs_fat32: fix default return value of fat_ioctl().
When issuing an ioctl for a file that exists in a FAT32 file system,
the FAT ioctl() is first executed, but it returns -ENOSYS in
an attempt to pass through to the vfs.

Therefore, the ioctl of the VFS layer, which expects -ENOTTY,
is not processed and an error occurs.

Signed-off-by: Takeyoshi Kikuchi <kikuchi@centurysys.co.jp>
2024-02-20 04:08:26 -08:00
Bowen Wang 169f47beec rpmsg: make all the rpmsg services deponds on RPMSG
After decoupled the rpmsg and rptun, all the rpmsg service should
depends on the RPMSG.

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
2024-02-18 04:09:34 -08:00
Yanfeng Liu ec7c876f13 fs/mount: add FS_RPMSGFS as cause of NODFS_SUPPORT
It seems that RPMSGFS is missed from the list that doesn't need block or
MTD drivers. This attempts to add it.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-02-10 17:07:05 +08:00
Saurav Pal 36ea2929f0 docs/fs/vfat: Improve VFAT documentation
Improved documentation of File Allocation Table (FAT) or VFAT.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-02-05 03:43:41 -08:00
Saurav Pal d79e5a4932 fs/vfat: Fix typo in the macro DIRSEC_BYTENDX
The DIRSEC_BYTENDX(f, i) is supposed to have DIRSEC_NDXMASK(f) in its expansion instead of DIRSEC_NDXMASK(fs). It went unnoticed in the codebase as DIRSEC_BYTENDX(fs, idx) is the way it is used, and it leads to a similar expansion as desired, and thus it has worked till now without any issues from this.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-02-03 12:46:08 -03:00
Ville Juven f0846e1d2d fs/shmfs: Fix stat() system call for shmfs object
Set i_size for shmfs objects
2024-02-02 09:12:18 -08:00
Ville Juven 07ce2f717a shmfs/shmfs_alloc. Fix POSIX violation for shmfs_truncate
When shmfs_truncate is called, it uses shmfs_alloc_object to create the
physical backing for the shm file. However, the allocated physical
memory returned by mm_pgalloc is not cleared when CONFIG_BUILD_KERNEL is
set, which is a clear POSIX violation:

https://pubs.opengroup.org/onlinepubs/9699919799/functions/truncate.html

"If the file was previously shorter than length, its size is increased,
and the extended area appears as if it were zero-filled."

For FLAT and PROTECTED modes zalloc is used, so the violation affects
KERNEL mode only.
2024-02-02 09:09:55 -08:00
Ville Juven 43a26220be fs/shmfs: Fix CONFIG_FS_SHM -> CONFIG_FS_SHMFS
The macro was wrong
2024-01-31 08:51:52 -08:00
chao an 5424ace1cf compiler/tasking: fix compiler warning on tasking
ctc W549: ["serial/serial.c" 877/37] condition is always true
ctc W549: ["inode/fs_inodesearch.c" 72/8] condition is always true
ctc W545: ["obstack/lib_obstack_malloc.c" 69/1] missing 'return'
ctc W545: ["obstack/lib_obstack_malloc.c" 82/1] missing 'return'

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-31 05:02:56 -08:00
chao an 8ff97f6210 compiler/tasking: fix unreachable code on tasking toolchain
ctc W544: ["serial/serial.c" 284/3] unreachable code
ctc W544: ["vfs/fs_lseek.c" 96/13] unreachable code
ctc W544: ["wqueue/kwork_thread.c" 210/32] unreachable code
ctc W544: ["stdio/lib_fopen.c" 327/19] unreachable code
ctc W544: ["stdio/lib_fopen.c" 404/13] unreachable code
ctc W544: ["string/lib_strcasestr.c" 120/3] unreachable code
ctc W544: ["unistd/lib_getopt_common.c" 156/21] unreachable code
ctc W544: ["unistd/lib_getopt_common.c" 216/21] unreachable code
ctc W544: ["wctype/lib_iswctype.c" 155/3] unreachable code

Signed-off-by: chao an <anchao@lixiang.com>
2024-01-30 20:53:00 -08:00