Commit Graph

1911 Commits

Author SHA1 Message Date
simbit18
ad957be5a9 fs/nxffs/Kconfig: Fix indentation
Remove spaces from Kconfig
2023-05-10 00:45:29 +08:00
Xiang Xiao
17f173d555 fs/vfs: Zero file struct field with memset
to avoid set fields to zero one by one

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 17:56:07 +03:00
Xiang Xiao
1955992ae5 fs: Replace strncat with strlcat
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
6f6fce95a2 Replace all sprintf with snprintf
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
fa8719bb5a Replace all strcat with strlcat
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Xiang Xiao
08ababd704 fs/vfs: Add a new argument(size_t len) to inode_getpath
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-05-08 09:57:01 +02:00
Radek Pesina
d58c445ac5 Add patch for littlefs to use kmm_malloc/free on kernel with MMU. 2023-04-28 16:45:05 +08:00
chao an
507c8145a9 sched/spawn: remove spawn proxy thread to simplify task/posix_spawn()
The spawn proxy thread is a special existence in NuttX, usually some developers
spend a lot of time on stack overflow of spawn proxy thread:

https://github.com/apache/nuttx/issues/9046
https://github.com/apache/nuttx/pull/9081

In order to avoid similar issues, this PR will remove spawn proxy thread to simplify
the process of task/posix_spawn().

1. Postpone the related processing of spawn file actions until after task_init()
2. Delete the temporary thread of spawn proxy and related global variables

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-27 17:35:58 +08:00
yinshengkai
006afeb21f fs/inode: when searching for nextname skip "/" and "./"
fix the problem that stat fails to use the relative path
An error will be reported if used in the following way:
stat("//./bin", &st);

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-04-25 21:28:59 +08:00
Xiang Xiao
dd631265c4 fs: Add g_ prefix for all global mountpt_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
Xiang Xiao
51dc67ad5f fs: Add g_ prefix for all global file_operations instances
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-24 16:13:29 +02:00
yinshengkai
c418d147fe procfs: add total time running time of task
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
2023-04-24 19:38:29 +08:00
anjiahao
49cd7a795a mm:change special pid to macro
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2023-04-23 23:28:32 +08:00
chao an
13cdffd302 fs/procfs: fix readdir loss last character
nsh> ls proc/fs
/proc/fs: ----> /proc/fs:
 block           blocks
 moun            mount
 usag            usage

Signed-off-by: chao an <anchao@xiaomi.com>
2023-04-23 17:13:51 +08:00
Xiang Xiao
4be499a243 procfs: Make g_procfs_entries in the alphabetic order
and option in procfs/Kconfig

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
c6d210289f procfs: remove procfs_ from procfs_operations variables
to aglin the naming style with other implementation

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
149cafe450 procfs: Add g_ prefix to all procfs_operations
to conform the coding style

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-22 03:33:50 -04:00
Xiang Xiao
404de093a1 fs: Flush the file system cache in BOARDIOC_POWEROFF too
and remove the check of SYS_DOWN since it defines to SYS_RESTART in reboot_notifer.h:
  #define SYS_DOWN        0x0001     /* Notify of system down */
  #define SYS_RESTART     SYS_DOWN
  #define SYS_HALT        0x0002     /* Notify of system halt */
  #define SYS_POWER_OFF   0x0003     /* Notify of system power off */

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-21 20:37:59 +03:00
Ville Juven
53d4b9ed54 mm/mm_map: Give the mm_map as parameter to the mm_map functions
This way the mappings can be modified for any vm area, not only the
process that is running.

Why? This allows mapping pages to kernel dynamically, this functionality
will be presented later.
2023-04-22 00:40:37 +08:00
Ville Juven
30bae2ca47 fs/cromfs: Fix faulty DEBUGASSERT() check
The logic being tested is wrong, obviously when accessing file the
driver private data has to be valid (open() has been called).
2023-04-21 10:29:08 -04:00
Fotis Panagiotopoulos
ab1b3c0337 Added missing checks in strdup'ed strings. 2023-04-19 02:49:31 +08:00
Fotis Panagiotopoulos
098b7bbfb3 Fixes in asprintf usage. 2023-04-19 02:48:39 +08:00
XinStellaris
770817ba2f fs/littlefs:littlefs shouldn't be used without C99 BOOL
Signed-off-by: XinStellaris <tianxin7@xiaomi.com>
2023-04-18 13:40:50 -04:00
zhangyuan21
c239d19df0 nuttx: add more dependent header file
Signed-off-by: zhangyuan21 <zhangyuan21@xiaomi.com>
2023-04-11 09:13:32 +03:00
Xiang Xiao
3aab2a2e73 fs/nxffs: Fix typo(nxem_wait->nxmutex_lock) error in comment
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-04-07 09:06:06 +03:00
Dong Heng
a51e102a41 xtensa/esp32: Make asprintf and lib_free corresponding 2023-04-06 20:57:19 +03:00
Gregory Nutt
717bb04cb7 Increase the number of real time signals. Two is not enough.
Refer to issue #8867 for details and rational.

Convert sigset_t to an array type so that more than 32 signals can be supported.

Why not use a uin64_t?
- Using a uin32_t is more flexible if we decide to increase the number of signals beyound 64.
- 64-bit accesses are not atomic, at least not on 32-bit ARMv7-M and similar
- Keeping the base type as uint32_t does not introduce additional overhead due to padding to achieve 64-bit alignment of uin64_t
- Some architectures still supported by NuttX do not support uin64_t
  types,

