Commit Graph

79 Commits

Author SHA1 Message Date
Xiang Xiao eddd90de78 poll: pollsetup should notify only one fd passd by caller
since it's redundant to iterate the whole fds array in setup

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2023-11-21 09:07:17 +01:00
Petro Karashchenko e77ec6c8c6 fs/mqueue: add missing FAR specifier
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2023-09-16 14:17:47 +08:00
chao an 7aa45305b7 fs/inode: remove all unnecessary check for filep/inode
Since VFS layer already contains sanity checks, so remove unnecessary lower half checks

Signed-off-by: chao an <anchao@xiaomi.com>
2023-08-29 09:47:11 +08:00
yangjiao a543950951 fs/mqueue/mq_open.c: Add the judgment for mq_attr is NULL.
Signed-off-by: yangjiao <yangjiao@xiaomi.com>
2023-08-03 03:10:56 -07:00
yangjiao bef756c004 fs/mqueue: Fix the wrong field type in mq_attr as the spec and add the logical judgment to deal with the condition when mq_maxmsg or mq_msgsize is less than zero or equal to zero.
In POSIX standard spec https://pubs.opengroup.org/onlinepubs/7908799/xsh/mqueue.h.html, the field type in mq_attr should be long not size_t. And no logical judgment when mq_maxmsg <= 0 or mq_msgsize <= 0. In this change, i update the field type in mq_attr, and add the missing logical judgment.

Signed-off-by: yangjiao <yangjiao@xiaomi.com>
2023-08-03 03:10:56 -07:00
hujun5 0b2b5b781c fs: remove sched_[un]lock
Signed-off-by: hujun5 <hujun5@xiaomi.com>
2023-08-01 23:15:37 +02:00
chao an 6ee9ec7656 build: add initial cmake build system
1. Update all CMakeLists.txt to adapt to new layout
2. Fix cmake build break
3. Update all new file license
4. Fully compatible with current compilation environment(use configure.sh or cmake as you choose)

------------------

How to test

From within nuttx/. Configure:

cmake -B build -DBOARD_CONFIG=sim/nsh -GNinja
cmake -B build -DBOARD_CONFIG=sim:nsh -GNinja
cmake -B build -DBOARD_CONFIG=sabre-6quad/smp -GNinja
cmake -B build -DBOARD_CONFIG=lm3s6965-ek/qemu-flat -GNinja

(or full path in custom board) :
cmake -B build -DBOARD_CONFIG=$PWD/boards/sim/sim/sim/configs/nsh -GNinja

This uses ninja generator (install with sudo apt install ninja-build). To build:

$ cmake --build build

menuconfig:

$ cmake --build build -t menuconfig

--------------------------

2. cmake/build: reformat the cmake style by cmake-format

https://github.com/cheshirekow/cmake_format

$ pip install cmakelang

$ for i in `find -name CMakeLists.txt`;do cmake-format $i -o $i;done
$ for i in `find -name *\.cmake`;do cmake-format $i -o $i;done

Co-authored-by: Matias N <matias@protobits.dev>
Signed-off-by: chao an <anchao@xiaomi.com>
2023-07-08 13:50:48 +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
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 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
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 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
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
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
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 938a995c92 mqueue: Rename FS_MQUEUE_MPATH to FS_MQUEUE_VFS_PATH
align with other similiar config which suffix with _VFS_PATH

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-05 23:58:01 +01:00
Xiang Xiao 0eec2f5251 fs: Remove the unnecessary Kconfig definition
since all these options should always have the default value

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-05 23:58:01 +01:00
Petro Karashchenko a743fed63d file_operations: get back C89 compatible initializer
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
2022-01-11 02:14:00 +08:00
ligd e3d20d2c54 mqueue: fix memory leak cause by lost inode_release
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-10-25 18:57:43 +09:00
Masayuki Ishikawa 585b1fc113 fs: mqueue: Change MAX_MQUEUE_PATH to 64
Summary:
- This commit changes MAX_MQUEUE_PATH to 64 to reduce stack
  memory if the NAME_MAX is large

Impact:
- None

