Xuxingliang
9166eeddf6
fs/mmap: update mapped var before exit
...
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-01-17 11:12:26 +08:00
Xuxingliang
dce315005a
fs/mmap: rammap should return buffer start address
...
Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
2023-01-17 11:12:26 +08:00
crafcat7
047f7f8d3a
vfs/fs_truncate.c:Add socket judgment to return correct errno.
2023-01-17 10:29:41 +08:00
Jukka Laitinen
6db295481b
fs/mmap/fs_rammap.c: Remove void * arithmetic
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 23:08:58 +08:00
Jukka Laitinen
3577d2f055
fs/mmap/fs_anonmap.c: Remove void * arithmetic
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-13 23:08:58 +08:00
Petro Karashchenko
6c5cb98e7d
fs/mount: fix logging macro in FS automount
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-13 12:18:36 +08:00
Xiang Xiao
fd0195b0d8
fs/mmap: Suppor the partial unmap for anonymous mapping
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-12 19:11:56 +02:00
Xiang Xiao
fcd4a421e3
fs/mmap: Support the no backing file for anonymous mapping
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-12 19:11:56 +02:00
Xiang Xiao
ab67d6a75b
fs/mmap: Remove the duplication rammap handling
...
and minor ifx for style and format
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-12 19:11:56 +02:00
Ville Juven
416e83d57e
fs/poll: add missing FAR qualifier to poll()
...
Follow-up to #8072
2023-01-11 21:12:17 +08:00
Ville Juven
f730cf8ad8
fs/poll: Fix poll_notify for CONFIG_BUILD_KERNEL
...
With flat addressing the user pollfd list is given directly to the
drivers that perform the notification. This is fine when the addressing
is flat, as there is no ambiguity on who gets notified and the fds memory
is always mapped.
For kernel mode with MMU this does not work. The notification must be done
via a temporary buffer allocated from kernel memory.
Thus, create a copy of the user fds and pass the copy to the drivers.
Afterwards copy the output events back to the user.
2023-01-11 01:53:13 +08:00
Jukka Laitinen
b8f23fc3f7
Move rammaps to use mm_map list
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
Jukka Laitinen
a5ed8014e8
Move anonymous mapping emulation into own module under fs/mmap
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
Jukka Laitinen
dd97900221
fs/mmap: Add mappings to mm_map list if CONFIG_MM_MAP is defined
...
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-10 18:34:25 +08:00
wangbowen6
a491d07061
sem_unlink: return ENOENT when the named semaphore does not exist.
...
Follow posix, return ENOENT when the named semaphore does not
exist to fix the ltp open posix sem_unlink 4-1.c test problem.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-01-09 22:46:30 +08:00
Xiang Xiao
9aa835815f
fs/timerfd: Reverse truncate and mmap field
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-07 14:27:42 +02:00
qinwei1
c137aeec32
fs/vfs: add missed truncate/mmap callback at timerfd file_operation
...
Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2023-01-06 13:31:38 +08:00
Xiang Xiao
1a59f4ed00
mm/map: Remove the unnessary map.h inclusion in various drivers
...
and Fix include/nuttx/mm/map.h:55:28: error: 'struct task_group_s' declared inside parameter list will not be visible outside of this definition or declaration
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-05 16:06:53 +02:00
Xiang Xiao
7179d57026
fs: Check offset and length more carefully in mmap callback
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 17:43:59 +02: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
Xiang Xiao
779a610ca3
Remove the unnecessary NULL fields in global instance definition of file_operations
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-04 00:32:13 +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
Jukka Laitinen
36528eed64
Revert "fs/vfs/fs_truncate.c: Use ioctl to truncate on non-mountpoint inode"
...
This reverts commit dbc163f1b0
.
2023-01-02 11:23:20 -03:00
dongjiuzhu1
f85d9a9332
fs/signalfd: using file descriptor to accept signal
...
Reference here:
https://man7.org/linux/man-pages/man2/signalfd.2.html
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-28 23:05:58 +08:00
dongjiuzhu1
d36b7fea45
timerfd: remove timeout work and do notify in isr
...
1.Optimize notification speed
2.using enter/leave critical to replace spin_lock to avoid race condition
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-28 22:45:25 +08:00
dongjiuzhu1
c7eca3d176
timerfd/eventfd: using file_allocate to replace register_driver
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-28 22:45:25 +08:00
Xiang Xiao
72e76600c3
fs/procfs: Avoid the cast in uptime_read
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-24 11:26:48 -03:00
Ville Juven
2ed51d026c
fs/streams: Move the file streams from the group structure into TLS
...
This is preparation for flushing streams from user space, like it should
be done.
- Move tg_streamlist (group, kernel space) ->
ta_streamlist (TLS, user space)
- Access stream list via tg_info in kernel
- Access stream list via TLS in user space
- Remove / rename nxsched_get_streams -> lib_getstreams
- Remove system call for nxsched_get_streams
2022-12-22 20:16:11 +08:00
Xiang Xiao
fd0d6a9bf5
compiler.h: Add _ between format|printf|syslog|scanf|strftime and like
...
align with other macro naming style
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-12-21 01:05:19 +02:00
anjiahao
70791af8e2
procmeminfo:support memdump can show specific task
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-12-19 20:43:33 +08:00
zhangyuan21
3462061624
task: show thread main entry when display thread name
...
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2022-12-17 14:53:59 +08:00
qinwei1
a4f06660d2
fs_epoll: fix some potential issue for list operation
...
VELAPLATFO-4690
Summary
1. delete item before free it
Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
Change-Id: Ie101a0cdba97caa8c3bbf0830dc0a35750688a41
2022-12-13 21:00:11 +02:00
chao an
b5507ea9a2
compile/attribute: minor fix for packed struct mismatch
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-12-06 03:50:20 +08:00
crafcat7
8b95b7ca5b
littlefs: Get and return the current error status before RMDIR execution type
...
In some cases, deleting a folder will return unexpected results. For example, ENOENT should be returned when deleting a non-existent folder, but the result will return ENOTDIR.
2022-12-03 02:44:49 +08:00
YAMAMOTO Takashi
8ee2ed0b91
littlefs: add a few Kconfig options
2022-12-01 23:34:31 +08:00
dongjiuzhu1
b1b2a7cc0b
timerfd_create: initial reference count to zero
...
nx_open in timerfd_create will increase reference count,
Therefore, the reference count starts with a value of 0.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-12-01 15:07:09 +08:00
Gao Feng
08f5a5a3be
meminfo: buflen identify the left of buffer
...
It is enought to only checking the buflen's avaiable or not.
(total size means total copied size)
Co-authored-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-11-29 01:29:55 +08:00
ligd
11fa70d53a
romfs: change lock to recursion lock
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-11-28 18:04:38 +08:00
wangbowen6
a0ded9d0d4
fs_epoll: [bug fix] epoll node use-after-free in epoll extend list
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-26 11:56:58 +08:00
wangbowen6
2f2176151e
fs_epoll: [bug fix] EPOLL_CTL_ADD/MOD consider the teardown list too
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-25 21:34:09 +08:00
wangbowen6
25bfd437fe
fs_epoll: support extend the epoll dynamicly.
...
1. epoll_ctl(EPOLL_CTL_ADD) support extend the epoll
events dynamicly;
2. enhance the epoll performance by moving some poll setup
and teardown process to the EPOLL_CTL_ADD/DEL/MOD;
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-11-22 21:08:56 +08:00
chao an
3727de1a93
fs/userfs: destroy nxmutex properly
...
Signed-off-by: chao an <anchao@xiaomi.com>
2022-11-21 01:15:48 +08:00
qinwei1
8021dfece6
sched/task/task_getpid: getpid should return process id not thread id
...
Summary:
implement the right semantics:
1. getpid should return the main thread id
2. gettid should return the current thread id
Refer to:
https://github.com/apache/incubator-nuttx/issues/2499
https://github.com/apache/incubator-nuttx/pull/2518
Signed-off-by: qinwei1 <qinwei1@xiaomi.com>
2022-11-17 17:58:08 +08:00
zhangyuan21
f27065cb9e
sched/mqueue: make mqueue and mqueue sysv can disable separately
2022-11-16 20:03:40 +08:00
dongjiuzhu1
0740ebb21b
fs/unionfs: fix memory leak about directory operation
...
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-11-14 14:31:02 +08:00
Marco Casaroli
36c511f710
fs/littlefs: set LFS_NAME_MAX
to CONFIG_NAME_MAX
2022-11-13 09:12:54 +08:00
Xiang Xiao
6f33dd6ea0
mm/heap: Change TCB_FLAG_HEAPCHECK to TCB_FLAG_HEAP_CHECK
...
align with other flags naming convention
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-12 09:39:01 +01:00
Xiang Xiao
b72be1ddbf
epoll: Call poll_notify before unlock mutex
...
to avoid the race condition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-11 21:12:59 +01:00
Xiang Xiao
7e8e5c10d1
fs/epoll: Reuse fd returned from epoll for internal signaling
...
to avoid the usage of nuttx special extension(POLLFILE)
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-11 21:12:59 +01:00
Xiang Xiao
faf16fb810
vfs/epoll: Protect epoll_ctl by mutex
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 22:06:46 +01:00
Xiang Xiao
7231a5f044
vfs/epoll: Replace sem_t with mutex_t for locking usage
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 22:06:46 +01:00
Xiang Xiao
38d1244751
mm/mempool: Remove MM_MEMPOOL option from Kconfig
...
since the linker can remove the unused object file from the final image
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-11-08 10:18:27 -03:00
anjiahao
be670c40d6
fix a mistake about nxmutex & sem
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-11-03 23:42:55 +08:00
yinshengkai
85f727f232
tools: replace INCDIR to Makefile variable
...
In the past, header file paths were generated by the incdir command
Now they are generated by concatenating environment variables
In this way, when executing makefile, no shell command will be executed,
it will improve the speed of executing makfile
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2022-11-03 19:59:55 +08: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
3f12b4f1e3
sched: Remove the unnecessary (FAR sem_t *) cast
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-29 21:12:40 +02:00
zhanghongyu
f00c11aec4
socket: separation error code EBADF and ENOTSOCK
...
Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
2022-10-29 08:18:02 +02:00
Xiang Xiao
488a56280a
fs: Correct the comment of file_allocate
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao
604eea453b
fs/vfs: Let caller control whether add the reference count of inode in file_allocate
...
to simplify the caller in some special case
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao
4d4bb458da
fs/vfs: Move file_allocate from fs/inode/inode.h to include/nuttx/fs/fs.h
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao
4af98af376
fs/vfs: Rename files_allocate to file_allocate
...
align with the intention better
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-28 10:12:08 +02:00
Xiang Xiao
fc1efe2c0b
fs: Remove the unused nx_fcntl to prefer file_fcntl for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao
b22cc1e2b8
fs: Remove the unused nx_dup to prefer file_dup for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao
cf21319d3a
fs: Remove the unused nx_poll to prefer file_poll for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Xiang Xiao
aa31648c9f
fs: Remove the unused nx_[v]ioctl to prefer file_[v]ioctl for kernel
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-27 23:14:25 +02:00
Jiuzhu Dong
d6423b5527
romfs: expand file cache by CONFIG_FS_ROMFS_FCACHE_NSECTORS
...
The default size of file cache is size of a sector, it may
not be good size for optimizing read/write speed in physical
device. So we can set the config according to speed test profile
to optimize access IO speed.
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2022-10-24 20:49:09 +08:00
Xiang Xiao
ab12bea1ae
Fix vfs/fs_timerfd.c:73:17: error: duplicate member 'lock'
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-23 12:08:30 +08:00
Miguel Herranz
819ebe7356
libc/stdio: Add stdio file locking functions
...
Add flockfile(), ftrylockfile() and funlockfile() functions [1].
[1] POSIX.1-2008 / System Interfaces / flockfile
https://pubs.opengroup.org/onlinepubs/9699919799.2008edition/functions/flockfile.html
Signed-off-by: Miguel Herranz <miguel@midokura.com>
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-22 23:34:45 +08:00
anjiahao
e1ca516488
use SEM_INITIALIZER inside of NXSEM_INITIALIZER
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
anjiahao
5724c6b2e4
sem:remove sem default protocl
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-10-22 14:50:48 +08:00
chao an
205c8934a3
sched/msgq: add support of System V message queue
...
https://man.openbsd.org/msgget.2
Signed-off-by: chao an <anchao@xiaomi.com>
2022-10-22 12:58:11 +08:00
zhangyuan21
16b6d365e9
fs/procfs: check task status before get group info
...
When ps cmd is invoked during the task exit process, the group information of the task may be deleted.
So need check the task flag before get the task group information.
2022-10-21 18:47:58 +08:00
YAMAMOTO Takashi
4eee9af668
file_vopen: Retry as a directory in case of EISDIR
...
This allows you to open() a directory without O_DIRECTORY.
2022-10-19 21:20:35 +08:00
YAMAMOTO Takashi
aa67e0a0f4
inode_stat: handle INODE_IS_PSEUDODIR case
...
If you open() a directory and fstat() it, you come here.
This commit fixes the file type in that case.
2022-10-19 21:20:35 +08:00
Xiang Xiao
6b31918b42
Remove the unnecessary cast for main_t, NULL and argv
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 08:51:45 +02:00
Xiang Xiao
b9a4bedc7f
fs/procfs: Change FS_PROCFS_EXCLUDE_xxx default value to DEFAULT_SMALL
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09:00
Xiang Xiao
36c05601df
fs/procfs: Fix warning when all CONFIG_FS_PROCFS_EXCLUDE_xxx are enabled
...
procfs/fs_procfs.c: In function 'procfs_readdir':
Error: procfs/fs_procfs.c:719:9: error: unused variable 'pid' [-Werror=unused-variable]
719 | pid_t pid;
| ^~~
Error: procfs/fs_procfs.c:716:21: error: unused variable 'tcb' [-Werror=unused-variable]
716 | FAR struct tcb_s *tcb;
| ^~~
procfs/fs_procfs.c: At top level:
Error: procfs/fs_procfs.c:206:16: error: 'procfs_enum' declared 'static' but never defined [-Werror=unused-function]
206 | static void procfs_enum(FAR struct tcb_s *tcb, FAR void *arg);
| ^~~~~~~~~~~
procfs/fs_procfs.c: In function 'procfs_readdir':
Error: procfs/fs_procfs.c:878:35: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
878 | if (strncmp(g_procfs_entries[level1->base.index].pathpattern,
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
procfs/fs_procfs.c:98:36: note: while referencing 'g_procfs_entries'
98 | static const struct procfs_entry_s g_procfs_entries[] =
| ^~~~~~~~~~~~~~~~
Error: procfs/fs_procfs.c:879:35: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
879 | g_procfs_entries[level1->firstindex].pathpattern,
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
procfs/fs_procfs.c:98:36: note: while referencing 'g_procfs_entries'
98 | static const struct procfs_entry_s g_procfs_entries[] =
| ^~~~~~~~~~~~~~~~
Error: procfs/fs_procfs.c:745:24: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
745 | pentry = &g_procfs_entries[index - priv->nentries];
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
procfs/fs_procfs.c:98:36: note: while referencing 'g_procfs_entries'
98 | static const struct procfs_entry_s g_procfs_entries[] =
| ^~~~~~~~~~~~~~~~
Error: procfs/fs_procfs.c:745:41: error: array subscript <unknown> is outside array bounds of 'const struct procfs_entry_s[0]' [-Werror=array-bounds]
745 | pentry = &g_procfs_entries[index - priv->nentries];
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09:00
Xiang Xiao
befc748460
fs/procfs: Simplify the code logic and fix the style issue
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-18 15:10:26 +09: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
47b47e0bb7
fs/vfs: Remove the redundancy file name comparison in mountptrename
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:27:08 -03:00
Xiang Xiao
7b19a605a7
fs/vfs: Free subdir before allocate new one in pseudorename
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-16 15:27:08 -03:00
Petro Karashchenko
969a06331f
fs/vfs: fix case when file to rename does not exist
...
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-10-15 04:04:12 +08:00
Fotis Panagiotopoulos
a0918d6d5e
Fixed NULL pointer use in tmpfs.
2022-10-14 21:29:37 +08:00
Xiang Xiao
523da07778
fs/epoll: Notify POLLIN directly(avoid set POLLFILE)
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-04 20:59:59 +02:00
Xiang Xiao
e99c76a313
poll: Don't need monitor POLLERR or POLLHUP explicitly
...
since spec require the implementation always report POLLERR/POLLHUP:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/poll.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-10-04 20:59:59 +02:00
wangbowen6
e9ccab2db3
fs/poll: using callback mechanism to implement poll notification
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-10-03 00:00:56 +08: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
Jukka Laitinen
dd2ffbc768
Fixes for GPT partition parsing
...
1. Don't handle invalid or empty pte entries
num_partition_entries field in GPT typically means number of maximum entries
and not the number of used entries. Empty entries are indentified with
"0" partition type guid. Loop through all the entries
2. Fix the GPT partition size calculation
"ending_lba" is included in the partition, it is not the start of the next one.
Thus the correct size of the partition is end-start+1
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-09-27 09:42:39 +08:00
wangbowen6
5e46a9908a
vfs/fs_poll: not clear POLLIN event if POLLHUP or POLLERR set
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-27 08:24:33 +09:00
Xiang Xiao
40ef5bc6db
libc: Move queue.h from include to include/nuttx
...
to avoid the conflict with libuv's queue.h
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-26 08:04:58 +02:00
wangbowen6
344c8be049
poll: add poll_notify() api and call it in all drivers
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-26 12:06:32 +08:00
Xiang Xiao
db518bf0df
fs: Allocate unique serial number for the root pseduo file system node
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 16:21:06 +08:00
Xiang Xiao
493152a45f
fs/eventfd: Remove the extra space
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-20 16:20:17 +09:00
Xiang Xiao
8a265e274d
Kconfig: Remove EXPERIMENTAL for features which is been around a long time
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-19 11:39:22 -03:00
wangbowen6
25c2f3e042
driver: move find_mtddriver() to fs.h and add close_mtddriver.c
...
Rpmsg mtd need a way to find the mtd device according to the
mtd device path.
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-09 19:27:57 +08:00
Nathan Hartman
09a186727c
fs/vfs/fs_open.c: Improve documentation blocks of functions
2022-09-08 09:01:36 +08:00
Xiang Xiao
9726be616a
fs: Run the default action of FIONBIO/FIOCLEX/FIONCLEX in success path
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-09-06 23:16:15 +08:00
curuvar
89d3ba44ca
Fixes to RP2040 SMART flash and documentation
2022-09-06 13:13:00 +08:00
curuvar
9ad75fd95d
Added SMART flash filesystem to RP2040
2022-09-05 10:38:56 -03:00
Masayuki Ishikawa
27985fa639
fs: procfs: Skip to register for meminfo if the name is NULL
...
Summary:
- This commit skips to register for meminfo if the name is NULL
Impact:
- None
Testing:
- Tested with sabre-6quad:netknsh (umm_heap will be updated later)
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2022-09-01 23:25:53 +02:00
chao an
42388f16e9
fs/dup2: fix potential deadlock on usrsock
...
apps/examples/usrsocktest/usrsocktest_basic_daemon.c:
321 static void basic_daemon_dup2(FAR struct usrsocktest_daemon_conf_s *dconf)
322 {
...
335 ret = dup2(sd2, sd);
352 }
Usrsocktest Task hold the file group lock and send the close request to usrsock deamon :
| #0 net_lockedwait_uninterruptible (sem=0x5555555f8ba2 <g_usrsockdev+34>) at utils/net_lock.c:427
| #1 0x000055555557489c in usrsockdev_do_request (conn=0x5555555f8800 <g_usrsock_connections>, iov=0x7ffff3f36040, iovcnt=1) at usrsock/usrsock_dev.c:1185
| --> send close request to usrsock deamon
|
| #2 0x00005555555d0439 in do_close_request (conn=0x5555555f8800 <g_usrsock_connections>) at usrsock/usrsock_close.c:109
| #3 0x00005555555d04f5 in usrsock_close (conn=0x5555555f8800 <g_usrsock_connections>) at usrsock/usrsock_close.c:157
| #4 0x00005555555cf100 in usrsock_sockif_close (psock=0x7ffff3ea4a60) at usrsock/usrsock_sockif.c:234
| #5 0x00005555555c7b2f in psock_close (psock=0x7ffff3ea4a60) at socket/net_close.c:102
| #6 0x000055555557a518 in sock_file_close (filep=0x7ffff3f253d0) at socket/socket.c:115
| #7 0x000055555557678f in file_close (filep=0x7ffff3f253d0) at vfs/fs_close.c:74
| #8 0x000055555557694c in file_dup2 (filep1=0x7ffff3f253e8, filep2=0x7ffff3f253d0) at vfs/fs_dup2.c:129
| ---> hold group file list lock ( _files_semtake(list) )
|
| #9 0x0000555555575aab in nx_dup2 (fd1=7, fd2=6) at inode/fs_files.c:451
| #10 0x0000555555575af3 in dup2 (fd1=7, fd2=6) at inode/fs_files.c:473
| #11 0x000055555559d937 in basic_daemon_dup2 (dconf=0x5555555f8d80 <usrsocktest_daemon_config>) at usrsocktest_basic_daemon.c:335
| #12 0x000055555559ed80 in usrsocktest_test_basic_daemon_basic_daemon_dup2 () at usrsocktest_basic_daemon.c:612
| #13 0x000055555559f18d in usrsocktest_group_basic_daemon_run () at usrsocktest_basic_daemon.c:666
| #14 0x0000555555599f8d in run_tests (name=0x5555555dc8c3 "basic_daemon", test_fn=0x55555559ef50 <usrsocktest_group_basic_daemon_run>) at usrsocktest_main.c:117
| #15 0x000055555559a06c in run_all_tests () at usrsocktest_main.c:154
| #16 0x000055555559a3d1 in usrsocktest_main (argc=1, argv=0x7ffff3f25450) at usrsocktest_main.c:248
| #17 0x000055555555cad8 in nxtask_startup (entrypt=0x55555559a357 <usrsocktest_main>, argc=1, argv=0x7ffff3f25450) at sched/task_startup.c:70
| #18 0x0000555555559938 in nxtask_start () at task/task_start.c:134
Usrsock Deamon weakup and setup the poll want to perform close request, but locked on fs_getfilep():
| #0 _files_semtake (list=0x7ffff3f250b8) at inode/fs_files.c:51
| --> Request group lock but which hold by close request, deadlock
| #1 0x00005555555758b1 in fs_getfilep (fd=5, filep=0x7ffff3f47190) at inode/fs_files.c:375
| #2 0x00005555555d3064 in poll_fdsetup (fd=5, fds=0x7ffff3f47290, setup=true) at vfs/fs_poll.c:79
| #3 0x00005555555d3243 in poll_setup (fds=0x7ffff3f47290, nfds=2, sem=0x7ffff3f47206) at vfs/fs_poll.c:139
| #4 0x00005555555d39a6 in nx_poll (fds=0x7ffff3f47290, nfds=2, timeout=-1) at vfs/fs_poll.c:383
| #5 0x00005555555d3abd in poll (fds=0x7ffff3f47290, nfds=2, timeout=-1) at vfs/fs_poll.c:501
| --> daemon weak up
| #6 0x00005555555c62c7 in usrsocktest_daemon (param=0x5555555f5360 <g_ub_daemon>) at usrsocktest_daemon.c:1846
| #7 0x000055555559161e in pthread_startup (entry=0x5555555c60d3 <usrsocktest_daemon>, arg=0x5555555f5360 <g_ub_daemon>) at pthread/pthread_create.c:59
| #8 0x00005555555d45f0 in pthread_start () at pthread/pthread_create.c:175
| #9 0x0000000000000000 in ?? ()
Signed-off-by: chao an <anchao@xiaomi.com>
2022-09-01 12:59:46 +08:00
wangbowen6
301cd53f14
rpmsgfs/Make.defs: rpmsgfs_server.c given more than once
...
Makefile:81: target 'rpmsgfs_server.o' given more than once in the same rule
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-01 11:41:23 +08:00
Fotis Panagiotopoulos
484bdc54d3
Fixed warnings in various prints.
2022-08-30 22:53:01 +08:00
Huang Qi
e0185faa78
Don't download tarballs if a local git repo found
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-28 03:07:58 +08:00
yangxuan8282
9c0b71469c
fs/aio: fix typo ail
2022-08-26 20:58:45 +08:00
Huang Qi
e4e3208180
Replace all strncpy with strlcpy for safety
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-08-25 13:38:36 +08:00
Jiuzhu Dong
a7e7487053
fs/rpmsgfs: fix double free
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-17 01:57:26 +08:00
wangbowen6
0b95148e5a
rpmsgfs: fix ioctl operation can not work bug
...
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-08-17 01:57:15 +08:00
Xiang Xiao
ba9486de4a
iob: Remove iob_user_e enum and related code
...
since it is impossible to track producer and consumer
correctly if TCP/IP stack pass IOB directly to netdev
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-15 08:41:20 +03: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
Xiang Xiao
5f93ae9dd2
fs/rpmsg: Move the server initialization to fs_initialize
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-08-11 02:08:42 +03:00
Jiuzhu Dong
4dbf4555eb
fs/dir: support fchdir and dirfd
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08: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
Jiuzhu Dong
3a70962b7a
fs/directory: use file mode to manage directory
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 23:30:01 +08:00
Jiuzhu Dong
c18b5602e8
fs/procfs: add mempool info to proc/mempool
...
server> cat /proc/mempool
total bsize nused nfree nifree nwaiter
hello: 400 20 17 3 0 0
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-08-09 15:38:57 +08:00
Peter van der Perk
fa9d352566
SPIFFS select FS_LARGEFILE since it's required
2022-08-04 22:31:57 +08:00
Peter van der Perk
93f05c7e74
NFS select FS_LARGEFILE since it's required
2022-08-04 22:31:57 +08:00
Peter van der Perk
e0080766b3
FS Disable FS_LARGEFILE by default
2022-08-04 22:31:57 +08:00
haopengxiang
9bb5148d10
procfs: add heapcheck flag
...
1 for open heapcheck, 0 for close
echo 1 > /proc/xxx/heapcheck
echo 0 > /proc/xxx/heapcheck
Signed-off-by: haopengxiang <haopengxiang@xiaomi.com>
2022-08-02 10:46:44 +08:00
Xiang Xiao
2b0e28e492
vfs: Remove the unnessary check when CONFIG_DEBUG_MM enable
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-28 16:52:06 +03:00
ligd
8a3683fb9f
rptun: add ns_match callback to resolve rptun deadlock
...
thread A: accept -> net_lock -> socket_rpmsg_accept
-> rpmsg_register_callabck -> rptun_lock
thread B: ns_bind -> rpmsg_socket_ns_bind -> get_tx_payload_buffer
-> rptun_wait_tx -> usrsock_rpmsg_ept_cb -> usrsockdev_write
-> net_lock -> deadlock
fix:
add ns_match callback
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-27 20:36:51 +08:00
Jiuzhu Dong
9899dd0ec0
mm/mm_heap: change CONFIG_MM_BACKTRACE to int type
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-26 23:45:31 +08:00
ligd
c0f2b7811e
pm: add pm procfs support
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 11:11:00 +08:00
ligd
5f68aa56fd
poll: defalut set POLLERR POLLHUP to events
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-26 09:36:55 +08:00
ligd
1e5568b030
rpmsgfs: fix nx_style
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 17:10:19 +03:00
ligd
572d865034
rpmsgfs: cache statfs result in case of deadlock
...
rptun: msg from other cpu
[ap] [ 5] [<0x2c353768>] arm_switchcontext+0xc/0x10
[ap] [ 5] [<0x2c322266>] sem_wait+0x5a/0xbc
[ap] [ 5] [<0x2c7400a8>] inode_semtake+0x24/0x5c
[ap] [ 5] [<0x2c74087a>] inode_release+0x6/0x60
[ap] [ 5] [<0x2c741284>] file_close+0x18/0x44
[ap] [ 5] [<0x2c74fb06>] rpmsgfs_close_handler+0x86/0xe4
[ap] [ 5] [<0x2c75b8de>] rpmsg_virtio_rx_callback+0xba/0x1b4
[ap] [ 5] [<0x2c75af70>] rproc_virtio_notified+0x44/0x5c
[ap] [ 5] [<0x2c75a93c>] remoteproc_get_notification+0x1c/0x2c
[ap] [ 5] [<0x2c335a08>] rptun_thread+0x74/0x208
[ap] [ 5] [<0x2c323e72>] nxtask_start+0x3a/0x60
nsh: send msg to other cpu with inode lock
[ap] [10] [<0x2c353768>] arm_switchcontext+0xc/0x10
[ap] [10] [<0x2c3221b2>] nxsem_wait_uninterruptible+0x6e/0xc8
[ap] [10] [<0x2c74e498>] rpmsgfs_send_recv.constprop.0+0x78/0xc0
[ap] [10] [<0x2c74ebc0>] rpmsgfs_client_statfs+0x50/0x80
[ap] [10] [<0x2c3221ca>] nxsem_wait_uninterruptible+0x86/0xc8
[ap] [10] [<0x2c74da78>] rpmsgfs_statfs+0x28/0x50
[ap] [10] [<0x2c74534e>] mountpoint_filter+0x66/0x90
[ap] [10] [<0x2c740016>] foreach_inodelevel+0x66/0x88
[ap] [10] [<0x2c73fffa>] foreach_inodelevel+0x4a/0x88
[ap] [10] [<0x2c740062>] foreach_inode+0x2a/0x48
[ap] [10] [<0x2c745388>] foreach_mountpoint+0x10/0x20
[ap] [10] [<0x2c745606>] mount_read+0x36/0x70
[ap] [10] [<0x2c742a34>] read+0x30/0x5c
[ap] [10] [<0x2c371096>] nsh_catfile+0x36/0x140
[ap] [10] [<0x2c36d01a>] nsh_parse_command+0x7fe/0xc54
[ap] [10] [<0x2c370f92>] nsh_session+0x66/0x134
[ap] [10] [<0x2c3721a4>] nsh_consolemain+0x2c/0x44
[ap] [10] [<0x2c374fde>] nsh_main+0x2a/0x4c
[ap] [10] [<0x2c33f7f8>] lib_cxx_initialize+0x24/0x48
[ap] [10] [<0x2c34274a>] nxtask_startup+0x12/0x24
[ap] [10] [<0x2c323e7e>] nxtask_start+0x46/0x60
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 17:10:19 +03:00
ligd
5f60b7dc12
rpmsgfs: hande count <=0 when rpmsgfs_read&write
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 17:10:19 +03:00
ligd
837c15dcb6
rpmsgfs: improve file read & write performance
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 17:10:19 +03:00
Jiuzhu Dong
978530f5f6
fs/ioctl: add BLKSSZGET cmd to get block sector size
...
refer to:
https://sites.uclouvain.be/SystInfo/usr/include/sys/mount.h.html
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-22 09:07:57 +03:00
Jiuzhu Dong
b385c48a30
fs/fs_fsync: add file sync operation by ioctl
...
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-07-22 09:07:57 +03:00
ligd
cda9cfbc80
unlink: don't do unlink with inode_semtake
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 11:00:26 +08:00
ligd
1f854486c3
procfs: procfs_opendir should return fail if can't match
...
Signed-off-by: ligd <liguiding1@xiaomi.com>
2022-07-22 10:53:44 +08:00
Fotis Panagiotopoulos
66f49c1f3c
mm: Fixed the usage of CONFIG_MM_BACKTRACE & CONFIG_DEBUG_MM.
2022-07-22 00:53:02 +08:00
Jukka Laitinen
b10658653b
fs/partition/fs_gpt.c: Fix compilation error
...
PRI?OFF macros are defined in inttypes, so include it
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-07-19 23:50:30 +08:00
Xiang Xiao
2166c98809
Add printflike and scanflike to all printf/scanf like functions
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-18 14:14:36 +03:00
Xiang Xiao
3276438984
procfs/mount: Unify uint[32|64]_t to fsblkcnt_t for the code simplification
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-16 21:06:53 +03:00
Xiang Xiao
c211954a42
partition/gpt: Replace PRI?LBA with PRI?OFF
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-16 21:04:58 +03:00
Nathan Hartman
849f760b77
Fix various typos
2022-07-08 02:15:54 +08:00
SPRESENSE
fa1fad50b9
fs/fat: Fix a bug that long file name cannot be found
...
The field of first cluster under LFN directory entry must be 0x0000. If
it is set a value other than 0, it causes a problem where the long file
name entry cannot be found on a Windows PC and the short file name is
always used. In addition, correct the macro error in big endian.
2022-06-30 15:35:57 +08:00
Xiang Xiao
53c6789bef
mm: Add mm_uninitialize to release the resource
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-12 19:41:14 +09:00
chao.an
2fa7ebc18f
fs/mqueue: skip nxmq_pollnotify() if no poll waiters
...
Signed-off-by: chao.an <anchao@xiaomi.com>
2022-06-10 18:40:42 +09:00
Xiang Xiao
3e32b605fe
libc/tls: Make tls_get_info as the pulibc function instead up_tls_info
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-06-03 23:56:50 +03:00
vxj9800
bfde3c007d
Add preprocessor directive __attribute__((packed)) to cromfs_node_s
...
This directive tells the compiler that cromfs_node_s might be located at a memory
address which is not word aligned. This resolves the hardFault caused by unaligned
memory access on armv6-m architecture which doesn't support it.
2022-06-01 12:09:37 +08:00
anjiahao
b88a8cf39f
use rmutex inside of all repeated implementation
...
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2022-05-30 19:43:48 +08:00
Xiang Xiao
7ec6b4c7dd
Change dpends on SCHED_[L|H]PWORK to SCHED_WORKQUEUE
...
since the code could map the unsupported work to the
supported one and remove select SCHED_WORKQUEUE from
Kconfig since SCHED_[L|H]PWORK already do the selection
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-05-28 18:41:51 +03:00
YAMAMOTO Takashi
b05320cac2
mm: Move backtrace stuff into a separate option
...
The functionality has too much overhead for CONFIG_DEBUG_MM.
2022-05-21 14:28:41 +08:00