Commit Graph

1911 Commits

Author SHA1 Message Date
Xiang Xiao
d92dc45a80 vfs: Suppoprt F_DUPFD_CLOEXEC and MSG_CMSG_CLOEXEC
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html
https://linux.die.net/man/2/recvmsg

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-02 01:00:10 +02: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
Masayuki Ishikawa
e6884b8cb1 fs: mqueue: Fix file_mq_open() for SMP
Summary:
- I noticed that sometimes mqueue_test in ostest failed
  (i.e. mq_open failed) with rv-virt:smp.
- This commit fixes this issue by replacing sched_lock with
  critical section.

Impact:
- file_mq_open()

Testing:
- Tested with ostest on QEMU-7.1

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2023-02-01 15:00:47 +08:00
Xiang Xiao
3904fd775a sched: Remove the unused TCB_FLAG_SCHED_OTHER
after https://github.com/apache/nuttx/pull/8330

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-31 16:16:25 +02:00
chao an
2ffe564fa2 fs/procfs: sort level0 process id
Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-30 14:57:43 +08:00
dongjiuzhu1
e02a5a70eb fs/partiton: add sanity check
mmcsd_spi don't support ioctl
when blocksize is zero, will cause crash.

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-01-29 17:30:51 -03:00
Xiang Xiao
7d66a16c53 Minor style clean up
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-28 19:53:20 +02:00
zhangyuan21
8c52633bd0 fs: unlock tmpfs before free the file object
tcb will hold an invalid semaphore when CONFIG_PRIORITY_INHERITANCE is enabled

Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-01-28 19:35:45 +08:00
Petro Karashchenko
2c972bd402 fs/shm: update pointer arithmetic logic
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:26:09 +08:00
Petro Karashchenko
d35d8b4a12 fs/shm: use ERROR instead of -1
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-01-26 10:26:09 +08:00
Alan Carvalho de Assis
c3a34a5956 fs: Avoid accessing filep fields if it is NULL & add DEBUGASSERTs 2023-01-20 22:31:00 +08:00
Xiang Xiao
f8d33e40ac Fix mmap/fs_mmap.c:259:13: warning: 'mapped' may be used uninitialized in this function [-Wmaybe-uninitialized]
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-18 08:40:33 +01:00
Jukka Laitinen
a0ebddaac1 fs/shm: Add initial implementation for posix shared memory
This implements the file system logic for posix shared memory:
shm_open, shm_unlink, mmap, munmap and close

For flat and protected builds the memory simply allocated from (user) heap

For kernel build the memory is allocated from page pool and mapped with MMU

This doesn't yet support protection flags or re-sizing already truncated shared
memory area.

Co-authored-by: Ville Juven <ville.juven@unikie.com>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2023-01-18 11:01:20 +08:00
chao an
3d7629a02c fs/mmap: fix compile warning if set the optimize level to O3
| $ gcc -c "-O3" -Wall -isystem include -D__NuttX__ -D__KERNEL__ -I fs -I sched fs/mmap/fs_mmap.c -o fs_mmap.o
| include/sys/mman.h: In function ‘mmap’:
| fs/mmap/fs_mmap.c:259:13: warning: ‘mapped’ may be used uninitialized in this function [-Wmaybe-uninitialized]
|   259 |   FAR void *mapped;
|       |             ^~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2023-01-17 21:56:37 +08:00
Xiang Xiao
0a95c7721b vfs/poll: Remove POLLFILE and POLLSOCK NuttX specific extension
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-17 14:02:59 +08:00
Xiang Xiao
b1899ffbfd fs: Support O_NOFOLLOW flag
https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/functions/open.html:
O_NOFOLLOW
If path names a symbolic link, fail and set errno to [ELOOP].

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-01-17 12:02:48 +08:00
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