Increased the number of signals to 64. This matches Linux. This will support all xsignals defined by Linux and also 32 real time signals (also like Linux).

This is is a work in progress; a draft PR that you are encouraged to comment on.
2023-03-27 16:59:04 +03:00
chenrun1
01cfb3b2db fs/fs_initialize.c: Sync will only be executed when the add is in reboot state.
In the last change, the assert behavior test was not considered. Therefore, in this change, sync will be performed only when SYS_RESTART/SYS_DOWN situation occurs, avoiding unpredictable results caused by handling locks or semaphores in interrupts.
2023-03-25 11:43:37 +02:00
chenrun1
7485f1c81d fs/fs_initialize.c:Sync fs in system restart callback 2023-03-25 11:43:37 +02:00
wangbowen6
5d53c8299e fs/fs_epoll: add oneshot list to handle the EPOLLONESHOT correctly
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2023-03-23 09:43:27 +02:00
dongjiuzhu1
f8b27d9fbe fs/mmap: try rammap when filesystem mmap don't support
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-03-10 10:43:33 +02:00
Karel Kočí
62661600b2 treewide: add DOWNLOAD variable as unification of curl call
This is a followup to the commit
03b164f59c.
2023-03-08 17:05:05 +08:00
Xiang Xiao
2c5f653bfd Remove the tail spaces from all files except Documentation
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-26 13:24:24 -08:00
lilei19
38f64f559d change strcpy to strlcpy
Signed-off-by: lilei19 <lilei19@xiaomi.com>
2023-02-24 12:15:40 +08:00
Jiuzhu Dong
9340d6e0d7 fs/rpmsgfs: return ENOTTY to vfs to do cmd operate
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2023-02-23 21:42:45 +02:00
chao an
9c30d3bf33 procfs/meminfo: skip invalid character before memdump
In the case of echo characters, atoi will mistake CRLF as a digit character and convert it to 0

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-23 13:51:12 +08:00
chao an
e28958fe5c fs/mount: fix compiler warning found out by GCC-12.2
mount/fs_foreachmountpoint.c: In function 'mountpoint_filter':
mount/fs_foreachmountpoint.c:99:38: warning: 'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]
   99 |       sprintf(&dirpath[pathlen], "/%s", node->i_name);
      |                                      ^
In function 'mountpoint_filter',
    inlined from 'mountpoint_filter' at mount/fs_foreachmountpoint.c:64:12:
mount/fs_foreachmountpoint.c:99:7: note: 'sprintf' output between 2 and 257 bytes into a destination of size 256
   99 |       sprintf(&dirpath[pathlen], "/%s", node->i_name);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-21 09:28:57 +08:00
lilei19
77f6319268 sync ps/assert output 2023-02-17 23:35:44 +08:00
Ville Juven
905cba3ee3 group/tg_info/argv: Make utility function to read argv as string
This creates a generic and safe way to read a process argument vector
as string from any context.
2023-02-17 01:27:16 +08:00
Xiang Xiao
4009cb1970 fs: Don't guard ftruncate with CONFIG_DISABLE_MOUNTPOINT
since ftruncate depends on file_operations not mountpt_operations

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-14 11:24:37 +08:00
Xiang Xiao
a05f9aaa85 fs: Don't guard fsync with CONFIG_DISABLE_MOUNTPOINT
since the driver can also support fsync by implementing BIOC_FLUSH

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-14 11:24:37 +08:00
Igor Mišić
3a7382e690 fs/littlefs: add full support for LittleFS block device cfg in Kconfig 2023-02-13 18:46:46 +08:00
chao an
77f68b121b fs/epoll: fix visual studio Compiler Error C2059
D:\archer\code\nuttx\fs\vfs\fs_epoll.c(456,15): error C2059: syntax error : '{'

Compiler error C2059:
The token caused a syntax error.

Reference:
https://learn.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2059?view=msvc-170

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:11:55 +08:00
chao an
3a0fdb019d nuttx: replace all ARRAY_SIZE()/ARRAYSIZE() to nitems()
Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-09 20:05:44 +08:00
dongjiuzhu1
63e6f80fb0 sync: add sync api
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 12:15:05 +02:00
dongjiuzhu1
7bbabc74fb fs/dir: provide absolute directory path for F_GETPATH by fcntl
Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
2023-02-07 03:45:38 +08:00
Stuart Ianna
a2a542562f fs: Implment link as a normal function instead macro
so "using ::link;" can pass the compiling. This change also
simplify the implementation of the hard link in the future.
2023-02-04 18:31:23 -03:00
Xiang Xiao
09841300b0 Remove the remain MIN/MAX like macro
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-02-03 20:42:57 +08:00
fangxiang
2c8c35431d fs/procfs: fix the issue of /proc/cpuload in SMP
Signed-off-by: ligd <liguiding1@xiaomi.com>
2023-02-02 22:48:30 +08:00
chao an
4c8d244fae sched/getpid: replace syscall getpid/tid/ppid() to kernel version
NuttX kernel should not use the syscall functions, especially after
enabling CONFIG_SCHED_INSTRUMENTATION_SYSCALL, all system functions
will be traced to backend, which will impact system performance.

Signed-off-by: chao an <anchao@xiaomi.com>
2023-02-02 10:33:01 +08:00