Commit Graph

2131 Commits

Author SHA1 Message Date
cuiziwei
17a06ce2cd fs/mmap: Fix build warning with [-Wmaybe-uninitialized].
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-08-19 16:40:58 +08:00
cuiziwei
71d10bd8cf nuttx/fs:Rename node with inode.
Signed-off-by: cuiziwei <cuiziwei@xiaomi.com>
2024-08-19 13:35:56 +08:00
chenrun1
d65f8bd4c1 filelock:Move filelock call to ioctl
Forward the implementation originally placed in fcntl to ioctl. in order
to achieve cross-core.

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 19:56:49 +08:00
chenrun1
a1e3444df0 rpmsgfs:Support cross-core access using file locks on the same file
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 19:56:49 +08:00
chenrun1
f7adb52c8b hostfs_ioctl:Fixed the error:expected expression caused by not adding parentheses in switch
hostfs/hostfs.c:612:17: error: expected expression
    FAR char *path = (FAR char *)(uintptr_t)arg;

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:17:48 +08:00
chenrun1
def05ebabb hostfs:ioctl should return -ENOTTY when the instruction is incompatible
When sending FIOC_XXXLK to hostfs, hostfs will return -1 by default. For ioctl statements, incompatible instructions should be processed as -ENOTTY by default

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:17:48 +08:00
chenrun1
6e9a43c504 hostfs:add get_path
To perform kvdb related type testing in the simulator, ioctl support is required to obtain relpath

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:17:48 +08:00
chenrun1
e9ac1a2317 rpmsgfs_client:Fix error return exception
When handling errors through ioctl, the error returned by the server is always 0 on the client, because cookie.result is not assigned, the error returned should be in msg->result

Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
2024-08-18 10:15:18 +08:00
Saurav Pal
daa3168cfb fs/mnemofs: Fix journal log rw issue, read size issue
Fixes the journal log read and write size and overlap issues, along with read return value issue.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-08-17 09:10:04 -03:00
Xiang Xiao
7c1768c167 fs/epoll: Double array size when it is full
correct the sequnce of array size from:
size, size, 2*size, 4*size, 8*size...
to:
size, 2*size, 4*size, 8*size, 16*size...

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-17 00:19:15 +02:00
Xiang Xiao
56b2e7254a fs/poll: Compute tick from millisecond by MSEC2TICK
reduce duplicate code

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2024-08-17 00:19:15 +02:00
xuxin19
7502c9c334 cmake:bugfix add sched include search path for fs
Signed-off-by: xuxin19 <xuxin19@xiaomi.com>
2024-08-14 20:58:59 +08:00
Saurav Pal
0be6dfb552 fs/mnemofs: Refactor path logic, direntry size bug fix, open free bug fix
Refactoring path logic to prevent logic flaws, direntry size bug fix to allow proper direntry traversal, open free bug fix to prevent memory leak after close.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-08-09 09:00:17 +02:00
Shoukui Zhang
a3b94383ed tmpfs: write end of file if open flag with O_APPEND
Signed-off-by: Shoukui Zhang <zhangshoukui@xiaomi.com>
2024-08-08 17:19:42 +08:00
Yanfeng Liu
160ca004ac procfs/meminfo: free delaylist for PROTECTED
This triggers `mm_free_delaylist()` before dumping status in PROTECTED
build, otherwise the `free` command still shows delaylist as `used`.

Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
2024-08-03 01:30:04 +08:00
Tiago Medicci
fe45d8aace fs/spiffs: Return OK on spiffs_[f]stat success
According to the POSIX standard, `fstat` and `stat` should return 0
(`OK`) on success. This commit changed the underlying `spiffs`
implementation to follow the POSIX standard.
2024-08-01 01:27:25 +08:00
Saurav Pal
786701c752 fs/mnemofs: Add master node and r/w methods
Adds master node and r/w methods to mnemofs

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-07-16 09:06:51 +08:00
hujun5
a4fece3450 spin_lock: inline spin_lock
test:
We can use qemu for testing.
compiling
make distclean -j20; ./tools/configure.sh -l qemu-armv8a:nsh_smp ;make -j20
running
qemu-system-aarch64 -cpu cortex-a53 -smp 4 -nographic -machine virt,virtualization=on,gic-version=3 -net none -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -kernel ./nuttx
2024-07-15 02:29:30 +08:00
Saurav Pal
c86ef1cbc4 fs/mnemofs: Add journal methods.
Journal methods for mnemofs.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-07-13 14:58:49 -03:00
Saurav Pal
9ef9788b6f fs/mnemofs: Add LRU and CTZ methods
LRU methods and CTZ methods to mnemofs

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-07-13 07:28:04 -03:00
Saurav Pal
2bc97c0f0e fs/mnemofs: Add parent iterator and path methods.
Pitr methods and path methods.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-07-12 10:30:41 -03:00
Saurav Pal
6f0daf08eb fs/mnemofs: Adds Block Allocator
Adds Block Allocator logic to mnemofs.

Signed-off-by: Saurav Pal <resyfer.dev@gmail.com>
2024-07-10 18:40:47 -03:00
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