Commit Graph

92 Commits

Author SHA1 Message Date
Xiang Xiao 02ea79365a drivers/bch: Adjust f_pos with the correct value
Fix the problem reported by:
https://github.com/apache/incubator-nuttx/issues/6619

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-07-17 17:13:36 +03:00
Jiuzhu Dong b03f2e34b8 lseek: use type:off_t for return value
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2022-03-28 22:49:37 +08:00
Jiuzhu Dong befad07fd4 bch: specify the alignment of bch buffer by CONFIG_BCH_BUFFER_ALIGNMENT
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-12-11 10:01:54 -06:00
Jiuzhu Dong f81ffb51cc bch/ioctl: support FLUSH cache by cmd: BIOC_FLUSH
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
2021-12-11 10:01:54 -06:00
Kenneth Thompson 50c49da078 bch/bchlib_cache.c: Fix error handling 2021-08-09 10:52:08 -07:00
Kenneth Thompson 9d29d4bef5 drivers/bch: Handle return value of bchlib_readsector() 2021-08-09 10:52:08 -07:00
YAMAMOTO Takashi ed305ccc64 drivers/bch/bchlib_cache.c: Fix build with CONFIG_BCH_ENCRYPTION
It seems no one has built this since 2014.

I only build-tested this with esp32-devkitc:wapi +
CONFIG_BCH_ENCRYPTION + CONFIG_ESP32_AES_ACCELERATOR.
2021-03-17 01:25:16 -07:00
YAMAMOTO Takashi 39b3998149 bch: Enable with CONFIG_BCH, instead of !CONFIG_DISABLE_MOUNTPOINT
BCH can be used without mount points.
Mount points can be used without BCH.
They are independent each other.
2021-03-17 01:25:16 -07:00
Alin Jerpelea ccff570e6f drivers: nxstyle fixes
nxstyle fixes to pass the CI.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08:00
Alin Jerpelea e5b6305f4a drivers: Author Gregory Nutt: update licenses to Apache
Gregory Nutt has submitted the SGA and we can migrate the licenses
 to Apache.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-03-04 18:32:27 -08: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
YAMAMOTO Takashi 1c3ae7f01e drivers/bch/bchlib_cache.c: Fix syslog format errors 2020-11-20 22:22:53 -08:00
YAMAMOTO Takashi bc552397e9 drivers/bch/bchlib_read.c: Fix a syslog format error 2020-11-20 22:22:53 -08:00
chao.an f97b8436b3 drivers/bch: flush the dirty sector to keep the sector sequence
flush the dirty sector to keep the sector sequence before ftl write

Change-Id: I1096cce39965806d5c877c2929b5a2ecdab27ac9
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 23:38:57 -05:00
chao.an ed3cddb684 drivers/bch: delay the sector flush
Delay the sector flush to avoid multiple earse/write operations in sequence write

Change-Id: If4331b7fc8d2c2061325533212b28e826141b411
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 23:38:57 -05:00
Xiang Xiao 5eae32577e build: Move INCDIROPT to common place
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-18 15:02:55 -06:00
Ouss4 997d4fabb0 Check return from nxsem_wait_uninterruptible
This commit is only for those files under drivers/1wire, drivers/bch,
drivers/can and drivers/mmcsd.
2020-03-31 14:58:09 -06:00
Gregory Nutt 5c0e8e88b1 Revert "Makefile: move INCDIROPT to common place (#625)"
This reverts commit b9ace36fcc.

This change was added by PR 625 but has a serious logic flaw.  It removes all occurrences of INCDIROPT and replaces it with a definition in tools/Config.mk:

    else ifeq ($(WINTOOL),y)
      DEFINE = "$(TOPDIR)/tools/define.sh"
      INCDIR = "$(TOPDIR)/tools/incdir.sh" -w

