Commit Graph

76 Commits

Author SHA1 Message Date
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 25c2f3e042 driver: move find_mtddriver() to fs.h and add close_mtddriver.c
Rpmsg mtd need a way to find the mtd device according to the
mtd device path.

Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
2022-09-09 19:27:57 +08:00
zhouliang3 1f53a058fa nuttx:Change fs strncpy to strlcpy to avoid losing'\0'
Signed-off-by: zhouliang3 <zhouliang3@xiaomi.com>
2021-12-30 18:06:00 +08:00
Gustavo Henrique Nihei c019533d7a fs/driver: Fix missing declaration of find_mtddriver when CONFIG_MTD=n
Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
2021-10-23 04:02:22 -05:00
Xiang Xiao af72376773 fs: Remove magic field from partition_info_s
since it is wrong and impossible to return file
system magic number from the block or mtd layer.

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-20 09:19:52 -03:00
Xiang Xiao 4f8c3ab901 fs: Support 64bit in register_[block|mtd]partition
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-16 10:16:09 -03:00
Xiang Xiao 162893cc3b fs/partition: Support BIOC_PARTINFO
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-13 08:45:18 -03:00
Xiang Xiao 6b6c11f0ad mtd: Replace MTDIOC_XIPBASE with BIOC_XIPBASE
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-08-12 08:01:29 -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
YAMAMOTO Takashi 5652de3fdf fs: try blockproxy only if BCH is enabled 2021-03-17 01:25:16 -07:00
YAMAMOTO Takashi 87d5a39f68 find_blockdriver: Don't ferr() on MTDs
It's the normal path when you open a MTD. ferr() is too strong.
2021-03-14 22:14:56 -07:00
Xiang Xiao 9473434587 Ensure the kernel component don't call userspace API
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-03-01 09:23:09 +09:00
Byron Ellacott 9a1b726bae fs: change geometry types from `size_t` to `blkcnt_t` and `blksize_t`
This change reflects that the geometry isn't related to the largest
allocatable unit on the platform.

Calls to read and write block devices are also affected and have
been updated.
2021-02-18 20:38:22 -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
Alin Jerpelea a544c3f499 fs: nxffs: nxstyle error fix
Fix nxstyle errors to pass CI

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-05 12:15:56 -03:00
Juha Niskanen a5ff391bb3 fs/driver: change unlink to nx_unlink to avoid setting errno
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-22 17:10:13 +01:00
Juha Niskanen eaa34b458a fs/driver: update comments about block_proxy()
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
2021-01-22 17:10:13 +01:00
Xiang Xiao 0536953ded Kernel module should prefer functions with nx/kmm prefix
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-01-13 08:57:58 +01:00
Xiang Xiao 0032ddb8bf fs: Reimplement file_open to not depend on nx_open
on the other hand, open/nx_open call file_open instead

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I66990a77cdeb6ff18f7bf48a65bbc7b701dad552
2021-01-11 23:47:57 +01:00
Xiang Xiao ae356001cf Change all files come from Xiaomi/Pinecone to Apache License 2.0
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-08-22 17:37:21 -06:00
YAMAMOTO Takashi 9dcc6f6da6 fs/driver/fs_blockproxy.c: Fix an error handling
Found by clang-check:

driver/fs_blockproxy.c:202:7: warning: Value stored to 'ret' is never read
      ret = -errno;
      ^     ~~~~~~
1 warning generated.
2020-07-29 21:13:20 -07:00
Brennan Ashton 3a58926d01 Cast pointer to uintptr prior to ulong for ioctl
Signed-off-by: Brennan Ashton <bashton@brennanashton.com>
2020-07-19 15:49:13 -03: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
Gregory Nutt 547a3cb3d9 Run all .c and .h files in previous commits through nxstyle. 2020-03-22 08:24:07 -05:00
Gregory Nutt 7a871e2f29 fs/: Remove support for CONFIG_FS_WRITABLE 2020-03-22 08:24:07 -05:00
Gregory Nutt c8b39b48bb z20x: w25boot configuration nees CONFIG_FS_WRITABLE
boards/z80/ez80/z20x/configs/w25boot/defconfig:  needs CONFIG_FS_WRITABLE=y

Style cleanup / Correct file header

  drivers/bch/bchdev_register.c, drivers/mtd/ftl.c, and fs/driver/fs_findblockdriver.c:
  Run through nxstyle; replace BSD-3 license with Apache 2.0
