Summary:
1.Add configuration to allocate memory from the specified section
2.Replace all memory operations (kmm_) in the vfs with
fs_heap_. When FS_HEAPSIZE > 0, memory is requested for the file system by specifying a configured heap location. By default (i.e. FS_HEAPSIZE=0) fs_heap_ is equivalent to kmm_
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Summary:
When restoring rammap fpos, we check the return value to avoid potential problems caused by no error return if the restore fails.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
CC: obstack/lib_obstack_printf.c "mmap/fs_rammap.c", line 126: warning #188-D: enumerated type mixed with
another type
enum mm_map_type_e type = (uintptr_t)entry->priv.p & 3;
^
Signed-off-by: guoshichao <guoshichao@xiaomi.com>
mmap/fs_rammap.c:81:39: error: expected ‘)’ before ‘PRIdOFF’
81 | ferr("ERRORL Seek to position %"PRIdOFF" failed\n", fpos);
| ^~~~~~~
mmap/fs_rammap.c:81:12: warning: spurious trailing ‘%’ in format [-Wformat=]
81 | ferr("ERRORL Seek to position %"PRIdOFF" failed\n", fpos);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
mmap/fs_rammap.c:81:37: note: format string is defined here
81 | ferr("ERRORL Seek to position %"PRIdOFF" failed\n", fpos);
| ^
In file included from mmap/fs_rammap.c:30:
mmap/fs_rammap.c:98:51: error: expected ‘)’ before ‘PRIdOFF’
98 | ferr("ERROR: Write failed: offset=%"PRIdOFF" nwrite=%zd\n",
| ^~~~~~~
mmap/fs_rammap.c:98:20: warning: spurious trailing ‘%’ in format [-Wformat=]
98 | ferr("ERROR: Write failed: offset=%"PRIdOFF" nwrite=%zd\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mmap/fs_rammap.c:98:49: note: format string is defined here
98 | ferr("ERROR: Write failed: offset=%"PRIdOFF" nwrite=%zd\n",
Signed-off-by: zhangshoukui <zhangshoukui@xiaomi.com>
Summary:
In rammap:
1.0 - User
2.1 - Kernel
3.2 - XIP
Therefore we need to use 2 bits to represent the type
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
Summary:
1.Added msync callback in struct mm_map_entry_s
2.Added msync API in fs_msync.c
3.Added static msync_rammap for rammap.
Signed-off-by: chenrun1 <chenrun1@xiaomi.com>
According to the mmap(2) specification, anonymous pages should be initialized to zero unless the MAP_UNINITIALIZED is specified.
Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
If MAP_PRIVATE is specified, do not change the underlying object,
that is OK to open file with read-only permission. Change to pass:
testcases/open_posix_testsuite/conformance/interfaces/mmap/6-5.c
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
As posix spec, mmap() function shall fail with ENODEV if fd refers
to a file whose type is not supported. Change to pass ltp open_posix test:
testcases/open_posix_testsuite/conformance/interfaces/mmap/23-1.c
https://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
while iterate throuh all mapping memory to munmap and release,
the last entry is NUlL.
We need differentiate the case with invald entry at the first.
The fix is to pass ltp shm related cases.
Signed-off-by: fangxinyong <fangxinyong@xiaomi.com>
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>
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.
| $ 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>
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>
- 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>
fs_munmap.c:122:15: error: ‘struct fs_rammap_s’ has no member named ‘kernel’
fs_rammap.c:110:52: error: expected ‘:’ before ‘;’ token
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>