This logic flaw is the Config.mk is included in all Make.defs files BEFORE WINTOOL is defined.  As a result, the definition is wrong in many places when building under Cygwin with a Windows native toolchain.
2020-03-26 08:50:29 -07:00
Xiang Xiao b9ace36fcc
Makefile: move INCDIROPT to common place (#625) 2020-03-26 08:09:59 -06:00
Pelle Windestam 5afee5cbd1 drivers/bch: fix nxstyle errors 2020-03-11 01:25:42 -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
Gregory Nutt 21aef0dd68 drivers/*/Kconfig: Consolidate driver Kconfig Files.
This commit does two things:

1. First, it reorganizes the driver Kconfig files so that each is self contained.  Before, a part of the driver configuration was in drivers/Kconfig and the rest was in in drivers/xyz/Konfig.  Now, all of the driver configuration is consolitated in the latter.

2. Second, this commit correct numerous serious errors introduced in a previous reorganization of the driver Kconfig files.  This was first noted by Nicholas Chin in PR270 for the case of the drivers/i2c/Kconfig but some examination indicates that the error was introduced into several other Kconfig files as well.

The nature of the introduced error was basically this:

- Nothing must intervene between the menuconfig selection and the following conditional configuration otpions.
- A previous PR erroneously introduced unconditional options between the menuconfig and the following confditional logic, thus corrupting the driver menus.

This error was easy to make because the driver Kconfig files were not well modularized.  Making them fully self-contained should eliminate this kind of error in the future.
2020-02-15 15:19:11 +01:00
Xiang Xiao 3cb259daa6 drivers/Kconfig: Move if/endif to subfolder Kconfig
Move if/endif to subfolder Kconfig and make ARCH_HAVE_XXX option always selectable by moving out of if/endif
2020-02-08 08:04:05 -06:00
Xiang Xiao a8de37fbec Ensure all source code end with one and only one newline
by this command:
git ls-files -z | while IFS= read -rd '' f; do tail -c1 < "$f" | read -r _ || echo >> "$f"; done
2020-02-08 07:25:56 -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
Gregory Nutt 2761279839 drivers/bch, pipes, timers: Run drivers through tools/nxstyle, correcting as many complaints as possible. 2019-12-06 23:36:33 -06:00
Gregory Nutt f6b42f87c9 More miscelleanous ZNeo build fixes 2019-06-03 14:45:00 -06:00
Gregory Nutt b49be4bb20 Squashed commit of the following:
arch/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    sched/ audio/ crypto/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    Documentation/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    fs/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    graphics/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    net/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    drivers/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    include/, syscall/, wireless/:  Removed all references to CONFIG_DISABLE_POLL.  The standard POSIX poll() can not longer be disabled.
    configs/:  Remove all references to CONFIG_DISABLE_POLL.  Standard POSIX poll can no longer be disabled.
2019-05-21 18:57:54 -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
Gregory Nutt 3a4984a40b Rename file_close_detached() to juse file_close() for better consistency in naming. 2018-09-15 13:04:56 -06:00
Gregory Nutt b48f46f1c8 Correct some errors found in build testing using recent commits. 2018-09-15 12:47:54 -06:00
Gregory Nutt a83b6d990b Replace callse to ioctl() in the OS to file_ioctl() 2018-09-15 11:47:24 -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 2683f713ab Make sure that labeling is used consistently in all function headers (part 3). 2018-02-01 12:17:03 -06:00
Gregory Nutt fc0a5e19d0 drivers/bch: The character driver to block device access now supports an IOCTL to get the geomtry of the underlying block device. 2017-10-20 11:36:44 -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
Gregory Nutt 83cdb0c552 Squashed commit of the following:
libc/semaphore:  Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable.  Changed all references to sem_getvalue in the OS to nxsem_getvalue().

    sched/semaphore:  Rename all internal private functions from sem_xyz to nxsem_xyz.  The sem_ prefix is (will be) reserved only for the application semaphore interfaces.

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

    sched/semaphore:  Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.

    sched/semaphoate:  Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Jussi Kivilinna 03a3aca774 drivers/bch: add poll support 2017-09-01 07:54:49 -06:00
Gregory Nutt e57a5755cc TX timeout must also be cancelled on a TX error. TX timeout should check if we are waiting for a TXto complete. TX timeout was too short (short than the maximum number of retries). 2017-08-06 16:56:02 -06:00
Masayuki Ishikawa 810f9b516c drivers/bch: Fix 'Missing Unlock' in bchdev_driver.c
Jira: PDFW15IS-265
Coverity-ID: 10597
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2017-05-22 14:29:41 +09:00
EunBong Song 5ef00f0b91 drivers/bch: BCH character driver bch_ioctl() always returns -ENOTTY for DIOC_GETPRIV command. It should returns OK if DIOC_GETPRIV command succeeds. 2017-05-16 08:01:05 -06:00
Gregory Nutt ba2b345990 Remove a few remaining use of the obsolteted 'Compilation Switches' program section 2017-01-22 08:57:18 -06:00
Gregory Nutt 4b4dbc79a2 Move driver related prototypes out of include/nuttx/fs/fs.h and into new include/drivers/drivers.h 2016-07-20 13:15:37 -06:00
Gregory Nutt 0c8c7fecf0 Add _ to the beginning of all debug macros to avoid name collisions 2016-06-16 12:33:32 -06:00
Gregory Nutt 0665c7e06c drivers/: Change some nerr() ERRORS to ninfo() and nwarn() WARNINGS. 2016-06-12 09:26:12 -06:00
Gregory Nutt a1469a3e95 Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err() 2016-06-11 15:50:49 -06:00