2020-03-07 16:59:38 -03: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 5c80b94820 Replace #include <semaphore.h> to #include <nuttx/semaphore.h>
Since the kernel side should call nxsem_xxx instead and remove the unused inclusion
2020-02-01 08:27:30 -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
Xiang Xiao 6a3c2aded6 Fix wait loop and void cast (#24)
* Simplify EINTR/ECANCEL error handling

1. Add semaphore uninterruptible wait function
2 .Replace semaphore wait loop with a single uninterruptible wait
3. Replace all sem_xxx to nxsem_xxx

* Unify the void cast usage

1. Remove void cast for function because many place ignore the returned value witout cast
2. Replace void cast for variable with UNUSED macro
2020-01-02 10:54:43 -06:00
ligd 77bf9b09a1 fs/driver/fs_findmtddriver.c: Fix compile failed if NO CONFIG_MTD. 2019-10-29 08:16:27 -06:00
Gregory Nutt bd3cc792ff fs/: Run all .c files under fs/ through tools/nxstyle. 2019-10-27 11:48:14 -06:00
Gregory Nutt a64869aa67 CONFIG_NFILE_DESCRIPTORS=0 can no longer be used to disable the file system. NuttX with no file system does not make sense.
Squashed commit of the following:

    configs/:  The few configurations that formerly set CONFIG_NFILE_DESCRIPTORS=0 should not default, rather they should set the number of descriptors to 3.
    fs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    tools/:  Tools updates for changes to usage of CONFIG_NFILE_DESCRIPTORS.
    syscall/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    libs/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    include/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    drivers/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    Documentation/:  Remove all references to CONFIG_NFILE_DESCRIPTORS == 0
    binfmt/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    arch/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    net/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/:  Remove all conditional logic based on CONFIG_NFILE_DESCRIPTORS == 0
    sched/Kconfig:  CONFIG_NFILE_DESCRIPTORS may no longer to set to a value less than 3
    configs/:  Remove all settings for CONFIG_NFILE_DESCRIPTORS < 3
2019-02-11 12:09:26 -06:00
David Sidrane 5433ec589b fs/driver/fs_blockpartition.c: Fix void pointer warning.
libs/libc/unistd/lib_daemon.c:  Fix compiler error is streams disabled.
sched/irq/irq_procfs.c:  Fix warning
sched/task/task_vfork.c: Fix void * math warning
2018-12-03 17:54:21 -06:00
Xiang Xiao 2f63becbc8 fs/driver: Add register_mtdpartition() for MTD partition 2018-11-08 10:03:07 -06:00
Xiang Xiao e674edfa19 fd/dirent, fs/driver/, and fs/vfs: Make MTD device accessible via a character driver proxy like block devices 2018-11-08 09:59:18 -06:00
Xiang Xiao d32d9d4b24 fs/partition: Try MTDIOC_GEOMETRY IOCTL before bops's geometry
fs/driver/fs_blockpartition.c:  Support MTD IOCTL
2018-11-08 09:41:54 -06:00
Gregory Nutt 992b293122 Squashed commit of the following:
fs/driver and fs/mount:  Add mount() support for file systems that require MTD drivers (vs. block drivers).
    fs/drivers:  Add support for named MTD drivers in the psuedo file system.  This will, eventually, allow us to mount file systems that need MTD drivers without having to fake an intervening block driver.
2018-09-22 14:20:18 -06:00
Gregory Nutt a7fd58c4db Squashed commit of the following:
many locations:  Change occurences of open() followed by file_detach() to file_open().  Change most non-controversion calls to open() to nx_open().

    fs/inode/fs_fileopen.c:  Flesh out file_open() with some interim, placeholder logic.

    fs/inode/fs_fileopen.c:  Add a framework for a file_open() implementation (no real logic in place yet).

    fs/vfs/fs_open.c:  Add nx_open() which is the same as open() except that it does not create a cancellation point nor does it modify the errno variable.
2018-09-15 10:49:41 -06:00
Gregory Nutt 33e3fb7a70 Correct mispellings of pseudo. Update some comments in signal.h. 2018-09-05 11:56:14 -06:00
Xiang Xiao 70a0bf0849 Squashed commit of the following:
fs/partition/fs_partition.c:  Add PTABLE parser

    fs/partion:  Add a partition parser framework

    fs/driver/fs_blockpartition.c:  Add register_blockpartition for block partition
2018-08-28 07:30:21 -06:00
Gregory Nutt 7cf88d7dbd Make sure that labeling is used consistently in all function headers. 2018-02-01 10:00:02 -06:00
Gregory Nutt 9568600ab1 Squashed commit of the following:
This commit backs out most of commit b4747286b1.  That change was added because sem_wait() would sometimes cause cancellation points inappropriated.  But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.

    In the OS, all calls to sem_wait() changed to nxsem_wait().  nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.

    In all OS functions (not libraries), change sem_wait() to nxsem_wait().  This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.

    sched/semaphore:  Add the function nxsem_wait().  This is a new internal OS interface.  It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt 42a0796615 Squashed commit of the following:
sched/semaphore:  Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable.  Changed all references to sem_post in the OS to nxsem_post().

    sched/semaphore:  Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable.  Changed all references to sem_destroy() in the OS to nxsem_destroy().

    libc/semaphore and sched/semaphore:  Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable.  Changed all references to sem_setprotocol in the OS to nxsem_setprotocol().  sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Masayuki Ishikawa 5efd942396 FS: Remove DEBUGASSERT() in block_proxy() because the flags are cleared later. 2017-07-04 10:56:54 +09:00
Gregory Nutt ee8abb8160 FS: Don't build block driver proxy if PSEUDOFS_OPERATIONS are disabled. 2017-03-04 08:25:20 -06:00
Masayuki Ishikawa e239961be8 Fix open() a block device with CONFIG_DISABLE_PSEUDOFS_OPERATIONS=y 2017-03-01 13:43:12 +09:00
Gregory Nutt 45fd98da88 Add macros support that will eventually allow dynamic allocation of strings need to support soft links. 2017-02-05 14:25:45 -06:00