Commit Graph

1746 Commits

Author SHA1 Message Date
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