Testing:
- Tested with spresense:rndis_smp

Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2021-10-25 03:57:09 -05:00
anjiahao 0aa14f832d mq_open: add long file name check and parameter check
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
2021-10-21 11:01:45 -03:00
Xiang Xiao a44f62ddf7 fs: should only apply umask to the userspace caller
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I608e3107aaf3d85045958163a742a1ef1107de91
2021-07-17 13:58:58 +09:00
Xiang Xiao a0f2f6c362 fs: Move umask to task_info_s
and implement the related semantic correctly

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0587341e2c505e41b5e24e55dba039ed200d65f2
2021-07-14 10:35:15 -03:00
Xiang Xiao 0148e1d501 fs: Support the root file system attributes(mode, uid, gid and time)
Note: all attributes is guarded by PSEUDOFS_ATTRIBUTES to save the space

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I664d60382e356068fd920f08aca5b4a49d8d92a9
2021-07-14 10:35:15 -03:00
Xiang Xiao 2e54df0f35 Don't include assert.h from public header file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-06-03 08:36:03 -07:00
Gustavo Henrique Nihei 330eff36d7 sourcefiles: Fix relative path in file header 2021-03-09 23:18:28 +08:00
ligd 48d49e5a7c mqueue: add poll support
Change-Id: I7e908f6a6c00158c0946587dd79ae3dc5d279d37
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-03-04 07:11:43 -08:00
Alin Jerpelea f9fb182809 Author: Gregory Nutt: update licenses to Apache
Update files from Gregory Nutt to Apache 2.0 license.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-05 12:15:56 -03:00
Xiang Xiao 86fab49c46 fs: Fix the race condition in file_dup
NULL inode passed to files_allocate doesn't mark file struct in the
allocated state, so other threads which invovle in file allocation
(e.g. open or dup) may allocate the same file struct again.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I53ff876eae3c7a1e311e7f671686b73a4b4ef891
2021-01-08 11:01:46 +08:00
ligd f63db66382 mqueue: add file_mq_xx for kernel use
Change-Id: Ida12f5938388cca2f233a4cde90277a218033645
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-05 02:40:43 -06:00
ligd 3bc33572e3 mqueue: simplify the mqueue reailize
1. remove descript management in mqueue, save code size
2. use i_ops instead of i_mqueue to remove the dup logic

Change-Id: Ie88960e50ddcae9c87977c9ad65a45297c663291
Signed-off-by: ligd <liguiding1@xiaomi.com>
2021-01-05 02:40:43 -06:00
Nathan Hartman 5791bbe17e fs/mqueue/Kconfig: Fix typo
fs/mqueue/Kconfig:

    * config FS_MQUEUE_MPATH:
      Fix typo in name string (queuee -> queue)
2021-01-03 20:28:13 -06:00
Esteban Zamora 8beb1edbda Fix inverted errno in mq_open
Signed-off-by: Esteban Zamora <esteban.zamora@hpe.com>
2020-08-20 20:35:16 -03:00
YAMAMOTO Takashi e22dffba8e fs/mqueue/mq_close.c: Remove a redundant assignment
Found by clang-check:

mqueue/mq_close.c:127:21: warning: Value stored to 'rtcb' during its initialization is never read
  FAR struct tcb_s *rtcb = (FAR struct tcb_s *)nxsched_self();
                    ^~~~   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-07-30 16:16:21 +02:00
Gregory Nutt a4218e2144 include/nuttx/sched.h: Make naming of all internal names consistent:
1. Add internal scheduler functions should begin with nxsched_, not sched_
2. Follow the consistent naming patter of https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+OS+Internal+Functions
2020-05-09 14:19:08 -03:00
Xiang Xiao 929292f57b mqueue: Add nxmq_open/nxmq_close/nxmq_unlink function
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-04 07:20:02 -06:00
Gregory Nutt ae401cecdd Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under fs/driver, fs/aio, fs/nfs, crypto/, and boards/.

Please note:  The modified file under fs/nfs generates several " Mixed case identifier found" errors.  Please ignore these.  These cannot be fixed without changes to numerous other files.  They also follow a non-standard convention that is used many files:  Using lower case structure names in custom SIZEOF_ definitions.
2020-03-30 17:09:45 +01:00
Gregory Nutt a4d6af8343 Check return from nxsem_wait_initialize()
Resolution of Issue 619 will require multiple steps, this part of the first step in that resolution:  Every call to nxsem_wait_uninterruptible() must handle the return value from nxsem_wait_uninterruptible properly.  This commit is only for those files under fs/inode.  Utility functions under fs/incode were modified so the changes do extend to other fs/ sub-directories as well.
2020-03-30 01:33:31 +01:00
Xiang Xiao cde88cabcc Run codespell -w with the latest dictonary again
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Xiang Xiao bd4e8e19d3 Run codespell -w against all files
and fix the wrong correction
2020-02-22 14:45:07 -06:00
Xiang Xiao 68951e8d72 Remove exra whitespace from files (#189)
* Remove multiple newlines at the end of files
* Remove the whitespace from the end of lines
2020-01-31 09:24:49 -06:00
Gregory Nutt bd3cc792ff fs/: Run all .c files under fs/ through tools/nxstyle. 2019-10-27 11:48:14 -06:00
Xiang Xiao 3bc62f1ccc Change space to tab and help to ---help--- in Kconfig files. 2019-10-05 21:39:12 -06:00
김정찬 a12f80fb90 sched/mqueue/mq_desclose.c: Add a test to verify that message queue is closed by the same task group that opened it. If not, then list corruption would result. This test is only performed if CONFIG_DEBUG_FEATURES is enabled since it should not normally be an issue: It would be a strange programming practice to open a message queue in open task group, then close it in another. 2019-08-05 18:30:07 -06:00
Gregory Nutt be3dd0bac6 fs/: Fix various coding standard issues found while testing tools/nxstyle.c 2019-03-01 15:01:04 -06:00
Gregory Nutt b54ffe858a Standardization of some function headers. 2018-03-13 09:52:27 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00