diff --git a/.gitee/PULL_REQUEST_TEMPLATE.md b/.gitee/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..cd8b2bc3a76 --- /dev/null +++ b/.gitee/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,11 @@ +## 概要 + +*在此部分更新信息,说明更改的必要性、具体做了什么以及如何实现的,如果有新功能出现,请提供参考资料(依赖关系、类似问题和解决方案等)。* + +## 影响 + +*在此部分更新信息(如适用),说明更改如何影响用户、构建过程、硬件、文档、安全性、兼容性等。* + +## 测试 + +*在此部分更新信息,详细说明如何验证更改,使用什么主机进行构建(操作系统、CPU、编译器等),使用什么目标进行验证(架构、板子:配置等)。提供更改前后的构建和运行日志将非常有帮助。* \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000000..50857c06938 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @xiaoxiang781216 @GUIDINGLI diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..cfe55eb61d3 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ +*Note: Please adhere to [Contributing Guidelines](https://github.com/open-vela/docs/blob/dev/CONTRIBUTING.md).* + +## Summary + +*Update this section with information on why change is necessary, + what it exactly does and how, if new feature shows up, provide + references (dependencies, similar problems and solutions), etc.* + +## Impact + +*Update this section, where applicable, on how change affects users, + build process, hardware, documentation, security, compatibility, etc.* + +## Testing + +*Update this section with details on how did you verify the change, + what Host was used for build (OS, CPU, compiler, ..), what Target was + used for verification (arch, board:config, ..), etc. Providing build + and runtime logs from before and after change is highly appreciated.* + diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b81074dc8a..aee2d0571bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,6 +364,10 @@ nuttx_export_kconfig(${CMAKE_BINARY_DIR}/.config) include(nuttx_generate_headers) include(nuttx_generate_outputs) include(nuttx_add_library) + +# add NuttX CMake extenstion after nuttx_add_library +include(nuttx_extensions) + include(nuttx_add_application) include(nuttx_add_romfs) include(nuttx_add_symtab) @@ -377,9 +381,6 @@ include(menuconfig) include(ExternalProject) include(FetchContent) -# add NuttX CMake extenstion at last -include(nuttx_extensions) - set(FETCHCONTENT_QUIET OFF) # Board common directory ##################################################### @@ -581,6 +582,11 @@ if(NOT CONFIG_BUILD_KERNEL) endif() +# after we traverse all build directories unify all target dependencies and all +# romfs target +process_all_target_dependencies() +process_all_directory_romfs() + # Link step ################################################################## # Get linker script to use diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst index e3a25a57080..9849d64214c 100644 --- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst @@ -783,3 +783,20 @@ To test the XTWDT(/dev/watchdog3) an interrupt handler needs to be implemented because XTWDT does not have system reset feature. To implement an interrupt handler `WDIOC_CAPTURE` command can be used. When interrupt rises, XTAL32K clock can be restored with `WDIOC_RSTCLK` command. + +adb +--- + +Basic NuttShell configuration console enabled over USB Device (USB ADB). + +You can run the configuration and compilation procedure:: + + $ ./tools/configure.sh esp32s3-devkit:adb + $ make -j16 + $ make flash ESPTOOL_PORT=/dev/ttyACMx + +Then run the adb command:: + + $ adb -s 1234 shell + nsh> uname -a + NuttX 0.0.0 Nov 22 2024 11:41:43 xtensa esp32s3-devkit diff --git a/Kconfig b/Kconfig index c02dd4f51f9..d8edfb613d3 100644 --- a/Kconfig +++ b/Kconfig @@ -2562,6 +2562,10 @@ config TRACE_RPMSGFS_FS bool "Enable tracepoints in rpmsgfs" default n +config TRACE_LROFS_FS + bool "Enable tracepoints in lrofs" + default n + endmenu # Trace Fs Support endif diff --git a/arch/Kconfig b/arch/Kconfig index 86a4e831035..4ec48387fcf 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -278,10 +278,6 @@ endif #ARCH_CHIP_CUSTOM source "$BINDIR/arch/dummy/Kconfig" -config ARCH_TOOLCHAIN_IAR - bool - default n - config ARCH_TOOLCHAIN_GNU bool default n @@ -291,8 +287,9 @@ config ARCH_TOOLCHAIN_CLANG select ARCH_TOOLCHAIN_GNU default n -config ARCH_TOOLCHAIN_TASKING +config ARCH_TOOLCHAIN_GCC bool + select ARCH_TOOLCHAIN_GNU default n config ARCH_TOOLCHAIN_GHS @@ -300,6 +297,14 @@ config ARCH_TOOLCHAIN_GHS select ARCH_TOOLCHAIN_GNU default n +config ARCH_TOOLCHAIN_IAR + bool + default n + +config ARCH_TOOLCHAIN_TASKING + bool + default n + config ARCH_GNU_NO_WEAKFUNCTIONS bool depends on ARCH_TOOLCHAIN_GNU @@ -484,6 +489,11 @@ config ARCH_HAVE_TESTSET bool default n +config ARCH_HAVE_CUSTOM_TESTSET + bool + default n + select ARCH_HAVE_TESTSET + config ARCH_HAVE_THREAD_LOCAL bool default n diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 64328c0006a..72bb3634837 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -17,24 +17,24 @@ config ARM_TOOLCHAIN_IAR config ARM_TOOLCHAIN_BUILDROOT bool "Buildroot (Cygwin or Linux)" depends on !WINDOWS_NATIVE - select ARCH_TOOLCHAIN_GNU + select ARCH_TOOLCHAIN_GCC config ARM_TOOLCHAIN_BUILDROOT_OABI bool "OABI (vs EABI)" depends on !WINDOWS_NATIVE - select ARCH_TOOLCHAIN_GNU + select ARCH_TOOLCHAIN_GCC ---help--- Most of the older buildroot toolchains are OABI config ARM_TOOLCHAIN_GNU_EABI bool "Generic GNU EABI toolchain" - select ARCH_TOOLCHAIN_GNU + select ARCH_TOOLCHAIN_GCC ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) config ARM_TOOLCHAIN_GNU_OABI bool "Generic GNU OABI toolchain" - select ARCH_TOOLCHAIN_GNU + select ARCH_TOOLCHAIN_GCC ---help--- This option should work for any GNU toolchain. @@ -221,6 +221,7 @@ config ARCH_CHIP_LC823450 select ARCH_HAVE_HEAPCHECK select ARCH_HAVE_MULTICPU select ARCH_HAVE_I2CRESET + select ARCH_HAVE_CUSTOM_TESTSET select ARCH_HAVE_CUSTOM_VECTORS ---help--- ON Semiconductor LC823450 architectures (ARM dual Cortex-M3) @@ -344,11 +345,11 @@ config ARCH_CHIP_RP2040 select ARCH_CORTEXM0 select ARCH_HAVE_RAMVECTORS select ARCH_HAVE_MULTICPU - select ARCH_HAVE_TESTSET select ARCH_HAVE_I2CRESET select ARM_HAVE_WFE_SEV select ARCH_HAVE_PWM_MULTICHAN select ARCH_BOARD_COMMON + select ARCH_HAVE_CUSTOM_TESTSET select ARCH_HAVE_CUSTOM_VECTORS ---help--- Raspberry Pi RP2040 architectures (ARM dual Cortex-M0+). @@ -655,6 +656,7 @@ config ARCH_CHIP_CXD56XX select ARCH_HAVE_SDIO if MMCSD select ARCH_HAVE_MATH_H select ARCH_HAVE_I2CRESET + select ARCH_HAVE_CUSTOM_TESTSET select ARCH_HAVE_CUSTOM_VECTORS ---help--- Sony CXD56XX (ARM Cortex-M4) architectures @@ -693,6 +695,7 @@ config ARCH_CHIP_GOLDFISH_ARM select ARCH_HAVE_RESET select ARM_HAVE_PSCI select ARM_HAVE_NEON + select ARCH_IDLE_CUSTOM ---help--- GOLDFISH virt platform (ARMv7a) diff --git a/arch/arm/include/armv6-m/irq.h b/arch/arm/include/armv6-m/irq.h index d5c2ca43a48..9f3d5c14a66 100644 --- a/arch/arm/include/armv6-m/irq.h +++ b/arch/arm/include/armv6-m/irq.h @@ -45,9 +45,6 @@ #ifdef __ghs__ # define __ARM_ARCH 6 -# ifdef __ARM_DSP__ -# define __ARM_FEATURE_DSP 1 -# endif #endif /* Configuration ************************************************************/ diff --git a/arch/arm/include/armv7-a/irq.h b/arch/arm/include/armv7-a/irq.h index 52c55378cac..ececff0e896 100644 --- a/arch/arm/include/armv7-a/irq.h +++ b/arch/arm/include/armv7-a/irq.h @@ -44,9 +44,6 @@ #ifdef __ghs__ # define __ARM_ARCH 7 -# ifdef __ARM_DSP__ -# define __ARM_FEATURE_DSP 1 -# endif #endif /* IRQ Stack Frame Format: diff --git a/arch/arm/include/armv7-m/irq.h b/arch/arm/include/armv7-m/irq.h index 23facf25f3c..4944ba6983d 100644 --- a/arch/arm/include/armv7-m/irq.h +++ b/arch/arm/include/armv7-m/irq.h @@ -44,9 +44,6 @@ #ifdef __ghs__ # define __ARM_ARCH 7 -# ifdef __ARM_DSP__ -# define __ARM_FEATURE_DSP 1 -# endif #endif /* Configuration ************************************************************/ diff --git a/arch/arm/include/armv7-r/irq.h b/arch/arm/include/armv7-r/irq.h index 5a5149bb307..b50795545a6 100644 --- a/arch/arm/include/armv7-r/irq.h +++ b/arch/arm/include/armv7-r/irq.h @@ -44,9 +44,6 @@ #ifdef __ghs__ # define __ARM_ARCH 7 -# ifdef __ARM_DSP__ -# define __ARM_FEATURE_DSP 1 -# endif #endif /* IRQ Stack Frame Format: diff --git a/arch/arm/include/armv8-m/irq.h b/arch/arm/include/armv8-m/irq.h index ad2e2b786db..32aefa0980e 100644 --- a/arch/arm/include/armv8-m/irq.h +++ b/arch/arm/include/armv8-m/irq.h @@ -44,9 +44,6 @@ #ifdef __ghs__ # define __ARM_ARCH 8 -# ifdef __ARM_DSP__ -# define __ARM_FEATURE_DSP 1 -# endif #endif /* Configuration ************************************************************/ diff --git a/arch/arm/include/armv8-r/irq.h b/arch/arm/include/armv8-r/irq.h index 34084eb7710..91557517bd2 100644 --- a/arch/arm/include/armv8-r/irq.h +++ b/arch/arm/include/armv8-r/irq.h @@ -44,9 +44,6 @@ #ifdef __ghs__ # define __ARM_ARCH 8 -# ifdef __ARM_DSP__ -# define __ARM_FEATURE_DSP 1 -# endif #endif /* IRQ Stack Frame Format: diff --git a/arch/arm/include/irq.h b/arch/arm/include/irq.h index 6334638455a..066be261d8a 100644 --- a/arch/arm/include/irq.h +++ b/arch/arm/include/irq.h @@ -75,6 +75,10 @@ * Pre-processor Prototypes ****************************************************************************/ +#if defined(__ghs__) && defined(__ARM_DSP__) +# define __ARM_FEATURE_DSP 1 +#endif + #ifndef __ASSEMBLY__ #ifndef up_switch_context diff --git a/arch/arm/include/spinlock.h b/arch/arm/include/spinlock.h index 61aa9d74e5d..574579ccf17 100644 --- a/arch/arm/include/spinlock.h +++ b/arch/arm/include/spinlock.h @@ -114,10 +114,7 @@ typedef uint8_t spinlock_t; * ****************************************************************************/ -#if defined(CONFIG_ARCH_HAVE_TESTSET) \ - && !defined(CONFIG_ARCH_CHIP_LC823450) \ - && !defined(CONFIG_ARCH_CHIP_CXD56XX) \ - && !defined(CONFIG_ARCH_CHIP_RP2040) +#if defined(CONFIG_ARCH_HAVE_TESTSET) && !defined(CONFIG_ARCH_HAVE_CUSTOM_TESTSET) static inline_function spinlock_t up_testset(volatile spinlock_t *lock) { spinlock_t ret = SP_UNLOCKED; diff --git a/arch/arm/src/arm/arm_sigdeliver.c b/arch/arm/src/arm/arm_sigdeliver.c index 22589d1e6e7..b55e820604f 100644 --- a/arch/arm/src/arm/arm_sigdeliver.c +++ b/arch/arm/src/arm/arm_sigdeliver.c @@ -97,5 +97,7 @@ void arm_sigdeliver(void) /* Then restore the correct state for this thread of execution. */ board_autoled_off(LED_SIGNAL); + + g_running_tasks[this_cpu()] = NULL; arm_fullcontextrestore(regs); } diff --git a/arch/arm/src/arm/arm_syscall.c b/arch/arm/src/arm/arm_syscall.c index 8a5849e4d2d..a69cc31941c 100644 --- a/arch/arm/src/arm/arm_syscall.c +++ b/arch/arm/src/arm/arm_syscall.c @@ -54,19 +54,23 @@ uint32_t *arm_syscall(uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb = this_task(); uint32_t cmd; - int cpu; /* Nested interrupts are not supported */ DEBUGASSERT(up_current_regs() == NULL); + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } + /* Current regs non-zero indicates that we are processing an interrupt; * current_regs is also used to manage interrupt level context switches. */ - tcb->xcp.regs = regs; up_set_current_regs(regs); /* The SYSCALL command is in R0 on entry. Parameters follow in R1..R7 */ @@ -118,11 +122,6 @@ uint32_t *arm_syscall(uint32_t *regs) */ case SYS_switch_context: - { - DEBUGASSERT(regs[REG_R1] != 0 && regs[REG_R2] != 0); - *(uint32_t **)regs[REG_R1] = regs; - up_set_current_regs((uint32_t *)regs[REG_R2]); - } break; default: @@ -134,7 +133,7 @@ uint32_t *arm_syscall(uint32_t *regs) break; } - if (regs != tcb->xcp.regs) + if (*running_task != tcb) { #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously @@ -145,25 +144,16 @@ uint32_t *arm_syscall(uint32_t *regs) addrenv_switch(NULL); #endif - - /* Record the new "running" task. g_running_tasks[] is only used by - * assertion logic for reporting crashes. - */ - - cpu = this_cpu(); - tcb = current_task(cpu); - /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[cpu]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); - g_running_tasks[cpu] = tcb; + *running_task = tcb; /* Restore the cpu lock */ - restore_critical_section(tcb, cpu); - regs = up_current_regs(); + restore_critical_section(tcb, this_cpu()); } /* Set current_regs to NULL to indicate that we are no longer in an diff --git a/arch/arm/src/armv6-m/arm_doirq.c b/arch/arm/src/armv6-m/arm_doirq.c index 3ec4f182a55..8e8f0de89b6 100644 --- a/arch/arm/src/armv6-m/arm_doirq.c +++ b/arch/arm/src/armv6-m/arm_doirq.c @@ -56,7 +56,13 @@ void exception_direct(void) uint32_t *arm_doirq(int irq, uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS @@ -80,13 +86,9 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) #endif up_irq_save(); - g_running_tasks[this_cpu()]->xcp.regs = regs; } else { - /* Dispatch irq */ - - tcb->xcp.regs = regs; irq_dispatch(irq, regs); } @@ -110,7 +112,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task when context switch occurred. @@ -118,7 +120,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) * crashes. */ - g_running_tasks[this_cpu()] = tcb; + *running_task = tcb; regs = tcb->xcp.regs; #endif diff --git a/arch/arm/src/armv6-m/arm_svcall.c b/arch/arm/src/armv6-m/arm_svcall.c index 55aa6ea07f1..1f0e1c4eb63 100644 --- a/arch/arm/src/armv6-m/arm_svcall.c +++ b/arch/arm/src/armv6-m/arm_svcall.c @@ -83,22 +83,22 @@ static void dispatch_syscall(void) { __asm__ __volatile__ ( - " push {r4, r5}\n" /* Save R4 and R5 */ - " sub sp, sp, #12\n" /* Create a stack frame to hold 3 parms */ - " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ - " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ - " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ - " mov r5, lr\n" /* Save lr in R5 */ - " ldr r4, =g_stublookup\n" /* R4=The base of the stub lookup table */ - " lsl r0, r0, #2\n" /* R0=Offset of the stub for this syscall */ - " ldr r4, [r4, r0]\n" /* R4=Address of the stub for this syscall */ - " blx r5\n" /* Call the stub (modifies lr) */ - " mov lr, r5\n" /* Restore lr */ - " add sp, sp, #12\n" /* Destroy the stack frame */ - " pop {r4, r5}\n" /* Recover R4 and R5 */ - " mov r2, r0\n" /* R2=Save return value in R2 */ - " mov r0, " STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ - " svc " STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ + " push {r4, r5}\n" /* Save R4 and R5 */ + " sub sp, sp, #12\n" /* Create a stack frame to hold 3 parms */ + " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ + " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ + " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ + " mov r5, lr\n" /* Save lr in R5 */ + " ldr r4, =g_stublookup\n" /* R4=The base of the stub lookup table */ + " lsl r0, r0, #2\n" /* R0=Offset of the stub for this syscall */ + " ldr r4, [r4, r0]\n" /* R4=Address of the stub for this syscall */ + " blx r4\n" /* Call the stub (modifies lr) */ + " mov lr, r5\n" /* Restore lr */ + " add sp, sp, #12\n" /* Destroy the stack frame */ + " pop {r4, r5}\n" /* Recover R4 and R5 */ + " mov r2, r0\n" /* R2=Save return value in R2 */ + " mov r0, #" STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ + " svc #" STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ ); } #endif @@ -119,6 +119,7 @@ int arm_svcall(int irq, void *context, void *arg) { struct tcb_s *tcb = this_task(); uint32_t *regs = (uint32_t *)context; + uint32_t *new_regs = regs; uint32_t cmd; cmd = regs[REG_R0]; @@ -167,6 +168,7 @@ int arm_svcall(int irq, void *context, void *arg) case SYS_restore_context: { DEBUGASSERT(regs[REG_R1] != 0); + new_regs = (uint32_t *)regs[REG_R1]; tcb->xcp.regs = (uint32_t *)regs[REG_R1]; } break; @@ -191,8 +193,7 @@ int arm_svcall(int irq, void *context, void *arg) case SYS_switch_context: { DEBUGASSERT(regs[REG_R1] != 0 && regs[REG_R2] != 0); - *(uint32_t **)regs[REG_R1] = regs; - tcb->xcp.regs = (uint32_t *)regs[REG_R2]; + new_regs = (uint32_t *)regs[REG_R2]; } break; @@ -446,12 +447,12 @@ int arm_svcall(int irq, void *context, void *arg) * switch. */ - if (regs != tcb->xcp.regs) + if (regs != new_regs) { restore_critical_section(tcb, this_cpu()); #ifdef CONFIG_DEBUG_SYSCALL_INFO - regs = (uint32_t *)tcb->xcp.regs; + regs = new_regs; svcinfo("SVCall Return:\n"); svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", diff --git a/arch/arm/src/armv7-a/arm_sigdeliver.c b/arch/arm/src/armv7-a/arm_sigdeliver.c index 98ac0e115b6..1867aa88446 100644 --- a/arch/arm/src/armv7-a/arm_sigdeliver.c +++ b/arch/arm/src/armv7-a/arm_sigdeliver.c @@ -160,5 +160,7 @@ void arm_sigdeliver(void) leave_critical_section(regs[REG_CPSR]); rtcb->irqcount--; #endif + + g_running_tasks[this_cpu()] = NULL; arm_fullcontextrestore(regs); } diff --git a/arch/arm/src/armv7-a/arm_syscall.c b/arch/arm/src/armv7-a/arm_syscall.c index a1c8fdced17..dc420295ad7 100644 --- a/arch/arm/src/armv7-a/arm_syscall.c +++ b/arch/arm/src/armv7-a/arm_syscall.c @@ -124,19 +124,19 @@ static void dispatch_syscall(void) { __asm__ __volatile__ ( - " sub sp, sp, #16\n" /* Create a stack frame to hold 3 parms + lr */ - " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ - " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ - " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ - " str lr, [sp, #12]\n" /* Save lr in the stack frame */ - " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ - " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this SYSCALL */ - " blx ip\n" /* Call the stub (modifies lr) */ - " ldr lr, [sp, #12]\n" /* Restore lr */ - " add sp, sp, #16\n" /* Destroy the stack frame */ - " mov r2, r0\n" /* R2=Save return value in R2 */ - " mov r0, " STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ - " svc " STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ + " sub sp, sp, #16\n" /* Create a stack frame to hold 3 parms + lr */ + " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ + " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ + " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ + " str lr, [sp, #12]\n" /* Save lr in the stack frame */ + " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ + " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this SYSCALL */ + " blx ip\n" /* Call the stub (modifies lr) */ + " ldr lr, [sp, #12]\n" /* Restore lr */ + " add sp, sp, #16\n" /* Destroy the stack frame */ + " mov r2, r0\n" /* R2=Save return value in R2 */ + " mov r0, #" STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ + " svc #" STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ ); } #endif @@ -159,9 +159,9 @@ static void dispatch_syscall(void) uint32_t *arm_syscall(uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; struct tcb_s *tcb = this_task(); uint32_t cmd; - int cpu; #ifdef CONFIG_BUILD_KERNEL uint32_t cpsr; #endif @@ -170,7 +170,10 @@ uint32_t *arm_syscall(uint32_t *regs) DEBUGASSERT(up_current_regs() == NULL); - tcb->xcp.regs = regs; + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } /* Current regs non-zero indicates that we are processing an interrupt; * current_regs is also used to manage interrupt level context switches. @@ -296,11 +299,6 @@ uint32_t *arm_syscall(uint32_t *regs) */ case SYS_switch_context: - { - DEBUGASSERT(regs[REG_R1] != 0 && regs[REG_R2] != 0); - *(uint32_t **)regs[REG_R1] = regs; - tcb->xcp.regs = (uint32_t *)regs[REG_R2]; - } break; /* R0=SYS_task_start: This a user task start @@ -566,7 +564,7 @@ uint32_t *arm_syscall(uint32_t *regs) break; } - if (regs != tcb->xcp.regs) + if (*running_task != tcb) { #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously @@ -578,23 +576,20 @@ uint32_t *arm_syscall(uint32_t *regs) addrenv_switch(NULL); #endif - cpu = this_cpu(); - tcb = current_task(cpu); - /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[cpu]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task. g_running_tasks[] is only used by * assertion logic for reporting crashes. */ - g_running_tasks[cpu] = tcb; + *running_task = tcb; /* Restore the cpu lock */ - restore_critical_section(tcb, cpu); + restore_critical_section(tcb, this_cpu()); regs = tcb->xcp.regs; } diff --git a/arch/arm/src/armv7-m/arm_doirq.c b/arch/arm/src/armv7-m/arm_doirq.c index 3f585442291..94a0f3e4f4d 100644 --- a/arch/arm/src/armv7-m/arm_doirq.c +++ b/arch/arm/src/armv7-m/arm_doirq.c @@ -56,7 +56,13 @@ void exception_direct(void) uint32_t *arm_doirq(int irq, uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS @@ -80,13 +86,9 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) #endif up_irq_save(); - g_running_tasks[this_cpu()]->xcp.regs = regs; } else { - /* Dispatch irq */ - - tcb->xcp.regs = regs; irq_dispatch(irq, regs); } @@ -110,7 +112,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task when context switch occurred. @@ -118,7 +120,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) * crashes. */ - g_running_tasks[this_cpu()] = tcb; + *running_task = tcb; regs = tcb->xcp.regs; #endif diff --git a/arch/arm/src/armv7-m/arm_svcall.c b/arch/arm/src/armv7-m/arm_svcall.c index 18a578f7cc3..da5122e8bb8 100644 --- a/arch/arm/src/armv7-m/arm_svcall.c +++ b/arch/arm/src/armv7-m/arm_svcall.c @@ -88,25 +88,25 @@ static void dispatch_syscall(void) * = orig_SP - 20 - ((orig_SP - 20) & ~7) */ - " mov ip, sp\n" /* Calculate (orig_SP - new_SP) */ + " mov ip, sp\n" /* Calculate (orig_SP - new_SP) */ " sub ip, ip, #20\n" " and ip, ip, #7\n" " add ip, ip, #20\n" " sub sp, sp, ip\n" - " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ - " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ - " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ - " str lr, [sp, #12]\n" /* Save lr in the stack frame */ - " str ip, [sp, #16]\n" /* Save (orig_SP - new_SP) value */ - " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ - " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this syscall */ - " blx ip\n" /* Call the stub (modifies lr) */ - " ldr lr, [sp, #12]\n" /* Restore lr */ - " ldr r2, [sp, #16]\n" /* Restore (orig_SP - new_SP) value */ - " add sp, sp, r2\n" /* Restore SP */ - " mov r2, r0\n" /* R2=Save return value in R2 */ - " mov r0, " STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ - " svc " STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ + " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ + " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ + " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ + " str lr, [sp, #12]\n" /* Save lr in the stack frame */ + " str ip, [sp, #16]\n" /* Save (orig_SP - new_SP) value */ + " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ + " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this syscall */ + " blx ip\n" /* Call the stub (modifies lr) */ + " ldr lr, [sp, #12]\n" /* Restore lr */ + " ldr r2, [sp, #16]\n" /* Restore (orig_SP - new_SP) value */ + " add sp, sp, r2\n" /* Restore SP */ + " mov r2, r0\n" /* R2=Save return value in R2 */ + " mov r0, #" STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ + " svc #" STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ ); } #endif @@ -127,6 +127,7 @@ int arm_svcall(int irq, void *context, void *arg) { struct tcb_s *tcb = this_task(); uint32_t *regs = (uint32_t *)context; + uint32_t *new_regs = regs; uint32_t cmd; cmd = regs[REG_R0]; @@ -176,6 +177,7 @@ int arm_svcall(int irq, void *context, void *arg) case SYS_restore_context: { DEBUGASSERT(regs[REG_R1] != 0); + new_regs = (uint32_t *)regs[REG_R1]; tcb->xcp.regs = (uint32_t *)regs[REG_R1]; } break; @@ -200,8 +202,7 @@ int arm_svcall(int irq, void *context, void *arg) case SYS_switch_context: { DEBUGASSERT(regs[REG_R1] != 0 && regs[REG_R2] != 0); - *(uint32_t **)regs[REG_R1] = regs; - tcb->xcp.regs = (uint32_t *)regs[REG_R2]; + new_regs = (uint32_t *)regs[REG_R2]; } break; @@ -456,12 +457,12 @@ int arm_svcall(int irq, void *context, void *arg) * switch. */ - if (regs != tcb->xcp.regs) + if (regs != new_regs) { restore_critical_section(tcb, this_cpu()); #ifdef CONFIG_DEBUG_SYSCALL_INFO - regs = (uint32_t *)tcb->xcp.regs; + regs = new_regs; svcinfo("SVCall Return:\n"); svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", diff --git a/arch/arm/src/armv7-r/arm_sigdeliver.c b/arch/arm/src/armv7-r/arm_sigdeliver.c index 706f6ad5551..5a63458b9b0 100644 --- a/arch/arm/src/armv7-r/arm_sigdeliver.c +++ b/arch/arm/src/armv7-r/arm_sigdeliver.c @@ -157,5 +157,7 @@ void arm_sigdeliver(void) leave_critical_section(regs[REG_CPSR]); rtcb->irqcount--; #endif + + g_running_tasks[this_cpu()] = NULL; arm_fullcontextrestore(regs); } diff --git a/arch/arm/src/armv7-r/arm_syscall.c b/arch/arm/src/armv7-r/arm_syscall.c index 2467c032077..b4f3a5047bf 100644 --- a/arch/arm/src/armv7-r/arm_syscall.c +++ b/arch/arm/src/armv7-r/arm_syscall.c @@ -121,19 +121,19 @@ static void dispatch_syscall(void) { __asm__ __volatile__ ( - " sub sp, sp, #16\n" /* Create a stack frame to hold 3 parms + lr */ - " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ - " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ - " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ - " str lr, [sp, #12]\n" /* Save lr in the stack frame */ - " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ - " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this SYSCALL */ - " blx ip\n" /* Call the stub (modifies lr) */ - " ldr lr, [sp, #12]\n" /* Restore lr */ - " add sp, sp, #16\n" /* Destroy the stack frame */ - " mov r2, r0\n" /* R2=Save return value in R2 */ - " mov r0, " STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ - " svc " STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ + " sub sp, sp, #16\n" /* Create a stack frame to hold 3 parms + lr */ + " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ + " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ + " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ + " str lr, [sp, #12]\n" /* Save lr in the stack frame */ + " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ + " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this SYSCALL */ + " blx ip\n" /* Call the stub (modifies lr) */ + " ldr lr, [sp, #12]\n" /* Restore lr */ + " add sp, sp, #16\n" /* Destroy the stack frame */ + " mov r2, r0\n" /* R2=Save return value in R2 */ + " mov r0, #" STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ + " svc #" STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ ); } #endif @@ -156,10 +156,9 @@ static void dispatch_syscall(void) uint32_t *arm_syscall(uint32_t *regs) { - struct tcb_s *tcb = this_task(); - + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb = this_task(); uint32_t cmd; - int cpu; #ifdef CONFIG_BUILD_PROTECTED uint32_t cpsr; #endif @@ -168,7 +167,10 @@ uint32_t *arm_syscall(uint32_t *regs) DEBUGASSERT(up_current_regs() == NULL); - tcb->xcp.regs = regs; + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } /* Current regs non-zero indicates that we are processing an interrupt; * current_regs is also used to manage interrupt level context switches. @@ -294,11 +296,6 @@ uint32_t *arm_syscall(uint32_t *regs) */ case SYS_switch_context: - { - DEBUGASSERT(regs[REG_R1] != 0 && regs[REG_R2] != 0); - *(uint32_t **)regs[REG_R1] = regs; - tcb->xcp.regs = (uint32_t *)regs[REG_R2]; - } break; /* R0=SYS_task_start: This a user task start @@ -564,24 +561,22 @@ uint32_t *arm_syscall(uint32_t *regs) break; } - if (regs != tcb->xcp.regs) + if (*running_task != tcb) { - cpu = this_cpu(); - /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[cpu]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task. g_running_tasks[] is only used by * assertion logic for reporting crashes. */ - g_running_tasks[cpu] = tcb; + *running_task = tcb; /* Restore the cpu lock */ - restore_critical_section(tcb, cpu); + restore_critical_section(tcb, this_cpu()); regs = tcb->xcp.regs; } diff --git a/arch/arm/src/armv8-m/arm_doirq.c b/arch/arm/src/armv8-m/arm_doirq.c index df51d7c6fb9..5f23362a541 100644 --- a/arch/arm/src/armv8-m/arm_doirq.c +++ b/arch/arm/src/armv8-m/arm_doirq.c @@ -67,7 +67,13 @@ void exception_direct(void) uint32_t *arm_doirq(int irq, uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS @@ -91,13 +97,9 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) #endif up_irq_save(); - g_running_tasks[this_cpu()]->xcp.regs = regs; } else { - /* Dispatch irq */ - - tcb->xcp.regs = regs; irq_dispatch(irq, regs); } @@ -121,7 +123,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task when context switch occurred. @@ -129,7 +131,7 @@ uint32_t *arm_doirq(int irq, uint32_t *regs) * crashes. */ - g_running_tasks[this_cpu()] = tcb; + *running_task = tcb; regs = tcb->xcp.regs; #endif diff --git a/arch/arm/src/armv8-m/arm_svcall.c b/arch/arm/src/armv8-m/arm_svcall.c index 168b071e3b4..fda01dd16f4 100644 --- a/arch/arm/src/armv8-m/arm_svcall.c +++ b/arch/arm/src/armv8-m/arm_svcall.c @@ -88,25 +88,25 @@ static void dispatch_syscall(void) * = orig_SP - 20 - ((orig_SP - 20) & ~7) */ - " mov ip, sp\n" /* Calculate (orig_SP - new_SP) */ + " mov ip, sp\n" /* Calculate (orig_SP - new_SP) */ " sub ip, ip, #20\n" " and ip, ip, #7\n" " add ip, ip, #20\n" " sub sp, sp, ip\n" - " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ - " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ - " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ - " str lr, [sp, #12]\n" /* Save lr in the stack frame */ - " str ip, [sp, #16]\n" /* Save (orig_SP - new_SP) value */ - " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ - " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this syscall */ - " blx ip\n" /* Call the stub (modifies lr) */ - " ldr lr, [sp, #12]\n" /* Restore lr */ - " ldr r2, [sp, #16]\n" /* Restore (orig_SP - new_SP) value */ - " add sp, sp, r2\n" /* Restore SP */ - " mov r2, r0\n" /* R2=Save return value in R2 */ - " mov r0, " STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ - " svc " STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ + " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ + " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ + " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ + " str lr, [sp, #12]\n" /* Save lr in the stack frame */ + " str ip, [sp, #16]\n" /* Save (orig_SP - new_SP) value */ + " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ + " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this syscall */ + " blx ip\n" /* Call the stub (modifies lr) */ + " ldr lr, [sp, #12]\n" /* Restore lr */ + " ldr r2, [sp, #16]\n" /* Restore (orig_SP - new_SP) value */ + " add sp, sp, r2\n" /* Restore SP */ + " mov r2, r0\n" /* R2=Save return value in R2 */ + " mov r0, #" STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ + " svc #" STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ ); } #endif @@ -127,6 +127,7 @@ int arm_svcall(int irq, void *context, void *arg) { struct tcb_s *tcb = this_task(); uint32_t *regs = (uint32_t *)context; + uint32_t *new_regs = regs; uint32_t cmd; cmd = regs[REG_R0]; @@ -176,6 +177,7 @@ int arm_svcall(int irq, void *context, void *arg) case SYS_restore_context: { DEBUGASSERT(regs[REG_R1] != 0); + new_regs = (uint32_t *)regs[REG_R1]; tcb->xcp.regs = (uint32_t *)regs[REG_R1]; } break; @@ -200,8 +202,7 @@ int arm_svcall(int irq, void *context, void *arg) case SYS_switch_context: { DEBUGASSERT(regs[REG_R1] != 0 && regs[REG_R2] != 0); - *(uint32_t **)regs[REG_R1] = regs; - tcb->xcp.regs = (uint32_t *)regs[REG_R2]; + new_regs = (uint32_t *)regs[REG_R2]; } break; @@ -456,12 +457,12 @@ int arm_svcall(int irq, void *context, void *arg) * switch. */ - if (regs != tcb->xcp.regs) + if (regs != new_regs) { restore_critical_section(tcb, this_cpu()); #ifdef CONFIG_DEBUG_SYSCALL_INFO - regs = (uint32_t *)tcb->xcp.regs; + regs = new_regs; svcinfo("SVCall Return:\n"); svcinfo(" R0: %08x %08x %08x %08x %08x %08x %08x %08x\n", diff --git a/arch/arm/src/armv8-r/arm_sigdeliver.c b/arch/arm/src/armv8-r/arm_sigdeliver.c index a6837079a3c..e4a8ad59353 100644 --- a/arch/arm/src/armv8-r/arm_sigdeliver.c +++ b/arch/arm/src/armv8-r/arm_sigdeliver.c @@ -155,5 +155,7 @@ void arm_sigdeliver(void) leave_critical_section(regs[REG_CPSR]); rtcb->irqcount--; #endif + + g_running_tasks[this_cpu()] = NULL; arm_fullcontextrestore(regs); } diff --git a/arch/arm/src/armv8-r/arm_syscall.c b/arch/arm/src/armv8-r/arm_syscall.c index 87ff43dc849..ab3f6cae88f 100644 --- a/arch/arm/src/armv8-r/arm_syscall.c +++ b/arch/arm/src/armv8-r/arm_syscall.c @@ -121,19 +121,19 @@ static void dispatch_syscall(void) { __asm__ __volatile__ ( - " sub sp, sp, #16\n" /* Create a stack frame to hold 3 parms + lr */ - " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ - " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ - " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ - " str lr, [sp, #12]\n" /* Save lr in the stack frame */ - " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ - " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this SYSCALL */ - " blx ip\n" /* Call the stub (modifies lr) */ - " ldr lr, [sp, #12]\n" /* Restore lr */ - " add sp, sp, #16\n" /* Destroy the stack frame */ - " mov r2, r0\n" /* R2=Save return value in R2 */ - " mov r0, " STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ - " svc " STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ + " sub sp, sp, #16\n" /* Create a stack frame to hold 3 parms + lr */ + " str r4, [sp, #0]\n" /* Move parameter 4 (if any) into position */ + " str r5, [sp, #4]\n" /* Move parameter 5 (if any) into position */ + " str r6, [sp, #8]\n" /* Move parameter 6 (if any) into position */ + " str lr, [sp, #12]\n" /* Save lr in the stack frame */ + " ldr ip, =g_stublookup\n" /* R12=The base of the stub lookup table */ + " ldr ip, [ip, r0, lsl #2]\n" /* R12=The address of the stub for this SYSCALL */ + " blx ip\n" /* Call the stub (modifies lr) */ + " ldr lr, [sp, #12]\n" /* Restore lr */ + " add sp, sp, #16\n" /* Destroy the stack frame */ + " mov r2, r0\n" /* R2=Save return value in R2 */ + " mov r0, #" STRINGIFY(SYS_syscall_return) "\n" /* R0=SYS_syscall_return */ + " svc #" STRINGIFY(SYS_syscall) "\n" /* Return from the SYSCALL */ ); } #endif @@ -156,9 +156,9 @@ static void dispatch_syscall(void) uint32_t *arm_syscall(uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + FAR struct tcb_s *tcb = this_task(); uint32_t cmd; - int cpu; #ifdef CONFIG_BUILD_PROTECTED uint32_t cpsr; #endif @@ -167,7 +167,10 @@ uint32_t *arm_syscall(uint32_t *regs) DEBUGASSERT(up_current_regs() == NULL); - tcb->xcp.regs = regs; + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } /* Current regs non-zero indicates that we are processing an interrupt; * current_regs is also used to manage interrupt level context switches. @@ -293,11 +296,6 @@ uint32_t *arm_syscall(uint32_t *regs) */ case SYS_switch_context: - { - DEBUGASSERT(regs[REG_R1] != 0 && regs[REG_R2] != 0); - *(uint32_t **)regs[REG_R1] = regs; - tcb->xcp.regs = (uint32_t *)regs[REG_R2]; - } break; /* R0=SYS_task_start: This a user task start @@ -563,24 +561,22 @@ uint32_t *arm_syscall(uint32_t *regs) break; } - if (regs != tcb->xcp.regs) + if (*running_task != tcb) { - cpu = this_cpu(); - /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[cpu]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task. g_running_tasks[] is only used by * assertion logic for reporting crashes. */ - g_running_tasks[cpu] = tcb; + *running_task = tcb; /* Restore the cpu lock */ - restore_critical_section(tcb, cpu); + restore_critical_section(tcb, this_cpu()); regs = tcb->xcp.regs; } diff --git a/arch/arm/src/cmake/armclang.cmake b/arch/arm/src/cmake/armclang.cmake index 6b383f114fc..0d023b114bc 100644 --- a/arch/arm/src/cmake/armclang.cmake +++ b/arch/arm/src/cmake/armclang.cmake @@ -116,11 +116,11 @@ if(CONFIG_STACK_USAGE_WARNING AND NOT "${CONFIG_STACK_USAGE_WARNING}" STREQUAL add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING}) endif() -if(CONFIG_SCHED_GCOV) - add_compile_options(-fprofile-generate -ftest-coverage) +if(CONFIG_COVERAGE_ALL) + add_compile_options(-fprofile-instr-generate -fcoverage-mapping) endif() -if(CONFIG_SCHED_GPROF_ALL) +if(CONFIG_PROFILE_ALL) add_compile_options(-pg) endif() diff --git a/arch/arm/src/cmake/clang.cmake b/arch/arm/src/cmake/clang.cmake index 1c45aa01b56..de5bfacb83c 100644 --- a/arch/arm/src/cmake/clang.cmake +++ b/arch/arm/src/cmake/clang.cmake @@ -117,11 +117,11 @@ if(CONFIG_STACK_USAGE_WARNING AND NOT "${CONFIG_STACK_USAGE_WARNING}" STREQUAL add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING}) endif() -if(CONFIG_SCHED_GCOV_ALL) - add_compile_options(-fprofile-generate -ftest-coverage) +if(CONFIG_COVERAGE_ALL) + add_compile_options(-fprofile-instr-generate -fcoverage-mapping) endif() -if(CONFIG_SCHED_GPROF_ALL) +if(CONFIG_PROFILE_ALL) add_compile_options(-pg) endif() @@ -238,14 +238,31 @@ set(PREPROCESS ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} -E -P -x c) set(NUTTX_FIND_TOOLCHAIN_LIB_DEFINED true) if(CONFIG_BUILTIN_TOOLCHAIN) - function(nuttx_find_toolchain_lib) - execute_process( - COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} - --print-file-name - OUTPUT_STRIP_TRAILING_WHITESPACE - OUTPUT_VARIABLE extra_lib_path) - nuttx_add_extra_library(${extra_lib_path}) - endfunction() + if(ARGN) + function(nuttx_find_toolchain_lib) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=${ARGN} + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE extra_lib_path) + nuttx_add_extra_library(${extra_lib_path}) + endfunction() + else() + function(nuttx_find_toolchain_lib) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} + --print-libgcc-file-name + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE libgcc_path) + get_filename_component(libgcc_name ${libgcc_path} NAME) + execute_process( + COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} + --print-file-name=${libgcc_name} + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE libgcc) + nuttx_add_extra_library(${libgcc}) + endfunction() + endif() else() function(nuttx_find_toolchain_lib) if(ARGN) diff --git a/arch/arm/src/cmake/gcc.cmake b/arch/arm/src/cmake/gcc.cmake index 9131695e44a..42fb5b532e1 100644 --- a/arch/arm/src/cmake/gcc.cmake +++ b/arch/arm/src/cmake/gcc.cmake @@ -67,6 +67,7 @@ if(CONFIG_ARCH_TOOLCHAIN_GNU AND NOT CONFIG_ARCH_TOOLCHAIN_CLANG) if(GCCVER GREATER_EQUAL 12) add_link_options(-Wl,--print-memory-usage) add_compile_options(--param=min-pagesize=0) + add_compile_options(-Wno-alloc-size-larger-than) if(CONFIG_ARCH_RAMFUNCS) add_link_options(-Wl,--no-warn-rwx-segments) endif() @@ -127,11 +128,11 @@ if(CONFIG_STACK_USAGE_WARNING AND NOT "${CONFIG_STACK_USAGE_WARNING}" STREQUAL add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING}) endif() -if(CONFIG_SCHED_GCOV_ALL) +if(CONFIG_COVERAGE_ALL) add_compile_options(-fprofile-generate -ftest-coverage) endif() -if(CONFIG_SCHED_GPROF_ALL) +if(CONFIG_PROFILE_ALL) add_compile_options(-pg) endif() @@ -165,7 +166,7 @@ if(CONFIG_ARCH_INSTRUMENT_ALL) add_compile_options(-finstrument-functions) endif() -if(CONFIG_SCHED_GPROF_ALL) +if(CONFIG_PROFILE_ALL) add_compile_options(-pg) endif() diff --git a/arch/arm/src/cmake/ghs.cmake b/arch/arm/src/cmake/ghs.cmake index d1636f2e86b..d45d521bbf1 100644 --- a/arch/arm/src/cmake/ghs.cmake +++ b/arch/arm/src/cmake/ghs.cmake @@ -88,11 +88,11 @@ if(CONFIG_STACK_USAGE_WARNING AND NOT "${CONFIG_STACK_USAGE_WARNING}" STREQUAL add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING}) endif() -if(CONFIG_SCHED_GCOV_ALL) +if(CONFIG_COVERAGE_ALL) add_compile_options(-fprofile-generate -ftest-coverage) endif() -if(CONFIG_SCHED_GPROF_ALL) +if(CONFIG_PROFILE_ALL) add_compile_options(-pg) endif() diff --git a/arch/arm/src/cmake/platform.cmake b/arch/arm/src/cmake/platform.cmake index 26e9adaebd8..401eac466a1 100644 --- a/arch/arm/src/cmake/platform.cmake +++ b/arch/arm/src/cmake/platform.cmake @@ -83,6 +83,6 @@ if(CONFIG_LIBSUPCXX_TOOLCHAIN) nuttx_find_toolchain_lib(libsupc++.a) endif() -if(CONFIG_SCHED_GCOV) +if(CONFIG_COVERAGE_TOOLCHAIN) nuttx_find_toolchain_lib(libgcov.a) endif() diff --git a/arch/arm/src/common/Toolchain.defs b/arch/arm/src/common/Toolchain.defs index ac37f8396ea..021d8fa90f8 100644 --- a/arch/arm/src/common/Toolchain.defs +++ b/arch/arm/src/common/Toolchain.defs @@ -72,7 +72,15 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0) ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING) endif -ifeq ($(CONFIG_SCHED_GPROF_ALL),y) +ifeq ($(CONFIG_COVERAGE_ALL),y) + ifeq ($(CONFIG_ARCH_TOOLCHAIN_GCC),y) + ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage + else ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) + ARCHOPTIMIZATION += -fprofile-instr-generate -fcoverage-mapping + endif +endif + +ifeq ($(CONFIG_PROFILE_ALL),y) ARCHOPTIMIZATION += -pg endif @@ -312,14 +320,18 @@ else # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105523 ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y) - ifeq ($(GCCVER),) - export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1) - endif - ifeq ($(shell expr "$(GCCVER)" \>= 12), 1) - ARCHOPTIMIZATION += --param=min-pagesize=0 - LDFLAGS += --print-memory-usage - ifeq ($(CONFIG_ARCH_RAMFUNCS),y) - LDFLAGS += --no-warn-rwx-segments + ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),) + ifeq ($(GCCVER),) + export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1) + endif + ifeq ($(shell expr "$(GCCVER)" \>= 12), 1) + ARCHOPTIMIZATION += --param=min-pagesize=0 -Wno-alloc-size-larger-than + LDFLAGS += --print-memory-usage + ifeq ($(CONFIG_ARCH_RAMFUNCS),y) + LDFLAGS += --no-warn-rwx-segments + else ifeq ($(CONFIG_BOOT_RUNFROMFLASH),) + LDFLAGS += --no-warn-rwx-segments + endif endif endif endif @@ -498,7 +510,7 @@ ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a)) endif diff --git a/arch/arm/src/cxd56xx/cxd56_hostif.c b/arch/arm/src/cxd56xx/cxd56_hostif.c index f37501fb52e..cb1756f60a6 100644 --- a/arch/arm/src/cxd56xx/cxd56_hostif.c +++ b/arch/arm/src/cxd56xx/cxd56_hostif.c @@ -147,7 +147,9 @@ static const struct file_operations g_hif_fops = hif_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - hif_poll /* poll */ + hif_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , hif_unlink /* unlink */ #endif diff --git a/arch/arm/src/goldfish/CMakeLists.txt b/arch/arm/src/goldfish/CMakeLists.txt index 229763209b5..26ac836951d 100644 --- a/arch/arm/src/goldfish/CMakeLists.txt +++ b/arch/arm/src/goldfish/CMakeLists.txt @@ -24,4 +24,8 @@ if(CONFIG_SMP) list(APPEND SRCS goldfish_cpuboot.c) endif() +if(CONFIG_ARCH_IDLE_CUSTOM) + list(APPEND SRCS goldfish_idle.c) +endif() + target_sources(arch PRIVATE ${SRCS}) diff --git a/arch/arm/src/goldfish/Make.defs b/arch/arm/src/goldfish/Make.defs index e3d93e34f77..20ff9d3fea3 100644 --- a/arch/arm/src/goldfish/Make.defs +++ b/arch/arm/src/goldfish/Make.defs @@ -28,3 +28,7 @@ CHIP_CSRCS += goldfish_memorymap.c goldfish_serial.c goldfish_timer.c ifeq ($(CONFIG_SMP),y) CHIP_CSRCS += goldfish_cpuboot.c endif + +ifeq ($(CONFIG_ARCH_IDLE_CUSTOM),y) +CHIP_CSRCS += goldfish_idle.c +endif diff --git a/arch/arm/src/goldfish/goldfish_idle.c b/arch/arm/src/goldfish/goldfish_idle.c new file mode 100644 index 00000000000..d46dee93e41 --- /dev/null +++ b/arch/arm/src/goldfish/goldfish_idle.c @@ -0,0 +1,63 @@ +/**************************************************************************** + * arch/arm/src/goldfish/goldfish_idle.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include "arm_internal.h" + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_idle + * + * Description: + * up_idle() is the logic that will be executed when there is no other + * ready-to-run task. This is processor idle time and will continue until + * some interrupt occurs to cause a context switch from the idle task. + * + * Processing in this state may be processor-specific. e.g., this is where + * power management operations might be performed. + * + ****************************************************************************/ + +void up_idle(void) +{ +#if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS) + /* If the system is idle and there are no timer interrupts, then process + * "fake" timer interrupts. Hopefully, something will wake up. + */ + + nxsched_process_timer(); +#else + + /* Sleep until an interrupt occurs to save power */ + + asm("WFI"); +#endif +} diff --git a/arch/arm/src/goldfish/goldfish_memorymap.h b/arch/arm/src/goldfish/goldfish_memorymap.h index 0c323de064c..b4acfcc3e60 100644 --- a/arch/arm/src/goldfish/goldfish_memorymap.h +++ b/arch/arm/src/goldfish/goldfish_memorymap.h @@ -38,7 +38,7 @@ /* Goldfish virt Physical Memory Map ****************************************/ -#define VIRT_FLASH_PSECTION 0x00000000 /* 0x00000000-0x08000000 */ +#define VIRT_FLASH_PSECTION 0x00600000 /* 0x00600000-0x08000000 */ #define VIRT_IO_PSECTION 0x08000000 /* 0x08000000-0x0f000000 */ #define VIRT_PCIE_PSECTION 0x10000000 /* 0x10000000-0x40000000 */ #define VIRT_DDR_PSECTION 0x40000000 /* 0x40000000-0x50000000 */ @@ -52,7 +52,7 @@ /* Sizes of memory regions in bytes. */ -#define VIRT_FLASH_SECSIZE (128*1024*1024) +#define VIRT_FLASH_SECSIZE (122*1024*1024) #define VIRT_IO_SECSIZE (112*1024*1024) #define VIRT_PCIE_SECSIZE (3*256*1024*1024) #define VIRT_DDR_SECSIZE (256*1024*1024) diff --git a/arch/arm/src/qemu/qemu_idle.c b/arch/arm/src/qemu/qemu_idle.c index 3bd00244a27..c0d1b900c44 100644 --- a/arch/arm/src/qemu/qemu_idle.c +++ b/arch/arm/src/qemu/qemu_idle.c @@ -61,19 +61,16 @@ void up_idle(void) arm_sm_boot_nsec(g_ap_entry); arm_sm_switch_nsec(); } -#else - #if defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS) +#elif defined(CONFIG_SUPPRESS_INTERRUPTS) || defined(CONFIG_SUPPRESS_TIMER_INTS) /* If the system is idle and there are no timer interrupts, then process * "fake" timer interrupts. Hopefully, something will wake up. */ - nxsched_process_timer(); - - #else + nxsched_process_timer(); +#else /* Sleep until an interrupt occurs to save power */ - asm("WFI"); - #endif + asm("WFI"); #endif } diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 6362df9e6e0..77a1151dae1 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -12,7 +12,7 @@ choice config ARM64_TOOLCHAIN_GNU_EABI bool "Generic GNU EABI toolchain" - select ARCH_TOOLCHAIN_GNU + select ARCH_TOOLCHAIN_GCC ---help--- This option should work for any modern GNU toolchain (GCC 4.5 or newer) diff --git a/arch/arm64/include/irq.h b/arch/arm64/include/irq.h index 778d741c74a..f4c91fdd0da 100644 --- a/arch/arm64/include/irq.h +++ b/arch/arm64/include/irq.h @@ -51,9 +51,6 @@ #ifdef __ghs__ # define __ARM_ARCH 8 -# ifdef __ARM_DSP__ -# define __ARM_FEATURE_DSP 1 -# endif #endif #define up_getsp() (uintptr_t)__builtin_frame_address(0) @@ -410,14 +407,15 @@ static inline void up_irq_restore(irqstate_t flags) #define up_update_task(t) modify_sysreg(t, ~1ul, tpidr_el1) #define up_interrupt_context() (read_sysreg(tpidr_el1) & 1) -#define up_switch_context(tcb, rtcb) \ - do { \ - if (!up_interrupt_context()) \ - { \ - sys_call2(SYS_switch_context, (uintptr_t)&rtcb->xcp.regs, \ - (uintptr_t)tcb->xcp.regs); \ - } \ - } while (0) +#define up_switch_context(tcb, rtcb) \ + do \ + { \ + if (!up_interrupt_context()) \ + { \ + sys_call2(SYS_switch_context, (uintptr_t)rtcb, (uintptr_t)tcb); \ + } \ + } \ + while (0) /**************************************************************************** * Name: up_getusrpc diff --git a/arch/arm64/src/Toolchain.defs b/arch/arm64/src/Toolchain.defs index 1da73fb715b..1e910b34c9f 100644 --- a/arch/arm64/src/Toolchain.defs +++ b/arch/arm64/src/Toolchain.defs @@ -104,7 +104,15 @@ ifeq ($(CONFIG_ARCH_INSTRUMENT_ALL),y) ARCHOPTIMIZATION += -finstrument-functions endif -ifeq ($(CONFIG_SCHED_GPROF_ALL),y) +ifeq ($(CONFIG_COVERAGE_ALL),y) + ifeq ($(CONFIG_ARCH_TOOLCHAIN_GCC),y) + ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage + else ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) + ARCHOPTIMIZATION += -fprofile-instr-generate -fcoverage-mapping + endif +endif + +ifeq ($(CONFIG_PROFILE_ALL),y) ARCHOPTIMIZATION += -pg endif @@ -119,6 +127,10 @@ ARCHCXXFLAGS += -fno-common ARCHCFLAGS += -Wall -Wstrict-prototypes -Wshadow -Wundef -Werror -Wno-attributes -Wno-unknown-pragmas ARCHCXXFLAGS += -Wall -Wshadow -Wundef -Wno-attributes -Wno-unknown-pragmas +ifeq ($(shell expr "$(GCCVER)" \>= 12),1) + ARCHCXXFLAGS += -Wno-alloc-size-larger-than +endif + # When all C++ code is built using GCC 7.1 or a higher version, # we can safely disregard warnings of the type "parameter passing for X changed in GCC 7.1." # Refer to : https://stackoverflow.com/questions/48149323/what-does-the-gcc-warning-project-parameter-passing-for-x-changed-in-gcc-7-1-m @@ -207,7 +219,6 @@ ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y) endif ifeq ($(shell expr "$(GCCVER)" \>= 12), 1) - LDFLAGS += --no-warn-rwx-segments LDFLAGS += --print-memory-usage endif endif @@ -224,7 +235,7 @@ ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a)) endif diff --git a/arch/arm64/src/cmake/Toolchain.cmake b/arch/arm64/src/cmake/Toolchain.cmake index e3f5ad69c73..1ce9168b9f9 100644 --- a/arch/arm64/src/cmake/Toolchain.cmake +++ b/arch/arm64/src/cmake/Toolchain.cmake @@ -135,7 +135,15 @@ if(CONFIG_ARCH_INSTRUMENT_ALL) add_compile_options(-finstrument-functions) endif() -if(CONFIG_SCHED_GPROF_ALL) +if(CONFIG_COVERAGE_ALL) + if(CONFIG_ARCH_TOOLCHAIN_GCC) + add_compile_options(-fprofile-generate -ftest-coverage) + elseif(CONFIG_ARCH_TOOLCHAIN_CLANG) + add_compile_options(-fprofile-instr-generate -fcoverage-mapping) + endif() +endif() + +if(CONFIG_PROFILE_ALL) add_compile_options(-pg) endif() @@ -153,6 +161,10 @@ add_compile_options( $<$:-Werror> $<$:-Wstrict-prototypes>) +if(GCCVER GREATER_EQUAL 12) + add_compile_options($<$:-Wno-alloc-size-larger-than>) +endif() + if(NOT CONFIG_LIBCXXTOOLCHAIN) add_compile_options($<$:-nostdinc++>) endif() diff --git a/arch/arm64/src/cmake/platform.cmake b/arch/arm64/src/cmake/platform.cmake index 130f620fa8b..6314978d4c2 100644 --- a/arch/arm64/src/cmake/platform.cmake +++ b/arch/arm64/src/cmake/platform.cmake @@ -56,7 +56,7 @@ if(CONFIG_LIBSUPCXX_TOOLCHAIN) OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_SCHED_GCOV) +if(CONFIG_COVERAGE_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libgcov.a diff --git a/arch/arm64/src/common/arm64_cpustart.c b/arch/arm64/src/common/arm64_cpustart.c index ef8e7a90bb0..09644213872 100644 --- a/arch/arm64/src/common/arm64_cpustart.c +++ b/arch/arm64/src/common/arm64_cpustart.c @@ -104,13 +104,6 @@ uint64_t *const g_cpu_int_fiq_stacktop[CONFIG_SMP_NCPUS] = * Private Functions ****************************************************************************/ -static inline void local_delay(void) -{ - for (volatile int i = 0; i < 1000; i++) - { - } -} - static void arm64_smp_init_top(void) { struct tcb_s *tcb = current_task(this_cpu()); diff --git a/arch/arm64/src/common/arm64_exit.c b/arch/arm64/src/common/arm64_exit.c index ba81dbb97f8..793533f76eb 100644 --- a/arch/arm64/src/common/arm64_exit.c +++ b/arch/arm64/src/common/arm64_exit.c @@ -76,5 +76,5 @@ void up_exit(int status) /* Then switch contexts */ - arm64_fullcontextrestore(tcb->xcp.regs); + arm64_fullcontextrestore(tcb); } diff --git a/arch/arm64/src/common/arm64_internal.h b/arch/arm64/src/common/arm64_internal.h index de5bc209806..5badadb9af2 100644 --- a/arch/arm64/src/common/arm64_internal.h +++ b/arch/arm64/src/common/arm64_internal.h @@ -112,10 +112,10 @@ /* Context switching */ -#define arm64_fullcontextrestore(restoreregs) \ +#define arm64_fullcontextrestore(next) \ do \ { \ - sys_call1(SYS_restore_context, (uintptr_t)restoreregs); \ + sys_call1(SYS_restore_context, (uintptr_t)next); \ } \ while (1) diff --git a/arch/arm64/src/common/arm64_sigdeliver.c b/arch/arm64/src/common/arm64_sigdeliver.c index fff7e1ccee5..3161f8859cb 100644 --- a/arch/arm64/src/common/arm64_sigdeliver.c +++ b/arch/arm64/src/common/arm64_sigdeliver.c @@ -160,5 +160,7 @@ void arm64_sigdeliver(void) leave_critical_section(flags); rtcb->irqcount--; #endif - arm64_fullcontextrestore(rtcb->xcp.regs); + + g_running_tasks[this_cpu()] = NULL; + arm64_fullcontextrestore(rtcb); } diff --git a/arch/arm64/src/common/arm64_syscall.c b/arch/arm64/src/common/arm64_syscall.c index a192cabafba..f969c4eb5d3 100644 --- a/arch/arm64/src/common/arm64_syscall.c +++ b/arch/arm64/src/common/arm64_syscall.c @@ -154,14 +154,19 @@ uintptr_t dispatch_syscall(unsigned int nbr, uintptr_t parm1, uint64_t *arm64_syscall(uint64_t *regs) { - uint64_t *ret_regs = regs; - uint64_t cmd; - struct tcb_s *tcb; - int cpu; + int cpu = this_cpu(); + struct tcb_s **running_task = &g_running_tasks[cpu]; + struct tcb_s *tcb = this_task(); + uint64_t cmd; #ifdef CONFIG_BUILD_KERNEL uint64_t spsr; #endif + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } + /* Nested interrupts are not supported */ DEBUGASSERT(regs); @@ -182,32 +187,21 @@ uint64_t *arm64_syscall(uint64_t *regs) * At this point, the following values are saved in context: * * x0 = SYS_restore_context - * x1 = restoreregs( xcp->regs, callee saved register save area) + * x1 = next */ case SYS_restore_context: - { - /* Replace 'regs' with the pointer to the register set in - * regs[REG_R1]. On return from the system call, that register - * set will determine the restored context. - */ - - ret_regs = (uint64_t *)regs[REG_X1]; - regs[REG_X1] = 0; /* set the saveregs = 0 */ - - DEBUGASSERT(ret_regs); - } break; /* x0 = SYS_switch_context: This a switch context command: * - * void arm64_switchcontext(uint64_t *saveregs, uint64_t *restoreregs); + * void arm64_switchcontext(struct tcb_s *prev, struct tcb_s *next); * * At this point, the following values are saved in context: * * x0 = SYS_switch_context - * x1 = saveregs (xcp->regs, callee saved register save area) - * x2 = restoreregs (xcp->regs, callee saved register save area) + * x1 = prev + * x2 = next * * In this case, we do both: We save the context registers to the save * register area reference by the saved contents of x1 and then set @@ -216,12 +210,6 @@ uint64_t *arm64_syscall(uint64_t *regs) */ case SYS_switch_context: - { - DEBUGASSERT(regs[REG_X1] != 0 && regs[REG_X2] != 0); - *(uint64_t **)regs[REG_X1] = regs; - - ret_regs = (uint64_t *)regs[REG_X2]; - } break; #ifdef CONFIG_BUILD_KERNEL @@ -328,15 +316,13 @@ uint64_t *arm64_syscall(uint64_t *regs) default: { svcerr("ERROR: Bad SYS call: 0x%" PRIx64 "\n", cmd); - ret_regs = 0; return 0; } break; } - if ((uint64_t *)regs != ret_regs) + if (*running_task != tcb) { - cpu = this_cpu(); tcb = current_task(cpu); #ifdef CONFIG_ARCH_ADDRENV @@ -351,19 +337,19 @@ uint64_t *arm64_syscall(uint64_t *regs) /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[cpu]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task. g_running_tasks[] is only used by * assertion logic for reporting crashes. */ - g_running_tasks[cpu] = tcb; + *running_task = tcb; /* Restore the cpu lock */ restore_critical_section(tcb, cpu); } - return ret_regs; + return tcb->xcp.regs; } diff --git a/arch/avr/src/avr/avr_doirq.c b/arch/avr/src/avr/avr_doirq.c index c25e8b68d12..0bc80302c1b 100644 --- a/arch/avr/src/avr/avr_doirq.c +++ b/arch/avr/src/avr/avr_doirq.c @@ -57,6 +57,13 @@ uint8_t *avr_doirq(uint8_t irq, uint8_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + avr_copystate((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); diff --git a/arch/avr/src/avr/avr_switchcontext.c b/arch/avr/src/avr/avr_switchcontext.c index 0b3bd586ed9..bd7194f3062 100644 --- a/arch/avr/src/avr/avr_switchcontext.c +++ b/arch/avr/src/avr/avr_switchcontext.c @@ -85,6 +85,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Switch context to the context of the task at the head of the * ready to run list. */ diff --git a/arch/avr/src/avr32/avr_doirq.c b/arch/avr/src/avr32/avr_doirq.c index 37d05289df6..3798248c626 100644 --- a/arch/avr/src/avr32/avr_doirq.c +++ b/arch/avr/src/avr32/avr_doirq.c @@ -58,6 +58,13 @@ uint32_t *avr_doirq(int irq, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + avr_copystate((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); diff --git a/arch/avr/src/avr32/avr_switchcontext.c b/arch/avr/src/avr32/avr_switchcontext.c index ea150f66331..71316ed163f 100644 --- a/arch/avr/src/avr32/avr_switchcontext.c +++ b/arch/avr/src/avr32/avr_switchcontext.c @@ -99,6 +99,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ avr_switchcontext(rtcb->xcp.regs, tcb->xcp.regs); diff --git a/arch/ceva/src/common/ceva_doirq.c b/arch/ceva/src/common/ceva_doirq.c index c977dc138e8..f5131596166 100644 --- a/arch/ceva/src/common/ceva_doirq.c +++ b/arch/ceva/src/common/ceva_doirq.c @@ -59,6 +59,13 @@ uint32_t *ceva_doirq(int irq, uint32_t *regs) } else { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } + /* Current regs non-zero indicates that we are processing an interrupt; * current_regs is also used to manage interrupt level context * switches. @@ -80,7 +87,7 @@ uint32_t *ceva_doirq(int irq, uint32_t *regs) { /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(this_task()); /* Record the new "running" task when context switch occurred. diff --git a/arch/ceva/src/common/ceva_exit.c b/arch/ceva/src/common/ceva_exit.c index 08d60544c11..b096ff491fb 100644 --- a/arch/ceva/src/common/ceva_exit.c +++ b/arch/ceva/src/common/ceva_exit.c @@ -78,6 +78,8 @@ void _exit(int status) sched_resume_scheduler(tcb); + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ ceva_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/hc/src/common/hc_doirq.c b/arch/hc/src/common/hc_doirq.c index 838358ebd38..2142687a456 100644 --- a/arch/hc/src/common/hc_doirq.c +++ b/arch/hc/src/common/hc_doirq.c @@ -58,6 +58,13 @@ uint8_t *hc_doirq(int irq, uint8_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + hc_copystate((*running_task)->xcp.regs); + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); diff --git a/arch/hc/src/common/hc_switchcontext.c b/arch/hc/src/common/hc_switchcontext.c index 7ea2c275abd..f75ee8576b8 100644 --- a/arch/hc/src/common/hc_switchcontext.c +++ b/arch/hc/src/common/hc_switchcontext.c @@ -102,6 +102,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ hc_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/mips/src/mips32/mips_doirq.c b/arch/mips/src/mips32/mips_doirq.c index 36c3151ccc2..8a08dc8c0ce 100644 --- a/arch/mips/src/mips32/mips_doirq.c +++ b/arch/mips/src/mips32/mips_doirq.c @@ -58,6 +58,13 @@ uint32_t *mips_doirq(int irq, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + mips_copystate((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); diff --git a/arch/mips/src/pic32mx/pic32mx_decodeirq.c b/arch/mips/src/pic32mx/pic32mx_decodeirq.c index 49f0c8b00d6..3b653f8ea88 100644 --- a/arch/mips/src/pic32mx/pic32mx_decodeirq.c +++ b/arch/mips/src/pic32mx/pic32mx_decodeirq.c @@ -70,12 +70,18 @@ uint32_t *pic32mx_decodeirq(uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; #ifdef CONFIG_PIC32MX_NESTED_INTERRUPTS uint32_t *savestate; #endif uint32_t regval; int irq; + if (*running_task != NULL) + { + mips_copystate((*running_task)->xcp.regs, regs); + } + /* If the board supports LEDs, turn on an LED now to indicate that we are * processing an interrupt. */ diff --git a/arch/mips/src/pic32mx/pic32mx_exception.c b/arch/mips/src/pic32mx/pic32mx_exception.c index 98f8c6dfbd0..85f8bf8c954 100644 --- a/arch/mips/src/pic32mx/pic32mx_exception.c +++ b/arch/mips/src/pic32mx/pic32mx_exception.c @@ -53,11 +53,17 @@ uint32_t *pic32mx_exception(uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; #ifdef CONFIG_DEBUG_FEATURES uint32_t cause; uint32_t epc; #endif + if (*running_task != NULL) + { + mips_copystate((*running_task)->xcp.regs, regs); + } + /* If the board supports LEDs, turn on an LED now to indicate that we are * processing an interrupt. */ diff --git a/arch/mips/src/pic32mz/pic32mz_decodeirq.c b/arch/mips/src/pic32mz/pic32mz_decodeirq.c index d64ff57c216..4c742e26465 100644 --- a/arch/mips/src/pic32mz/pic32mz_decodeirq.c +++ b/arch/mips/src/pic32mz/pic32mz_decodeirq.c @@ -69,6 +69,13 @@ uint32_t *pic32mz_decodeirq(uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + mips_copystate((*running_task)->xcp.regs, regs); + } + #ifdef CONFIG_PIC32MZ_NESTED_INTERRUPTS uint32_t *savestate; #endif diff --git a/arch/mips/src/pic32mz/pic32mz_exception.c b/arch/mips/src/pic32mz/pic32mz_exception.c index 4cca474cdb3..d16da4c1c34 100644 --- a/arch/mips/src/pic32mz/pic32mz_exception.c +++ b/arch/mips/src/pic32mz/pic32mz_exception.c @@ -52,11 +52,17 @@ uint32_t *pic32mz_exception(uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; #ifdef CONFIG_DEBUG_FEATURES uint32_t cause; uint32_t epc; #endif + if (*running_task != NULL) + { + mips_copystate((*running_task)->xcp.regs, regs); + } + /* If the board supports LEDs, turn on an LED now to indicate that we are * processing an interrupt. */ diff --git a/arch/misoc/src/lm32/lm32_doirq.c b/arch/misoc/src/lm32/lm32_doirq.c index 3472df00bec..079429b4d8a 100644 --- a/arch/misoc/src/lm32/lm32_doirq.c +++ b/arch/misoc/src/lm32/lm32_doirq.c @@ -45,6 +45,13 @@ uint32_t *lm32_doirq(int irq, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + lm32_copystate((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/arch/misoc/src/minerva/minerva_doirq.c b/arch/misoc/src/minerva/minerva_doirq.c index 0a4cca5d7ea..815e1c242cb 100644 --- a/arch/misoc/src/minerva/minerva_doirq.c +++ b/arch/misoc/src/minerva/minerva_doirq.c @@ -45,6 +45,13 @@ uint32_t *minerva_doirq(int irq, uint32_t * regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + minerva_copystate((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/arch/or1k/src/common/or1k_doirq.c b/arch/or1k/src/common/or1k_doirq.c index 42bb4f6a03a..ecd6e33a43c 100644 --- a/arch/or1k/src/common/or1k_doirq.c +++ b/arch/or1k/src/common/or1k_doirq.c @@ -41,6 +41,13 @@ uint32_t *or1k_doirq(int irq, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + or1k_copyfullstate((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); diff --git a/arch/or1k/src/common/or1k_switchcontext.c b/arch/or1k/src/common/or1k_switchcontext.c index c19cf847ed9..1e0921e2512 100644 --- a/arch/or1k/src/common/or1k_switchcontext.c +++ b/arch/or1k/src/common/or1k_switchcontext.c @@ -106,6 +106,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ or1k_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/renesas/src/common/renesas_doirq.c b/arch/renesas/src/common/renesas_doirq.c index 06af0e84c4e..a6503087c4a 100644 --- a/arch/renesas/src/common/renesas_doirq.c +++ b/arch/renesas/src/common/renesas_doirq.c @@ -58,6 +58,13 @@ uint32_t *renesas_doirq(int irq, uint32_t * regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + renesas_copystate((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); diff --git a/arch/renesas/src/common/renesas_switchcontext.c b/arch/renesas/src/common/renesas_switchcontext.c index b4a79c922b2..9ff14868c91 100644 --- a/arch/renesas/src/common/renesas_switchcontext.c +++ b/arch/renesas/src/common/renesas_switchcontext.c @@ -102,6 +102,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ renesas_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/renesas/src/rx65n/Kconfig b/arch/renesas/src/rx65n/Kconfig index 269895caadb..e553f5f9714 100644 --- a/arch/renesas/src/rx65n/Kconfig +++ b/arch/renesas/src/rx65n/Kconfig @@ -149,7 +149,7 @@ config RX65N_CMT0 config RX65N_CMT1 bool "CMT1" default n - depends on BOARD_CRASHDUMP && RX65N_SBRAM && RX65N_SAVE_CRASHDUMP + depends on BOARD_CRASHDUMP_CUSTOM && RX65N_SBRAM && RX65N_SAVE_CRASHDUMP config RX65N_CMT2 bool "CMT2" @@ -170,7 +170,7 @@ config RX65N_IRQ_GROUP config RX65N_SBRAM bool "SBRAM" default n - depends on BOARD_CRASHDUMP + depends on BOARD_CRASHDUMP_CUSTOM config RX65N_SAVE_CRASHDUMP bool "SBRAM Save Crashdump" @@ -541,7 +541,7 @@ config RX65N_CMT0 config RX65N_CMT1 bool "CMT1" default n - depends on BOARD_CRASHDUMP && RX65N_SBRAM && RX65N_SAVE_CRASHDUMP + depends on BOARD_CRASHDUMP_CUSTOM && RX65N_SBRAM && RX65N_SAVE_CRASHDUMP config RX65N_CMT2 bool "CMT2" @@ -562,7 +562,7 @@ config RX65N_IRQ_GROUP config RX65N_SBRAM bool "SBRAM" default n - depends on BOARD_CRASHDUMP + depends on BOARD_CRASHDUMP_CUSTOM config RX65N_SAVE_CRASHDUMP bool "SBRAM Save Crashdump" diff --git a/arch/risc-v/Kconfig b/arch/risc-v/Kconfig index 372757061da..f4bb77d499f 100644 --- a/arch/risc-v/Kconfig +++ b/arch/risc-v/Kconfig @@ -89,6 +89,7 @@ config ARCH_CHIP_ESP32C3 select ARCH_HAVE_BOOTLOADER select ARCH_HAVE_PERF_EVENTS select ARCH_HAVE_DEBUG + select ARCH_HAVE_RAMFUNCS ---help--- Espressif ESP32-C3 (RV32IMC). @@ -119,6 +120,7 @@ config ARCH_CHIP_ESP32C3_GENERIC select ESPRESSIF_SOC_RTC_MEM_SUPPORTED select ARCH_CHIP_ESPRESSIF select ARCH_HAVE_DEBUG + select ARCH_HAVE_RAMFUNCS ---help--- ESP32-C3 chip with a single RISC-V IMC core, no embedded Flash memory diff --git a/arch/risc-v/include/csr.h b/arch/risc-v/include/csr.h index 2350982313b..9a9de4413f3 100644 --- a/arch/risc-v/include/csr.h +++ b/arch/risc-v/include/csr.h @@ -734,6 +734,91 @@ #define ISELECT_EIE62 0xfe #define ISELECT_EIE63 0xff +#ifndef __ASSEMBLY__ + +/* Read the value of a CSR register */ + +#define READ_CSR(reg) \ + ({ \ + uintreg_t __regval; \ + __asm__ __volatile__("csrr %0, " __STR(reg) : "=r"(__regval)); \ + __regval; \ + }) + +/* Read the value of a CSR register and set the specified bits */ + +#define READ_AND_SET_CSR(reg, bits) \ + ({ \ + uintreg_t __regval; \ + __asm__ __volatile__("csrrs %0, " __STR(reg) ", %1": "=r"(__regval) : "rK"(bits)); \ + __regval; \ + }) + +/* Write a value to a CSR register */ + +#define WRITE_CSR(reg, val) \ + ({ \ + __asm__ __volatile__("csrw " __STR(reg) ", %0" :: "rK"(val)); \ + }) + +/* Set the specified bits in a CSR register */ + +#define SET_CSR(reg, bits) \ + ({ \ + __asm__ __volatile__("csrs " __STR(reg) ", %0" :: "rK"(bits)); \ + }) + +/* Clear the specified bits in a CSR register */ + +#define CLEAR_CSR(reg, bits) \ + ({ \ + __asm__ __volatile__("csrc " __STR(reg) ", %0" :: "rK"(bits)); \ + }) + +/* Swap the value of a CSR register with the specified value */ + +#define SWAP_CSR(reg, val) \ + ({ \ + uintptr_t regval; \ + __asm__ __volatile__("csrrw %0, " __STR(reg) ", %1" : "=r"(regval) \ + : "rK"(val)); \ + regval; \ + }) + +/* Write a value to an indirect CSR register */ + +#define WRITE_INDIRECT_CSR_REG0(reg, val) \ + ({ \ + WRITE_CSR(CSR_ISELECT, reg); \ + WRITE_CSR(CSR_IREG, val); \ + }) + +/* Read the value of an indirect CSR register */ + +#define READ_INDIRECT_CSR_REG0(reg, val) \ + ({ \ + WRITE_CSR(CSR_ISELECT, reg); \ + READ_CSR(CSR_IREG, val); \ + }) + +/* Set the specified bits in an indirect CSR register */ + +#define SET_INDIRECT_CSR_REG0(reg, val) \ + ({ \ + WRITE_CSR(CSR_ISELECT, reg); \ + SET_CSR(CSR_IREG, val); \ + }) + +/* Clear the specified bits in an indirect CSR register */ + +#define CLEAR_INDIRECT_CSR_REG0(reg, val) \ + ({ \ + WRITE_CSR(CSR_ISELECT, reg); \ + CLEAR_CSR(CSR_IREG, val); \ + }) + +#endif /* __ASSEMBLY__ */ + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/arch/risc-v/src/cmake/Toolchain.cmake b/arch/risc-v/src/cmake/Toolchain.cmake index f3288cfb598..75c5ad9cacb 100644 --- a/arch/risc-v/src/cmake/Toolchain.cmake +++ b/arch/risc-v/src/cmake/Toolchain.cmake @@ -159,7 +159,7 @@ if(${CONFIG_STACK_USAGE_WARNING}) endif() endif() -if(CONFIG_SCHED_GCOV_ALL) +if(CONFIG_COVERAGE_ALL) add_compile_options(-fprofile-generate -ftest-coverage) endif() @@ -265,6 +265,12 @@ if(CONFIG_RISCV_TOOLCHAIN STREQUAL GNU_RVG) string(REGEX MATCH "([0-9]+)\\.[0-9]+" GCC_VERSION_REGEX "${GCC_VERSION_OUTPUT}") set(GCCVER ${CMAKE_MATCH_1}) + + if(GCCVER GREATER_EQUAL 12) + if(CONFIG_ARCH_RAMFUNCS OR NOT CONFIG_BOOT_RUNFROMFLASH) + add_link_options(-Wl,--no-warn-rwx-segments) + endif() + endif() endif() if(CONFIG_ARCH_RV_ISA_ZICSR_ZIFENCEI) diff --git a/arch/risc-v/src/cmake/platform.cmake b/arch/risc-v/src/cmake/platform.cmake index 41996556265..fe582f713d8 100644 --- a/arch/risc-v/src/cmake/platform.cmake +++ b/arch/risc-v/src/cmake/platform.cmake @@ -61,7 +61,7 @@ if(CONFIG_LIBSUPCXX_TOOLCHAIN) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_SCHED_GCOV) +if(CONFIG_COVERAGE_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libgcov.a diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs index b0e5729bed6..f0d6e02856d 100644 --- a/arch/risc-v/src/common/Toolchain.defs +++ b/arch/risc-v/src/common/Toolchain.defs @@ -386,6 +386,13 @@ ifeq ($(CONFIG_ARCH_TOOLCHAIN_GNU),y) ifeq ($(GCCVER),) export GCCVER := $(shell $(CC) --version | grep gcc | sed -E "s/.* ([0-9]+\.[0-9]+).*/\1/" | cut -d'.' -f1) endif + ifeq ($(shell expr "$(GCCVER)" \>= 12), 1) + ifeq ($(CONFIG_ARCH_RAMFUNCS),y) + LDFLAGS += --no-warn-rwx-segments + else ifeq ($(CONFIG_BOOT_RUNFROMFLASH),) + LDFLAGS += --no-warn-rwx-segments + endif + endif endif endif @@ -410,7 +417,7 @@ ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a)) endif diff --git a/arch/risc-v/src/common/riscv_doirq.c b/arch/risc-v/src/common/riscv_doirq.c index bbb1db9fb0a..dd8e094cd93 100644 --- a/arch/risc-v/src/common/riscv_doirq.c +++ b/arch/risc-v/src/common/riscv_doirq.c @@ -99,7 +99,7 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs) * returning from the interrupt. */ - if ((*running_task) != tcb) + if (*running_task != tcb) { #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously @@ -113,7 +113,7 @@ uintreg_t *riscv_doirq(int irq, uintreg_t *regs) /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task when context switch occurred. diff --git a/arch/risc-v/src/common/riscv_internal.h b/arch/risc-v/src/common/riscv_internal.h index ffa85d54501..d10f7c42cf3 100644 --- a/arch/risc-v/src/common/riscv_internal.h +++ b/arch/risc-v/src/common/riscv_internal.h @@ -160,67 +160,6 @@ static inline void putreg64(uint64_t v, const volatile uintreg_t a) __asm__ __volatile__("sd %0, 0(%1)" : : "r" (v), "r" (a)); } -#define READ_CSR(reg) \ - ({ \ - uintreg_t __regval; \ - __asm__ __volatile__("csrr %0, " __STR(reg) : "=r"(__regval)); \ - __regval; \ - }) - -#define READ_AND_SET_CSR(reg, bits) \ - ({ \ - uintreg_t __regval; \ - __asm__ __volatile__("csrrs %0, " __STR(reg) ", %1": "=r"(__regval) : "rK"(bits)); \ - __regval; \ - }) - -#define WRITE_CSR(reg, val) \ - ({ \ - __asm__ __volatile__("csrw " __STR(reg) ", %0" :: "rK"(val)); \ - }) - -#define SET_CSR(reg, bits) \ - ({ \ - __asm__ __volatile__("csrs " __STR(reg) ", %0" :: "rK"(bits)); \ - }) - -#define CLEAR_CSR(reg, bits) \ - ({ \ - __asm__ __volatile__("csrc " __STR(reg) ", %0" :: "rK"(bits)); \ - }) - -#define SWAP_CSR(reg, val) \ - ({ \ - uintptr_t regval; \ - __asm__ __volatile__("csrrw %0, " __STR(reg) ", %1" : "=r"(regval) \ - : "rK"(val)); \ - regval; \ - }) - -#define WRITE_INDIRECT_CSR_REG0(reg, val) \ - ({ \ - WRITE_CSR(CSR_ISELECT, reg); \ - WRITE_CSR(CSR_IREG, val); \ - }) - -#define READ_INDIRECT_CSR_REG0(reg, val) \ - ({ \ - WRITE_CSR(CSR_ISELECT, reg); \ - READ_CSR(CSR_IREG, val); \ - }) - -#define SET_INDIRECT_CSR_REG0(reg, val) \ - ({ \ - WRITE_CSR(CSR_ISELECT, reg); \ - SET_CSR(CSR_IREG, val); \ - }) - -#define CLEAR_INDIRECT_CSR_REG0(reg, val) \ - ({ \ - WRITE_CSR(CSR_ISELECT, reg); \ - CLEAR_CSR(CSR_IREG, val); \ - }) - #define riscv_append_pmp_region(a, b, s) \ riscv_config_pmp_region(riscv_next_free_pmp_region(), a, b, s) diff --git a/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c b/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c index aa36a12c65d..00fd5f54b2e 100644 --- a/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c +++ b/arch/risc-v/src/common/supervisor/riscv_perform_syscall.c @@ -54,7 +54,7 @@ void *riscv_perform_syscall(uintreg_t *regs) riscv_swint(0, regs, NULL); tcb = this_task(); - if ((*running_task) != tcb) + if (*running_task != tcb) { #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously @@ -67,7 +67,7 @@ void *riscv_perform_syscall(uintreg_t *regs) #endif /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(tcb); /* Record the new "running" task. g_running_tasks[] is only used by diff --git a/arch/sim/Kconfig b/arch/sim/Kconfig index ec069012148..bedca62e9f1 100644 --- a/arch/sim/Kconfig +++ b/arch/sim/Kconfig @@ -90,9 +90,9 @@ config SIM_UBSAN_DUMMY ---help--- Keep SIM_UBSAN compile time but disable runtime actions. -config SIM_GPROF +config SIM_PROFILE bool "Enable gprof" - depends on !SCHED_GPROF + depends on PROFILE_NONE default n ---help--- Enable support gprof profiling tool. diff --git a/arch/sim/src/Makefile b/arch/sim/src/Makefile index b7f552d6f29..049d04609b9 100644 --- a/arch/sim/src/Makefile +++ b/arch/sim/src/Makefile @@ -140,11 +140,11 @@ ifeq ($(CONFIG_LIBM_TOOLCHAIN),y) STDLIBS += -lm endif -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_TOOLCHAIN),y) STDLIBS += -lgcov endif -ifeq ($(CONFIG_SIM_GPROF),y) +ifneq ($(CONFIG_SIM_PROFILE)$(CONFIG_PROFILE_ALL),) HOSTCFLAGS += -pg endif @@ -435,6 +435,9 @@ ifneq ($(CONFIG_HOST_MACOS),y) -e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld $(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld endif +ifeq ($(CONFIG_OPTEE_OS),y) + $(Q) sed -i 's/\*(.text.hot .text.hot.*)/KEEP(*(SORT(.scattered_array*)))\n *(.text.hot .text.hot.*)/g' nuttx.ld +endif ifeq ($(CONFIG_MM_KASAN_GLOBAL),y) $(Q) sed -i 's/\s*\.interp\s*:\s*{\s*\*(\.interp)\s*}/ \ .kasan.global : {KEEP(*(.data..LASAN0)) KEEP (*(.data.rel.local..LASAN0)) }\n \ diff --git a/arch/sim/src/cmake/Toolchain.cmake b/arch/sim/src/cmake/Toolchain.cmake index 4257ea8d31b..af1ffd9c2df 100644 --- a/arch/sim/src/cmake/Toolchain.cmake +++ b/arch/sim/src/cmake/Toolchain.cmake @@ -86,11 +86,11 @@ if(CONFIG_STACK_USAGE_WARNING) add_compile_options(-Wstack-usage=${CONFIG_STACK_USAGE_WARNING}) endif() -if(CONFIG_SCHED_GCOV_ALL) +if(CONFIG_COVERAGE_ALL) add_compile_options(-fprofile-generate -ftest-coverage) endif() -if(CONFIG_SCHED_GPROF_ALL OR CONFIG_SIM_GPROF) +if(CONFIG_PROFILE_ALL OR CONFIG_SIM_PROFILE) add_compile_options(-pg) endif() @@ -189,6 +189,10 @@ if(CONFIG_LIBCXX) add_compile_options($<$:-D_LIBCPP_DISABLE_AVAILABILITY>) endif() +if(CONFIG_LIBCXX_TEST) + add_link_options(-Wl,-latomic) +endif() + if(APPLE) add_link_options(-Wl,-dead_strip) else() diff --git a/arch/sim/src/sim/CMakeLists.txt b/arch/sim/src/sim/CMakeLists.txt index ce909412b7e..74651482323 100644 --- a/arch/sim/src/sim/CMakeLists.txt +++ b/arch/sim/src/sim/CMakeLists.txt @@ -27,7 +27,7 @@ set(HOSTSRCS) set(HOST_INCLUDE_DIRS) set(STDLIBS pthread) -if(CONFIG_SCHED_GCOV) +if(CONFIG_COVERAGE_TOOLCHAIN) list(APPEND STDLIBS gcov) endif() diff --git a/arch/sim/src/sim/posix/sim_hostmisc.c b/arch/sim/src/sim/posix/sim_hostmisc.c index 44f3f19c872..b7987057885 100644 --- a/arch/sim/src/sim/posix/sim_hostmisc.c +++ b/arch/sim/src/sim/posix/sim_hostmisc.c @@ -50,7 +50,7 @@ * Public Function Prototypes ****************************************************************************/ -#ifdef CONFIG_SCHED_GCOV +#ifndef CONFIG_COVERAGE_NONE void __gcov_dump(void); #endif @@ -72,7 +72,7 @@ extern int backtrace(void **array, int size); void host_abort(int status) { -#ifdef CONFIG_SCHED_GCOV +#ifndef CONFIG_COVERAGE_NONE /* Dump gcov data. */ host_uninterruptible_no_return(__gcov_dump); diff --git a/arch/sim/src/sim/sim_doirq.c b/arch/sim/src/sim/sim_doirq.c index 5adcf15cdfa..5d75d76bf20 100644 --- a/arch/sim/src/sim/sim_doirq.c +++ b/arch/sim/src/sim/sim_doirq.c @@ -63,6 +63,13 @@ void *sim_doirq(int irq, void *context) sim_saveusercontext(regs, ret); if (ret == 0) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + sim_copyfullstate((*running_task)->xcp.regs, regs); + } + up_set_current_regs(regs); /* Deliver the IRQ */ diff --git a/arch/sim/src/sim/sim_switchcontext.c b/arch/sim/src/sim/sim_switchcontext.c index fc8d9d703df..83a845ad6f4 100644 --- a/arch/sim/src/sim/sim_switchcontext.c +++ b/arch/sim/src/sim/sim_switchcontext.c @@ -105,6 +105,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) restore_critical_section(tcb, this_cpu()); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ sim_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/sparc/src/sparc_v8/sparc_v8_doirq.c b/arch/sparc/src/sparc_v8/sparc_v8_doirq.c index f596139c34e..05e1ed77057 100644 --- a/arch/sparc/src/sparc_v8/sparc_v8_doirq.c +++ b/arch/sparc/src/sparc_v8/sparc_v8_doirq.c @@ -58,6 +58,13 @@ uint32_t *sparc_doirq(int irq, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + trap_flush_task((*running_task)->xcp.regs, regs); + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); diff --git a/arch/tricore/src/cmake/ToolchainGnuc.cmake b/arch/tricore/src/cmake/ToolchainGnuc.cmake index 123ed995d37..59b665c0000 100644 --- a/arch/tricore/src/cmake/ToolchainGnuc.cmake +++ b/arch/tricore/src/cmake/ToolchainGnuc.cmake @@ -84,7 +84,7 @@ if(CONFIG_STACK_CANARIES) add_compile_options(-fstack-protector-all) endif() -if(CONFIG_SCHED_GCOV_ALL) +if(CONFIG_COVERAGE_ALL) add_compile_options(-fprofile-generate -ftest-coverage) endif() diff --git a/arch/tricore/src/cmake/platform.cmake b/arch/tricore/src/cmake/platform.cmake index da0207fa616..a2e2cf8d4da 100644 --- a/arch/tricore/src/cmake/platform.cmake +++ b/arch/tricore/src/cmake/platform.cmake @@ -60,7 +60,7 @@ if(CONFIG_TRICORE_TOOLCHAIN_GNU) OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) endif() - if(CONFIG_SCHED_GCOV) + if(CONFIG_COVERAGE_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libgcov.a diff --git a/arch/tricore/src/common/ToolchainGnuc.defs b/arch/tricore/src/common/ToolchainGnuc.defs index 0e1d164f10b..ed961a4a204 100644 --- a/arch/tricore/src/common/ToolchainGnuc.defs +++ b/arch/tricore/src/common/ToolchainGnuc.defs @@ -58,7 +58,7 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0) ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING) endif -ifeq ($(CONFIG_SCHED_GCOV_ALL),y) +ifeq ($(CONFIG_COVERAGE_ALL),y) ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage endif @@ -183,7 +183,7 @@ ifeq ($(CONFIG_LIBSUPCXX),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a)) endif diff --git a/arch/tricore/src/common/tricore_doirq.c b/arch/tricore/src/common/tricore_doirq.c index f3ed8151ea7..975ad21fef8 100644 --- a/arch/tricore/src/common/tricore_doirq.c +++ b/arch/tricore/src/common/tricore_doirq.c @@ -44,12 +44,19 @@ IFX_INTERRUPT_INTERNAL(tricore_doirq, 0, 255) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + #ifdef CONFIG_SUPPRESS_INTERRUPTS PANIC(); #else Ifx_CPU_ICR icr; uintptr_t *regs; + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } + icr.U = __mfcr(CPU_ICR); regs = (uintptr_t *)__mfcr(CPU_PCXI); diff --git a/arch/x86/src/common/x86_switchcontext.c b/arch/x86/src/common/x86_switchcontext.c index 2ab1e358d2c..b1d7f1147c1 100644 --- a/arch/x86/src/common/x86_switchcontext.c +++ b/arch/x86/src/common/x86_switchcontext.c @@ -102,6 +102,10 @@ void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ x86_fullcontextrestore(tcb->xcp.regs); diff --git a/arch/x86/src/qemu/qemu_handlers.c b/arch/x86/src/qemu/qemu_handlers.c index 091d75ff74b..ab9093d9963 100644 --- a/arch/x86/src/qemu/qemu_handlers.c +++ b/arch/x86/src/qemu/qemu_handlers.c @@ -76,6 +76,7 @@ static void idt_outb(uint8_t val, uint16_t addr) #ifndef CONFIG_SUPPRESS_INTERRUPTS static uint32_t *common_handler(int irq, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; board_autoled_on(LED_INIRQ); /* Current regs non-zero indicates that we are processing an interrupt; @@ -87,6 +88,11 @@ static uint32_t *common_handler(int irq, uint32_t *regs) DEBUGASSERT(up_current_regs() == NULL); up_set_current_regs(regs); + if (*running_task != NULL) + { + x86_savestate((*running_task)->xcp.regs); + } + /* Deliver the IRQ */ irq_dispatch(irq, regs); @@ -118,7 +124,7 @@ static uint32_t *common_handler(int irq, uint32_t *regs) /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(this_task()); /* Record the new "running" task when context switch occurred. @@ -126,7 +132,7 @@ static uint32_t *common_handler(int irq, uint32_t *regs) * crashes. */ - g_running_tasks[this_cpu()] = this_task(); + *running_task = this_task(); } /* If a context switch occurred while processing the interrupt then diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index ebc840d94f3..aec5db986ac 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig @@ -147,6 +147,34 @@ config MULTBOOT2_FB_TERM ---help--- Enable a framebuffer terminal for early debug printing +config MULTBOOT2_FB + bool "Multiboot2 framebuffer" + default n + ---help--- + Enable a framebuffer support + +if MULTBOOT2_FB + +config MULTBOOT2_FB_WIDTH + int "Multiboot2 framebuffer width" + default 1024 + ---help--- + Requested framebuffer width + +config MULTBOOT2_FB_HEIGHT + int "Multiboot2 framebuffer height" + default 768 + ---help--- + Requested framebuffer height + +config MULTBOOT2_FB_DEEPTH + int "Multiboot2 framebuffer deepth" + default 32 + ---help--- + Requested framebuffer deepth + +endif # MULTBOOT2_FB + endif # ARCH_MULTIBOOT2 config ARCH_PVHBOOT diff --git a/arch/x86_64/src/cmake/Toolchain.cmake b/arch/x86_64/src/cmake/Toolchain.cmake index 162d818e11f..aa862a16d9e 100644 --- a/arch/x86_64/src/cmake/Toolchain.cmake +++ b/arch/x86_64/src/cmake/Toolchain.cmake @@ -75,7 +75,7 @@ if(${CONFIG_STACK_USAGE_WARNING}) endif() endif() -if(CONFIG_SCHED_GCOV_ALL) +if(CONFIG_COVERAGE_ALL) add_compile_options(-fprofile-generate -ftest-coverage) endif() diff --git a/arch/x86_64/src/cmake/platform.cmake b/arch/x86_64/src/cmake/platform.cmake index 414deb5c328..6e196376f8b 100644 --- a/arch/x86_64/src/cmake/platform.cmake +++ b/arch/x86_64/src/cmake/platform.cmake @@ -61,7 +61,7 @@ if(CONFIG_LIBSUPCXX_TOOLCHAIN) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_SCHED_GCOV) +if(CONFIG_COVERAGE_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libgcov.a diff --git a/arch/x86_64/src/intel64/CMakeLists.txt b/arch/x86_64/src/intel64/CMakeLists.txt index 67d43547508..0aacf939165 100644 --- a/arch/x86_64/src/intel64/CMakeLists.txt +++ b/arch/x86_64/src/intel64/CMakeLists.txt @@ -72,7 +72,11 @@ if(CONFIG_SMP) endif() if(CONFIG_MULTBOOT2_FB_TERM) - list(APPEND SRCS intel64_mbfb.c) + list(APPEND SRCS intel64_fbterm.c) +endif() + +if(CONFIG_MULTBOOT2_FB) + list(APPEND SRCS intel64_fb.c) endif() if(CONFIG_ARCH_INTEL64_HAVE_TSC) diff --git a/arch/x86_64/src/intel64/Make.defs b/arch/x86_64/src/intel64/Make.defs index cceec076daf..a59fd1eab95 100644 --- a/arch/x86_64/src/intel64/Make.defs +++ b/arch/x86_64/src/intel64/Make.defs @@ -63,7 +63,11 @@ endif # Configuration-dependent intel64 files ifeq ($(CONFIG_MULTBOOT2_FB_TERM),y) -CHIP_CSRCS += intel64_mbfb.c +CHIP_CSRCS += intel64_fbterm.c +endif + +ifeq ($(CONFIG_MULTBOOT2_FB),y) +CHIP_CSRCS += intel64_fb.c endif ifeq ($(CONFIG_ARCH_INTEL64_HAVE_TSC),y) diff --git a/arch/x86_64/src/intel64/intel64_cpustart.c b/arch/x86_64/src/intel64/intel64_cpustart.c index ec78ccc7204..7c9a4f88a13 100644 --- a/arch/x86_64/src/intel64/intel64_cpustart.c +++ b/arch/x86_64/src/intel64/intel64_cpustart.c @@ -165,8 +165,10 @@ void x86_64_ap_boot(void) irq_attach(SMP_IPI_CALL_IRQ, x86_64_smp_call_handler, NULL); irq_attach(SMP_IPI_SCHED_IRQ, x86_64_smp_sched_handler, NULL); - up_enable_irq(SMP_IPI_CALL_IRQ); - up_enable_irq(SMP_IPI_SCHED_IRQ); + + /* NOTE: IPC interrupts don't use IOAPIC but interrupts are sent + * directly to CPU, so we don't use up_enable_irq() API here. + */ #ifdef CONFIG_STACK_COLORATION /* If stack debug is enabled, then fill the stack with a diff --git a/arch/x86_64/src/intel64/intel64_fb.c b/arch/x86_64/src/intel64/intel64_fb.c new file mode 100644 index 00000000000..b2ed36377d2 --- /dev/null +++ b/arch/x86_64/src/intel64/intel64_fb.c @@ -0,0 +1,314 @@ +/**************************************************************************** + * arch/x86_64/src/intel64/intel64_fb.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include + +#include + +#include "x86_64_internal.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct multiboot_fb_s +{ + /* Framebuffer interface */ + + struct fb_vtable_s vtable; + + /* Framebuffer video information */ + + struct fb_videoinfo_s videoinfo; + + /* Framebuffer plane information */ + + struct fb_planeinfo_s planeinfo; + + /* Framebuffer base address */ + + void *baseaddr; +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/* Framebuffer interface */ + +static int intel64_getvideoinfo(struct fb_vtable_s *vtable, + struct fb_videoinfo_s *vinfo); +static int intel64_getplaneinfo(struct fb_vtable_s *vtable, + int planeno, + struct fb_planeinfo_s *pinfo); + +/* Helpers */ + +static uint8_t intel64_fb_getfmt(uint8_t bpp, uint8_t type); +static void intel64_fb_clear(void); + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +extern struct multiboot_tag_framebuffer *g_mb_fb_tag; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct multiboot_fb_s g_fb = +{ + .vtable = + { + .getvideoinfo = intel64_getvideoinfo, + .getplaneinfo = intel64_getplaneinfo + }, + + .baseaddr = NULL +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: intel64_getvideoinfo + ****************************************************************************/ + +static int intel64_getvideoinfo(struct fb_vtable_s *vtable, + struct fb_videoinfo_s *vinfo) +{ + struct multiboot_fb_s *priv = (struct multiboot_fb_s *)vtable; + + memcpy(vinfo, &priv->videoinfo, sizeof(struct fb_videoinfo_s)); + return OK; +} + +/**************************************************************************** + * Name: intel64_getplaneinfo + ****************************************************************************/ + +static int intel64_getplaneinfo(struct fb_vtable_s *vtable, + int planeno, + struct fb_planeinfo_s *pinfo) +{ + struct multiboot_fb_s *priv = (struct multiboot_fb_s *)vtable; + + if (planeno == 0) + { + memcpy(pinfo, &priv->planeinfo, sizeof(struct fb_planeinfo_s)); + return OK; + } + + gerr("ERROR: Returning EINVAL\n"); + return -EINVAL; +} + +/**************************************************************************** + * Name: intel64_fb_getfmt + ****************************************************************************/ + +static uint8_t intel64_fb_getfmt(uint8_t bpp, uint8_t type) +{ + if (type != MULTIBOOT_FRAMEBUFFER_TYPE_RGB) + { + /* Only RGB type supported */ + + gerr("ERROR: not supported type=%d\n", type); + PANIC(); + } + + switch (bpp) + { + case 8: + { + return FB_FMT_RGB8; + } + + case 24: + { + return FB_FMT_RGB24; + } + + case 32: + { + return FB_FMT_RGB32; + } + + default: + { + gerr("ERROR: not supported BPP=%d\n", bpp); + PANIC(); + } + } +} + +/**************************************************************************** + * Name: intel64_fb_clear + ****************************************************************************/ + +static void intel64_fb_clear(void) +{ + if (g_fb.baseaddr == NULL) + { + return; + } + + memset(g_fb.baseaddr, 0, g_fb.planeinfo.stride * g_fb.videoinfo.yres); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_fbinitialize + * + * Description: + * Initialize the framebuffer video hardware associated with the display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. + * + ****************************************************************************/ + +int up_fbinitialize(int display) +{ + struct multiboot_tag_framebuffer *fbt = g_mb_fb_tag; + struct multiboot_fb_s *fb = &g_fb; + + UNUSED(display); + + /* Return error if multiboot tag is empty */ + + if (fbt == NULL) + { + return -ENODEV; + } + + /* Get framebuffer base address */ + + fb->baseaddr = (void *)(uintptr_t)fbt->common.framebuffer_addr; + + /* Get video info */ + + fb->videoinfo.xres = fbt->common.framebuffer_width; + fb->videoinfo.yres = fbt->common.framebuffer_height; + fb->videoinfo.nplanes = 1; + fb->videoinfo.fmt = intel64_fb_getfmt(fbt->common.framebuffer_bpp, + fbt->common.framebuffer_type); + + /* Get plane info */ + + fb->planeinfo.fbmem = fb->baseaddr; + fb->planeinfo.fblen = (fbt->common.framebuffer_pitch * + fb->videoinfo.yres); + fb->planeinfo.stride = fbt->common.framebuffer_pitch; + fb->planeinfo.bpp = fbt->common.framebuffer_bpp; + + /* Map framebuffer memory. + * NOTE: framebuffer base address may lie above 4GB for real hardware, + * in that case CONFIG_MM_PGALLOC=y must be enabled so + * up_map_region() can map this address. + */ + + up_map_region(fb->baseaddr, fb->planeinfo.stride * fb->videoinfo.yres, + X86_PAGE_WR | X86_PAGE_PRESENT | + X86_PAGE_NOCACHE | X86_PAGE_GLOBAL); + + /* Clear frambufer */ + + intel64_fb_clear(); + + return OK; +} + +/**************************************************************************** + * Name: up_fbgetvplane + * + * Description: + * Return a a reference to the framebuffer object for the specified video + * plane of the specified plane. + * Many OSDs support multiple planes of video. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. + * + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. + * + ****************************************************************************/ + +struct fb_vtable_s *up_fbgetvplane(int display, int vplane) +{ + if (vplane == 0) + { + return &g_fb.vtable; + } + + return NULL; +} + +/**************************************************************************** + * Name: up_fbuninitialize + * + * Description: + * Uninitialize the framebuffer support for the specified display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_fbuninitialize(int display) +{ + UNUSED(display); + + /* Clear frambufer */ + + intel64_fb_clear(); +} diff --git a/arch/x86_64/src/intel64/intel64_mbfb.c b/arch/x86_64/src/intel64/intel64_fbterm.c similarity index 99% rename from arch/x86_64/src/intel64/intel64_mbfb.c rename to arch/x86_64/src/intel64/intel64_fbterm.c index 665e79a57a3..c8dc6fbfd39 100644 --- a/arch/x86_64/src/intel64/intel64_mbfb.c +++ b/arch/x86_64/src/intel64/intel64_fbterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/x86_64/src/intel64/intel64_mbfb.c + * arch/x86_64/src/intel64/intel64_fbterm.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/arch/x86_64/src/intel64/intel64_handlers.c b/arch/x86_64/src/intel64/intel64_handlers.c index c17f8fc8c28..2d234b21bcd 100644 --- a/arch/x86_64/src/intel64/intel64_handlers.c +++ b/arch/x86_64/src/intel64/intel64_handlers.c @@ -62,9 +62,15 @@ #ifndef CONFIG_SUPPRESS_INTERRUPTS static uint64_t *common_handler(int irq, uint64_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; struct tcb_s *tcb; int cpu; + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } + /* Current regs non-zero indicates that we are processing an interrupt; * g_current_regs is also used to manage interrupt level context switches. * @@ -99,7 +105,7 @@ static uint64_t *common_handler(int irq, uint64_t *regs) /* Update scheduler parameters */ cpu = this_cpu(); - nxsched_suspend_scheduler(g_running_tasks[cpu]); + nxsched_suspend_scheduler(*running_task); nxsched_resume_scheduler(this_task()); /* Record the new "running" task when context switch occurred. @@ -146,6 +152,13 @@ static uint64_t *common_handler(int irq, uint64_t *regs) uint64_t *isr_handler(uint64_t *regs, uint64_t irq) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } + board_autoled_on(LED_INIRQ); #ifdef CONFIG_SUPPRESS_INTERRUPTS diff --git a/arch/x86_64/src/intel64/intel64_head.S b/arch/x86_64/src/intel64/intel64_head.S index 251b7966f90..d9b8f16ba95 100644 --- a/arch/x86_64/src/intel64/intel64_head.S +++ b/arch/x86_64/src/intel64/intel64_head.S @@ -119,6 +119,16 @@ header_start: .long MULTIBOOT_TAG_TYPE_ACPI_OLD .long MULTIBOOT_TAG_TYPE_ACPI_NEW +#ifdef CONFIG_MULTBOOT2_FB + .short MULTIBOOT_HEADER_TAG_FRAMEBUFFER + .short 0 /* flags, none set */ + .long 20 /* size, including itself (short + short + long) */ + .long CONFIG_MULTBOOT2_FB_WIDTH /* width */ + .long CONFIG_MULTBOOT2_FB_HEIGHT /* height */ + .long CONFIG_MULTBOOT2_FB_DEEPTH /* depth */ + .long 0 +#endif + .short MULTIBOOT_HEADER_TAG_END .short 0 /* flags, none set */ .long 8 /* size, including itself (short + short + long) */ diff --git a/arch/x86_64/src/intel64/intel64_irq.c b/arch/x86_64/src/intel64/intel64_irq.c index baa6e6fd5d1..dc63e9027e9 100644 --- a/arch/x86_64/src/intel64/intel64_irq.c +++ b/arch/x86_64/src/intel64/intel64_irq.c @@ -56,8 +56,8 @@ struct intel64_irq_priv_s { - cpu_set_t busy; - bool msi; + bool busy; + bool msi; }; /**************************************************************************** @@ -512,12 +512,7 @@ void up_disable_irq(int irq) #ifndef CONFIG_ARCH_INTEL64_DISABLE_INT_INIT irqstate_t flags = spin_lock_irqsave(&g_irq_spinlock); - if (irq > IRQ255) - { - /* Not supported yet */ - - ASSERT(0); - } + DEBUGASSERT(irq <= IRQ255); /* Do nothing if this is MSI/MSI-X */ @@ -527,9 +522,7 @@ void up_disable_irq(int irq) return; } - CPU_CLR(this_cpu(), &g_irq_priv[irq].busy); - - if (CPU_COUNT(&g_irq_priv[irq].busy) == 0) + if (g_irq_priv[irq].busy) { /* One time disable */ @@ -537,6 +530,8 @@ void up_disable_irq(int irq) { up_ioapic_mask_pin(irq - IRQ0); } + + g_irq_priv[irq].busy = false; } spin_unlock_irqrestore(&g_irq_spinlock, flags); @@ -556,14 +551,7 @@ void up_enable_irq(int irq) #ifndef CONFIG_ARCH_INTEL64_DISABLE_INT_INIT irqstate_t flags = spin_lock_irqsave(&g_irq_spinlock); -# ifndef CONFIG_IRQCHAIN - /* Check if IRQ is free if we don't support IRQ chains */ - - if (CPU_ISSET(this_cpu(), &g_irq_priv[irq].busy)) - { - ASSERT(0); - } -# endif + DEBUGASSERT(irq <= IRQ255); /* Do nothing if this is MSI/MSI-X */ @@ -573,14 +561,16 @@ void up_enable_irq(int irq) return; } - if (irq > IRQ255) - { - /* Not supported yet */ +# ifndef CONFIG_IRQCHAIN + /* Check if IRQ is free if we don't support IRQ chains */ + if (g_irq_priv[irq].busy) + { ASSERT(0); } +# endif - if (CPU_COUNT(&g_irq_priv[irq].busy) == 0) + if (!g_irq_priv[irq].busy) { /* One time enable */ @@ -588,9 +578,9 @@ void up_enable_irq(int irq) { up_ioapic_unmask_pin(irq - IRQ0); } - } - CPU_SET(this_cpu(), &g_irq_priv[irq].busy); + g_irq_priv[irq].busy = true; + } spin_unlock_irqrestore(&g_irq_spinlock, flags); #endif @@ -693,8 +683,9 @@ int up_alloc_irq_msi(uint8_t busno, uint32_t devfn, int *pirq, int num) for (i = 0; i < num; i++) { - ASSERT(CPU_COUNT(&g_irq_priv[irq + i].busy) == 0); - g_irq_priv[irq + i].msi = true; + ASSERT(g_irq_priv[irq + i].busy == false); + g_irq_priv[irq + i].busy = true; + g_irq_priv[irq + i].msi = true; pirq[i] = irq + i; } @@ -720,7 +711,8 @@ void up_release_irq_msi(int *irq, int num) for (i = 0; i < num; i++) { - g_irq_priv[irq[i]].msi = false; + g_irq_priv[irq[i]].busy = false; + g_irq_priv[irq[i]].msi = false; } spin_unlock_irqrestore(&g_irq_spinlock, flags); diff --git a/arch/x86_64/src/intel64/intel64_start.c b/arch/x86_64/src/intel64/intel64_start.c index 005a692c325..a7e9eea9a63 100644 --- a/arch/x86_64/src/intel64/intel64_start.c +++ b/arch/x86_64/src/intel64/intel64_start.c @@ -46,6 +46,10 @@ uint32_t g_mb_magic __attribute__((section(".loader.bss"))); uint32_t g_mb_info_struct __attribute__((section(".loader.bss"))); uintptr_t g_acpi_rsdp = 0; +#ifdef CONFIG_MULTBOOT2_FB +struct multiboot_tag_framebuffer *g_mb_fb_tag = NULL; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -98,11 +102,15 @@ static void x86_64_mb2_config(void) break; } -#ifdef CONFIG_MULTBOOT2_FB_TERM +#ifdef CONFIG_MULTBOOT2_FB case MULTIBOOT_TAG_TYPE_FRAMEBUFFER: { - x86_64_mb2_fbinitialize( - (struct multiboot_tag_framebuffer *)tag); + /* We have to postpone frame buffer initialization because + * at this boot stage we can't map >4GB memory yet and it's + * possible that frame bufer address is above 4GB. + */ + + g_mb_fb_tag = (struct multiboot_tag_framebuffer *)tag; break; } #endif diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index c2c5814bc5e..7cb9e2193e9 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig @@ -321,7 +321,7 @@ choice config XTENSA_TOOLCHAIN_XCC bool "Xtensa Toolchain use GCC as front end" - select ARCH_TOOLCHAIN_GNU + select ARCH_TOOLCHAIN_GCC config XTENSA_TOOLCHAIN_XCLANG bool "Xtensa Toolchain use CLANG as front end" diff --git a/arch/xtensa/include/irq.h b/arch/xtensa/include/irq.h index f680b3dec0c..36a63bef284 100644 --- a/arch/xtensa/include/irq.h +++ b/arch/xtensa/include/irq.h @@ -37,6 +37,7 @@ #include #ifndef __ASSEMBLY__ # include +# include #endif #include @@ -458,6 +459,15 @@ noinstrument_function static inline_function bool up_interrupt_context(void) } #endif +#define up_switch_context(tcb, rtcb) \ + do { \ + if (!up_interrupt_context()) \ + { \ + sys_call2(SYS_switch_context, (uintptr_t)&rtcb->xcp.regs, \ + (uintptr_t)tcb->xcp.regs); \ + } \ + } while (0) + /**************************************************************************** * Name: up_getusrpc ****************************************************************************/ diff --git a/arch/xtensa/include/iss-hifi3z/core-isa.h b/arch/xtensa/include/iss-hifi3z/core-isa.h index 7fe873f293a..10b8b47a2e6 100644 --- a/arch/xtensa/include/iss-hifi3z/core-isa.h +++ b/arch/xtensa/include/iss-hifi3z/core-isa.h @@ -25,8 +25,8 @@ * ****************************************************************************/ -#ifndef XTENSA_CORE_CONFIGURATION_H_ -#define XTENSA_CORE_CONFIGURATION_H_ +#ifndef __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_CORE_ISA_H +#define __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_CORE_ISA_H /**************************************************************************** * Pre-processor Definitions @@ -819,4 +819,4 @@ #define XCHAL_HAVE_WWDT 0 #endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */ -#endif /* XTENSA_CORE_CONFIGURATION_H_ */ +#endif /* __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_CORE_ISA_H */ diff --git a/arch/xtensa/include/iss-hifi3z/tie-asm.h b/arch/xtensa/include/iss-hifi3z/tie-asm.h index 0021cf19908..237165e7b29 100644 --- a/arch/xtensa/include/iss-hifi3z/tie-asm.h +++ b/arch/xtensa/include/iss-hifi3z/tie-asm.h @@ -30,8 +30,8 @@ * ****************************************************************************/ -#ifndef _XTENSA_CORE_TIE_ASM_H -#define _XTENSA_CORE_TIE_ASM_H +#ifndef __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_TIE_ASM_H +#define __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_TIE_ASM_H /* Selection parameter values for save-area save/restore macros: */ @@ -274,4 +274,4 @@ .macro xchal_cp7_store p a b c d continue=0 ofs=-1 select=-1 ; .endm .macro xchal_cp7_load p a b c d continue=0 ofs=-1 select=-1 ; .endm -#endif /* _XTENSA_CORE_TIE_ASM_H */ +#endif /* __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_TIE_ASM_H */ diff --git a/arch/xtensa/include/iss-hifi3z/tie.h b/arch/xtensa/include/iss-hifi3z/tie.h index ee4335c0a17..fbc5063290d 100644 --- a/arch/xtensa/include/iss-hifi3z/tie.h +++ b/arch/xtensa/include/iss-hifi3z/tie.h @@ -32,8 +32,8 @@ * ****************************************************************************/ -#ifndef XTENSA_CORE_TIE_H -#define XTENSA_CORE_TIE_H +#ifndef __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_TIE_H +#define __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_TIE_H /* parasoft-begin-suppress ALL "This file not MISRA checked." */ @@ -179,4 +179,4 @@ /* parasoft-end-suppress ALL "This file not MISRA checked." */ -#endif /* XTENSA_CORE_TIE_H */ +#endif /* __ARCH_XTENSA_INCLUDE_ISS_HIFI3Z_TIE_H */ diff --git a/arch/xtensa/include/iss-hifi4/core-isa.h b/arch/xtensa/include/iss-hifi4/core-isa.h index 53d0831905c..8d12675fdba 100644 --- a/arch/xtensa/include/iss-hifi4/core-isa.h +++ b/arch/xtensa/include/iss-hifi4/core-isa.h @@ -25,8 +25,8 @@ * ****************************************************************************/ -#ifndef XTENSA_CORE_CONFIGURATION_H_ -#define XTENSA_CORE_CONFIGURATION_H_ +#ifndef __ARCH_XTENSA_INCLUDE_ISS_HIFI4_CORE_ISA_H +#define __ARCH_XTENSA_INCLUDE_ISS_HIFI4_CORE_ISA_H /**************************************************************************** * Pre-processor Definitions @@ -762,4 +762,4 @@ #endif /* !XTENSA_HAL_NON_PRIVILEGED_ONLY */ -#endif /* XTENSA_CORE_CONFIGURATION_H_ */ +#endif /* __ARCH_XTENSA_INCLUDE_ISS_HIFI4_CORE_ISA_H */ diff --git a/arch/xtensa/include/iss-hifi4/tie-asm.h b/arch/xtensa/include/iss-hifi4/tie-asm.h index 7113aa384e5..6bae0dc9edb 100644 --- a/arch/xtensa/include/iss-hifi4/tie-asm.h +++ b/arch/xtensa/include/iss-hifi4/tie-asm.h @@ -30,8 +30,8 @@ * ****************************************************************************/ -#ifndef _XTENSA_CORE_TIE_ASM_H -#define _XTENSA_CORE_TIE_ASM_H +#ifndef __ARCH_XTENSA_INCLUDE_ISS_HIFI4_TIE_ASM_H +#define __ARCH_XTENSA_INCLUDE_ISS_HIFI4_TIE_ASM_H /* Selection parameter values for save-area save/restore macros: */ @@ -346,4 +346,4 @@ .macro xchal_cp7_store p a b c d continue=0 ofs=-1 select=-1 ; .endm .macro xchal_cp7_load p a b c d continue=0 ofs=-1 select=-1 ; .endm -#endif /* _XTENSA_CORE_TIE_ASM_H */ +#endif /* __ARCH_XTENSA_INCLUDE_ISS_HIFI4_TIE_ASM_H */ diff --git a/arch/xtensa/include/iss-hifi4/tie.h b/arch/xtensa/include/iss-hifi4/tie.h index d1549d0d9b5..9a8be6a89b4 100644 --- a/arch/xtensa/include/iss-hifi4/tie.h +++ b/arch/xtensa/include/iss-hifi4/tie.h @@ -32,8 +32,8 @@ * ****************************************************************************/ -#ifndef XTENSA_CORE_TIE_H -#define XTENSA_CORE_TIE_H +#ifndef __ARCH_XTENSA_INCLUDE_ISS_HIFI4_TIE_H +#define __ARCH_XTENSA_INCLUDE_ISS_HIFI4_TIE_H /* parasoft-begin-suppress ALL "This file not MISRA checked." */ @@ -193,4 +193,4 @@ /* parasoft-end-suppress ALL "This file not MISRA checked." */ -#endif /* XTENSA_CORE_TIE_H */ +#endif /* __ARCH_XTENSA_INCLUDE_ISS_HIFI4_TIE_H */ diff --git a/arch/xtensa/src/cmake/platform.cmake b/arch/xtensa/src/cmake/platform.cmake index b1b792e14b0..bf6beee0d03 100644 --- a/arch/xtensa/src/cmake/platform.cmake +++ b/arch/xtensa/src/cmake/platform.cmake @@ -48,7 +48,7 @@ if(NOT CONFIG_LIBM) OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_LIBSUPCXX) +if(CONFIG_LIBSUPCXX_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libsupc++.a @@ -56,7 +56,7 @@ if(CONFIG_LIBSUPCXX) OUTPUT_VARIABLE extra_library) list(APPEND EXTRA_LIB ${extra_library}) endif() -if(CONFIG_SCHED_GCOV) +if(CONFIG_COVERAGE_TOOLCHAIN) execute_process( COMMAND ${CMAKE_C_COMPILER} ${CMAKE_C_FLAG_ARGS} ${NUTTX_EXTRA_FLAGS} --print-file-name=libgcov.a diff --git a/arch/xtensa/src/common/CMakeLists.txt b/arch/xtensa/src/common/CMakeLists.txt index 154bee98990..e677de7893e 100644 --- a/arch/xtensa/src/common/CMakeLists.txt +++ b/arch/xtensa/src/common/CMakeLists.txt @@ -69,7 +69,6 @@ list( xtensa_releasestack.c xtensa_registerdump.c xtensa_sigdeliver.c - xtensa_switchcontext.c xtensa_swint.c xtensa_stackframe.c xtensa_saveusercontext.c diff --git a/arch/xtensa/src/common/Make.defs b/arch/xtensa/src/common/Make.defs index 061575726be..8209da1bdd6 100644 --- a/arch/xtensa/src/common/Make.defs +++ b/arch/xtensa/src/common/Make.defs @@ -34,7 +34,7 @@ CMN_CSRCS += xtensa_irqdispatch.c xtensa_lowputs.c xtensa_mdelay.c CMN_CSRCS += xtensa_modifyreg8.c xtensa_modifyreg16.c xtensa_modifyreg32.c CMN_CSRCS += xtensa_mpu.c xtensa_nputs.c xtensa_oneshot.c xtensa_perf.c CMN_CSRCS += xtensa_releasestack.c xtensa_registerdump.c xtensa_sigdeliver.c -CMN_CSRCS += xtensa_switchcontext.c xtensa_swint.c xtensa_stackframe.c +CMN_CSRCS += xtensa_swint.c xtensa_stackframe.c CMN_CSRCS += xtensa_saveusercontext.c xtensa_schedsigaction.c xtensa_udelay.c CMN_CSRCS += xtensa_usestack.c xtensa_tcbinfo.c diff --git a/arch/xtensa/src/common/xtensa.h b/arch/xtensa/src/common/xtensa.h index f0eb3a5ff34..5d9edb40fa6 100644 --- a/arch/xtensa/src/common/xtensa.h +++ b/arch/xtensa/src/common/xtensa.h @@ -108,9 +108,6 @@ #define xtensa_context_restore(regs)\ sys_call1(SYS_restore_context, (uintptr_t)regs) -#define xtensa_switchcontext(saveregs, restoreregs)\ - sys_call2(SYS_switch_context, (uintptr_t)saveregs, (uintptr_t)restoreregs) - /* Interrupt codes from other CPUs: */ #define CPU_INTCODE_NONE 0 diff --git a/arch/xtensa/src/common/xtensa_assert.c b/arch/xtensa/src/common/xtensa_assert.c index 0b51bd603ac..e3a6abbff20 100644 --- a/arch/xtensa/src/common/xtensa_assert.c +++ b/arch/xtensa/src/common/xtensa_assert.c @@ -65,6 +65,13 @@ void xtensa_panic(int xptcode, uint32_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + (*running_task)->xcp.regs = regs; + } + up_set_current_regs(regs); /* We get here when a un-dispatch-able, irrecoverable exception occurs */ diff --git a/arch/xtensa/src/common/xtensa_cache.c b/arch/xtensa/src/common/xtensa_cache.c index 9161ad55c8b..db3633b8bc8 100644 --- a/arch/xtensa/src/common/xtensa_cache.c +++ b/arch/xtensa/src/common/xtensa_cache.c @@ -348,13 +348,11 @@ void up_enable_dcache(void) /* Check if the D-Cache is enabled */ - if ((memctl & MEMCTL_INV_EN) != 0) + if ((memctl & (MEMCTL_DCWA_MASK | MEMCTL_DCWU_MASK)) != 0) { return; } - up_invalidate_dcache_all(); - /* set ways allocatable & ways use */ memctl = memctl & ~(MEMCTL_DCWA_MASK | MEMCTL_DCWU_MASK); diff --git a/arch/xtensa/src/common/xtensa_irqdispatch.c b/arch/xtensa/src/common/xtensa_irqdispatch.c index c3023994c8d..46e848c777c 100644 --- a/arch/xtensa/src/common/xtensa_irqdispatch.c +++ b/arch/xtensa/src/common/xtensa_irqdispatch.c @@ -44,7 +44,8 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) { - struct tcb_s *tcb = this_task(); + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + struct tcb_s *tcb; #ifdef CONFIG_SUPPRESS_INTERRUPTS board_autoled_on(LED_INIRQ); @@ -64,11 +65,9 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) up_set_current_regs(regs); - if (irq != XTENSA_IRQ_SWINT) + if (*running_task != NULL) { - /* we are not trigger by syscall */ - - tcb->xcp.regs = regs; + (*running_task)->xcp.regs = regs; } /* Deliver the IRQ */ @@ -80,7 +79,7 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) * current_regs will have a different value than it did on entry. */ - if (regs != tcb->xcp.regs) + if (*running_task != tcb) { #ifdef CONFIG_ARCH_ADDRENV /* Make sure that the address environment for the previously @@ -94,16 +93,15 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) /* Update scheduler parameters */ - nxsched_suspend_scheduler(g_running_tasks[this_cpu()]); - nxsched_resume_scheduler(this_task()); + nxsched_suspend_scheduler(*running_task); + nxsched_resume_scheduler(tcb); /* Record the new "running" task when context switch occurred. * g_running_tasks[] is only used by assertion logic for reporting * crashes. */ - g_running_tasks[this_cpu()] = tcb; - regs = tcb->xcp.regs; + *running_task = tcb; } /* Set current_regs to NULL to indicate that we are no longer in an @@ -114,5 +112,5 @@ uint32_t *xtensa_irq_dispatch(int irq, uint32_t *regs) #endif board_autoled_off(LED_INIRQ); - return regs; + return tcb->xcp.regs; } diff --git a/arch/xtensa/src/common/xtensa_swint.c b/arch/xtensa/src/common/xtensa_swint.c index 943a7724307..fc48a03f3e0 100644 --- a/arch/xtensa/src/common/xtensa_swint.c +++ b/arch/xtensa/src/common/xtensa_swint.c @@ -59,12 +59,12 @@ int xtensa_swint(int irq, void *context, void *arg) { uint32_t *regs = (uint32_t *)context; struct tcb_s *tcb = this_task(); + uintptr_t *new_regs = regs; uint32_t cmd; DEBUGASSERT(regs != NULL); cmd = regs[REG_A2]; - tcb->xcp.regs = regs; /* The syscall software interrupt is called with A2 = system call command * and A3..A9 = variable number of arguments depending on the system call. @@ -119,6 +119,7 @@ int xtensa_swint(int irq, void *context, void *arg) case SYS_restore_context: { DEBUGASSERT(regs[REG_A3] != 0); + new_regs = (uint32_t *)regs[REG_A3]; tcb->xcp.regs = (uint32_t *)regs[REG_A3]; } break; @@ -142,9 +143,8 @@ int xtensa_swint(int irq, void *context, void *arg) case SYS_switch_context: { - DEBUGASSERT(regs[REG_A3] != 0 && regs[REG_A4] != 0); - *(uint32_t **)regs[REG_A3] = regs; - tcb->xcp.regs = (uint32_t *)regs[REG_A4]; + DEBUGASSERT(regs[REG_A4] != 0); + new_regs = (uint32_t *)regs[REG_A4]; } break; @@ -432,10 +432,10 @@ int xtensa_swint(int irq, void *context, void *arg) */ #ifdef CONFIG_DEBUG_SYSCALL_INFO - if (regs != tcb->xcp.regs) + if (regs != new_regs) { svcinfo("SYSCALL Return: Context switch!\n"); - up_dump_register(tcb->xcp.regs); + up_dump_register(new_regs); } else { @@ -443,7 +443,7 @@ int xtensa_swint(int irq, void *context, void *arg) } #endif - if (regs != tcb->xcp.regs) + if (regs != new_regs) { restore_critical_section(this_task(), this_cpu()); } diff --git a/arch/xtensa/src/lx6/Toolchain.defs b/arch/xtensa/src/lx6/Toolchain.defs index 6c3d51abbfb..78a5794c0b0 100644 --- a/arch/xtensa/src/lx6/Toolchain.defs +++ b/arch/xtensa/src/lx6/Toolchain.defs @@ -199,7 +199,7 @@ ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a)) endif diff --git a/arch/xtensa/src/lx7/Toolchain.defs b/arch/xtensa/src/lx7/Toolchain.defs index d9da19b7054..a0aebcc8087 100644 --- a/arch/xtensa/src/lx7/Toolchain.defs +++ b/arch/xtensa/src/lx7/Toolchain.defs @@ -203,7 +203,7 @@ ifeq ($(CONFIG_LIBSUPCXX_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libsupc++.a)) endif -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_TOOLCHAIN),y) EXTRA_LIBS += $(wildcard $(shell $(CC) $(ARCHCPUFLAGS) --print-file-name=libgcov.a)) endif diff --git a/arch/z16/src/common/z16_doirq.c b/arch/z16/src/common/z16_doirq.c index 233f7788580..a9ed9605e3e 100644 --- a/arch/z16/src/common/z16_doirq.c +++ b/arch/z16/src/common/z16_doirq.c @@ -58,8 +58,14 @@ FAR chipreg_t *z16_doirq(int irq, FAR chipreg_t *regs) #else if ((unsigned)irq < NR_IRQS) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; FAR chipreg_t *savestate; + if (*running_task != NULL) + { + z16_copystate((*running_task)->xcp.regs, regs) + } + /* Nested interrupts are not supported in this implementation. If * you want to implement nested interrupts, you would have to (1) * change the way that g_current_regs is handled and (2) the design diff --git a/arch/z16/src/common/z16_switchcontext.c b/arch/z16/src/common/z16_switchcontext.c index f076ba37011..e703b996ffb 100644 --- a/arch/z16/src/common/z16_switchcontext.c +++ b/arch/z16/src/common/z16_switchcontext.c @@ -93,6 +93,10 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ RESTORE_USERCONTEXT(tcb); diff --git a/arch/z16/src/z16f/z16f_sysexec.c b/arch/z16/src/z16f/z16f_sysexec.c index 916aa679f61..5d38d2a410d 100644 --- a/arch/z16/src/z16f/z16f_sysexec.c +++ b/arch/z16/src/z16f/z16f_sysexec.c @@ -47,8 +47,14 @@ void z16f_sysexec(FAR chipreg_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; uint16_t excp; + if (*running_task != NULL) + { + z16_copystate((*running_task)->xcp.regs, regs) + } + /* Save that register reference so that it can be used for built-in * diagnostics. */ diff --git a/arch/z80/src/common/z80_doirq.c b/arch/z80/src/common/z80_doirq.c index 81bbc2b51b3..8429a41bfc8 100644 --- a/arch/z80/src/common/z80_doirq.c +++ b/arch/z80/src/common/z80_doirq.c @@ -44,6 +44,13 @@ FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs) { + struct tcb_s **running_task = &g_running_tasks[this_cpu()]; + + if (*running_task != NULL) + { + z80_copystate((*running_task)->xcp.regs, regs) + } + board_autoled_on(LED_INIRQ); DECL_SAVESTATE(); diff --git a/arch/z80/src/common/z80_switchcontext.c b/arch/z80/src/common/z80_switchcontext.c index fde1cd3c0d1..08fdab13788 100644 --- a/arch/z80/src/common/z80_switchcontext.c +++ b/arch/z80/src/common/z80_switchcontext.c @@ -105,6 +105,10 @@ void up_switch_context(FAR struct tcb_s *tcb, FAR struct tcb_s *rtcb) nxsched_resume_scheduler(tcb); + /* Record the new "running" task */ + + g_running_tasks[this_cpu()] = tcb; + /* Then switch contexts */ RESTORE_USERCONTEXT(tcb); diff --git a/boards/Kconfig b/boards/Kconfig index 368569924fa..65968d17349 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -3478,6 +3478,7 @@ config ARCH_BOARD default "pinephonepro" if ARCH_BOARD_PINEPHONE_PRO default "nanopi_m4" if ARCH_BOARD_NANOPI_M4 default "fvp-armv8r" if ARCH_BOARD_FVP_ARMV8R + default "vdk-armv8r" if ARCH_BOARD_VDK_ARMV8R_BASE default "fvp-armv8r-aarch32" if ARCH_BOARD_FVP_ARMV8R_AARCH32 default "imx8qm-mek" if ARCH_BOARD_IMX8QM_MEK default "imx93-evk" if ARCH_BOARD_IMX93_EVK @@ -3704,6 +3705,9 @@ endif if ARCH_BOARD_FVP_ARMV8R source "boards/arm64/fvp-v8r/fvp-armv8r/Kconfig" endif +if ARCH_BOARD_VDK_ARMV8R_BASE +source "boards/arm64/vdk/vdk-armv8r/Kconfig" +endif if ARCH_BOARD_FVP_ARMV8R_AARCH32 source "boards/arm/fvp-v8r-aarch32/fvp-armv8r-aarch32/Kconfig" endif @@ -4652,9 +4656,9 @@ source "boards/arm/nrf91/common/Kconfig" endif endif -config BOARD_CRASHDUMP - bool "Enable Board level logging of crash dumps" - default n +choice + prompt "BOARD crashdump method" + default BOARD_CRASHDUMP_NONE ---help--- If selected up_assert will call out to board_crashdump, in the case of an assertion failure, prior to calling exit. Or in the @@ -4671,28 +4675,43 @@ config BOARD_CRASHDUMP config BOARD_COREDUMP_SYSLOG bool "Enable Core dump to syslog" - default n depends on COREDUMP ---help--- Enable put coredump to syslog when crash. config BOARD_COREDUMP_BLKDEV bool "Enable Core Dump to block device" - default n depends on COREDUMP ---help--- - Enable save coredump at block device when crash. + Enable save coredump to block device when crash. + +config BOARD_COREDUMP_MTDDEV + bool "Enable Core Dump to mtd device" + depends on COREDUMP + ---help--- + Enable save coredump to mtd device when crash. + +config BOARD_CRASHDUMP_CUSTOM + bool "Enable Core Dump with custom method" + ---help--- + Enable save coredump with custom method. only work with + board_crashdump api. + +config BOARD_CRASHDUMP_NONE + bool "No Board level crash dump" + +endchoice # BOARD crashdump method -config BOARD_COREDUMP_BLKDEV_PATH - string "Save Core Dump block device PATH" - depends on BOARD_COREDUMP_BLKDEV +config BOARD_COREDUMP_DEVPATH + string "Save Core Dump data with device PATH" + depends on BOARD_COREDUMP_BLKDEV || BOARD_COREDUMP_MTDDEV ---help--- - Save coredump file block device path. + Save coredump file into block/mtd device path. config BOARD_COREDUMP_FULL bool "Core Dump all thread registers and stacks" default y - depends on BOARD_COREDUMP_SYSLOG || BOARD_COREDUMP_BLKDEV + depends on !BOARD_CRASHDUMP_NONE ---help--- Enable to support for the dump all task registers and stacks. @@ -4700,7 +4719,7 @@ config BOARD_COREDUMP_COMPRESSION bool "Enable Core Dump compression" default y select LIBC_LZF - depends on BOARD_COREDUMP_SYSLOG || BOARD_COREDUMP_BLKDEV + depends on !BOARD_CRASHDUMP_NONE ---help--- Enable LZF compression algorithm for core dump content diff --git a/boards/arm/mps/mps3-an547/configs/ap/defconfig b/boards/arm/mps/mps3-an547/configs/ap/defconfig index 4791167167d..43cf502c703 100644 --- a/boards/arm/mps/mps3-an547/configs/ap/defconfig +++ b/boards/arm/mps/mps3-an547/configs/ap/defconfig @@ -65,7 +65,6 @@ # CONFIG_NSH_DISABLE_UNSET is not set # CONFIG_NSH_DISABLE_UPTIME is not set # CONFIG_NSH_DISABLE_USLEEP is not set -# CONFIG_NSH_DISABLE_WAIT is not set # CONFIG_NSH_DISABLE_WGET is not set # CONFIG_NSH_DISABLE_XD is not set CONFIG_ARCH="arm" diff --git a/boards/arm/mps/mps3-an547/configs/archivefs/defconfig b/boards/arm/mps/mps3-an547/configs/archivefs/defconfig new file mode 100644 index 00000000000..a959764351f --- /dev/null +++ b/boards/arm/mps/mps3-an547/configs/archivefs/defconfig @@ -0,0 +1,86 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_DEBUG_WARN is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="mps3-an547" +CONFIG_ARCH_BOARD_MPS3_AN547=y +CONFIG_ARCH_CHIP="mps" +CONFIG_ARCH_CHIP_MPS3_AN547=y +CONFIG_ARCH_CHIP_MPS=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV8M_SYSTICK=y +CONFIG_ARMV8M_USEBASEPRI=y +CONFIG_BCH=y +CONFIG_BUILTIN=y +CONFIG_CMSDK_UART0=y +CONFIG_CMSDK_UART0_BASE=0x49303000 +CONFIG_CMSDK_UART0_CLOCK=25000000 +CONFIG_CMSDK_UART0_OV_IRQ=59 +CONFIG_CMSDK_UART0_RX_IRQ=50 +CONFIG_CMSDK_UART0_SERIAL_CONSOLE=y +CONFIG_CMSDK_UART0_TX_IRQ=49 +CONFIG_CMSDK_UART=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_BUSFAULT=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_FS_ERROR=y +CONFIG_DEBUG_FULLOPT=y +CONFIG_DEBUG_HARDFAULT_ALERT=y +CONFIG_DEBUG_SCHED=y +CONFIG_DEBUG_SCHED_ERROR=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEBUG_USAGEFAULT=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_DEV_ZERO=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXPERIMENTAL=y +CONFIG_FS_ARCHIVEFS=y +CONFIG_FS_PROCFS=y +CONFIG_FS_ROMFS=y +CONFIG_FS_TMPFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_LOCALE=y +CONFIG_LIBC_MEMFD_ERROR=y +CONFIG_LIB_ZLIB=y +CONFIG_MTD=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAMLOG=y +CONFIG_RAM_SIZE=2097152 +CONFIG_RAM_START=0x01000000 +CONFIG_RAW_BINARY=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_IRQMONITOR=y +CONFIG_SPINLOCK=y +CONFIG_STACK_COLORATION=y +CONFIG_STANDARD_SERIAL=y +CONFIG_START_DAY=25 +CONFIG_START_MONTH=4 +CONFIG_START_YEAR=2023 +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SYSTEM=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_TIMER=y +CONFIG_TIMER_ARCH=y +CONFIG_USEC_PER_TICK=1000 +CONFIG_UTILS_LIBARCHIVE=y +CONFIG_UTILS_XZ=y diff --git a/boards/arm/mps/mps3-an547/configs/gcov/defconfig b/boards/arm/mps/mps3-an547/configs/gcov/defconfig new file mode 100644 index 00000000000..c97dfe12d02 --- /dev/null +++ b/boards/arm/mps/mps3-an547/configs/gcov/defconfig @@ -0,0 +1,80 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_DEBUG_WARN is not set +CONFIG_ARCH="arm" +CONFIG_ARCH_BOARD="mps3-an547" +CONFIG_ARCH_BOARD_MPS3_AN547=y +CONFIG_ARCH_CHIP="mps" +CONFIG_ARCH_CHIP_MPS3_AN547=y +CONFIG_ARCH_CHIP_MPS=y +CONFIG_ARCH_INTERRUPTSTACK=2048 +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARMV8M_SYSTICK=y +CONFIG_ARMV8M_USEBASEPRI=y +CONFIG_ARM_TOOLCHAIN_CLANG=y +CONFIG_BUILTIN=y +CONFIG_CMSDK_UART0=y +CONFIG_CMSDK_UART0_BASE=0x49303000 +CONFIG_CMSDK_UART0_CLOCK=25000000 +CONFIG_CMSDK_UART0_OV_IRQ=59 +CONFIG_CMSDK_UART0_RX_IRQ=50 +CONFIG_CMSDK_UART0_SERIAL_CONSOLE=y +CONFIG_CMSDK_UART0_TX_IRQ=49 +CONFIG_CMSDK_UART=y +CONFIG_COVERAGE_MINI=y +CONFIG_DEBUG_ASSERTIONS=y +CONFIG_DEBUG_BUSFAULT=y +CONFIG_DEBUG_FEATURES=y +CONFIG_DEBUG_HARDFAULT_ALERT=y +CONFIG_DEBUG_SCHED=y +CONFIG_DEBUG_SCHED_ERROR=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEBUG_USAGEFAULT=y +CONFIG_DEFAULT_TASK_STACKSIZE=4096 +CONFIG_DEV_ZERO=y +CONFIG_EXAMPLES_HELLO=y +CONFIG_EXPERIMENTAL=y +CONFIG_FS_PROCFS=y +CONFIG_FS_ROMFS=y +CONFIG_FS_TMPFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INTELHEX_BINARY=y +CONFIG_LIBC_MEMFD_ERROR=y +CONFIG_LIBM=y +CONFIG_MM_REGIONS=2 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAMLOG=y +CONFIG_RAM_SIZE=2097152 +CONFIG_RAM_START=0x01000000 +CONFIG_RAW_BINARY=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_HPWORKPRIORITY=192 +CONFIG_SCHED_IRQMONITOR=y +CONFIG_SPINLOCK=y +CONFIG_STACK_COLORATION=y +CONFIG_STANDARD_SERIAL=y +CONFIG_START_DAY=25 +CONFIG_START_MONTH=4 +CONFIG_START_YEAR=2023 +CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_SYSTEM=y +CONFIG_TESTING_GETPRIME=y +CONFIG_TESTING_OSTEST=y +CONFIG_TIMER=y +CONFIG_TIMER_ARCH=y +CONFIG_USEC_PER_TICK=1000 diff --git a/boards/arm/mps/mps3-an547/scripts/Make.defs b/boards/arm/mps/mps3-an547/scripts/Make.defs index cf8e5476148..3dd2b045385 100644 --- a/boards/arm/mps/mps3-an547/scripts/Make.defs +++ b/boards/arm/mps/mps3-an547/scripts/Make.defs @@ -37,22 +37,3 @@ AFLAGS := $(CFLAGS) -D__ASSEMBLY__ NXFLATLDFLAGS1 = -r -d -warn-common NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)$(DELIM)binfmt$(DELIM)libnxflat$(DELIM)gnu-nxflat-pcrel.ld -no-check-sections LDNXFLATFLAGS = -e main -s 2048 - -ifeq ($(CONFIG_MPS3_AN547_AP),y) -define POSTBUILD - $(Q)echo "Generating: ap.bin"; \ - cp nuttx ap.elf; - cp nuttx.bin ap.bin; - cp nuttx.map ap.map; - $(STRIP) --remove-section=.rel.text --remove-section=.comment --strip-unneeded ap.elf -o boot -endef -endif - -ifeq ($(CONFIG_MPS3_AN547_BL),y) -define POSTBUILD - $(Q)echo "Generating: bl.bin"; \ - cp nuttx bl.elf; - cp nuttx.bin bl.bin; - cp nuttx.map bl.map; -endef -endif diff --git a/boards/arm/mps/mps3-an547/scripts/flash.ld b/boards/arm/mps/mps3-an547/scripts/flash.ld index cd7a38c5663..d605dfc9410 100644 --- a/boards/arm/mps/mps3-an547/scripts/flash.ld +++ b/boards/arm/mps/mps3-an547/scripts/flash.ld @@ -57,6 +57,12 @@ SECTIONS _einit = ABSOLUTE(.); } > flash + __llvm_prf_names : { + __start__llvm_prf_names = .; + KEEP (*(__llvm_prf_names)) + __end__llvm_prf_names = .; + } > flash + .ARM.extab : ALIGN(4) { *(.ARM.extab*) } > flash @@ -93,6 +99,24 @@ SECTIONS *(.gnu.linkonce.d.*) CONSTRUCTORS . = ALIGN(4); + } > sram1 AT > flash + + __llvm_prf_data : { + __start__llvm_prf_data = .; + KEEP (*(__llvm_prf_data)) + __end__llvm_prf_data = .; + } > sram1 AT > flash + + __llvm_prf_vnds : { + __start__llvm_prf_vnds = .; + KEEP (*(__llvm_prf_vnds)) + __end__llvm_prf_vnds = .; + } > sram1 AT > flash + + __llvm_prf_cnts : { + __start__llvm_prf_cnts = .; + KEEP (*(__llvm_prf_cnts)) + __end__llvm_prf_cnts = .; _edata = ABSOLUTE(.); } > sram1 AT > flash diff --git a/boards/arm/sama5/sama5d4-ek/src/at25_main.c b/boards/arm/sama5/sama5d4-ek/src/at25_main.c index ba6e45346d3..d75702f2e04 100644 --- a/boards/arm/sama5/sama5d4-ek/src/at25_main.c +++ b/boards/arm/sama5/sama5d4-ek/src/at25_main.c @@ -180,7 +180,7 @@ int at25_main(int argc, char *argv[]) /* The HEX file load was successful, write the data to FLASH */ printf("Successfully loaded the Intel HEX file into memory...\n"); - printf(" Writing %d bytes to the AT25 Serial FLASH\n", + printf(" Writing %" PRIdOFF " bytes to the AT25 Serial FLASH\n", memoutstream.common.nput); remaining = memoutstream.common.nput; @@ -213,7 +213,7 @@ int at25_main(int argc, char *argv[]) * the same. */ - printf(" Verifying %d bytes in the AT25 Serial FLASH\n", + printf(" Verifying %" PRIdOFF " bytes in the AT25 Serial FLASH\n", memoutstream.common.nput); /* Open the AT25 device for writing */ @@ -252,7 +252,7 @@ int at25_main(int argc, char *argv[]) { if (memcmp(g_iobuffer, src, nread) != 0) { - fprintf(stderr, "ERROR: Verify failed at offset %d\n", + fprintf(stderr, "ERROR: Verify failed at offset %"PRIdOFF"\n", memoutstream.common.nput - remaining); close(fd); return EXIT_FAILURE; @@ -264,7 +264,7 @@ int at25_main(int argc, char *argv[]) } while (remaining > 0); - printf(" Successfully verified %d bytes in the AT25 Serial FLASH\n", + printf("Successfully verified %"PRIdOFF" bytes in the AT25 Serial FLASH\n", memoutstream.common.nput); close(fd); diff --git a/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig b/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig index 700591697bf..db83de70edc 100644 --- a/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig +++ b/boards/arm64/qemu/qemu-armv8a/configs/nsh/defconfig @@ -30,23 +30,26 @@ CONFIG_DEVICE_TREE=y CONFIG_DEV_ZERO=y CONFIG_EXAMPLES_HELLO=y CONFIG_EXPERIMENTAL=y +CONFIG_FRAME_POINTER=y CONFIG_FS_HOSTFS=y CONFIG_FS_PROCFS=y CONFIG_FS_PROCFS_REGISTER=y CONFIG_FS_ROMFS=y +CONFIG_FS_TMPFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y CONFIG_IDLETHREAD_STACKSIZE=8192 CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INTELHEX_BINARY=y CONFIG_LIBC_EXECFUNCS=y -CONFIG_MM_KASAN=y -CONFIG_MM_KASAN_GLOBAL=y +CONFIG_LIBC_MEMFD_ERROR=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_READLINE=y CONFIG_PREALLOC_TIMERS=4 +CONFIG_PROFILE_ALL=y +CONFIG_PROFILE_MINI=y CONFIG_PTHREAD_STACK_MIN=8192 CONFIG_RAMLOG=y CONFIG_RAM_SIZE=134217728 @@ -61,6 +64,7 @@ CONFIG_STACK_COLORATION=y CONFIG_START_MONTH=3 CONFIG_START_YEAR=2022 CONFIG_SYMTAB_ORDEREDBYNAME=y +CONFIG_SYSTEM_GPROF=y CONFIG_SYSTEM_NSH=y CONFIG_SYSTEM_SYSTEM=y CONFIG_SYSTEM_TIME64=y diff --git a/boards/risc-v/esp32c3-legacy/esp32c3-devkit-rust-1/src/esp32c3_boot.c b/boards/risc-v/esp32c3-legacy/esp32c3-devkit-rust-1/src/esp32c3_boot.c index 6ab7c136f9d..ec6495b0165 100644 --- a/boards/risc-v/esp32c3-legacy/esp32c3-devkit-rust-1/src/esp32c3_boot.c +++ b/boards/risc-v/esp32c3-legacy/esp32c3-devkit-rust-1/src/esp32c3_boot.c @@ -23,6 +23,7 @@ ****************************************************************************/ #include +#include #include /**************************************************************************** diff --git a/boards/risc-v/esp32c3-legacy/esp32c3-devkit/src/esp32c3_boot.c b/boards/risc-v/esp32c3-legacy/esp32c3-devkit/src/esp32c3_boot.c index 4605b870c76..b3c16746178 100644 --- a/boards/risc-v/esp32c3-legacy/esp32c3-devkit/src/esp32c3_boot.c +++ b/boards/risc-v/esp32c3-legacy/esp32c3-devkit/src/esp32c3_boot.c @@ -23,6 +23,8 @@ ****************************************************************************/ #include +#include +#include /**************************************************************************** * Pre-processor Definitions diff --git a/boards/sim/sim/sim/configs/kasan/defconfig b/boards/sim/sim/sim/configs/kasan/defconfig index 34b43ed9a20..369a239922a 100644 --- a/boards/sim/sim/sim/configs/kasan/defconfig +++ b/boards/sim/sim/sim/configs/kasan/defconfig @@ -13,6 +13,7 @@ CONFIG_ARCH_SIM=y CONFIG_BOARDCTL_POWEROFF=y CONFIG_BUILTIN=y CONFIG_CANCELLATION_POINTS=y +CONFIG_COVERAGE_TOOLCHAIN=y CONFIG_DEBUG_FEATURES=y CONFIG_DEBUG_SYMBOLS=y CONFIG_DEV_LOOP=y @@ -38,7 +39,6 @@ CONFIG_PTHREAD_MUTEX_TYPES=y CONFIG_PTHREAD_MUTEX_UNSAFE=y CONFIG_READLINE_TABCOMPLETION=y CONFIG_RR_INTERVAL=10 -CONFIG_SCHED_GCOV=y CONFIG_SCHED_HAVE_PARENT=y CONFIG_SCHED_LPWORK=y CONFIG_SCHED_WAITPID=y diff --git a/boards/sim/sim/sim/configs/libcxxtest/defconfig b/boards/sim/sim/sim/configs/libcxxtest/defconfig index 98735fa9869..608014f9546 100644 --- a/boards/sim/sim/sim/configs/libcxxtest/defconfig +++ b/boards/sim/sim/sim/configs/libcxxtest/defconfig @@ -10,7 +10,6 @@ CONFIG_ARCH="sim" CONFIG_ARCH_BOARD="sim" CONFIG_ARCH_BOARD_SIM=y CONFIG_ARCH_CHIP="sim" -CONFIG_ARCH_MATH_H=y CONFIG_ARCH_SIM=y CONFIG_BOARDCTL_APP_SYMTAB=y CONFIG_BOARDCTL_POWEROFF=y diff --git a/boards/sim/sim/sim/configs/nsh/defconfig b/boards/sim/sim/sim/configs/nsh/defconfig index 2f89783ec16..eaa288908cb 100644 --- a/boards/sim/sim/sim/configs/nsh/defconfig +++ b/boards/sim/sim/sim/configs/nsh/defconfig @@ -49,6 +49,7 @@ CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILE_APPS=y CONFIG_NSH_READLINE=y CONFIG_PATH_INITIAL="/bin" +CONFIG_PIPES=y CONFIG_PSEUDOFS_ATTRIBUTES=y CONFIG_PSEUDOFS_FILE=y CONFIG_PSEUDOFS_SOFTLINKS=y diff --git a/boards/sim/sim/sim/configs/thermal/defconfig b/boards/sim/sim/sim/configs/thermal/defconfig index 4f26a749afd..ed59eb3eab7 100644 --- a/boards/sim/sim/sim/configs/thermal/defconfig +++ b/boards/sim/sim/sim/configs/thermal/defconfig @@ -1,75 +1,12 @@ -# -# This file is autogenerated: PLEASE DO NOT EDIT IT. -# -# You can use "make menuconfig" to make any modifications to the installed .config file. -# You can then do "make savedefconfig" to generate a new defconfig file that includes your -# modifications. -# -# CONFIG_NSH_CMDOPT_HEXDUMP is not set -CONFIG_ARCH="sim" -CONFIG_ARCH_BOARD="sim" -CONFIG_ARCH_BOARD_SIM=y -CONFIG_ARCH_CHIP="sim" -CONFIG_ARCH_SIM=y -CONFIG_BOARDCTL_APP_SYMTAB=y -CONFIG_BOARDCTL_POWEROFF=y -CONFIG_BOARD_LOOPSPERMSEC=0 -CONFIG_BOOT_RUNFROMEXTSRAM=y -CONFIG_BUILTIN=y +#include "../nsh/defconfig" CONFIG_DEBUG_FEATURES=y -CONFIG_DEBUG_SYMBOLS=y CONFIG_DEBUG_THERMAL=y CONFIG_DEBUG_THERMAL_ERROR=y CONFIG_DEBUG_THERMAL_INFO=y CONFIG_DEBUG_THERMAL_WARN=y -CONFIG_DEV_GPIO=y -CONFIG_DEV_LOOP=y -CONFIG_DEV_ZERO=y -CONFIG_ETC_FATDEVNO=2 -CONFIG_ETC_ROMFS=y -CONFIG_ETC_ROMFSDEVNO=1 -CONFIG_EXAMPLES_GPIO=y -CONFIG_EXAMPLES_HELLO=y -CONFIG_FAT_LCNAMES=y -CONFIG_FAT_LFN=y -CONFIG_FSUTILS_PASSWD=y -CONFIG_FSUTILS_PASSWD_READONLY=y -CONFIG_FS_BINFS=y -CONFIG_FS_FAT=y -CONFIG_FS_PROCFS=y -CONFIG_FS_RAMMAP=y -CONFIG_FS_ROMFS=y -CONFIG_GPIO_LOWER_HALF=y -CONFIG_IDLETHREAD_STACKSIZE=4096 -CONFIG_INIT_ENTRYPOINT="nsh_main" -CONFIG_IOEXPANDER=y -CONFIG_IOEXPANDER_DUMMY=y -CONFIG_LIBC_ENVPATH=y -CONFIG_LIBC_EXECFUNCS=y -CONFIG_LIBC_LOCALE=y -CONFIG_LIBC_LOCALE_CATALOG=y -CONFIG_LIBC_LOCALE_GETTEXT=y -CONFIG_LIBC_MAX_EXITFUNS=1 -CONFIG_LIBC_NUMBERED_ARGS=y -CONFIG_NSH_ARCHINIT=y -CONFIG_NSH_BUILTIN_APPS=y -CONFIG_NSH_FILE_APPS=y -CONFIG_NSH_MOTD=y -CONFIG_NSH_MOTD_STRING="MOTD: username=admin password=Administrator" -CONFIG_NSH_READLINE=y -CONFIG_PATH_INITIAL="/bin" CONFIG_PM=y -CONFIG_PSEUDOFS_ATTRIBUTES=y -CONFIG_PSEUDOFS_SOFTLINKS=y -CONFIG_READLINE_TABCOMPLETION=y -CONFIG_SCHED_BACKTRACE=y -CONFIG_SCHED_HAVE_PARENT=y -CONFIG_SCHED_WAITPID=y -CONFIG_SIM_WALLTIME_SIGNAL=y -CONFIG_START_MONTH=6 -CONFIG_START_YEAR=2008 -CONFIG_SYSTEM_DUMPSTACK=y -CONFIG_SYSTEM_NSH=y +CONFIG_READLINE_CMD_HISTORY=y +CONFIG_SCHED_LPWORK=y CONFIG_THERMAL=y CONFIG_THERMAL_DUMMY=y CONFIG_THERMAL_PROCFS=y diff --git a/boards/sim/sim/sim/scripts/Make.defs b/boards/sim/sim/sim/scripts/Make.defs index 2d03dd3200c..79466fe7b4c 100644 --- a/boards/sim/sim/sim/scripts/Make.defs +++ b/boards/sim/sim/sim/scripts/Make.defs @@ -72,11 +72,15 @@ ifneq ($(CONFIG_STACK_USAGE_WARNING),0) ARCHOPTIMIZATION += -Wstack-usage=$(CONFIG_STACK_USAGE_WARNING) endif -ifeq ($(CONFIG_SCHED_GCOV_ALL),y) - ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage +ifeq ($(CONFIG_COVERAGE_ALL),y) + ifeq ($(CONFIG_ARCH_TOOLCHAIN_GCC),y) + ARCHOPTIMIZATION += -fprofile-generate -ftest-coverage + else ifeq ($(CONFIG_ARCH_TOOLCHAIN_CLANG),y) + ARCHOPTIMIZATION += -fprofile-instr-generate -fcoverage-mapping + endif endif -ifneq ($(CONFIG_SCHED_GPROF_ALL)$(CONFIG_SIM_GPROF),) +ifneq ($(CONFIG_PROFILE_ALL)$(CONFIG_SIM_PROFILE),) ARCHOPTIMIZATION += -pg endif @@ -278,8 +282,8 @@ CELFFLAGS += -fno-pic CXXELFFLAGS += -fno-pic ifeq ($(CONFIG_LIBC_ARCH_ELF_64BIT),y) # See the comment on CMODULEFLAGS above. - CELFFLAGS += -mcmodel=large - CXXELFFLAGS += -mcmodel=large + CELFFLAGS += -mcmodel=medium + CXXELFFLAGS += -mcmodel=medium endif LDELFFLAGS = -r -e main --gc-sections @@ -289,10 +293,7 @@ ifeq ($(CONFIG_HOST_MACOS),y) LDFLAGS += -Wl,-dead_strip else LDFLAGS += -Wl,--gc-sections - - # Let the symbol table link from 0x50000000 - # which is more convenient for debugging. - LDFLAGS += -Wl,-Ttext-segment=0x50000000 + LDFLAGS += -Wl,-Ttext-segment=0x40000000 endif ifeq ($(CONFIG_DEBUG_LINK_MAP),y) @@ -323,3 +324,18 @@ else ifeq ($(CONFIG_HOST_MACOS),) ARCHPICFLAGS += -no-pie LDFLAGS += -Wl,-no-pie endif + +ifeq ($(CONFIG_HOST_LINUX),y) + define POSTBUILD + $(Q)echo "Pac SIM with dynamic libs.."; + @ rm -rf sim-pac; + @ mkdir -p sim-pac/libs; + @ cp nuttx sim-pac/nuttx; + @ ldd sim-pac/nuttx | grep "=> /" | awk '{print $$3}' | xargs -I '{}' cp -v '{}' sim-pac/libs; + @ readelf -l nuttx | grep "program interpreter" | awk -F':' '{print $$2}'| cut -d"]" -f1 | xargs -I '{}' cp -v '{}' sim-pac; + @ cp $(TOPDIR)/tools/simlaunch.sh sim-pac; + @ tar -czf nuttx.tgz sim-pac; + $(Q)echo "SIM elf with dynamic libs archive in nuttx.tgz" + @ rm -rf sim-pac; + endef +endif diff --git a/boards/x86_64/intel64/qemu-intel64/configs/fb/defconfig b/boards/x86_64/intel64/qemu-intel64/configs/fb/defconfig new file mode 100644 index 00000000000..0c4866f6d93 --- /dev/null +++ b/boards/x86_64/intel64/qemu-intel64/configs/fb/defconfig @@ -0,0 +1,76 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_PVHBOOT is not set +# CONFIG_NX_DISABLE_32BPP is not set +CONFIG_16550_ADDRWIDTH=16 +CONFIG_16550_UART0=y +CONFIG_16550_UART0_BASE=0x3f8 +CONFIG_16550_UART0_CLOCK=1843200 +CONFIG_16550_UART0_IRQ=36 +CONFIG_16550_UART0_RXBUFSIZE=16 +CONFIG_16550_UART0_SERIAL_CONSOLE=y +CONFIG_16550_UART0_TXBUFSIZE=16 +CONFIG_16550_UART=y +CONFIG_ARCH="x86_64" +CONFIG_ARCH_BOARD="qemu-intel64" +CONFIG_ARCH_BOARD_INTEL64_QEMU=y +CONFIG_ARCH_CHIP="intel64" +CONFIG_ARCH_CHIP_INTEL64_QEMU=y +CONFIG_ARCH_INTEL64_CORE_FREQ_KHZ=2600000 +CONFIG_ARCH_SIZET_LONG=y +CONFIG_ARCH_X86_64=y +CONFIG_BOARD_LOOPSPERMSEC=999 +CONFIG_BOOT_RUNFROMEXTSRAM=y +CONFIG_BUILTIN=y +CONFIG_CONSOLE_SYSLOG=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=4194304 +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_FB=y +CONFIG_EXAMPLES_NX=y +CONFIG_EXAMPLES_NXDEMO=y +CONFIG_EXAMPLES_NXDEMO_BPP=32 +CONFIG_EXAMPLES_NXTERM=y +CONFIG_EXAMPLES_NXTERM_BPP=32 +CONFIG_FS_PROCFS=y +CONFIG_IDLETHREAD_STACKSIZE=4194304 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LIBM=y +CONFIG_MQ_MAXMSGSIZE=64 +CONFIG_MULTBOOT2_FB=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFCONFIG=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_NX=y +CONFIG_NXFONT_SANS17X22=y +CONFIG_NXTERM=y +CONFIG_NX_BLOCKING=y +CONFIG_PREALLOC_CHILDSTATUS=16 +CONFIG_PRIORITY_INHERITANCE=y +CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_INHERIT=y +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_PTHREAD_STACK_MIN=4194304 +CONFIG_RAM_SIZE=268435456 +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_THREAD_LOCAL=y +CONFIG_SCHED_TICKLESS=y +CONFIG_SCHED_TICKLESS_ALARM=y +CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP=y +CONFIG_SCHED_WAITPID=y +CONFIG_SIG_DEFAULT=y +CONFIG_START_DAY=3 +CONFIG_START_MONTH=3 +CONFIG_START_YEAR=2011 +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_TIME64=y +CONFIG_TESTING_OSTEST=y +CONFIG_TESTING_OSTEST_STACKSIZE=4194304 +CONFIG_USEC_PER_TICK=1 +CONFIG_VIDEO_FB=y diff --git a/boards/x86_64/intel64/qemu-intel64/configs/lvgl/defconfig b/boards/x86_64/intel64/qemu-intel64/configs/lvgl/defconfig new file mode 100644 index 00000000000..2a168c46d56 --- /dev/null +++ b/boards/x86_64/intel64/qemu-intel64/configs/lvgl/defconfig @@ -0,0 +1,73 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_PVHBOOT is not set +CONFIG_16550_ADDRWIDTH=16 +CONFIG_16550_UART0=y +CONFIG_16550_UART0_BASE=0x3f8 +CONFIG_16550_UART0_CLOCK=1843200 +CONFIG_16550_UART0_IRQ=36 +CONFIG_16550_UART0_RXBUFSIZE=16 +CONFIG_16550_UART0_SERIAL_CONSOLE=y +CONFIG_16550_UART0_TXBUFSIZE=16 +CONFIG_16550_UART=y +CONFIG_ARCH="x86_64" +CONFIG_ARCH_BOARD="qemu-intel64" +CONFIG_ARCH_BOARD_INTEL64_QEMU=y +CONFIG_ARCH_CHIP="intel64" +CONFIG_ARCH_CHIP_INTEL64_QEMU=y +CONFIG_ARCH_INTEL64_CORE_FREQ_KHZ=2600000 +CONFIG_ARCH_SIZET_LONG=y +CONFIG_ARCH_X86_64=y +CONFIG_BOARD_LOOPSPERMSEC=999 +CONFIG_BOOT_RUNFROMEXTSRAM=y +CONFIG_BUILTIN=y +CONFIG_CONSOLE_SYSLOG=y +CONFIG_DEBUG_SYMBOLS=y +CONFIG_DEFAULT_TASK_STACKSIZE=4194304 +CONFIG_DRIVERS_VIDEO=y +CONFIG_EXAMPLES_LVGLDEMO=y +CONFIG_FS_PROCFS=y +CONFIG_GRAPHICS_LVGL=y +CONFIG_IDLETHREAD_STACKSIZE=4194304 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_LIBM=y +CONFIG_LV_USE_CLIB_MALLOC=y +CONFIG_LV_USE_CLIB_SPRINTF=y +CONFIG_LV_USE_CLIB_STRING=y +CONFIG_LV_USE_DEMO_WIDGETS=y +CONFIG_LV_USE_LOG=y +CONFIG_LV_USE_NUTTX=y +CONFIG_LV_USE_NUTTX_TOUCHSCREEN=y +CONFIG_MULTBOOT2_FB=y +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_DISABLE_IFCONFIG=y +CONFIG_NSH_DISABLE_IFUPDOWN=y +CONFIG_PREALLOC_CHILDSTATUS=16 +CONFIG_PRIORITY_INHERITANCE=y +CONFIG_PTHREAD_MUTEX_DEFAULT_PRIO_INHERIT=y +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_PTHREAD_STACK_MIN=4194304 +CONFIG_RAM_SIZE=268435456 +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_THREAD_LOCAL=y +CONFIG_SCHED_TICKLESS=y +CONFIG_SCHED_TICKLESS_ALARM=y +CONFIG_SCHED_TICKLESS_LIMIT_MAX_SLEEP=y +CONFIG_SCHED_WAITPID=y +CONFIG_SIG_DEFAULT=y +CONFIG_START_DAY=3 +CONFIG_START_MONTH=3 +CONFIG_START_YEAR=2011 +CONFIG_SYSTEM_NSH=y +CONFIG_SYSTEM_TIME64=y +CONFIG_TESTING_OSTEST=y +CONFIG_TESTING_OSTEST_STACKSIZE=4194304 +CONFIG_USEC_PER_TICK=1 +CONFIG_VIDEO_FB=y diff --git a/boards/x86_64/intel64/qemu-intel64/configs/pcitest/defconfig b/boards/x86_64/intel64/qemu-intel64/configs/pcitest/defconfig index 8756a42640c..96e7dccfe6e 100644 --- a/boards/x86_64/intel64/qemu-intel64/configs/pcitest/defconfig +++ b/boards/x86_64/intel64/qemu-intel64/configs/pcitest/defconfig @@ -38,6 +38,29 @@ CONFIG_FS_PROCFS=y CONFIG_IDLETHREAD_STACKSIZE=4194304 CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_LIBM=y +CONFIG_NET=y +CONFIG_NETDB_DNSCLIENT=y +CONFIG_NETDEV_LATEINIT=y +CONFIG_NETDEV_WORK_THREAD=y +CONFIG_NETINIT_DRIPADDR=0xc0a80801 +CONFIG_NETINIT_IPADDR=0x0a000102 +CONFIG_NETUTILS_CODECS=y +CONFIG_NETUTILS_IPERF=y +CONFIG_NETUTILS_TELNETD=y +CONFIG_NETUTILS_TFTPC=y +CONFIG_NETUTILS_WEBCLIENT=y +CONFIG_NET_BROADCAST=y +CONFIG_NET_E1000=y +CONFIG_NET_ETH_PKTSIZE=1514 +CONFIG_NET_ICMP_SOCKET=y +CONFIG_NET_IGC=y +CONFIG_NET_IGC_I225LM=y +CONFIG_NET_LL_GUARDSIZE=32 +CONFIG_NET_MAX_LISTENPORTS=8 +CONFIG_NET_PKT=y +CONFIG_NET_STATISTICS=y +CONFIG_NET_TCP=y +CONFIG_NET_UDP=y CONFIG_NSH_ARCHINIT=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_DISABLE_IFCONFIG=y diff --git a/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c b/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c index 4c8b60da5aa..e28e4c927b1 100644 --- a/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c +++ b/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c @@ -40,6 +40,10 @@ # include #endif +#ifdef CONFIG_VIDEO_FB +# include +#endif + #include "qemu_intel64.h" /**************************************************************************** @@ -95,5 +99,15 @@ int qemu_bringup(void) } #endif +#ifdef CONFIG_VIDEO_FB + /* Initialize and register the framebuffer driver */ + + ret = fb_register(0, 0); + if (ret < 0) + { + syslog(LOG_ERR, "ERROR: fb_register() failed: %d\n", ret); + } +#endif + return ret; } diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/configs/adb/defconfig b/boards/xtensa/esp32s3/esp32s3-devkit/configs/adb/defconfig new file mode 100644 index 00000000000..7f9aaeb2574 --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-devkit/configs/adb/defconfig @@ -0,0 +1,25 @@ +#include "../usb_device/defconfig" +CONFIG_ADBD_SHELL_SERVICE=y +CONFIG_ADBD_STACKSIZE=8192 +CONFIG_ADBD_USB_BOARDCTL=y +CONFIG_ADBD_USB_SERVER=y +CONFIG_CDCACM=n +CONFIG_ESP32S3_OTG_ENDPOINT_NUM=2 +CONFIG_ETC_ROMFS=y +CONFIG_EXAMPLES_USBSERIAL=n +CONFIG_FS_ROMFS=y +CONFIG_LIBC_EXECFUNCS=y +CONFIG_LIBUV=y +CONFIG_POSIX_SPAWN_DEFAULT_STACKSIZE=4096 +CONFIG_PSEUDOTERM=y +CONFIG_PTHREAD_MUTEX_TYPES=y +CONFIG_SCHED_BACKTRACE=y +CONFIG_SCHED_CHILD_STATUS=y +CONFIG_SCHED_HAVE_PARENT=y +CONFIG_SCHED_HPWORKSTACKSIZE=8192 +CONFIG_SYSLOG_CHARDEV=y +CONFIG_SYSTEM_ADBD=y +CONFIG_TLS_NCLEANUP=4 +CONFIG_TLS_NELEM=4 +CONFIG_TLS_TASK_NELEM=4 +CONFIG_USBADB=y diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs b/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs index 652b0e2fcd3..73fc23b7bb5 100644 --- a/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs +++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/Make.defs @@ -61,3 +61,6 @@ DEPPATH += --dep-path board VPATH += :board CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src$(DELIM)board$(DELIM)board +ifeq ($(CONFIG_ETC_ROMFS),y) +RCSRCS = etc/init.d/rc.sysinit etc/init.d/rcS +endif diff --git a/boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rc.sysinit b/boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rc.sysinit new file mode 100644 index 00000000000..6279920d9ba --- /dev/null +++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rc.sysinit @@ -0,0 +1,24 @@ +/**************************************************************************** + * boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rc.sysinit + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#include + diff --git a/arch/sim/include/math.h b/boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rcS similarity index 72% rename from arch/sim/include/math.h rename to boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rcS index 7126027332c..2956b2d02c0 100644 --- a/arch/sim/include/math.h +++ b/boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rcS @@ -1,5 +1,7 @@ /**************************************************************************** - * arch/sim/include/math.h + * boards/xtensa/esp32s3/esp32s3-devkit/src/etc/init.d/rcS + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -18,17 +20,8 @@ * ****************************************************************************/ -#ifndef __ARCH_SIM_INCLUDE_MATH_H -#define __ARCH_SIM_INCLUDE_MATH_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include_next +#include -#ifdef __GLIBC__ -#undef __GLIBC__ +#ifdef CONFIG_SYSTEM_ADBD +adbd & #endif - -#endif /* __ARCH_SIM_INCLUDE_MATH_H */ diff --git a/boards/xtensa/iss-hifi3z/iss-hifi3z/configs/nsh/defconfig b/boards/xtensa/iss-hifi3z/iss-hifi3z/configs/nsh/defconfig index 34e56087835..0d091ac1f31 100644 --- a/boards/xtensa/iss-hifi3z/iss-hifi3z/configs/nsh/defconfig +++ b/boards/xtensa/iss-hifi3z/iss-hifi3z/configs/nsh/defconfig @@ -27,6 +27,7 @@ CONFIG_DEBUG_SYMBOLS=y CONFIG_DEFAULT_TASK_STACKSIZE=4096 CONFIG_ETC_ROMFS=y CONFIG_EXAMPLES_HELLO=y +CONFIG_FORTIFY_SOURCE=3 CONFIG_FS_HOSTFS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y diff --git a/boards/xtensa/iss-hifi4/iss-hifi4/configs/nsh/defconfig b/boards/xtensa/iss-hifi4/iss-hifi4/configs/nsh/defconfig index c0d131799b1..2c177eb090d 100644 --- a/boards/xtensa/iss-hifi4/iss-hifi4/configs/nsh/defconfig +++ b/boards/xtensa/iss-hifi4/iss-hifi4/configs/nsh/defconfig @@ -27,6 +27,7 @@ CONFIG_DEBUG_SYMBOLS=y CONFIG_DEFAULT_TASK_STACKSIZE=4096 CONFIG_ETC_ROMFS=y CONFIG_EXAMPLES_HELLO=y +CONFIG_FORTIFY_SOURCE=3 CONFIG_FS_HOSTFS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y diff --git a/cmake/nuttx_add_application.cmake b/cmake/nuttx_add_application.cmake index f2eaddb1aa7..b27ba7611ea 100644 --- a/cmake/nuttx_add_application.cmake +++ b/cmake/nuttx_add_application.cmake @@ -90,11 +90,13 @@ function(nuttx_add_application) DEFINITIONS OPTIONS NO_MAIN_ALIAS - REQUIRED - NAME ARGN ${ARGN}) + if(NOT NAME) + return() + endif() + # check if SRCS exist if(SRCS) file(GLOB SRCS_EXIST ${SRCS}) @@ -154,6 +156,24 @@ function(nuttx_add_application) set(TARGET "apps_${NAME}") add_library(${TARGET} ${SRCS}) + # Set apps global compile options & definitions hold by + # nuttx_apps_interface + target_compile_options( + ${TARGET} + PRIVATE + $> + ) + target_compile_definitions( + ${TARGET} + PRIVATE + $> + ) + target_include_directories( + ${TARGET} + PRIVATE + $> + ) + nuttx_add_library_internal(${TARGET}) # add to list of application libraries diff --git a/cmake/nuttx_add_dependencies.cmake b/cmake/nuttx_add_dependencies.cmake index 46aeea9a5fb..c1291729c20 100644 --- a/cmake/nuttx_add_dependencies.cmake +++ b/cmake/nuttx_add_dependencies.cmake @@ -20,6 +20,9 @@ # # ############################################################################## +# global dependency maintenance target +add_custom_target(nuttx_dep_map) + include(nuttx_parse_function_args) # ~~~ @@ -55,16 +58,47 @@ function(nuttx_add_dependencies) ARGN ${ARGN}) - get_target_property(NO_COMPILABLE_TARGET ${TARGET} NO_COMPILABLE_TARGET) - if(NO_COMPILABLE_TARGET) - return() - endif() + set_property( + TARGET nuttx_dep_map + APPEND + PROPERTY ALL_PROCESS_TARGET ${TARGET}) foreach(dep ${DEPENDS}) - # add dependencies - add_dependencies(${TARGET} ${dep}) - # add export include directory - target_include_directories(${TARGET} - PRIVATE ${NUTTX_APPS_BINDIR}/include/${dep}) + set_property( + TARGET nuttx_dep_map + APPEND + PROPERTY ${TARGET} ${dep}) + endforeach() +endfunction() + +# After collecting all dependency mappings, process all targets uniformly +function(process_all_target_dependencies) + # get all target need add deps + get_property( + all_process_target + TARGET nuttx_dep_map + PROPERTY ALL_PROCESS_TARGET) + foreach(target ${all_process_target}) + if(TARGET ${target}) + get_target_property(NO_COMPILABLE_TARGET ${target} NO_COMPILABLE_TARGET) + if(NOT NO_COMPILABLE_TARGET) + # treat `target` as mapping key + get_property( + all_deps + TARGET nuttx_dep_map + PROPERTY ${target}) + foreach(dep ${all_deps}) + if(TARGET ${dep}) + # ensure build time order + add_dependencies(${target} ${dep}) + # inherit public properties + nuttx_link_libraries(${target} ${dep}) + # compatible with previous export headers + target_include_directories( + ${target} PRIVATE ${NUTTX_APPS_BINDIR}/include/${dep}) + endif() + endforeach() + endif() + endif() endforeach() endfunction() diff --git a/cmake/nuttx_add_library.cmake b/cmake/nuttx_add_library.cmake index fc97281d9ff..380696af0ad 100644 --- a/cmake/nuttx_add_library.cmake +++ b/cmake/nuttx_add_library.cmake @@ -183,7 +183,22 @@ function(nuttx_add_library target) add_library(${target} ${ARGN}) add_dependencies(${target} apps_context) set_property(GLOBAL APPEND PROPERTY NUTTX_SYSTEM_LIBRARIES ${target}) - + # Set apps global compile options & definitions hold by nuttx_apps_interface + target_compile_options( + ${target} + PRIVATE + $> + ) + target_compile_definitions( + ${target} + PRIVATE + $> + ) + target_include_directories( + ${target} + PRIVATE + $> + ) nuttx_add_library_internal(${target}) endfunction() diff --git a/cmake/nuttx_add_romfs.cmake b/cmake/nuttx_add_romfs.cmake index e095c91d2be..2ba2d0fdf9f 100644 --- a/cmake/nuttx_add_romfs.cmake +++ b/cmake/nuttx_add_romfs.cmake @@ -20,6 +20,9 @@ # # ############################################################################## +# Custom target to hold global ROMFS data +add_custom_target(romfs_holder) + function(add_board_rcsrcs) set_property( TARGET board @@ -34,6 +37,36 @@ function(add_board_rcraws) PROPERTY BOARD_RCRAWS ${ARGN}) endfunction() +# ~~~ +# add_dynamic_rcsrcs & add_dynamic_rcraws +# provide a way to add dynamic ROMFS data +# which genrate during the build process +# to the final romfs_holder target +# ~~~ +function(add_dynamic_rcsrcs) + cmake_parse_arguments(R "" "" "SRCS;DEPENDS" ${ARGN}) + set_property( + TARGET romfs_holder + APPEND + PROPERTY DYN_RCSRCS ${R_SRCS}) + set_property( + TARGET romfs_holder + APPEND + PROPERTY DYN_DEPS ${R_DEPENDS}) +endfunction() + +function(add_dynamic_rcraws) + cmake_parse_arguments(R "" "" "RAWS;DEPENDS" ${ARGN}) + set_property( + TARGET romfs_holder + APPEND + PROPERTY DYN_RCRAWS ${R_RAWS}) + set_property( + TARGET romfs_holder + APPEND + PROPERTY DYN_DEPS ${R_DEPENDS}) +endfunction() + # ~~~ # nuttx_add_romfs # @@ -208,3 +241,136 @@ function(nuttx_add_cromfs) add_library(cromfs_${NAME} OBJECT cromfs_${NAME}.c) nuttx_add_library_internal(cromfs_${NAME}) endfunction() + +# ~~~ +# The files of romfs may be added in +# ANY PROCESS IN ANY DIRECORY, +# so we process all the targets at the end. +# ~~~ +function(process_all_directory_romfs) + + # have we enabled etc romfs? + if(NOT CONFIG_ETC_ROMFS) + return() + endif() + + # have we generated romfs yet? + if(TARGET target-romfs) + return() + endif() + + # collect all ROMFS files + get_property( + board_rcsrcs + TARGET board + PROPERTY BOARD_RCSRCS) + get_property( + board_rcraws + TARGET board + PROPERTY BOARD_RCRAWS) + + get_property( + dyn_rcsrcs + TARGET romfs_holder + PROPERTY DYN_RCSRCS) + get_property( + dyn_rcraws + TARGET romfs_holder + PROPERTY DYN_RCRAWS) + + list(PREPEND RCSRCS ${board_rcsrcs} ${dyn_rcsrcs}) + list(PREPEND RCRAWS ${board_rcraws} ${dyn_rcraws}) + + # init dynamic dependencies + + get_property( + dyn_deps + TARGET romfs_holder + PROPERTY DYN_DEPS) + + # precompile all rcsrcs + foreach(rcsrc ${RCSRCS}) + if(IS_ABSOLUTE ${rcsrc}) + string(REGEX REPLACE "^(.*)/etc(/.*)?$" "\\1" SOURCE_ETC_PREFIX + "${rcsrc}") + string(REGEX REPLACE "^.*/(etc(/.*)?)$" "\\1" REMAINING_PATH "${rcsrc}") + string(REGEX REPLACE "^/" "" SOURCE_ETC_SUFFIX "${REMAINING_PATH}") + else() + set(SOURCE_ETC_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}) + set(SOURCE_ETC_SUFFIX ${rcsrc}) + endif() + + get_filename_component(rcpath ${SOURCE_ETC_SUFFIX} DIRECTORY) + if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${rcpath}) + file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${rcpath}) + endif() + nuttx_generate_preprocess_target( + SOURCE_FILE + ${SOURCE_ETC_PREFIX}/${SOURCE_ETC_SUFFIX} + TARGET_FILE + ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX} + DEPENDS + nuttx_context + ${dyn_deps}) + list(APPEND DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX}) + endforeach() + + # process all rcraws + foreach(rcraw ${RCRAWS}) + if(IS_ABSOLUTE ${rcraw}) + string(REGEX REPLACE "^(.*)/etc(/.*)?$" "\\1" SOURCE_ETC_PREFIX + "${rcraw}") + string(REGEX REPLACE "^.*/(etc(/.*)?)$" "\\1" REMAINING_PATH "${rcraw}") + string(REGEX REPLACE "^/" "" SOURCE_ETC_SUFFIX "${REMAINING_PATH}") + else() + set(SOURCE_ETC_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}) + set(SOURCE_ETC_SUFFIX ${rcraw}) + endif() + + if(IS_DIRECTORY ${SOURCE_ETC_PREFIX}/${SOURCE_ETC_SUFFIX}) + # if it is a directory, copy it to the build directory + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX} + COMMAND ${CMAKE_COMMAND} -E make_directory + ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX} + COMMAND + ${CMAKE_COMMAND} -E copy_directory + ${SOURCE_ETC_PREFIX}/${SOURCE_ETC_SUFFIX} + ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX} + DEPENDS ${dyn_deps}) + list(APPEND DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX}) + else() + list(FIND DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX} index) + if(index GREATER -1) + set(APPEND_OPTION APPEND) + else() + set(APPEND_OPTION) + endif() + list(APPEND DEPENDS ${SOURCE_ETC_PREFIX}/${SOURCE_ETC_SUFFIX}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX} + COMMAND + ${CMAKE_COMMAND} -E copy ${SOURCE_ETC_PREFIX}/${SOURCE_ETC_SUFFIX} + ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX} ${APPEND_OPTION} + DEPENDS ${dyn_deps}) + list(APPEND DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${SOURCE_ETC_SUFFIX}) + endif() + endforeach() + + add_custom_command( + OUTPUT romfs_etc.c + COMMAND ${CMAKE_COMMAND} -E make_directory romfs_etc + COMMAND if \[ \"etc\" != \"\" \]; then ${CMAKE_COMMAND} -E copy_directory + etc romfs_etc \; fi + COMMAND genromfs -f romfs.img -d romfs_etc -V etc + COMMAND xxd -i romfs.img romfs_etc.c + COMMAND sed -E -i'' -e "s/^unsigned/const unsigned/g" romfs_etc.c + DEPENDS ${DEPENDS}) + + add_custom_target(target-romfs DEPENDS ${DEPENDS}) + nuttx_add_aux_library(romfs_etc) + target_sources(romfs_etc PRIVATE romfs_etc.c) + add_dependencies(romfs_etc target-romfs) + + target_link_libraries(board PRIVATE romfs_etc) +endfunction() diff --git a/cmake/nuttx_extensions.cmake b/cmake/nuttx_extensions.cmake index 09251b50617..aa2232e16d4 100644 --- a/cmake/nuttx_extensions.cmake +++ b/cmake/nuttx_extensions.cmake @@ -24,6 +24,10 @@ include(nuttx_parse_function_args) +# "nuttx_apps_interface" is a source-less target that encapsulates all the apps +# compiler options and include path needed by all apps libraries. +add_custom_target(nuttx_apps_interface) + # Macro: nuttx_library # # Creates a library target with the given name and mode. If MODE is "KERNEL", it @@ -222,3 +226,49 @@ function(nuttx_compile_options_ifndef cond) nuttx_compile_options(${ARGN}) endif() endfunction() + +# the visible scope is all the APPS include search path +function(nuttx_include_directories_for_all_apps) + set_property( + TARGET nuttx_apps_interface + APPEND + PROPERTY APPS_INCLUDE_DIRECTORIES ${ARGN}) +endfunction() + +# all apps compile_options +function(nuttx_compile_options_for_all_apps) + set_property( + TARGET nuttx_apps_interface + APPEND + PROPERTY APPS_COMPILE_OPTIONS ${ARGN}) +endfunction() + +# all apps compile_definitions +function(nuttx_compile_definitions_for_all_apps) + set_property( + TARGET nuttx_apps_interface + APPEND + PROPERTY APPS_COMPILE_DEFINITIONS ${ARGN}) +endfunction() + +# since we dont call `target_link_libraries` directly, we only inherit their +# compilation configuration +function(nuttx_link_libraries) + set(TARGET ${ARGV0}) + if(TARGET ${TARGET}) + foreach(dep ${ARGN}) + target_compile_options( + ${TARGET} + PRIVATE + $>) + target_compile_definitions( + ${TARGET} + PRIVATE + $>) + target_include_directories( + ${TARGET} + PRIVATE + $>) + endforeach() + endif() +endfunction() diff --git a/cmake/nuttx_generate_sim_ld.cmake b/cmake/nuttx_generate_sim_ld.cmake index c59301dd6ce..b9757ac489c 100644 --- a/cmake/nuttx_generate_sim_ld.cmake +++ b/cmake/nuttx_generate_sim_ld.cmake @@ -53,6 +53,12 @@ file( DESTINATION ${CMAKE_BINARY_DIR} FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) +if(CONFIG_OPTEE_OS) + set(SIM_LD_ADD_SCATTERED_ARRAY_SECTION + " 's/\*\(.text.hot .text.hot.*\)/KEEP\(*\(SORT\(.scattered_array*\)\)\)\\n *\(.text.hot .text.hot.*\)/g' " + ) +endif() + add_custom_command( OUTPUT nuttx.ld COMMAND @@ -61,5 +67,6 @@ add_custom_command( || true COMMAND sh process_sim_ld_script.sh nuttx-orig.ld nuttx.ld COMMAND sed -i '/\\.data *:/i " ${CONFIG_SIM_CUSTOM_DATA_SECTION} " ' nuttx.ld + COMMAND sed -i " ${SIM_LD_ADD_SCATTERED_ARRAY_SECTION} " nuttx.ld COMMENT "Generating sim linker script nuttx.ld" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) diff --git a/drivers/1wire/1wire.c b/drivers/1wire/1wire.c index 1f47a50ff2d..323eca38361 100644 --- a/drivers/1wire/1wire.c +++ b/drivers/1wire/1wire.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/1wire/1wire.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/1wire/1wire_crc.c b/drivers/1wire/1wire_crc.c index 0c193dee39b..f22d166e444 100644 --- a/drivers/1wire/1wire_crc.c +++ b/drivers/1wire/1wire_crc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/1wire/1wire_crc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/1wire/1wire_internal.h b/drivers/1wire/1wire_internal.h index 0e7aad9e90c..a34e60da535 100644 --- a/drivers/1wire/1wire_internal.h +++ b/drivers/1wire/1wire_internal.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/1wire/1wire_internal.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/1wire/1wire_read.c b/drivers/1wire/1wire_read.c index b4f27c2d783..4170e5b8e52 100644 --- a/drivers/1wire/1wire_read.c +++ b/drivers/1wire/1wire_read.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/1wire/1wire_read.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/1wire/1wire_write.c b/drivers/1wire/1wire_write.c index 6b9edc00605..348f28ec673 100644 --- a/drivers/1wire/1wire_write.c +++ b/drivers/1wire/1wire_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/1wire/1wire_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/1wire/1wire_writeread.c b/drivers/1wire/1wire_writeread.c index 9560b97d44c..a64ff4ca6b7 100644 --- a/drivers/1wire/1wire_writeread.c +++ b/drivers/1wire/1wire_writeread.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/1wire/1wire_writeread.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/1wire/CMakeLists.txt b/drivers/1wire/CMakeLists.txt index 79a0cd3127a..b4b0cdc84cd 100644 --- a/drivers/1wire/CMakeLists.txt +++ b/drivers/1wire/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/1wire/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/1wire/Make.defs b/drivers/1wire/Make.defs index 32961e2f6e1..01695e3e3cc 100644 --- a/drivers/1wire/Make.defs +++ b/drivers/1wire/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/1wire/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/1wire/ds28e17.c b/drivers/1wire/ds28e17.c index 83e022dfe14..52082cfce83 100644 --- a/drivers/1wire/ds28e17.c +++ b/drivers/1wire/ds28e17.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/1wire/ds28e17.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index 0e81c4df467..7277c54cd35 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/Makefile b/drivers/Makefile index efaddd7eaf2..3ec59556b37 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,6 +1,8 @@ ############################################################################ # drivers/Makefile # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/aie/Make.defs b/drivers/aie/Make.defs index 1e849b0de42..8b98eb18ad0 100644 --- a/drivers/aie/Make.defs +++ b/drivers/aie/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/aie/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/aie/ai_engine.c b/drivers/aie/ai_engine.c index 2f6ae39ac39..d39b5f37a3d 100644 --- a/drivers/aie/ai_engine.c +++ b/drivers/aie/ai_engine.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/aie/ai_engine.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/CMakeLists.txt b/drivers/analog/CMakeLists.txt index 57a836cb8d6..27b7180b413 100644 --- a/drivers/analog/CMakeLists.txt +++ b/drivers/analog/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/analog/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/analog/Make.defs b/drivers/analog/Make.defs index 0bc3e001cdd..fe2e4e1211b 100644 --- a/drivers/analog/Make.defs +++ b/drivers/analog/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/analog/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/ad5410.c b/drivers/analog/ad5410.c index 1ddcc798c9f..eb4418d298a 100644 --- a/drivers/analog/ad5410.c +++ b/drivers/analog/ad5410.c @@ -1,14 +1,11 @@ /**************************************************************************** * drivers/analog/ad5410.c * - * Copyright (C) 2010, 2016 Gregory Nutt. All rights reserved. - * Copyright (C) 2011 Li Zhuoyi. All rights reserved. - * Author: Li Zhuoyi - * Gregory Nutt - * - * This file is a part of NuttX: - * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2010, 2016 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2011 Li Zhuoyi. All rights reserved. + * SPDX-FileContributor: Li Zhuoyi + * SPDX-FileContributor: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/analog/adc.c b/drivers/analog/adc.c index fd1ef02a04d..86dc64e594e 100644 --- a/drivers/analog/adc.c +++ b/drivers/analog/adc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/adc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/ads1242.c b/drivers/analog/ads1242.c index 0d753151fff..65a5e7a9678 100644 --- a/drivers/analog/ads1242.c +++ b/drivers/analog/ads1242.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/ads1242.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/ads1255.c b/drivers/analog/ads1255.c index 4eae9d5671e..a7332a03e4f 100644 --- a/drivers/analog/ads1255.c +++ b/drivers/analog/ads1255.c @@ -1,14 +1,11 @@ /**************************************************************************** * drivers/analog/ads1255.c * - * Copyright (C) 2010, 2016 Gregory Nutt. All rights reserved. - * Copyright (C) 2011 Li Zhuoyi. All rights reserved. - * Author: Li Zhuoyi - * Gregory Nutt - * - * This file is a part of NuttX: - * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2010, 2016 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2011 Li Zhuoyi. All rights reserved. + * SPDX-FileContributor: Li Zhuoyi + * SPDX-FileContributor: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/analog/ads7828.c b/drivers/analog/ads7828.c index b9bbf0dc4da..0311b2a1104 100644 --- a/drivers/analog/ads7828.c +++ b/drivers/analog/ads7828.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/ads7828.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/comp.c b/drivers/analog/comp.c index a87738a6a0d..2203531772a 100644 --- a/drivers/analog/comp.c +++ b/drivers/analog/comp.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/comp.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/dac.c b/drivers/analog/dac.c index d6aa153539e..2b3291c4409 100644 --- a/drivers/analog/dac.c +++ b/drivers/analog/dac.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/dac.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/dac7554.c b/drivers/analog/dac7554.c index a171c02a156..1eb67f56ccc 100644 --- a/drivers/analog/dac7554.c +++ b/drivers/analog/dac7554.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/dac7554.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/dac7571.c b/drivers/analog/dac7571.c index f7820b81a4f..8631be811b8 100644 --- a/drivers/analog/dac7571.c +++ b/drivers/analog/dac7571.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/dac7571.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/hx711.c b/drivers/analog/hx711.c index 578b9c9d7a3..14ce63e11c6 100644 --- a/drivers/analog/hx711.c +++ b/drivers/analog/hx711.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/hx711.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/lmp92001.c b/drivers/analog/lmp92001.c index 6e75a32e633..06f1dae30bf 100644 --- a/drivers/analog/lmp92001.c +++ b/drivers/analog/lmp92001.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/lmp92001.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/ltc1867l.c b/drivers/analog/ltc1867l.c index b88b53cf95b..9803a255d92 100644 --- a/drivers/analog/ltc1867l.c +++ b/drivers/analog/ltc1867l.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/ltc1867l.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/max1161x.c b/drivers/analog/max1161x.c index 7c29d9e1b38..6aecd6a60f1 100644 --- a/drivers/analog/max1161x.c +++ b/drivers/analog/max1161x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/max1161x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/mcp3008.c b/drivers/analog/mcp3008.c index 39e393f73c9..aa4d3d095fc 100644 --- a/drivers/analog/mcp3008.c +++ b/drivers/analog/mcp3008.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/analog/mcp3008.c * - * Contributed by Matteo Golin + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/analog/mcp48xx.c b/drivers/analog/mcp48xx.c index 19b01747834..2b25ec913e1 100644 --- a/drivers/analog/mcp48xx.c +++ b/drivers/analog/mcp48xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/mcp48xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/opamp.c b/drivers/analog/opamp.c index ef647509437..c19bb60714d 100644 --- a/drivers/analog/opamp.c +++ b/drivers/analog/opamp.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/opamp.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/analog/pga11x.c b/drivers/analog/pga11x.c index d0d74d5e276..0353c38ed8c 100644 --- a/drivers/analog/pga11x.c +++ b/drivers/analog/pga11x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/analog/pga11x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/CMakeLists.txt b/drivers/audio/CMakeLists.txt index 4fe4b34c9ce..c9f34e0b168 100644 --- a/drivers/audio/CMakeLists.txt +++ b/drivers/audio/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/audio/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/audio/Make.defs b/drivers/audio/Make.defs index 007ab0618ca..6f0918cbb54 100644 --- a/drivers/audio/Make.defs +++ b/drivers/audio/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/audio/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/audio_dma.c b/drivers/audio/audio_dma.c index 4a03d830432..8b8a6bd2e2e 100644 --- a/drivers/audio/audio_dma.c +++ b/drivers/audio/audio_dma.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/audio_dma.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/audio_i2s.c b/drivers/audio/audio_i2s.c index 33408a9fb15..cfb7a872fc7 100644 --- a/drivers/audio/audio_i2s.c +++ b/drivers/audio/audio_i2s.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/audio_i2s.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/audio_null.c b/drivers/audio/audio_null.c index f857a122120..83a4633986c 100644 --- a/drivers/audio/audio_null.c +++ b/drivers/audio/audio_null.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/audio_null.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/cs4344.c b/drivers/audio/cs4344.c index e71707d359c..dd956fcd0f5 100644 --- a/drivers/audio/cs4344.c +++ b/drivers/audio/cs4344.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/cs4344.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/cs4344.h b/drivers/audio/cs4344.h index e09c3930e37..6045f3ee83b 100644 --- a/drivers/audio/cs4344.h +++ b/drivers/audio/cs4344.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/cs4344.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/cs43l22.c b/drivers/audio/cs43l22.c index 3a5e684fdc7..f5b3ef385b4 100644 --- a/drivers/audio/cs43l22.c +++ b/drivers/audio/cs43l22.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/cs43l22.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/cs43l22.h b/drivers/audio/cs43l22.h index 125eb361149..e932b0bd89d 100644 --- a/drivers/audio/cs43l22.h +++ b/drivers/audio/cs43l22.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/cs43l22.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/cs43l22_debug.c b/drivers/audio/cs43l22_debug.c index fbc1c91e27a..79939aa0ef1 100644 --- a/drivers/audio/cs43l22_debug.c +++ b/drivers/audio/cs43l22_debug.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/cs43l22_debug.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/es8311.c b/drivers/audio/es8311.c index fd653ec64e1..4fcff6a420c 100644 --- a/drivers/audio/es8311.c +++ b/drivers/audio/es8311.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/es8311.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/es8311.h b/drivers/audio/es8311.h index 3a9b0583c91..cb8e1297bec 100644 --- a/drivers/audio/es8311.h +++ b/drivers/audio/es8311.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/es8311.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/es8311_debug.c b/drivers/audio/es8311_debug.c index 03a8bb207c3..78fccbf4402 100644 --- a/drivers/audio/es8311_debug.c +++ b/drivers/audio/es8311_debug.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/es8311_debug.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/es8388.c b/drivers/audio/es8388.c index e27e6a847c2..7e648323f12 100644 --- a/drivers/audio/es8388.c +++ b/drivers/audio/es8388.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/es8388.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/es8388.h b/drivers/audio/es8388.h index 62923b7009f..dad9cd5431a 100644 --- a/drivers/audio/es8388.h +++ b/drivers/audio/es8388.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/es8388.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/es8388_debug.c b/drivers/audio/es8388_debug.c index d42d5453d9e..78a473d0238 100644 --- a/drivers/audio/es8388_debug.c +++ b/drivers/audio/es8388_debug.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/es8388_debug.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/esxxxx_common.h b/drivers/audio/esxxxx_common.h index 11e6c0a25b6..4cd07def024 100644 --- a/drivers/audio/esxxxx_common.h +++ b/drivers/audio/esxxxx_common.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/esxxxx_common.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/tone.c b/drivers/audio/tone.c index 68cc01c6c2b..7db86dcec72 100644 --- a/drivers/audio/tone.c +++ b/drivers/audio/tone.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/tone.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/vs1053.c b/drivers/audio/vs1053.c index ab18c5ca1cb..959bed61793 100644 --- a/drivers/audio/vs1053.c +++ b/drivers/audio/vs1053.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/vs1053.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/vs1053.h b/drivers/audio/vs1053.h index 9d85af56351..b1917ddeac1 100644 --- a/drivers/audio/vs1053.h +++ b/drivers/audio/vs1053.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/vs1053.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8776.c b/drivers/audio/wm8776.c index b2088a2180f..79c770aac22 100644 --- a/drivers/audio/wm8776.c +++ b/drivers/audio/wm8776.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8776.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8776.h b/drivers/audio/wm8776.h index 9b304f0e11b..55a772f4882 100644 --- a/drivers/audio/wm8776.h +++ b/drivers/audio/wm8776.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8776.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8904.c b/drivers/audio/wm8904.c index bf342804e5b..ff3e3b6496f 100644 --- a/drivers/audio/wm8904.c +++ b/drivers/audio/wm8904.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8904.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8904.h b/drivers/audio/wm8904.h index 2cb58445ece..dcbd7ed9257 100644 --- a/drivers/audio/wm8904.h +++ b/drivers/audio/wm8904.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8904.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8904_debug.c b/drivers/audio/wm8904_debug.c index b27ca2f8fd7..e57d162fea0 100644 --- a/drivers/audio/wm8904_debug.c +++ b/drivers/audio/wm8904_debug.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8904_debug.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8994.c b/drivers/audio/wm8994.c index 7e1e49ad657..9052a49a3df 100644 --- a/drivers/audio/wm8994.c +++ b/drivers/audio/wm8994.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8994.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8994.h b/drivers/audio/wm8994.h index 561a9e3143f..3d5f85b5cf9 100644 --- a/drivers/audio/wm8994.h +++ b/drivers/audio/wm8994.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8994.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/audio/wm8994_debug.c b/drivers/audio/wm8994_debug.c index 6dbdc80230b..e27bbe9c1ee 100644 --- a/drivers/audio/wm8994_debug.c +++ b/drivers/audio/wm8994_debug.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/audio/wm8994_debug.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/CMakeLists.txt b/drivers/bch/CMakeLists.txt index 542bebc0f4e..ea66569f466 100644 --- a/drivers/bch/CMakeLists.txt +++ b/drivers/bch/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/bch/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/bch/Make.defs b/drivers/bch/Make.defs index aefb6a6efd4..ff064dec004 100644 --- a/drivers/bch/Make.defs +++ b/drivers/bch/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/bch/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bch.h b/drivers/bch/bch.h index c3e802d9ece..2d31a007ee4 100644 --- a/drivers/bch/bch.h +++ b/drivers/bch/bch.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bch.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bchdev_driver.c b/drivers/bch/bchdev_driver.c index 6fbea4e8ec9..7032908a5b8 100644 --- a/drivers/bch/bchdev_driver.c +++ b/drivers/bch/bchdev_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchdev_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -80,7 +82,9 @@ const struct file_operations g_bch_fops = bch_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - bch_poll /* poll */ + bch_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , bch_unlink /* unlink */ #endif @@ -455,6 +459,13 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg) if (bchinode->u.i_bops->ioctl != NULL) { ret = bchinode->u.i_bops->ioctl(bchinode, cmd, arg); + + /* Drivers may not support command BIOC_FLUSH */ + + if (ret == -ENOTTY && cmd == BIOC_FLUSH) + { + ret = 0; + } } } break; diff --git a/drivers/bch/bchdev_register.c b/drivers/bch/bchdev_register.c index f28f451e8cb..849f0e47577 100644 --- a/drivers/bch/bchdev_register.c +++ b/drivers/bch/bchdev_register.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchdev_register.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bchdev_unregister.c b/drivers/bch/bchdev_unregister.c index 6eeb45d42ee..98a44bf607a 100644 --- a/drivers/bch/bchdev_unregister.c +++ b/drivers/bch/bchdev_unregister.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchdev_unregister.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bchlib_cache.c b/drivers/bch/bchlib_cache.c index 81583d3ab98..59a347ca918 100644 --- a/drivers/bch/bchlib_cache.c +++ b/drivers/bch/bchlib_cache.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchlib_cache.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bchlib_read.c b/drivers/bch/bchlib_read.c index 86ed93fe285..320c81a599a 100644 --- a/drivers/bch/bchlib_read.c +++ b/drivers/bch/bchlib_read.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchlib_read.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bchlib_setup.c b/drivers/bch/bchlib_setup.c index dca08903ffe..a78f2329ec5 100644 --- a/drivers/bch/bchlib_setup.c +++ b/drivers/bch/bchlib_setup.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchlib_setup.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bchlib_teardown.c b/drivers/bch/bchlib_teardown.c index 89f9f4a20ef..be751426749 100644 --- a/drivers/bch/bchlib_teardown.c +++ b/drivers/bch/bchlib_teardown.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchlib_teardown.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/bch/bchlib_write.c b/drivers/bch/bchlib_write.c index 9a08bf0b4fe..8d5977080f3 100644 --- a/drivers/bch/bchlib_write.c +++ b/drivers/bch/bchlib_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/bch/bchlib_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/binder/binder.c b/drivers/binder/binder.c index 57b6767b494..ae17a21683a 100644 --- a/drivers/binder/binder.c +++ b/drivers/binder/binder.c @@ -295,6 +295,7 @@ static int binder_flush(FAR struct file *filp) { wait_wake_up(&thread->wait, 0); wake_count++; + thread->looper_need_return = false; } } diff --git a/drivers/can/CMakeLists.txt b/drivers/can/CMakeLists.txt index d73f924da78..2b60bc044b5 100644 --- a/drivers/can/CMakeLists.txt +++ b/drivers/can/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/can/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/can/Make.defs b/drivers/can/Make.defs index cefe78cac4b..d093a199557 100644 --- a/drivers/can/Make.defs +++ b/drivers/can/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/can/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/can/can.c b/drivers/can/can.c index 2eed29fce7d..b319b2aec6a 100644 --- a/drivers/can/can.c +++ b/drivers/can/can.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/can/can.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/can/can_sender.c b/drivers/can/can_sender.c index 03976260b61..062461a9668 100644 --- a/drivers/can/can_sender.c +++ b/drivers/can/can_sender.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/can/can_sender.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/can/mcp2515.c b/drivers/can/mcp2515.c index 89d2c337666..22f42df1b00 100644 --- a/drivers/can/mcp2515.c +++ b/drivers/can/mcp2515.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/can/mcp2515.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/can/mcp2515.h b/drivers/can/mcp2515.h index a71b3fe7a93..9c0ec46397d 100644 --- a/drivers/can/mcp2515.h +++ b/drivers/can/mcp2515.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/can/mcp2515.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/can/sja1000.c b/drivers/can/sja1000.c index 4894bf23846..b5175768c26 100644 --- a/drivers/can/sja1000.c +++ b/drivers/can/sja1000.c @@ -1,9 +1,7 @@ /**************************************************************************** * drivers/can/sja1000.c * - * SJA1000 CAN driver based on esp32c3_twai.c - * - * License header retained from original source. + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/can/sja1000.h b/drivers/can/sja1000.h index ee156b88408..80895020bc1 100644 --- a/drivers/can/sja1000.h +++ b/drivers/can/sja1000.h @@ -1,9 +1,7 @@ /**************************************************************************** * drivers/can/sja1000.h * - * SJA1000 CAN driver based on esp32c3_twai.h - * - * License header retained from original source. + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/clk/CMakeLists.txt b/drivers/clk/CMakeLists.txt index c1a478e20f0..28975d61688 100644 --- a/drivers/clk/CMakeLists.txt +++ b/drivers/clk/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/clk/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/clk/Make.defs b/drivers/clk/Make.defs index 348e17184df..b1c76cde3eb 100644 --- a/drivers/clk/Make.defs +++ b/drivers/clk/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/clk/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 522829b1ac6..0cce75e95e8 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk.h b/drivers/clk/clk.h index c06095cbad0..320ed1e39c4 100644 --- a/drivers/clk/clk.h +++ b/drivers/clk/clk.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_divider.c b/drivers/clk/clk_divider.c index 079d8f7fd3d..dbd94dec904 100644 --- a/drivers/clk/clk_divider.c +++ b/drivers/clk/clk_divider.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_divider.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c index 5e2b32dee4c..647e58539c0 100644 --- a/drivers/clk/clk_fixed_factor.c +++ b/drivers/clk/clk_fixed_factor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_fixed_factor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_fixed_rate.c b/drivers/clk/clk_fixed_rate.c index 133f48c8e16..b788982f45b 100644 --- a/drivers/clk/clk_fixed_rate.c +++ b/drivers/clk/clk_fixed_rate.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_fixed_rate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_fractional_divider.c b/drivers/clk/clk_fractional_divider.c index ef73990dbcc..784123da707 100644 --- a/drivers/clk/clk_fractional_divider.c +++ b/drivers/clk/clk_fractional_divider.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_fractional_divider.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_gate.c b/drivers/clk/clk_gate.c index 58bd63aadae..1eab53984df 100644 --- a/drivers/clk/clk_gate.c +++ b/drivers/clk/clk_gate.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_gate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_multiplier.c b/drivers/clk/clk_multiplier.c index a25c34be08b..a18a0bd3717 100644 --- a/drivers/clk/clk_multiplier.c +++ b/drivers/clk/clk_multiplier.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_multiplier.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_mux.c b/drivers/clk/clk_mux.c index aef92cd04ef..d982b6da8d2 100644 --- a/drivers/clk/clk_mux.c +++ b/drivers/clk/clk_mux.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_mux.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_phase.c b/drivers/clk/clk_phase.c index bcc7aa2def5..8a96d745336 100644 --- a/drivers/clk/clk_phase.c +++ b/drivers/clk/clk_phase.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_phase.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/clk/clk_rpmsg.c b/drivers/clk/clk_rpmsg.c index 97ab7a880cc..3a581602c7f 100644 --- a/drivers/clk/clk_rpmsg.c +++ b/drivers/clk/clk_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/clk/clk_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/contactless/CMakeLists.txt b/drivers/contactless/CMakeLists.txt index 44b0a1d8ac6..4cf695d16fa 100644 --- a/drivers/contactless/CMakeLists.txt +++ b/drivers/contactless/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/contactless/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/contactless/Make.defs b/drivers/contactless/Make.defs index 62b6728c65c..d2b1d444b9e 100644 --- a/drivers/contactless/Make.defs +++ b/drivers/contactless/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/contactless/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/contactless/mfrc522.c b/drivers/contactless/mfrc522.c index a862ee70f97..b1018cfe46c 100644 --- a/drivers/contactless/mfrc522.c +++ b/drivers/contactless/mfrc522.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/contactless/mfrc522.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/contactless/mfrc522.h b/drivers/contactless/mfrc522.h index 0f5c46caf54..e23cfe0b16a 100644 --- a/drivers/contactless/mfrc522.h +++ b/drivers/contactless/mfrc522.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/contactless/mfrc522.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/contactless/pn532.c b/drivers/contactless/pn532.c index 4842e691f7b..ca0712570d5 100644 --- a/drivers/contactless/pn532.c +++ b/drivers/contactless/pn532.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/contactless/pn532.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/contactless/pn532.h b/drivers/contactless/pn532.h index 2b4b8d26281..29f2dae8319 100644 --- a/drivers/contactless/pn532.h +++ b/drivers/contactless/pn532.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/contactless/pn532.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/CMakeLists.txt b/drivers/coresight/CMakeLists.txt index 6f74e3657f7..81b18bbd1f5 100644 --- a/drivers/coresight/CMakeLists.txt +++ b/drivers/coresight/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/coresight/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/coresight/Make.defs b/drivers/coresight/Make.defs index 7ca35f81cb1..5addfc9047a 100644 --- a/drivers/coresight/Make.defs +++ b/drivers/coresight/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/coresight/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_common.c b/drivers/coresight/coresight_common.c index 73be36d2ac4..21a6f9bf588 100644 --- a/drivers/coresight/coresight_common.c +++ b/drivers/coresight/coresight_common.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_common.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_common.h b/drivers/coresight/coresight_common.h index b4c15f5c0fe..a82a16a2d1a 100644 --- a/drivers/coresight/coresight_common.h +++ b/drivers/coresight/coresight_common.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_common.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_core.c b/drivers/coresight/coresight_core.c index 9b113123b9e..28e96480def 100644 --- a/drivers/coresight/coresight_core.c +++ b/drivers/coresight/coresight_core.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_core.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_etb.c b/drivers/coresight/coresight_etb.c index 372972d8147..70c889229f7 100644 --- a/drivers/coresight/coresight_etb.c +++ b/drivers/coresight/coresight_etb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_etb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_etm3.c b/drivers/coresight/coresight_etm3.c index db72d048761..f37d29d7014 100644 --- a/drivers/coresight/coresight_etm3.c +++ b/drivers/coresight/coresight_etm3.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_etm3.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_etm4.c b/drivers/coresight/coresight_etm4.c index a0fba45ac5b..a1b93185b8c 100644 --- a/drivers/coresight/coresight_etm4.c +++ b/drivers/coresight/coresight_etm4.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_etm4.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_funnel.c b/drivers/coresight/coresight_funnel.c index 8fe281f19eb..c7dd7b4e5fa 100644 --- a/drivers/coresight/coresight_funnel.c +++ b/drivers/coresight/coresight_funnel.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_funnel.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_replicator.c b/drivers/coresight/coresight_replicator.c index 9d64d412123..03c7ad3e9c1 100644 --- a/drivers/coresight/coresight_replicator.c +++ b/drivers/coresight/coresight_replicator.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_replicator.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_stm.c b/drivers/coresight/coresight_stm.c index ecb8b7d0de4..5d79976057d 100644 --- a/drivers/coresight/coresight_stm.c +++ b/drivers/coresight/coresight_stm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_stm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_tmc_core.c b/drivers/coresight/coresight_tmc_core.c index d6044692bbd..e79abeb68f7 100644 --- a/drivers/coresight/coresight_tmc_core.c +++ b/drivers/coresight/coresight_tmc_core.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_tmc_core.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_tmc_core.h b/drivers/coresight/coresight_tmc_core.h index 991b1c4c4a2..1c1f70c9310 100644 --- a/drivers/coresight/coresight_tmc_core.h +++ b/drivers/coresight/coresight_tmc_core.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_tmc_core.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_tmc_etf.c b/drivers/coresight/coresight_tmc_etf.c index 67cb659c58a..05587febcb6 100644 --- a/drivers/coresight/coresight_tmc_etf.c +++ b/drivers/coresight/coresight_tmc_etf.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_tmc_etf.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_tmc_etr.c b/drivers/coresight/coresight_tmc_etr.c index b83dfa0128e..460dddbb64a 100644 --- a/drivers/coresight/coresight_tmc_etr.c +++ b/drivers/coresight/coresight_tmc_etr.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_tmc_etr.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/coresight/coresight_tpiu.c b/drivers/coresight/coresight_tpiu.c index 2c688e8c7ab..9c3311398cb 100644 --- a/drivers/coresight/coresight_tpiu.c +++ b/drivers/coresight/coresight_tpiu.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/coresight/coresight_tpiu.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/CMakeLists.txt b/drivers/crypto/CMakeLists.txt index efb21c91326..f310ae115e5 100644 --- a/drivers/crypto/CMakeLists.txt +++ b/drivers/crypto/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/crypto/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/crypto/Make.defs b/drivers/crypto/Make.defs index dc2039bcdaf..240ba5ceab8 100644 --- a/drivers/crypto/Make.defs +++ b/drivers/crypto/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/crypto/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/dev_urandom.c b/drivers/crypto/dev_urandom.c index cb9f5cd8ade..e3e71f72619 100644 --- a/drivers/crypto/dev_urandom.c +++ b/drivers/crypto/dev_urandom.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/dev_urandom.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/Make.defs b/drivers/crypto/pnt/Make.defs index 8798b65e3c6..19d6cccb820 100644 --- a/drivers/crypto/pnt/Make.defs +++ b/drivers/crypto/pnt/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/crypto/pnt/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/pnt_se05x_api.c b/drivers/crypto/pnt/pnt_se05x_api.c index 01823e9150a..7339a4ab057 100644 --- a/drivers/crypto/pnt/pnt_se05x_api.c +++ b/drivers/crypto/pnt/pnt_se05x_api.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/pnt_se05x_api.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/pnt_se05x_api.h b/drivers/crypto/pnt/pnt_se05x_api.h index b3e8d404501..671e066a5c8 100644 --- a/drivers/crypto/pnt/pnt_se05x_api.h +++ b/drivers/crypto/pnt/pnt_se05x_api.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/pnt_se05x_api.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/pnt_util.c b/drivers/crypto/pnt/pnt_util.c index 4468497e811..f8a34c2aef5 100644 --- a/drivers/crypto/pnt/pnt_util.c +++ b/drivers/crypto/pnt/pnt_util.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/pnt_util.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/pnt_util.h b/drivers/crypto/pnt/pnt_util.h index 6ea74ca72e5..0ccf9511747 100644 --- a/drivers/crypto/pnt/pnt_util.h +++ b/drivers/crypto/pnt/pnt_util.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/pnt_util.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/scp03_keys.h b/drivers/crypto/pnt/scp03_keys.h index 0466a5eb065..483de82b9a2 100644 --- a/drivers/crypto/pnt/scp03_keys.h +++ b/drivers/crypto/pnt/scp03_keys.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/scp03_keys.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/sm_i2c.c b/drivers/crypto/pnt/sm_i2c.c index 775ae6c890e..de0fe6bbed2 100644 --- a/drivers/crypto/pnt/sm_i2c.c +++ b/drivers/crypto/pnt/sm_i2c.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/sm_i2c.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/sm_i2c.h b/drivers/crypto/pnt/sm_i2c.h index 3566f0f32a4..5da36e869e2 100644 --- a/drivers/crypto/pnt/sm_i2c.h +++ b/drivers/crypto/pnt/sm_i2c.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/sm_i2c.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/sm_port.h b/drivers/crypto/pnt/sm_port.h index 54970ff911e..99b4e1598bd 100644 --- a/drivers/crypto/pnt/sm_port.h +++ b/drivers/crypto/pnt/sm_port.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/sm_port.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/sm_timer.c b/drivers/crypto/pnt/sm_timer.c index fc49b580b69..588a5f63299 100644 --- a/drivers/crypto/pnt/sm_timer.c +++ b/drivers/crypto/pnt/sm_timer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/sm_timer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/pnt/sm_timer.h b/drivers/crypto/pnt/sm_timer.h index e30d8bf1eaf..779f922d809 100644 --- a/drivers/crypto/pnt/sm_timer.h +++ b/drivers/crypto/pnt/sm_timer.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/pnt/sm_timer.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/se05x.c b/drivers/crypto/se05x.c index f41b0a5fb62..127ae1bfe68 100644 --- a/drivers/crypto/se05x.c +++ b/drivers/crypto/se05x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/se05x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/crypto/se05x_internal.h b/drivers/crypto/se05x_internal.h index 7b3ac184de0..c5fda3977aa 100644 --- a/drivers/crypto/se05x_internal.h +++ b/drivers/crypto/se05x_internal.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/crypto/se05x_internal.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/devicetree/CMakeLists.txt b/drivers/devicetree/CMakeLists.txt index f9edc73fe56..98ce039cb7e 100644 --- a/drivers/devicetree/CMakeLists.txt +++ b/drivers/devicetree/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/devicetree/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/devicetree/Make.defs b/drivers/devicetree/Make.defs index 9c85c76b838..23b5e6e4033 100644 --- a/drivers/devicetree/Make.defs +++ b/drivers/devicetree/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/devicetree/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/devicetree/fdt.c b/drivers/devicetree/fdt.c index 923959d79a2..7e44db06bb6 100644 --- a/drivers/devicetree/fdt.c +++ b/drivers/devicetree/fdt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/devicetree/fdt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/devicetree/fdt_pci.c b/drivers/devicetree/fdt_pci.c index b3475f3805c..44ebcb27812 100644 --- a/drivers/devicetree/fdt_pci.c +++ b/drivers/devicetree/fdt_pci.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/devicetree/fdt_pci.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/devicetree/fdt_virtio_mmio.c b/drivers/devicetree/fdt_virtio_mmio.c index 6e6dd098151..435057734b6 100644 --- a/drivers/devicetree/fdt_virtio_mmio.c +++ b/drivers/devicetree/fdt_virtio_mmio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/devicetree/fdt_virtio_mmio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/dma/Make.defs b/drivers/dma/Make.defs index 7066ea51a98..68e565beac1 100644 --- a/drivers/dma/Make.defs +++ b/drivers/dma/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/dma/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/drivers_initialize.c b/drivers/drivers_initialize.c index a2ed022e8bd..17fd2eaea01 100644 --- a/drivers/drivers_initialize.c +++ b/drivers/drivers_initialize.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/drivers_initialize.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/dummy/CMakeLists.txt b/drivers/dummy/CMakeLists.txt index 8b137891791..9916304c81a 100644 --- a/drivers/dummy/CMakeLists.txt +++ b/drivers/dummy/CMakeLists.txt @@ -1 +1,23 @@ +############################################################################ +# drivers/dummy/CMakeLists.txt +# +# SPDX-License-Identifier: Apache-2.0 +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. The +# ASF licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the +# License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +############################################################################ + diff --git a/drivers/eeprom/CMakeLists.txt b/drivers/eeprom/CMakeLists.txt index a527dff3e78..258db57314a 100644 --- a/drivers/eeprom/CMakeLists.txt +++ b/drivers/eeprom/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/eeprom/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/eeprom/Make.defs b/drivers/eeprom/Make.defs index f414a36ad07..a90e2a99681 100644 --- a/drivers/eeprom/Make.defs +++ b/drivers/eeprom/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/eeprom/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/eeprom/i2c_xx24xx.c b/drivers/eeprom/i2c_xx24xx.c index 6d2210a991f..12ea5dc531c 100644 --- a/drivers/eeprom/i2c_xx24xx.c +++ b/drivers/eeprom/i2c_xx24xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/eeprom/i2c_xx24xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/eeprom/spi_xx25xx.c b/drivers/eeprom/spi_xx25xx.c index dd3be40f4cd..49a53e58ac9 100644 --- a/drivers/eeprom/spi_xx25xx.c +++ b/drivers/eeprom/spi_xx25xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/eeprom/spi_xx25xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/efuse/CMakeLists.txt b/drivers/efuse/CMakeLists.txt index 1e9ddde6e43..ab1f2fda249 100644 --- a/drivers/efuse/CMakeLists.txt +++ b/drivers/efuse/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/efuse/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/efuse/Make.defs b/drivers/efuse/Make.defs index 9f99f738654..6db180e4059 100644 --- a/drivers/efuse/Make.defs +++ b/drivers/efuse/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/efuse/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/efuse/efuse.c b/drivers/efuse/efuse.c index 4af62ccbc3e..4ee8a06f1a0 100644 --- a/drivers/efuse/efuse.c +++ b/drivers/efuse/efuse.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/efuse/efuse.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/CMakeLists.txt b/drivers/i2c/CMakeLists.txt index b365491feea..3b97aa78744 100644 --- a/drivers/i2c/CMakeLists.txt +++ b/drivers/i2c/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/i2c/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this @@ -17,7 +19,6 @@ # the License. # # ############################################################################## -# ############################################################################## if(CONFIG_I2C) set(SRCS i2c_read.c i2c_write.c i2c_writeread.c) diff --git a/drivers/i2c/Make.defs b/drivers/i2c/Make.defs index e823327de08..059dbd3cd2e 100644 --- a/drivers/i2c/Make.defs +++ b/drivers/i2c/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/i2c/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/i2c_bitbang.c b/drivers/i2c/i2c_bitbang.c index 3d8e9c3a2e6..e99c3b3a4ef 100644 --- a/drivers/i2c/i2c_bitbang.c +++ b/drivers/i2c/i2c_bitbang.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/i2c_bitbang.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/i2c_driver.c b/drivers/i2c/i2c_driver.c index b80981a49b8..de2aa236046 100644 --- a/drivers/i2c/i2c_driver.c +++ b/drivers/i2c/i2c_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/i2c_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -99,7 +101,9 @@ static const struct file_operations g_i2cdrvr_fops = i2cdrvr_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , i2cdrvr_unlink /* unlink */ #endif diff --git a/drivers/i2c/i2c_read.c b/drivers/i2c/i2c_read.c index 6e7ae82e6b3..cf3c82a0aff 100644 --- a/drivers/i2c/i2c_read.c +++ b/drivers/i2c/i2c_read.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/i2c_read.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/i2c_slave_driver.c b/drivers/i2c/i2c_slave_driver.c index f5531b7e7c6..dfc0ef479cf 100644 --- a/drivers/i2c/i2c_slave_driver.c +++ b/drivers/i2c/i2c_slave_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/i2c_slave_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -134,7 +136,9 @@ static const struct file_operations g_i2cslavefops = NULL, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - i2c_slave_poll /* poll */ + i2c_slave_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , i2c_slave_unlink /* unlink */ #endif diff --git a/drivers/i2c/i2c_write.c b/drivers/i2c/i2c_write.c index 3e02d4e8332..51930e49bca 100644 --- a/drivers/i2c/i2c_write.c +++ b/drivers/i2c/i2c_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/i2c_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/i2c_writeread.c b/drivers/i2c/i2c_writeread.c index 3c06a4f8f70..149b6fa5681 100644 --- a/drivers/i2c/i2c_writeread.c +++ b/drivers/i2c/i2c_writeread.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/i2c_writeread.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/pca9540bdp.c b/drivers/i2c/pca9540bdp.c index 321635c2049..9d3af7299a5 100644 --- a/drivers/i2c/pca9540bdp.c +++ b/drivers/i2c/pca9540bdp.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/pca9540bdp.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/pca9540bdp.h b/drivers/i2c/pca9540bdp.h index f113ff26a1f..ac2edf60f17 100644 --- a/drivers/i2c/pca9540bdp.h +++ b/drivers/i2c/pca9540bdp.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2c/pca9540bdp.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i2c/tca9548a.c b/drivers/i2c/tca9548a.c index e4ad72228a2..75ae871d120 100644 --- a/drivers/i2c/tca9548a.c +++ b/drivers/i2c/tca9548a.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/i2c/tca9548a.c - * Driver for the TCA9448A i2c multiplexer + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/i2s/CMakeLists.txt b/drivers/i2s/CMakeLists.txt index 83ac11b08f2..3f687d73967 100644 --- a/drivers/i2s/CMakeLists.txt +++ b/drivers/i2s/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/i2s/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/i2s/Make.defs b/drivers/i2s/Make.defs index cd76ea4898f..db029d67f8c 100644 --- a/drivers/i2s/Make.defs +++ b/drivers/i2s/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/i2s/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/i2s/i2schar.c b/drivers/i2s/i2schar.c index 67744668a45..26e6324842c 100644 --- a/drivers/i2s/i2schar.c +++ b/drivers/i2s/i2schar.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i2s/i2schar.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i3c/CMakeLists.txt b/drivers/i3c/CMakeLists.txt index e82e0968c5b..ee25b3318d8 100644 --- a/drivers/i3c/CMakeLists.txt +++ b/drivers/i3c/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/i3c/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/i3c/Make.defs b/drivers/i3c/Make.defs index 7e7f0a04fc7..4d11d560219 100644 --- a/drivers/i3c/Make.defs +++ b/drivers/i3c/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/i3c/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/i3c/device.c b/drivers/i3c/device.c index ef7f59fed3e..71e17bb8125 100644 --- a/drivers/i3c/device.c +++ b/drivers/i3c/device.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i3c/device.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i3c/i3c_driver.c b/drivers/i3c/i3c_driver.c index 05e013afd71..ffa777ab608 100644 --- a/drivers/i3c/i3c_driver.c +++ b/drivers/i3c/i3c_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i3c/i3c_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -96,7 +98,9 @@ static const struct file_operations g_i3cdrvr_fops = i3cdrvr_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , i3cdrvr_unlink /* unlink */ #endif diff --git a/drivers/i3c/internals.h b/drivers/i3c/internals.h index 4f6ecf9c1ea..a23871b7922 100644 --- a/drivers/i3c/internals.h +++ b/drivers/i3c/internals.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i3c/internals.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 30bf899b791..f2d3c452fa3 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/i3c/master.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/CMakeLists.txt b/drivers/input/CMakeLists.txt index 55e718dd564..a1c4eea640e 100644 --- a/drivers/input/CMakeLists.txt +++ b/drivers/input/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/input/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/input/Make.defs b/drivers/input/Make.defs index 85891e0adf2..7cfc0c28d7c 100644 --- a/drivers/input/Make.defs +++ b/drivers/input/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/input/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/input/ads7843e.c b/drivers/input/ads7843e.c index eee7c49acf7..e4cb356e6fc 100644 --- a/drivers/input/ads7843e.c +++ b/drivers/input/ads7843e.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/ads7843e.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/ads7843e.h b/drivers/input/ads7843e.h index bf2ce171f5a..9db3f68640c 100644 --- a/drivers/input/ads7843e.h +++ b/drivers/input/ads7843e.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/ads7843e.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/ajoystick.c b/drivers/input/ajoystick.c index 65f09677434..ce8fea13007 100644 --- a/drivers/input/ajoystick.c +++ b/drivers/input/ajoystick.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/ajoystick.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/aw86225.c b/drivers/input/aw86225.c index 1ccf573fc31..24fb868fb80 100644 --- a/drivers/input/aw86225.c +++ b/drivers/input/aw86225.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/aw86225.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/aw86225_internal.h b/drivers/input/aw86225_internal.h index 68b21141d92..1dda28f1799 100644 --- a/drivers/input/aw86225_internal.h +++ b/drivers/input/aw86225_internal.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/aw86225_internal.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/aw86225_reg.h b/drivers/input/aw86225_reg.h index 5081051c32f..69abf94a0c7 100644 --- a/drivers/input/aw86225_reg.h +++ b/drivers/input/aw86225_reg.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/aw86225_reg.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/button_lower.c b/drivers/input/button_lower.c index 37dd88c728f..b68b8b1ee53 100644 --- a/drivers/input/button_lower.c +++ b/drivers/input/button_lower.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/button_lower.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c index 10f603493cd..98ae78c3fba 100644 --- a/drivers/input/button_upper.c +++ b/drivers/input/button_upper.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/button_upper.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/cypress_mbr3108.c b/drivers/input/cypress_mbr3108.c index 2d4a2be2e4d..3832b718a32 100644 --- a/drivers/input/cypress_mbr3108.c +++ b/drivers/input/cypress_mbr3108.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/cypress_mbr3108.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/djoystick.c b/drivers/input/djoystick.c index 75c9d2d208d..1db52b2022b 100644 --- a/drivers/input/djoystick.c +++ b/drivers/input/djoystick.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/djoystick.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/ff_dummy.c b/drivers/input/ff_dummy.c index 64703b20132..b73ba11d4e5 100644 --- a/drivers/input/ff_dummy.c +++ b/drivers/input/ff_dummy.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/ff_dummy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/ff_upper.c b/drivers/input/ff_upper.c index 3f0ad340bc1..b8024b1987b 100644 --- a/drivers/input/ff_upper.c +++ b/drivers/input/ff_upper.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/ff_upper.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/ft5x06.c b/drivers/input/ft5x06.c index fa2212e7e35..be5db167865 100644 --- a/drivers/input/ft5x06.c +++ b/drivers/input/ft5x06.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/ft5x06.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/ft5x06.h b/drivers/input/ft5x06.h index 998cf49c842..27157234bc6 100644 --- a/drivers/input/ft5x06.h +++ b/drivers/input/ft5x06.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/ft5x06.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/goldfish_events.c b/drivers/input/goldfish_events.c index f52503d5c82..733b075e314 100644 --- a/drivers/input/goldfish_events.c +++ b/drivers/input/goldfish_events.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/goldfish_events.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/gt9xx.c b/drivers/input/gt9xx.c index 42423cd24f2..fee2a7ef766 100644 --- a/drivers/input/gt9xx.c +++ b/drivers/input/gt9xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/gt9xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -124,7 +126,9 @@ static const struct file_operations g_gt9xx_fileops = NULL, /* ioctl */ NULL, /* truncate */ NULL, /* mmap */ - gt9xx_poll /* poll */ + gt9xx_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , NULL /* unlink */ #endif diff --git a/drivers/input/keyboard_upper.c b/drivers/input/keyboard_upper.c index 1e42c09227e..73ebd80efc2 100644 --- a/drivers/input/keyboard_upper.c +++ b/drivers/input/keyboard_upper.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/keyboard_upper.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/max11802.c b/drivers/input/max11802.c index 1ad3956ddbd..4b709aee86b 100644 --- a/drivers/input/max11802.c +++ b/drivers/input/max11802.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/max11802.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/max11802.h b/drivers/input/max11802.h index ccf50b7f197..c3e3c989761 100644 --- a/drivers/input/max11802.h +++ b/drivers/input/max11802.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/max11802.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/mouse_upper.c b/drivers/input/mouse_upper.c index f63118180d9..069b47a969b 100644 --- a/drivers/input/mouse_upper.c +++ b/drivers/input/mouse_upper.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/mouse_upper.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/mxt.c b/drivers/input/mxt.c index 62be9660d13..80f8173e8f8 100644 --- a/drivers/input/mxt.c +++ b/drivers/input/mxt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/mxt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/mxt.h b/drivers/input/mxt.h index 2ac01f1e753..d35ce914e3b 100644 --- a/drivers/input/mxt.h +++ b/drivers/input/mxt.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/mxt.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/nunchuck.c b/drivers/input/nunchuck.c index 7c357b82d17..0888e54f460 100644 --- a/drivers/input/nunchuck.c +++ b/drivers/input/nunchuck.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/nunchuck.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/spq10kbd.c b/drivers/input/spq10kbd.c index afb33a7a291..0f11208e3ab 100644 --- a/drivers/input/spq10kbd.c +++ b/drivers/input/spq10kbd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/spq10kbd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/stmpe811.h b/drivers/input/stmpe811.h index f1c2b0c3ef7..3f2d3fdc2b3 100644 --- a/drivers/input/stmpe811.h +++ b/drivers/input/stmpe811.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/stmpe811.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/stmpe811_adc.c b/drivers/input/stmpe811_adc.c index 2f0a5562b97..84769959f91 100644 --- a/drivers/input/stmpe811_adc.c +++ b/drivers/input/stmpe811_adc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/stmpe811_adc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/stmpe811_base.c b/drivers/input/stmpe811_base.c index 9b771ecec38..c3ceae74bf7 100644 --- a/drivers/input/stmpe811_base.c +++ b/drivers/input/stmpe811_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/stmpe811_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/stmpe811_gpio.c b/drivers/input/stmpe811_gpio.c index 6d70653291a..07911f6f192 100644 --- a/drivers/input/stmpe811_gpio.c +++ b/drivers/input/stmpe811_gpio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/stmpe811_gpio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/stmpe811_temp.c b/drivers/input/stmpe811_temp.c index f3dbaeafcca..41d221a5528 100644 --- a/drivers/input/stmpe811_temp.c +++ b/drivers/input/stmpe811_temp.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/stmpe811_temp.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/stmpe811_tsc.c b/drivers/input/stmpe811_tsc.c index f3e60c174fa..c4a667b62da 100644 --- a/drivers/input/stmpe811_tsc.c +++ b/drivers/input/stmpe811_tsc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/stmpe811_tsc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/touchscreen_upper.c b/drivers/input/touchscreen_upper.c index 11ebc3c104f..12f7d1f5ff7 100644 --- a/drivers/input/touchscreen_upper.c +++ b/drivers/input/touchscreen_upper.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/touchscreen_upper.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/tsc2007.c b/drivers/input/tsc2007.c index 019e98383e3..c4546083121 100644 --- a/drivers/input/tsc2007.c +++ b/drivers/input/tsc2007.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/tsc2007.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/input/tsc2007.h b/drivers/input/tsc2007.h index 99290c2d12e..fac1f8ab106 100644 --- a/drivers/input/tsc2007.h +++ b/drivers/input/tsc2007.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/input/tsc2007.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/CMakeLists.txt b/drivers/ioexpander/CMakeLists.txt index 2274811abe6..d5b594200cf 100644 --- a/drivers/ioexpander/CMakeLists.txt +++ b/drivers/ioexpander/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/ioexpander/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this @@ -17,7 +19,6 @@ # the License. # # ############################################################################## -# ############################################################################## set(SRCS) diff --git a/drivers/ioexpander/Make.defs b/drivers/ioexpander/Make.defs index cdf0921ccdd..290f5f0be2a 100644 --- a/drivers/ioexpander/Make.defs +++ b/drivers/ioexpander/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/ioexpander/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/gpio.c b/drivers/ioexpander/gpio.c index be76f71ac26..1549d7d4817 100644 --- a/drivers/ioexpander/gpio.c +++ b/drivers/ioexpander/gpio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/gpio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/gpio_lower_half.c b/drivers/ioexpander/gpio_lower_half.c index 40fba20c911..7cf1ab6868c 100644 --- a/drivers/ioexpander/gpio_lower_half.c +++ b/drivers/ioexpander/gpio_lower_half.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/gpio_lower_half.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/icjx.c b/drivers/ioexpander/icjx.c index 7518db8440c..dd9222f6fcf 100644 --- a/drivers/ioexpander/icjx.c +++ b/drivers/ioexpander/icjx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/icjx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/icjx.h b/drivers/ioexpander/icjx.h index 550924394c0..1c3c777ef12 100644 --- a/drivers/ioexpander/icjx.h +++ b/drivers/ioexpander/icjx.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/icjx.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/ioe_dummy.c b/drivers/ioexpander/ioe_dummy.c index fb2b4a356b1..cc57644ff99 100644 --- a/drivers/ioexpander/ioe_dummy.c +++ b/drivers/ioexpander/ioe_dummy.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/ioe_dummy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/ioe_rpmsg.c b/drivers/ioexpander/ioe_rpmsg.c index c97ef1299d1..9fe562798a6 100644 --- a/drivers/ioexpander/ioe_rpmsg.c +++ b/drivers/ioexpander/ioe_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/ioe_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/iso1h812g.c b/drivers/ioexpander/iso1h812g.c index 36d15234eef..fe18460efba 100644 --- a/drivers/ioexpander/iso1h812g.c +++ b/drivers/ioexpander/iso1h812g.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/iso1h812g.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/iso1h812g.h b/drivers/ioexpander/iso1h812g.h index 83ff8b4c34d..7ab28032d9d 100644 --- a/drivers/ioexpander/iso1h812g.h +++ b/drivers/ioexpander/iso1h812g.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/iso1h812g.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/iso1i813t.c b/drivers/ioexpander/iso1i813t.c index 144f35cdbf4..8e831c6c936 100644 --- a/drivers/ioexpander/iso1i813t.c +++ b/drivers/ioexpander/iso1i813t.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/iso1i813t.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/iso1i813t.h b/drivers/ioexpander/iso1i813t.h index 7fd543496b6..b1d7a1c0532 100644 --- a/drivers/ioexpander/iso1i813t.h +++ b/drivers/ioexpander/iso1i813t.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/iso1i813t.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/mcp23x08.c b/drivers/ioexpander/mcp23x08.c index bea149d044e..8c0886c8db3 100644 --- a/drivers/ioexpander/mcp23x08.c +++ b/drivers/ioexpander/mcp23x08.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/mcp23x08.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/mcp23x08.h b/drivers/ioexpander/mcp23x08.h index cf47a7d9b11..44893dc9515 100644 --- a/drivers/ioexpander/mcp23x08.h +++ b/drivers/ioexpander/mcp23x08.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/mcp23x08.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/mcp23x17.c b/drivers/ioexpander/mcp23x17.c index d3175a16708..d7e4be55200 100644 --- a/drivers/ioexpander/mcp23x17.c +++ b/drivers/ioexpander/mcp23x17.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/mcp23x17.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/mcp23x17.h b/drivers/ioexpander/mcp23x17.h index dd2463ee558..4dc0c25ef06 100644 --- a/drivers/ioexpander/mcp23x17.h +++ b/drivers/ioexpander/mcp23x17.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/mcp23x17.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pca9538.c b/drivers/ioexpander/pca9538.c index ac12a1a1c87..e1d57a3ea51 100644 --- a/drivers/ioexpander/pca9538.c +++ b/drivers/ioexpander/pca9538.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pca9538.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pca9538.h b/drivers/ioexpander/pca9538.h index 7faa5b55e10..38052f47aec 100644 --- a/drivers/ioexpander/pca9538.h +++ b/drivers/ioexpander/pca9538.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pca9538.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pca9555.c b/drivers/ioexpander/pca9555.c index d74d633e7e9..55ca3ae4902 100644 --- a/drivers/ioexpander/pca9555.c +++ b/drivers/ioexpander/pca9555.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pca9555.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pca9555.h b/drivers/ioexpander/pca9555.h index 5981713f7a0..cc80c1cc5e8 100644 --- a/drivers/ioexpander/pca9555.h +++ b/drivers/ioexpander/pca9555.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pca9555.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pcf8574.c b/drivers/ioexpander/pcf8574.c index 2e16a0fe1ba..a1d3ed65a29 100644 --- a/drivers/ioexpander/pcf8574.c +++ b/drivers/ioexpander/pcf8574.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pcf8574.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pcf8574.h b/drivers/ioexpander/pcf8574.h index f1b3b8658ed..de92959cf51 100644 --- a/drivers/ioexpander/pcf8574.h +++ b/drivers/ioexpander/pcf8574.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pcf8574.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pcf8575.c b/drivers/ioexpander/pcf8575.c index a702953e316..4a174e8224a 100644 --- a/drivers/ioexpander/pcf8575.c +++ b/drivers/ioexpander/pcf8575.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pcf8575.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/pcf8575.h b/drivers/ioexpander/pcf8575.h index 818e129988b..5e95f012e03 100644 --- a/drivers/ioexpander/pcf8575.h +++ b/drivers/ioexpander/pcf8575.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/pcf8575.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/skeleton.c b/drivers/ioexpander/skeleton.c index 7f7d7de083d..5a5b4491bb9 100644 --- a/drivers/ioexpander/skeleton.c +++ b/drivers/ioexpander/skeleton.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/skeleton.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/sx1509.c b/drivers/ioexpander/sx1509.c index 88fdbafed92..09baeeced3e 100644 --- a/drivers/ioexpander/sx1509.c +++ b/drivers/ioexpander/sx1509.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/sx1509.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/sx1509.h b/drivers/ioexpander/sx1509.h index 8cc7ad39f51..3acebad37b1 100644 --- a/drivers/ioexpander/sx1509.h +++ b/drivers/ioexpander/sx1509.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/sx1509.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/tca64xx.c b/drivers/ioexpander/tca64xx.c index f0ca5e87310..eccdfd5a264 100644 --- a/drivers/ioexpander/tca64xx.c +++ b/drivers/ioexpander/tca64xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/tca64xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ioexpander/tca64xx.h b/drivers/ioexpander/tca64xx.h index bcec8af971a..47695874e40 100644 --- a/drivers/ioexpander/tca64xx.h +++ b/drivers/ioexpander/tca64xx.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ioexpander/tca64xx.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/CMakeLists.txt b/drivers/ipcc/CMakeLists.txt index 54d128b2ecc..b0c1e265dca 100644 --- a/drivers/ipcc/CMakeLists.txt +++ b/drivers/ipcc/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/ipcc/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/ipcc/Make.defs b/drivers/ipcc/Make.defs index 0892b0de3d7..87fbf1f3b31 100644 --- a/drivers/ipcc/Make.defs +++ b/drivers/ipcc/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/ipcc/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_close.c b/drivers/ipcc/ipcc_close.c index cf4a021b69d..a12ef6bba7b 100644 --- a/drivers/ipcc/ipcc_close.c +++ b/drivers/ipcc/ipcc_close.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_close.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_open.c b/drivers/ipcc/ipcc_open.c index d9c105ed2d5..6f160cf69a9 100644 --- a/drivers/ipcc/ipcc_open.c +++ b/drivers/ipcc/ipcc_open.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_open.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_poll.c b/drivers/ipcc/ipcc_poll.c index 350c95be38b..83a3833ab04 100644 --- a/drivers/ipcc/ipcc_poll.c +++ b/drivers/ipcc/ipcc_poll.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_poll.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_priv.h b/drivers/ipcc/ipcc_priv.h index cfaf054f0a1..bb0233c83ca 100644 --- a/drivers/ipcc/ipcc_priv.h +++ b/drivers/ipcc/ipcc_priv.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_priv.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_read.c b/drivers/ipcc/ipcc_read.c index ea6f4a34c18..d1d93322b05 100644 --- a/drivers/ipcc/ipcc_read.c +++ b/drivers/ipcc/ipcc_read.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_read.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_register.c b/drivers/ipcc/ipcc_register.c index 3f7abfb4bf8..401eba2bc5c 100644 --- a/drivers/ipcc/ipcc_register.c +++ b/drivers/ipcc/ipcc_register.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_register.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_unlink.c b/drivers/ipcc/ipcc_unlink.c index cbee60a220f..a6630b2f555 100644 --- a/drivers/ipcc/ipcc_unlink.c +++ b/drivers/ipcc/ipcc_unlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_unlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/ipcc/ipcc_write.c b/drivers/ipcc/ipcc_write.c index c88cd5b2b3d..369edb0e960 100644 --- a/drivers/ipcc/ipcc_write.c +++ b/drivers/ipcc/ipcc_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/ipcc/ipcc_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/CMakeLists.txt b/drivers/lcd/CMakeLists.txt index 5c4311be521..0bd152f9518 100644 --- a/drivers/lcd/CMakeLists.txt +++ b/drivers/lcd/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/lcd/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/lcd/Make.defs b/drivers/lcd/Make.defs index 046341e9e3e..95a4b414f0a 100644 --- a/drivers/lcd/Make.defs +++ b/drivers/lcd/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/lcd/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/apa102.c b/drivers/lcd/apa102.c index 05155df3fb6..1e28a631136 100644 --- a/drivers/lcd/apa102.c +++ b/drivers/lcd/apa102.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/apa102.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ft80x.c b/drivers/lcd/ft80x.c index b17e38cbff3..ede8b273aa9 100644 --- a/drivers/lcd/ft80x.c +++ b/drivers/lcd/ft80x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ft80x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -136,7 +138,9 @@ static const struct file_operations g_ft80x_fops = ft80x_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , ft80x_unlink /* unlink */ #endif diff --git a/drivers/lcd/ft80x.h b/drivers/lcd/ft80x.h index 6b611851d90..681cdceda8d 100644 --- a/drivers/lcd/ft80x.h +++ b/drivers/lcd/ft80x.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ft80x.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ft80x_spi.c b/drivers/lcd/ft80x_spi.c index 53895d795e1..44708065f46 100644 --- a/drivers/lcd/ft80x_spi.c +++ b/drivers/lcd/ft80x_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ft80x_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/gc9a01.c b/drivers/lcd/gc9a01.c index 229f7be761d..679c4feeb16 100644 --- a/drivers/lcd/gc9a01.c +++ b/drivers/lcd/gc9a01.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/gc9a01.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/gc9a01.h b/drivers/lcd/gc9a01.h index 858f9ad54e7..d1bcee3c207 100644 --- a/drivers/lcd/gc9a01.h +++ b/drivers/lcd/gc9a01.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/gc9a01.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ht16k33_14seg.c b/drivers/lcd/ht16k33_14seg.c index 2d91284cf4f..c02a0442dd8 100644 --- a/drivers/lcd/ht16k33_14seg.c +++ b/drivers/lcd/ht16k33_14seg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ht16k33_14seg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ili9225.c b/drivers/lcd/ili9225.c index a7d77daae69..c41024224f6 100644 --- a/drivers/lcd/ili9225.c +++ b/drivers/lcd/ili9225.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ili9225.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ili9340.c b/drivers/lcd/ili9340.c index f4e0cb99fc5..caa312fd676 100644 --- a/drivers/lcd/ili9340.c +++ b/drivers/lcd/ili9340.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ili9340.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ili9341.c b/drivers/lcd/ili9341.c index d8471aa9ebf..bc3a1d7e09a 100644 --- a/drivers/lcd/ili9341.c +++ b/drivers/lcd/ili9341.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ili9341.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/jd9851.c b/drivers/lcd/jd9851.c index 9815bfa848e..61d5afdec13 100644 --- a/drivers/lcd/jd9851.c +++ b/drivers/lcd/jd9851.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/jd9851.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/jd9851.h b/drivers/lcd/jd9851.h index 34b6138b6bb..962faa0452c 100644 --- a/drivers/lcd/jd9851.h +++ b/drivers/lcd/jd9851.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/jd9851.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/lcd_dev.c b/drivers/lcd/lcd_dev.c index dc465be7224..33eb58b1caa 100644 --- a/drivers/lcd/lcd_dev.c +++ b/drivers/lcd/lcd_dev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/lcd_dev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/lcd_framebuffer.c b/drivers/lcd/lcd_framebuffer.c index d7a2f88d4bd..d0a0c8bda4b 100644 --- a/drivers/lcd/lcd_framebuffer.c +++ b/drivers/lcd/lcd_framebuffer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/lcd_framebuffer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/lcddrv_spiif.c b/drivers/lcd/lcddrv_spiif.c index 8e998f574b2..be45a4a36dd 100644 --- a/drivers/lcd/lcddrv_spiif.c +++ b/drivers/lcd/lcddrv_spiif.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/lcddrv_spiif.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/lpm013m091a.c b/drivers/lcd/lpm013m091a.c index c1908fbb9c8..d36eb2d9d3d 100644 --- a/drivers/lcd/lpm013m091a.c +++ b/drivers/lcd/lpm013m091a.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/lpm013m091a.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/max7219.c b/drivers/lcd/max7219.c index 447ab256490..c1a0c499f5c 100644 --- a/drivers/lcd/max7219.c +++ b/drivers/lcd/max7219.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/max7219.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/memlcd.c b/drivers/lcd/memlcd.c index 86bdda6691a..4ab7e87beda 100644 --- a/drivers/lcd/memlcd.c +++ b/drivers/lcd/memlcd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/memlcd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/mio283qt2.c b/drivers/lcd/mio283qt2.c index 2cd7d6dbb78..34e0e756503 100644 --- a/drivers/lcd/mio283qt2.c +++ b/drivers/lcd/mio283qt2.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/mio283qt2.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/mio283qt9a.c b/drivers/lcd/mio283qt9a.c index 4e9d6b37ee8..0fdafdb1618 100644 --- a/drivers/lcd/mio283qt9a.c +++ b/drivers/lcd/mio283qt9a.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/mio283qt9a.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/p14201.c b/drivers/lcd/p14201.c index 56f8d755dc9..48501c379db 100644 --- a/drivers/lcd/p14201.c +++ b/drivers/lcd/p14201.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/p14201.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/pcd8544.c b/drivers/lcd/pcd8544.c index c528d0ee337..1222212b294 100644 --- a/drivers/lcd/pcd8544.c +++ b/drivers/lcd/pcd8544.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/pcd8544.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/pcd8544.h b/drivers/lcd/pcd8544.h index a88390072c7..40908a34a92 100644 --- a/drivers/lcd/pcd8544.h +++ b/drivers/lcd/pcd8544.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/pcd8544.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/pcf8574_lcd_backpack.c b/drivers/lcd/pcf8574_lcd_backpack.c index b4ee2eaece7..7f8418e373e 100644 --- a/drivers/lcd/pcf8574_lcd_backpack.c +++ b/drivers/lcd/pcf8574_lcd_backpack.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/pcf8574_lcd_backpack.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -119,7 +121,9 @@ static const struct file_operations g_pcf8574_lcd_fops = pcf8574_lcd_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - pcf8574_lcd_poll /* poll */ + pcf8574_lcd_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , pcf8574_lcd_unlink /* unlink */ #endif diff --git a/drivers/lcd/pcf8833.h b/drivers/lcd/pcf8833.h index c63c170834b..2209a79d050 100644 --- a/drivers/lcd/pcf8833.h +++ b/drivers/lcd/pcf8833.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/pcf8833.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ra8875.c b/drivers/lcd/ra8875.c index 331bee90737..8d759e6ac5b 100644 --- a/drivers/lcd/ra8875.c +++ b/drivers/lcd/ra8875.c @@ -1,12 +1,9 @@ /**************************************************************************** * drivers/lcd/ra8875.c * - * Driver for the RAiO Technologies RA8875 LCD controller - * - * Copyright (C) 2015 Intuitive Aerial AB. All rights reserved. - * Author: Marten Svanfeldt - * - * References: RA8875, Rev 1.6, Apr 2013, RAiO Technologies Inc + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2015 Intuitive Aerial AB. All rights reserved. + * SPDX-FileContributor: Marten Svanfeldt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/lcd/ra8875.h b/drivers/lcd/ra8875.h index 318fc0c46ea..137674dd50e 100644 --- a/drivers/lcd/ra8875.h +++ b/drivers/lcd/ra8875.h @@ -1,11 +1,9 @@ /**************************************************************************** * drivers/lcd/ra8875.h - * Definitions for the RAiO Technologies RA8875 LCD controller * - * Copyright (C) 2015 Intuitive Aerial AB. All rights reserved. - * Author: Marten Svanfeldt - * - * References: RA8875, Rev 1.6, Apr 2013, RAiO Technologies Inc + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2015 Intuitive Aerial AB. All rights reserved. + * SPDX-FileContributor: Marten Svanfeldt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/lcd/s1d15g10.h b/drivers/lcd/s1d15g10.h index a6cbb9b17d0..21bc35301ba 100644 --- a/drivers/lcd/s1d15g10.h +++ b/drivers/lcd/s1d15g10.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/s1d15g10.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/sd1329.h b/drivers/lcd/sd1329.h index 0b99f61d880..c5b5f9002df 100644 --- a/drivers/lcd/sd1329.h +++ b/drivers/lcd/sd1329.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/sd1329.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/skeleton.c b/drivers/lcd/skeleton.c index 62a80f4ec4c..ab1737f121a 100644 --- a/drivers/lcd/skeleton.c +++ b/drivers/lcd/skeleton.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/skeleton.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1289.c b/drivers/lcd/ssd1289.c index e3ac200faa3..9263dba2103 100644 --- a/drivers/lcd/ssd1289.c +++ b/drivers/lcd/ssd1289.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1289.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1289.h b/drivers/lcd/ssd1289.h index 13bb1200c01..b375d3a3567 100644 --- a/drivers/lcd/ssd1289.h +++ b/drivers/lcd/ssd1289.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1289.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1305.h b/drivers/lcd/ssd1305.h index 4e7bfc0150d..c6fc7d070b9 100644 --- a/drivers/lcd/ssd1305.h +++ b/drivers/lcd/ssd1305.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1305.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1306.h b/drivers/lcd/ssd1306.h index 2bc26612efd..d98fdbb5db7 100644 --- a/drivers/lcd/ssd1306.h +++ b/drivers/lcd/ssd1306.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1306.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1306_base.c b/drivers/lcd/ssd1306_base.c index fa8d43b4b0b..6b616badf9a 100644 --- a/drivers/lcd/ssd1306_base.c +++ b/drivers/lcd/ssd1306_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1306_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1306_i2c.c b/drivers/lcd/ssd1306_i2c.c index d95e82bcab1..029938d63b6 100644 --- a/drivers/lcd/ssd1306_i2c.c +++ b/drivers/lcd/ssd1306_i2c.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1306_i2c.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1306_spi.c b/drivers/lcd/ssd1306_spi.c index 5dd8aedd0fe..dd8037a8501 100644 --- a/drivers/lcd/ssd1306_spi.c +++ b/drivers/lcd/ssd1306_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1306_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1351.c b/drivers/lcd/ssd1351.c index 3a9aa0ce636..0dda890fbc8 100644 --- a/drivers/lcd/ssd1351.c +++ b/drivers/lcd/ssd1351.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1351.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1680.c b/drivers/lcd/ssd1680.c index 13277144115..5b9742aa502 100644 --- a/drivers/lcd/ssd1680.c +++ b/drivers/lcd/ssd1680.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1680.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ssd1680.h b/drivers/lcd/ssd1680.h index cae2cf1d649..9d090dceff1 100644 --- a/drivers/lcd/ssd1680.h +++ b/drivers/lcd/ssd1680.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ssd1680.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7032.c b/drivers/lcd/st7032.c index adbbf886d6b..95839b26085 100644 --- a/drivers/lcd/st7032.c +++ b/drivers/lcd/st7032.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7032.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7565.c b/drivers/lcd/st7565.c index 538d8c580a3..2849dd297f1 100644 --- a/drivers/lcd/st7565.c +++ b/drivers/lcd/st7565.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7565.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7565.h b/drivers/lcd/st7565.h index 498f5fcda19..cc4d9bcf6e2 100644 --- a/drivers/lcd/st7565.h +++ b/drivers/lcd/st7565.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7565.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7567.c b/drivers/lcd/st7567.c index 3f28796eb9f..86753dcc541 100644 --- a/drivers/lcd/st7567.c +++ b/drivers/lcd/st7567.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7567.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7567.h b/drivers/lcd/st7567.h index d84dc53be78..fc9734c55c5 100644 --- a/drivers/lcd/st7567.h +++ b/drivers/lcd/st7567.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7567.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7735.c b/drivers/lcd/st7735.c index 04481c8ca80..5efd8f2d76a 100644 --- a/drivers/lcd/st7735.c +++ b/drivers/lcd/st7735.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7735.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7735.h b/drivers/lcd/st7735.h index 057b2ff9faa..94babc26883 100644 --- a/drivers/lcd/st7735.h +++ b/drivers/lcd/st7735.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7735.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7789.c b/drivers/lcd/st7789.c index b6418fa5dd8..59adb8195a9 100644 --- a/drivers/lcd/st7789.c +++ b/drivers/lcd/st7789.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7789.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/st7789.h b/drivers/lcd/st7789.h index 9f3ffd196df..770fce0247b 100644 --- a/drivers/lcd/st7789.h +++ b/drivers/lcd/st7789.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/st7789.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/tda19988.c b/drivers/lcd/tda19988.c index 77d2c147cc7..2c5bc9913f2 100644 --- a/drivers/lcd/tda19988.c +++ b/drivers/lcd/tda19988.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/tda19988.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -173,7 +175,9 @@ static const struct file_operations g_tda19988_fops = tda19988_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - tda19988_poll /* poll */ + tda19988_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , tda19988_unlink /* unlink */ #endif diff --git a/drivers/lcd/tda19988.h b/drivers/lcd/tda19988.h index cfd0fc573ad..ffb894908ce 100644 --- a/drivers/lcd/tda19988.h +++ b/drivers/lcd/tda19988.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/tda19988.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ug-2864ambag01.c b/drivers/lcd/ug-2864ambag01.c index dc727d9b2fe..9095a3c662b 100644 --- a/drivers/lcd/ug-2864ambag01.c +++ b/drivers/lcd/ug-2864ambag01.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ug-2864ambag01.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/lcd/ug-9664hswag01.c b/drivers/lcd/ug-9664hswag01.c index 2ea05aa995f..c28bb1e6e28 100644 --- a/drivers/lcd/ug-9664hswag01.c +++ b/drivers/lcd/ug-9664hswag01.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/lcd/ug-9664hswag01.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/CMakeLists.txt b/drivers/leds/CMakeLists.txt index 432d6c364ce..eb292f16da0 100644 --- a/drivers/leds/CMakeLists.txt +++ b/drivers/leds/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/leds/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this @@ -17,7 +19,6 @@ # the License. # # ############################################################################## -# ############################################################################## set(SRCS) diff --git a/drivers/leds/Make.defs b/drivers/leds/Make.defs index 480a95690b5..0d4611e2257 100644 --- a/drivers/leds/Make.defs +++ b/drivers/leds/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/leds/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/apa102.c b/drivers/leds/apa102.c index 39c76d8483c..86b4a0cac5f 100644 --- a/drivers/leds/apa102.c +++ b/drivers/leds/apa102.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/apa102.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/lp503x.c b/drivers/leds/lp503x.c index bc43bdc87b1..3521cd0eeb8 100644 --- a/drivers/leds/lp503x.c +++ b/drivers/leds/lp503x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/lp503x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/max7219.c b/drivers/leds/max7219.c index 3967da3ee2c..aa01ca534e9 100644 --- a/drivers/leds/max7219.c +++ b/drivers/leds/max7219.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/max7219.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/ncp5623c.c b/drivers/leds/ncp5623c.c index 005a4967558..41478350ec6 100644 --- a/drivers/leds/ncp5623c.c +++ b/drivers/leds/ncp5623c.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/ncp5623c.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/pca9635pw.c b/drivers/leds/pca9635pw.c index 951ad611cc0..c86d5aef7b5 100644 --- a/drivers/leds/pca9635pw.c +++ b/drivers/leds/pca9635pw.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/pca9635pw.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/rgbled.c b/drivers/leds/rgbled.c index b20380de70b..c4d61896487 100644 --- a/drivers/leds/rgbled.c +++ b/drivers/leds/rgbled.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/rgbled.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/userled_lower.c b/drivers/leds/userled_lower.c index e1451d656a5..52985f25835 100644 --- a/drivers/leds/userled_lower.c +++ b/drivers/leds/userled_lower.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/userled_lower.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/userled_upper.c b/drivers/leds/userled_upper.c index 27134158ec7..884502dc9fb 100644 --- a/drivers/leds/userled_upper.c +++ b/drivers/leds/userled_upper.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/userled_upper.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/leds/ws2812.c b/drivers/leds/ws2812.c index 850a35c6422..ae1988c5273 100644 --- a/drivers/leds/ws2812.c +++ b/drivers/leds/ws2812.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/leds/ws2812.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/loop/CMakeLists.txt b/drivers/loop/CMakeLists.txt index f7189c1e7f7..a47acbf39ea 100644 --- a/drivers/loop/CMakeLists.txt +++ b/drivers/loop/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/loop/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/loop/Make.defs b/drivers/loop/Make.defs index e6e411845e8..88924c13ed6 100644 --- a/drivers/loop/Make.defs +++ b/drivers/loop/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/loop/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/loop/loop.c b/drivers/loop/loop.c index 5b8c068984b..889040d7d77 100644 --- a/drivers/loop/loop.c +++ b/drivers/loop/loop.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/loop/loop.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -38,10 +40,10 @@ * Private Function Prototypes ****************************************************************************/ -static ssize_t loop_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); -static ssize_t loop_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen); +static ssize_t loop_readv(FAR struct file *filep, + FAR const struct uio *uio); +static ssize_t loop_writev(FAR struct file *filep, + FAR const struct uio *uio); static int loop_ioctl(FAR struct file *filep, int cmd, unsigned long arg); @@ -53,10 +55,15 @@ static const struct file_operations g_loop_fops = { NULL, /* open */ NULL, /* close */ - loop_read, /* read */ - loop_write, /* write */ + NULL, /* read */ + NULL, /* write */ NULL, /* seek */ loop_ioctl, /* ioctl */ + NULL, /* mmap */ + NULL, /* truncate */ + NULL, /* poll */ + loop_readv, /* readv */ + loop_writev /* writev */ }; /**************************************************************************** @@ -67,8 +74,8 @@ static const struct file_operations g_loop_fops = * Name: loop_read ****************************************************************************/ -static ssize_t loop_read(FAR struct file *filep, FAR char *buffer, - size_t len) +static ssize_t loop_readv(FAR struct file *filep, + FAR const struct uio *uio) { return 0; /* Return EOF */ } @@ -77,10 +84,10 @@ static ssize_t loop_read(FAR struct file *filep, FAR char *buffer, * Name: loop_write ****************************************************************************/ -static ssize_t loop_write(FAR struct file *filep, FAR const char *buffer, - size_t len) +static ssize_t loop_writev(FAR struct file *filep, + FAR const struct uio *uio) { - return len; /* Say that everything was written */ + return uio_total_len(uio); /* Say that everything was written */ } /**************************************************************************** diff --git a/drivers/loop/losetup.c b/drivers/loop/losetup.c index b337938b6d3..aa20c6f5419 100644 --- a/drivers/loop/losetup.c +++ b/drivers/loop/losetup.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/loop/losetup.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/math/CMakeLists.txt b/drivers/math/CMakeLists.txt index 7f21d4998c0..91b9059d8b4 100644 --- a/drivers/math/CMakeLists.txt +++ b/drivers/math/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/math/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/math/Make.defs b/drivers/math/Make.defs index 03547c3efe2..b20e1cee607 100644 --- a/drivers/math/Make.defs +++ b/drivers/math/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/math/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/math/math.c b/drivers/math/math.c index 8751414f63e..9a9de2f2af5 100644 --- a/drivers/math/math.c +++ b/drivers/math/math.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/math/math.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/CMakeLists.txt b/drivers/misc/CMakeLists.txt index 349246d4454..3fc5ebf5b82 100644 --- a/drivers/misc/CMakeLists.txt +++ b/drivers/misc/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/misc/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/misc/Make.defs b/drivers/misc/Make.defs index f039f528ed4..d694947953d 100644 --- a/drivers/misc/Make.defs +++ b/drivers/misc/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/misc/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/addrenv.c b/drivers/misc/addrenv.c index b22ede370ff..ec1d7f76dfd 100644 --- a/drivers/misc/addrenv.c +++ b/drivers/misc/addrenv.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/addrenv.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/dev_ascii.c b/drivers/misc/dev_ascii.c index 96d11ff36ba..cd8fbea9554 100644 --- a/drivers/misc/dev_ascii.c +++ b/drivers/misc/dev_ascii.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/dev_ascii.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/dev_mem.c b/drivers/misc/dev_mem.c index a6cf1ec2f63..9db2c700d23 100644 --- a/drivers/misc/dev_mem.c +++ b/drivers/misc/dev_mem.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/dev_mem.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/dev_null.c b/drivers/misc/dev_null.c index d058d64d3e2..1c8c2f0a102 100644 --- a/drivers/misc/dev_null.c +++ b/drivers/misc/dev_null.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/dev_null.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -38,10 +40,10 @@ * Private Function Prototypes ****************************************************************************/ -static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); -static ssize_t devnull_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen); +static ssize_t devnull_readv(FAR struct file *filep, + FAR const struct uio *uio); +static ssize_t devnull_writev(FAR struct file *filep, + FAR const struct uio *uio); static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); @@ -51,15 +53,17 @@ static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds, static const struct file_operations g_devnull_fops = { - NULL, /* open */ - NULL, /* close */ - devnull_read, /* read */ - devnull_write, /* write */ - NULL, /* seek */ - NULL, /* ioctl */ - NULL, /* mmap */ - NULL, /* truncate */ - devnull_poll /* poll */ + NULL, /* open */ + NULL, /* close */ + NULL, /* read */ + NULL, /* writev */ + NULL, /* seek */ + NULL, /* ioctl */ + NULL, /* mmap */ + NULL, /* truncate */ + devnull_poll, /* poll */ + devnull_readv, /* readv */ + devnull_writev /* writev */ }; /**************************************************************************** @@ -70,12 +74,11 @@ static const struct file_operations g_devnull_fops = * Name: devnull_read ****************************************************************************/ -static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer, - size_t len) +static ssize_t devnull_readv(FAR struct file *filep, + FAR const struct uio *uio) { UNUSED(filep); - UNUSED(buffer); - UNUSED(len); + UNUSED(uio); return 0; /* Return EOF */ } @@ -84,13 +87,12 @@ static ssize_t devnull_read(FAR struct file *filep, FAR char *buffer, * Name: devnull_write ****************************************************************************/ -static ssize_t devnull_write(FAR struct file *filep, FAR const char *buffer, - size_t len) +static ssize_t devnull_writev(FAR struct file *filep, + FAR const struct uio *uio) { UNUSED(filep); - UNUSED(buffer); - return len; /* Say that everything was written */ + return uio_total_len(uio); /* Say that everything was written */ } /**************************************************************************** diff --git a/drivers/misc/dev_zero.c b/drivers/misc/dev_zero.c index 46d0f359838..0b5a41712ed 100644 --- a/drivers/misc/dev_zero.c +++ b/drivers/misc/dev_zero.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/dev_zero.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -38,10 +40,10 @@ * Private Function Prototypes ****************************************************************************/ -static ssize_t devzero_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); -static ssize_t devzero_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen); +static ssize_t devzero_readv(FAR struct file *filep, + FAR const struct uio *uio); +static ssize_t devzero_writev(FAR struct file *filep, + FAR const struct uio *uio); static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup); @@ -51,15 +53,17 @@ static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds, static const struct file_operations g_devzero_fops = { - NULL, /* open */ - NULL, /* close */ - devzero_read, /* read */ - devzero_write, /* write */ - NULL, /* seek */ - NULL, /* ioctl */ - NULL, /* mmap */ - NULL, /* truncate */ - devzero_poll /* poll */ + NULL, /* open */ + NULL, /* close */ + NULL, /* read */ + NULL, /* write */ + NULL, /* seek */ + NULL, /* ioctl */ + NULL, /* mmap */ + NULL, /* truncate */ + devzero_poll, /* poll */ + devzero_readv, /* readv */ + devzero_writev /* writev */ }; /**************************************************************************** @@ -70,26 +74,39 @@ static const struct file_operations g_devzero_fops = * Name: devzero_read ****************************************************************************/ -static ssize_t devzero_read(FAR struct file *filep, FAR char *buffer, - size_t len) +static ssize_t devzero_readv(FAR struct file *filep, + FAR const struct uio *uio) { + ssize_t total = uio_total_len(uio); + FAR const struct iovec *iov = uio->uio_iov; + int iovcnt = uio->uio_iovcnt; + int i; + UNUSED(filep); - memset(buffer, 0, len); - return len; + if (total < 0) + { + return total; + } + + for (i = 0; i < iovcnt; i++) + { + memset(iov[i].iov_base, 0, iov[i].iov_len); + } + + return total; } /**************************************************************************** * Name: devzero_write ****************************************************************************/ -static ssize_t devzero_write(FAR struct file *filep, FAR const char *buffer, - size_t len) +static ssize_t devzero_writev(FAR struct file *filep, + FAR const struct uio *uio) { UNUSED(filep); - UNUSED(buffer); - return len; + return uio_total_len(uio); } /**************************************************************************** diff --git a/drivers/misc/goldfish_pipe.c b/drivers/misc/goldfish_pipe.c index 5070c4bb388..bde70a4df4b 100644 --- a/drivers/misc/goldfish_pipe.c +++ b/drivers/misc/goldfish_pipe.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/goldfish_pipe.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/lwl_console.c b/drivers/misc/lwl_console.c index b16b720d23d..68333d6bb9a 100644 --- a/drivers/misc/lwl_console.c +++ b/drivers/misc/lwl_console.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/lwl_console.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/mkrd.c b/drivers/misc/mkrd.c index bf2f69ba307..62f1f4b6d52 100644 --- a/drivers/misc/mkrd.c +++ b/drivers/misc/mkrd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/mkrd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/optee.c b/drivers/misc/optee.c index 6eb13d43b51..4ac33d78350 100644 --- a/drivers/misc/optee.c +++ b/drivers/misc/optee.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/optee.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/ramdisk.c b/drivers/misc/ramdisk.c index 7d04ce6b2ed..96f0410c68f 100644 --- a/drivers/misc/ramdisk.c +++ b/drivers/misc/ramdisk.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/ramdisk.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/rpmsgblk.c b/drivers/misc/rpmsgblk.c index 70dc9a5ee98..b35145c26be 100644 --- a/drivers/misc/rpmsgblk.c +++ b/drivers/misc/rpmsgblk.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/rpmsgblk.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/rpmsgblk.h b/drivers/misc/rpmsgblk.h index d3d83f41e12..93db30cdb25 100644 --- a/drivers/misc/rpmsgblk.h +++ b/drivers/misc/rpmsgblk.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/rpmsgblk.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/rpmsgblk_server.c b/drivers/misc/rpmsgblk_server.c index 1ac7610b4d7..20871dcec60 100644 --- a/drivers/misc/rpmsgblk_server.c +++ b/drivers/misc/rpmsgblk_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/rpmsgblk_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/rpmsgdev.c b/drivers/misc/rpmsgdev.c index cc250676997..2b9eefdb4e3 100644 --- a/drivers/misc/rpmsgdev.c +++ b/drivers/misc/rpmsgdev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/rpmsgdev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -613,6 +615,8 @@ static ssize_t rpmsgdev_ioctl_arglen(int cmd, unsigned long arg) case BATIOC_TEMPERATURE: case BATIOC_INPUT_CURRENT: case BATIOC_STATE: + case BATIOC_CAPACITY: + case BATIOC_CHIPID: return sizeof(int); case TUNSETIFF: case TUNGETIFF: diff --git a/drivers/misc/rpmsgdev.h b/drivers/misc/rpmsgdev.h index 5d777950aab..d21e9af677b 100644 --- a/drivers/misc/rpmsgdev.h +++ b/drivers/misc/rpmsgdev.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/rpmsgdev.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/rpmsgdev_server.c b/drivers/misc/rpmsgdev_server.c index 6bc07f95a29..fcdfade746b 100644 --- a/drivers/misc/rpmsgdev_server.c +++ b/drivers/misc/rpmsgdev_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/rpmsgdev_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/misc/rwbuffer.c b/drivers/misc/rwbuffer.c index 28b94f3df97..91e6307fdeb 100644 --- a/drivers/misc/rwbuffer.c +++ b/drivers/misc/rwbuffer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/misc/rwbuffer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/CMakeLists.txt b/drivers/mmcsd/CMakeLists.txt index d8298f44969..5728f7046f1 100644 --- a/drivers/mmcsd/CMakeLists.txt +++ b/drivers/mmcsd/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/mmcsd/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/mmcsd/Make.defs b/drivers/mmcsd/Make.defs index c80dd7ecafc..b65cc9f8d76 100644 --- a/drivers/mmcsd/Make.defs +++ b/drivers/mmcsd/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/mmcsd/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd.h b/drivers/mmcsd/mmcsd.h index 67cb2a3ec60..ff20eb283a5 100644 --- a/drivers/mmcsd/mmcsd.h +++ b/drivers/mmcsd/mmcsd.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_csd.h b/drivers/mmcsd/mmcsd_csd.h index 423c6b98340..274a3cf8d3f 100644 --- a/drivers/mmcsd/mmcsd_csd.h +++ b/drivers/mmcsd/mmcsd_csd.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_csd.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_debug.c b/drivers/mmcsd/mmcsd_debug.c index dbc4d400f0a..68cca85e072 100644 --- a/drivers/mmcsd/mmcsd_debug.c +++ b/drivers/mmcsd/mmcsd_debug.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_debug.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_extcsd.h b/drivers/mmcsd/mmcsd_extcsd.h index 60070e9fd3b..37e61d2a6fe 100644 --- a/drivers/mmcsd/mmcsd_extcsd.h +++ b/drivers/mmcsd/mmcsd_extcsd.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_extcsd.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_procfs.c b/drivers/mmcsd/mmcsd_procfs.c index 6cb811b34e4..1a815e9a4c4 100644 --- a/drivers/mmcsd/mmcsd_procfs.c +++ b/drivers/mmcsd/mmcsd_procfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_procfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_sdio.c b/drivers/mmcsd/mmcsd_sdio.c index 29350380c9d..49023628ea2 100644 --- a/drivers/mmcsd/mmcsd_sdio.c +++ b/drivers/mmcsd/mmcsd_sdio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_sdio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_sdio.h b/drivers/mmcsd/mmcsd_sdio.h index 8185741984f..76dcf15c6c4 100644 --- a/drivers/mmcsd/mmcsd_sdio.h +++ b/drivers/mmcsd/mmcsd_sdio.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_sdio.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_spi.c b/drivers/mmcsd/mmcsd_spi.c index cc0e2edbe23..a6e71fe3cdc 100644 --- a/drivers/mmcsd/mmcsd_spi.c +++ b/drivers/mmcsd/mmcsd_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/mmcsd_spi.h b/drivers/mmcsd/mmcsd_spi.h index 4732a78d790..f3fc9b93160 100644 --- a/drivers/mmcsd/mmcsd_spi.h +++ b/drivers/mmcsd/mmcsd_spi.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/mmcsd_spi.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mmcsd/sdio.c b/drivers/mmcsd/sdio.c index 0bd1e0cbea9..a259fa8e0ae 100644 --- a/drivers/mmcsd/sdio.c +++ b/drivers/mmcsd/sdio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mmcsd/sdio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/CMakeLists.txt b/drivers/modem/CMakeLists.txt index ac33a0c450c..6af35aafab2 100644 --- a/drivers/modem/CMakeLists.txt +++ b/drivers/modem/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/modem/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/modem/Make.defs b/drivers/modem/Make.defs index 55de4aa908c..c81979b783a 100644 --- a/drivers/modem/Make.defs +++ b/drivers/modem/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/modem/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/CMakeLists.txt b/drivers/modem/alt1250/CMakeLists.txt index 519d51b59b4..443f02aa3fc 100644 --- a/drivers/modem/alt1250/CMakeLists.txt +++ b/drivers/modem/alt1250/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/modem/alt1250/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/modem/alt1250/Make.defs b/drivers/modem/alt1250/Make.defs index 70daac09066..26ce27f06f7 100644 --- a/drivers/modem/alt1250/Make.defs +++ b/drivers/modem/alt1250/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/modem/alt1250/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/alt1250.c b/drivers/modem/alt1250/alt1250.c index e88999c498f..da2a7f57305 100644 --- a/drivers/modem/alt1250/alt1250.c +++ b/drivers/modem/alt1250/alt1250.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/alt1250.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/alt1250.h b/drivers/modem/alt1250/alt1250.h index 10b962f9049..6ab50a6706d 100644 --- a/drivers/modem/alt1250/alt1250.h +++ b/drivers/modem/alt1250/alt1250.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/alt1250.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_cmd.h b/drivers/modem/alt1250/altcom_cmd.h index 3d23d15fa5f..47c6b8da631 100644 --- a/drivers/modem/alt1250/altcom_cmd.h +++ b/drivers/modem/alt1250/altcom_cmd.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_cmd.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_cmd_log.h b/drivers/modem/alt1250/altcom_cmd_log.h index 337693a57a0..e1e57e5b53d 100644 --- a/drivers/modem/alt1250/altcom_cmd_log.h +++ b/drivers/modem/alt1250/altcom_cmd_log.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_cmd_log.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_cmd_sms.h b/drivers/modem/alt1250/altcom_cmd_sms.h index 6bc5e8e076e..220e9a0d7ef 100644 --- a/drivers/modem/alt1250/altcom_cmd_sms.h +++ b/drivers/modem/alt1250/altcom_cmd_sms.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_cmd_sms.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_cmd_sock.h b/drivers/modem/alt1250/altcom_cmd_sock.h index 5b2c02ee31f..812d7d20a1e 100644 --- a/drivers/modem/alt1250/altcom_cmd_sock.h +++ b/drivers/modem/alt1250/altcom_cmd_sock.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_cmd_sock.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_errno.c b/drivers/modem/alt1250/altcom_errno.c index d52e4ec6ecf..2e387d46be4 100644 --- a/drivers/modem/alt1250/altcom_errno.c +++ b/drivers/modem/alt1250/altcom_errno.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_errno.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_errno.h b/drivers/modem/alt1250/altcom_errno.h index 102b6bc93e9..6f3fa63898a 100644 --- a/drivers/modem/alt1250/altcom_errno.h +++ b/drivers/modem/alt1250/altcom_errno.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_errno.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr.c b/drivers/modem/alt1250/altcom_hdlr.c index e55e844d6ce..2d334ca28d1 100644 --- a/drivers/modem/alt1250/altcom_hdlr.c +++ b/drivers/modem/alt1250/altcom_hdlr.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr.h b/drivers/modem/alt1250/altcom_hdlr.h index 402dd7c6feb..481b1e24d60 100644 --- a/drivers/modem/alt1250/altcom_hdlr.h +++ b/drivers/modem/alt1250/altcom_hdlr.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_firmware.c b/drivers/modem/alt1250/altcom_hdlr_firmware.c index 78422cfc6a6..02082ea501c 100644 --- a/drivers/modem/alt1250/altcom_hdlr_firmware.c +++ b/drivers/modem/alt1250/altcom_hdlr_firmware.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_firmware.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_firmware.h b/drivers/modem/alt1250/altcom_hdlr_firmware.h index c8c6d079aa8..eb2ce73d073 100644 --- a/drivers/modem/alt1250/altcom_hdlr_firmware.h +++ b/drivers/modem/alt1250/altcom_hdlr_firmware.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_firmware.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_log.c b/drivers/modem/alt1250/altcom_hdlr_log.c index 93901c2b044..210e21c95ef 100644 --- a/drivers/modem/alt1250/altcom_hdlr_log.c +++ b/drivers/modem/alt1250/altcom_hdlr_log.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_log.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_log.h b/drivers/modem/alt1250/altcom_hdlr_log.h index 24949eb2128..6aa370f65d7 100644 --- a/drivers/modem/alt1250/altcom_hdlr_log.h +++ b/drivers/modem/alt1250/altcom_hdlr_log.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_log.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_net.c b/drivers/modem/alt1250/altcom_hdlr_net.c index b967ad5041a..815deb33e9c 100644 --- a/drivers/modem/alt1250/altcom_hdlr_net.c +++ b/drivers/modem/alt1250/altcom_hdlr_net.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_net.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_net.h b/drivers/modem/alt1250/altcom_hdlr_net.h index 6a4c41b6011..6711c17e4e5 100644 --- a/drivers/modem/alt1250/altcom_hdlr_net.h +++ b/drivers/modem/alt1250/altcom_hdlr_net.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_net.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_other.c b/drivers/modem/alt1250/altcom_hdlr_other.c index e30ef7f1530..b0b0417206f 100644 --- a/drivers/modem/alt1250/altcom_hdlr_other.c +++ b/drivers/modem/alt1250/altcom_hdlr_other.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_other.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_other.h b/drivers/modem/alt1250/altcom_hdlr_other.h index 22affad5113..9bc22480916 100644 --- a/drivers/modem/alt1250/altcom_hdlr_other.h +++ b/drivers/modem/alt1250/altcom_hdlr_other.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_other.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_pdn.c b/drivers/modem/alt1250/altcom_hdlr_pdn.c index 90803cff15e..2166d1f3bf7 100644 --- a/drivers/modem/alt1250/altcom_hdlr_pdn.c +++ b/drivers/modem/alt1250/altcom_hdlr_pdn.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_pdn.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_pdn.h b/drivers/modem/alt1250/altcom_hdlr_pdn.h index 458474a181a..9e22182e110 100644 --- a/drivers/modem/alt1250/altcom_hdlr_pdn.h +++ b/drivers/modem/alt1250/altcom_hdlr_pdn.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_pdn.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_pin.c b/drivers/modem/alt1250/altcom_hdlr_pin.c index 066e75137da..dcf57e5cbdd 100644 --- a/drivers/modem/alt1250/altcom_hdlr_pin.c +++ b/drivers/modem/alt1250/altcom_hdlr_pin.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_pin.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_pin.h b/drivers/modem/alt1250/altcom_hdlr_pin.h index 4745a903440..ca857b7bbce 100644 --- a/drivers/modem/alt1250/altcom_hdlr_pin.h +++ b/drivers/modem/alt1250/altcom_hdlr_pin.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_pin.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_psave.c b/drivers/modem/alt1250/altcom_hdlr_psave.c index 08afb8acdac..03dd6c505d3 100644 --- a/drivers/modem/alt1250/altcom_hdlr_psave.c +++ b/drivers/modem/alt1250/altcom_hdlr_psave.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_psave.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_psave.h b/drivers/modem/alt1250/altcom_hdlr_psave.h index 359d56dcb7e..00b55f80a4f 100644 --- a/drivers/modem/alt1250/altcom_hdlr_psave.h +++ b/drivers/modem/alt1250/altcom_hdlr_psave.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_psave.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_radio.c b/drivers/modem/alt1250/altcom_hdlr_radio.c index 24ab28b9668..c0155851143 100644 --- a/drivers/modem/alt1250/altcom_hdlr_radio.c +++ b/drivers/modem/alt1250/altcom_hdlr_radio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_radio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_radio.h b/drivers/modem/alt1250/altcom_hdlr_radio.h index cf1791620bf..3a1f9ad306f 100644 --- a/drivers/modem/alt1250/altcom_hdlr_radio.h +++ b/drivers/modem/alt1250/altcom_hdlr_radio.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_radio.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_sim.c b/drivers/modem/alt1250/altcom_hdlr_sim.c index 5270dfbd97d..56c5a78c33a 100644 --- a/drivers/modem/alt1250/altcom_hdlr_sim.c +++ b/drivers/modem/alt1250/altcom_hdlr_sim.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_sim.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_sim.h b/drivers/modem/alt1250/altcom_hdlr_sim.h index 66be84ab729..64d02514b0a 100644 --- a/drivers/modem/alt1250/altcom_hdlr_sim.h +++ b/drivers/modem/alt1250/altcom_hdlr_sim.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_sim.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_sms.c b/drivers/modem/alt1250/altcom_hdlr_sms.c index d1b2718c86b..aac06eb6c5d 100644 --- a/drivers/modem/alt1250/altcom_hdlr_sms.c +++ b/drivers/modem/alt1250/altcom_hdlr_sms.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_sms.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_sms.h b/drivers/modem/alt1250/altcom_hdlr_sms.h index 064ccdc8f5a..9084b084908 100644 --- a/drivers/modem/alt1250/altcom_hdlr_sms.h +++ b/drivers/modem/alt1250/altcom_hdlr_sms.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_sms.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_socket.c b/drivers/modem/alt1250/altcom_hdlr_socket.c index 438aa68990b..01d9a65de9c 100644 --- a/drivers/modem/alt1250/altcom_hdlr_socket.c +++ b/drivers/modem/alt1250/altcom_hdlr_socket.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_socket.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_hdlr_socket.h b/drivers/modem/alt1250/altcom_hdlr_socket.h index cb159e47cb0..5572422af12 100644 --- a/drivers/modem/alt1250/altcom_hdlr_socket.h +++ b/drivers/modem/alt1250/altcom_hdlr_socket.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_hdlr_socket.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_lwm2m_hdlr.c b/drivers/modem/alt1250/altcom_lwm2m_hdlr.c index a4eb5ff956b..b86d943c57b 100644 --- a/drivers/modem/alt1250/altcom_lwm2m_hdlr.c +++ b/drivers/modem/alt1250/altcom_lwm2m_hdlr.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_lwm2m_hdlr.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_lwm2m_hdlr.h b/drivers/modem/alt1250/altcom_lwm2m_hdlr.h index 5cc7bff05f3..42ce21e3217 100644 --- a/drivers/modem/alt1250/altcom_lwm2m_hdlr.h +++ b/drivers/modem/alt1250/altcom_lwm2m_hdlr.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_lwm2m_hdlr.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_pkt.c b/drivers/modem/alt1250/altcom_pkt.c index e1c086c6888..5ce15120b2e 100644 --- a/drivers/modem/alt1250/altcom_pkt.c +++ b/drivers/modem/alt1250/altcom_pkt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_pkt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altcom_pkt.h b/drivers/modem/alt1250/altcom_pkt.h index d486818d667..fee4bcc2490 100644 --- a/drivers/modem/alt1250/altcom_pkt.h +++ b/drivers/modem/alt1250/altcom_pkt.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altcom_pkt.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm.c b/drivers/modem/alt1250/altmdm.c index f1745b2dbdd..a0b813324b8 100644 --- a/drivers/modem/alt1250/altmdm.c +++ b/drivers/modem/alt1250/altmdm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm.h b/drivers/modem/alt1250/altmdm.h index 6697d5df7ae..3f8b7e1fd95 100644 --- a/drivers/modem/alt1250/altmdm.h +++ b/drivers/modem/alt1250/altmdm.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm_event.c b/drivers/modem/alt1250/altmdm_event.c index 511da25da48..65028cf8eef 100644 --- a/drivers/modem/alt1250/altmdm_event.c +++ b/drivers/modem/alt1250/altmdm_event.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm_event.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm_event.h b/drivers/modem/alt1250/altmdm_event.h index de672baae4e..7581de2e825 100644 --- a/drivers/modem/alt1250/altmdm_event.h +++ b/drivers/modem/alt1250/altmdm_event.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm_event.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm_spi.c b/drivers/modem/alt1250/altmdm_spi.c index 6b18b633300..5f3b30fcc3d 100644 --- a/drivers/modem/alt1250/altmdm_spi.c +++ b/drivers/modem/alt1250/altmdm_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm_spi.h b/drivers/modem/alt1250/altmdm_spi.h index d16e7bef7a6..8e7d6513512 100644 --- a/drivers/modem/alt1250/altmdm_spi.h +++ b/drivers/modem/alt1250/altmdm_spi.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm_spi.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm_timer.c b/drivers/modem/alt1250/altmdm_timer.c index ffa338b681d..afe09a19d71 100644 --- a/drivers/modem/alt1250/altmdm_timer.c +++ b/drivers/modem/alt1250/altmdm_timer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm_timer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/alt1250/altmdm_timer.h b/drivers/modem/alt1250/altmdm_timer.h index 0d69de64e52..58f67d916bb 100644 --- a/drivers/modem/alt1250/altmdm_timer.h +++ b/drivers/modem/alt1250/altmdm_timer.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/modem/alt1250/altmdm_timer.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/modem/u-blox.c b/drivers/modem/u-blox.c index 9f05344e949..d1871b661fc 100644 --- a/drivers/modem/u-blox.c +++ b/drivers/modem/u-blox.c @@ -1,8 +1,9 @@ /**************************************************************************** * drivers/modem/u-blox.c * - * Copyright (C) 2016 Vladimir Komendantskiy. All rights reserved. - * Author: Vladimir Komendantskiy + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2016 Vladimir Komendantskiy. All rights reserved. + * SPDX-FileContributor: Vladimir Komendantskiy * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/motor/CMakeLists.txt b/drivers/motor/CMakeLists.txt index 7d6990d83f0..297c0cc4646 100644 --- a/drivers/motor/CMakeLists.txt +++ b/drivers/motor/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/motor/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/motor/Make.defs b/drivers/motor/Make.defs index 4a683548a26..6baee176b4b 100644 --- a/drivers/motor/Make.defs +++ b/drivers/motor/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/motor/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/motor/a4988.c b/drivers/motor/a4988.c index dbe1017afdb..b4b5bdbaa5e 100644 --- a/drivers/motor/a4988.c +++ b/drivers/motor/a4988.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/motor/a4988.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/motor/drv8825.c b/drivers/motor/drv8825.c index 1b45af0b13a..88b5e214dc1 100644 --- a/drivers/motor/drv8825.c +++ b/drivers/motor/drv8825.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/motor/drv8825.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/motor/foc/CMakeLists.txt b/drivers/motor/foc/CMakeLists.txt index 9cee9bf19bf..c9bed201381 100644 --- a/drivers/motor/foc/CMakeLists.txt +++ b/drivers/motor/foc/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/motor/foc/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/motor/foc/Make.defs b/drivers/motor/foc/Make.defs index 8d505a61bd7..2c0f127c870 100644 --- a/drivers/motor/foc/Make.defs +++ b/drivers/motor/foc/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/motor/foc/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/motor/foc/drv8301.c b/drivers/motor/foc/drv8301.c index a169fa60412..9e8712e30af 100644 --- a/drivers/motor/foc/drv8301.c +++ b/drivers/motor/foc/drv8301.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/motor/foc/drv8301.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/motor/foc/foc_dev.c b/drivers/motor/foc/foc_dev.c index 241dbbfd8ae..25b00a04311 100644 --- a/drivers/motor/foc/foc_dev.c +++ b/drivers/motor/foc/foc_dev.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/motor/foc/foc_dev.c - * Upper-half FOC controller logic + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/motor/foc/foc_dummy.c b/drivers/motor/foc/foc_dummy.c index 466390e7767..69416fbbd1e 100644 --- a/drivers/motor/foc/foc_dummy.c +++ b/drivers/motor/foc/foc_dummy.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/motor/foc/foc_dummy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/motor/foc/foc_pwr.c b/drivers/motor/foc/foc_pwr.c index 521c78ffd1e..fc0ef44a36d 100644 --- a/drivers/motor/foc/foc_pwr.c +++ b/drivers/motor/foc/foc_pwr.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/motor/foc/foc_pwr.c - * Power-stage FOC logic + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/motor/motor.c b/drivers/motor/motor.c index ffa975dfa17..1031388007e 100644 --- a/drivers/motor/motor.c +++ b/drivers/motor/motor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/motor/motor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/motor/stepper.c b/drivers/motor/stepper.c index 443e0adbb02..2cfc55dc95a 100644 --- a/drivers/motor/stepper.c +++ b/drivers/motor/stepper.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/motor/stepper.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/CMakeLists.txt b/drivers/mtd/CMakeLists.txt index ea9eabc99d9..46965d40caa 100644 --- a/drivers/mtd/CMakeLists.txt +++ b/drivers/mtd/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/mtd/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this @@ -17,8 +19,6 @@ # the License. # # ############################################################################## -# -# ############################################################################## if(CONFIG_MTD) set(SRCS ftl.c) diff --git a/drivers/mtd/Make.defs b/drivers/mtd/Make.defs index 6956610c3cd..0bc3cce279b 100644 --- a/drivers/mtd/Make.defs +++ b/drivers/mtd/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/mtd/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/at24xx.c b/drivers/mtd/at24xx.c index edb191b7f3b..7942b07e601 100644 --- a/drivers/mtd/at24xx.c +++ b/drivers/mtd/at24xx.c @@ -1,8 +1,9 @@ /**************************************************************************** * drivers/mtd/at24xx.c * - * Copyright (C) 2011 Li Zhuoyi. All rights reserved. - * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2013, 2016 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2011 Li Zhuoyi. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/at25.c b/drivers/mtd/at25.c index c4d793806dc..9694ce4c5be 100644 --- a/drivers/mtd/at25.c +++ b/drivers/mtd/at25.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/at25.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/at25ee.c b/drivers/mtd/at25ee.c index 45873a7c46c..6f355b2379c 100644 --- a/drivers/mtd/at25ee.c +++ b/drivers/mtd/at25ee.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/at25ee.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/at45db.c b/drivers/mtd/at45db.c index 59fcde39b76..25b94d73e81 100644 --- a/drivers/mtd/at45db.c +++ b/drivers/mtd/at45db.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/at45db.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/dhara.c b/drivers/mtd/dhara.c index 8ae8acf2e6b..550572b6977 100644 --- a/drivers/mtd/dhara.c +++ b/drivers/mtd/dhara.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/dhara.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/filemtd.c b/drivers/mtd/filemtd.c index 7a87496c593..f9694f1b5c9 100644 --- a/drivers/mtd/filemtd.c +++ b/drivers/mtd/filemtd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/filemtd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 5e19ead19c8..04f9fc7592b 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/ftl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/gd25.c b/drivers/mtd/gd25.c index c19646fb2f4..7b6f529fb93 100644 --- a/drivers/mtd/gd25.c +++ b/drivers/mtd/gd25.c @@ -1,6 +1,8 @@ /*************************************************************************** * drivers/mtd/gd25.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/gd5f.c b/drivers/mtd/gd5f.c index 9f5e252a9c7..a13126ac09c 100644 --- a/drivers/mtd/gd5f.c +++ b/drivers/mtd/gd5f.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/gd5f.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/hamming.c b/drivers/mtd/hamming.c index 49e361d8a27..d2fee21ee31 100644 --- a/drivers/mtd/hamming.c +++ b/drivers/mtd/hamming.c @@ -1,7 +1,8 @@ /**************************************************************************** * drivers/mtd/hamming.c * - * Copyright (c) 2011, Atmel Corporation + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2011, Atmel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/is25xp.c b/drivers/mtd/is25xp.c index becd7951890..87440d68cf3 100644 --- a/drivers/mtd/is25xp.c +++ b/drivers/mtd/is25xp.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/is25xp.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/m25px.c b/drivers/mtd/m25px.c index 20fab5e11fe..03678da6215 100644 --- a/drivers/mtd/m25px.c +++ b/drivers/mtd/m25px.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/m25px.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/mtd_config.c b/drivers/mtd/mtd_config.c index 746a5013342..eed3d307c4c 100644 --- a/drivers/mtd/mtd_config.c +++ b/drivers/mtd/mtd_config.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_config.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/mtd_modeltab.c b/drivers/mtd/mtd_modeltab.c index 404045049e1..d0cf5d5ca2d 100644 --- a/drivers/mtd/mtd_modeltab.c +++ b/drivers/mtd/mtd_modeltab.c @@ -1,7 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_modeltab.c * - * Copyright (c) 2012, Atmel Corporation + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2012, Atmel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/mtd_nand.c b/drivers/mtd/mtd_nand.c index 725238dc75f..c2eb679eeca 100644 --- a/drivers/mtd/mtd_nand.c +++ b/drivers/mtd/mtd_nand.c @@ -1,7 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_nand.c * - * Copyright (c) 2011, 2012, Atmel Corporation + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2011, 2012, Atmel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/mtd_nandecc.c b/drivers/mtd/mtd_nandecc.c index 5a21a791772..adff42218ea 100644 --- a/drivers/mtd/mtd_nandecc.c +++ b/drivers/mtd/mtd_nandecc.c @@ -1,7 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_nandecc.c * - * Copyright (c) 2011, 2012, Atmel Corporation + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2011, 2012, Atmel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/mtd_nandmodel.c b/drivers/mtd/mtd_nandmodel.c index bafa50580ec..ec417606e6d 100644 --- a/drivers/mtd/mtd_nandmodel.c +++ b/drivers/mtd/mtd_nandmodel.c @@ -1,7 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_nandmodel.c * - * Copyright (c) 2011, 2012, Atmel Corporation + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2011, 2012, Atmel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/mtd_nandram.c b/drivers/mtd/mtd_nandram.c index a306bf62853..9e2d3cec755 100644 --- a/drivers/mtd/mtd_nandram.c +++ b/drivers/mtd/mtd_nandram.c @@ -1,8 +1,7 @@ /**************************************************************************** * drivers/mtd/mtd_nandram.c - * This file deals with the raw lower half of the device driver, and manages - * reading and writing to the actual NAND Flash device that has been emulated - * from RAM. + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/mtd/mtd_nandscheme.c b/drivers/mtd/mtd_nandscheme.c index e177d34937b..4e8318c951a 100644 --- a/drivers/mtd/mtd_nandscheme.c +++ b/drivers/mtd/mtd_nandscheme.c @@ -1,7 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_nandscheme.c * - * Copyright (c) 2012, Atmel Corporation + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2012, Atmel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/mtd_nandwrapper.c b/drivers/mtd/mtd_nandwrapper.c index 8d604b96b1f..248db39e4a0 100644 --- a/drivers/mtd/mtd_nandwrapper.c +++ b/drivers/mtd/mtd_nandwrapper.c @@ -1,8 +1,7 @@ /**************************************************************************** * drivers/mtd/mtd_nandwrapper.c - * This deals with the wrapper over the upper half of the driver, to enable - * logging for debugging, and essentially passes the parameters right to the - * actual upper half of the NAND Flash device driver without changing them. + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/mtd/mtd_onfi.c b/drivers/mtd/mtd_onfi.c index b89ad74d1cc..cc3e217baff 100644 --- a/drivers/mtd/mtd_onfi.c +++ b/drivers/mtd/mtd_onfi.c @@ -1,7 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_onfi.c * - * Copyright (c) 2010, Atmel Corporation + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2010, Atmel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/mtd/mtd_partition.c b/drivers/mtd/mtd_partition.c index 4db75d92d15..20401040bc2 100644 --- a/drivers/mtd/mtd_partition.c +++ b/drivers/mtd/mtd_partition.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_partition.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/mtd_progmem.c b/drivers/mtd/mtd_progmem.c index 762f33735fd..e48e5d0fdfd 100644 --- a/drivers/mtd/mtd_progmem.c +++ b/drivers/mtd/mtd_progmem.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_progmem.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/mtd_rwbuffer.c b/drivers/mtd/mtd_rwbuffer.c index 7b76b605adb..ebd1a3647ce 100644 --- a/drivers/mtd/mtd_rwbuffer.c +++ b/drivers/mtd/mtd_rwbuffer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/mtd_rwbuffer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/mx25lx.c b/drivers/mtd/mx25lx.c index ffd1e8511ff..1e55b2916e1 100644 --- a/drivers/mtd/mx25lx.c +++ b/drivers/mtd/mx25lx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/mx25lx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/mx25rxx.c b/drivers/mtd/mx25rxx.c index 7a1f9cdb145..e809539cb9b 100644 --- a/drivers/mtd/mx25rxx.c +++ b/drivers/mtd/mx25rxx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/mx25rxx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/mx35.c b/drivers/mtd/mx35.c index 57d30e93d2c..f602bc6ae20 100644 --- a/drivers/mtd/mx35.c +++ b/drivers/mtd/mx35.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/mx35.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/n25qxxx.c b/drivers/mtd/n25qxxx.c index c43a4d8278b..bde0dc88f40 100644 --- a/drivers/mtd/n25qxxx.c +++ b/drivers/mtd/n25qxxx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/n25qxxx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/nullmtd.c b/drivers/mtd/nullmtd.c index edc1dee0ae0..e5124e24dd3 100644 --- a/drivers/mtd/nullmtd.c +++ b/drivers/mtd/nullmtd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/nullmtd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/rammtd.c b/drivers/mtd/rammtd.c index faae742a234..0bcc0af0a38 100644 --- a/drivers/mtd/rammtd.c +++ b/drivers/mtd/rammtd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/rammtd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -518,3 +520,21 @@ FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size) return &priv->mtd; } + +/**************************************************************************** + * Name: rammtd_uninitialize + * + * Description: + * Free the resources associated with a RAM MTD device instance. + * + * Input Parameters: + * dev - Pointer to the MTD device instance to be uninitialized. + * + ****************************************************************************/ + +void rammtd_uninitialize(FAR struct mtd_dev_s *dev) +{ + FAR struct ram_dev_s *priv = (FAR struct ram_dev_s *)dev; + + kmm_free(priv); +} diff --git a/drivers/mtd/ramtron.c b/drivers/mtd/ramtron.c index 1f342f7d726..ef7057a26db 100644 --- a/drivers/mtd/ramtron.c +++ b/drivers/mtd/ramtron.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/ramtron.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/rpmsgmtd.c b/drivers/mtd/rpmsgmtd.c index 8545b24f69f..82036cce478 100644 --- a/drivers/mtd/rpmsgmtd.c +++ b/drivers/mtd/rpmsgmtd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/rpmsgmtd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/rpmsgmtd.h b/drivers/mtd/rpmsgmtd.h index 5a803753510..8641f06c0f5 100644 --- a/drivers/mtd/rpmsgmtd.h +++ b/drivers/mtd/rpmsgmtd.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/rpmsgmtd.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/rpmsgmtd_server.c b/drivers/mtd/rpmsgmtd_server.c index 7320c5d3650..36c8f51bce3 100644 --- a/drivers/mtd/rpmsgmtd_server.c +++ b/drivers/mtd/rpmsgmtd_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/rpmsgmtd_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/s25fl1.c b/drivers/mtd/s25fl1.c index 414d9c98771..b85db789187 100644 --- a/drivers/mtd/s25fl1.c +++ b/drivers/mtd/s25fl1.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/s25fl1.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/sector512.c b/drivers/mtd/sector512.c index 787f22ae548..d0f99df667b 100644 --- a/drivers/mtd/sector512.c +++ b/drivers/mtd/sector512.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/sector512.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/skeleton.c b/drivers/mtd/skeleton.c index 1a2d42ec24a..a20b0cc5157 100644 --- a/drivers/mtd/skeleton.c +++ b/drivers/mtd/skeleton.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/skeleton.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/smart.c b/drivers/mtd/smart.c index 801b80216a3..ff0f0cb582a 100644 --- a/drivers/mtd/smart.c +++ b/drivers/mtd/smart.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/smart.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/sst25.c b/drivers/mtd/sst25.c index 7f991037a17..c918b9b8df4 100644 --- a/drivers/mtd/sst25.c +++ b/drivers/mtd/sst25.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/sst25.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/sst25xx.c b/drivers/mtd/sst25xx.c index 39dca0d7897..83dfd4a1cce 100644 --- a/drivers/mtd/sst25xx.c +++ b/drivers/mtd/sst25xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/sst25xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/sst26.c b/drivers/mtd/sst26.c index d625c494199..824e67488b9 100644 --- a/drivers/mtd/sst26.c +++ b/drivers/mtd/sst26.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/sst26.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/sst39vf.c b/drivers/mtd/sst39vf.c index 9f97b286637..1a33dc58f26 100644 --- a/drivers/mtd/sst39vf.c +++ b/drivers/mtd/sst39vf.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/sst39vf.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/w25.c b/drivers/mtd/w25.c index fd0df350159..07f585bc512 100644 --- a/drivers/mtd/w25.c +++ b/drivers/mtd/w25.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/w25.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/mtd/w25qxxxjv.c b/drivers/mtd/w25qxxxjv.c index 1eb25a80d7e..881f2070ddf 100644 --- a/drivers/mtd/w25qxxxjv.c +++ b/drivers/mtd/w25qxxxjv.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/mtd/w25qxxxjv.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/CMakeLists.txt b/drivers/net/CMakeLists.txt index 0a8c2b174b3..86c96da39d4 100644 --- a/drivers/net/CMakeLists.txt +++ b/drivers/net/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/net/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 6cc7e5fcea5..c2b25eae13d 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -781,24 +781,6 @@ config NET_E1000_RXSPARE int "Intel E1000 spare RX buffers" default 8 -config NET_E1000_I219 - bool "Intel I219" - default n - ---help--- - Enable Intel I219 Ethernet driver. - -config NET_E1000_82540EM - bool "Intel 82540EM" - default n - ---help--- - Enable Intel 82540EM Ethernet driver (-device e1000 on QEMU). - -config NET_E1000_82574L - bool "Intel 82574L" - default n - ---help--- - Enable Intel 82574L Ethernet driver (-device e1000e on QEMU). - endif # NET_E1000 menuconfig NET_IGC diff --git a/drivers/net/Make.defs b/drivers/net/Make.defs index d0b3b010652..20a2b2b138c 100644 --- a/drivers/net/Make.defs +++ b/drivers/net/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/net/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/net/dm90x0.c b/drivers/net/dm90x0.c index 02722b78546..8e9e05a45b7 100644 --- a/drivers/net/dm90x0.c +++ b/drivers/net/dm90x0.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/dm90x0.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 54da2c6cb0f..b959654c795 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -1,6 +1,8 @@ /***************************************************************************** * drivers/net/e1000.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -223,7 +225,6 @@ static int e1000_probe(FAR struct pci_device_s *dev); * Private Data *****************************************************************************/ -#ifdef CONFIG_NET_E1000_I219 /* Intel I219 */ static const struct e1000_type_s g_e1000_i219 = @@ -232,9 +233,7 @@ static const struct e1000_type_s g_e1000_i219 = .mta_regs = 32, .flags = E1000_RESET_BROKEN }; -#endif -#ifdef CONFIG_NET_E1000_82540EM /* Intel 82801IB (QEMU -device e1000) */ static const struct e1000_type_s g_e1000_82540em = @@ -243,9 +242,7 @@ static const struct e1000_type_s g_e1000_82540em = .mta_regs = 128, .flags = 0 }; -#endif -#ifdef CONFIG_NET_E1000_82574L /* Intel 82574L (QEMU -device e1000e) */ static const struct e1000_type_s g_e1000_82574l = @@ -254,28 +251,21 @@ static const struct e1000_type_s g_e1000_82574l = .mta_regs = 128, .flags = E1000_HAS_MSIX }; -#endif static const struct pci_device_id_s g_e1000_id_table[] = { -#ifdef CONFIG_NET_E1000_I219 { PCI_DEVICE(0x8086, 0x1a1e), .driver_data = (uintptr_t)&g_e1000_i219 }, -#endif -#ifdef CONFIG_NET_E1000_82540EM { PCI_DEVICE(0x8086, 0x100e), .driver_data = (uintptr_t)&g_e1000_82540em }, -#endif -#ifdef CONFIG_NET_E1000_82574L { PCI_DEVICE(0x8086, 0x10d3), .driver_data = (uintptr_t)&g_e1000_82574l }, -#endif { } }; diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h index 0650c69d075..c2f92c7340c 100644 --- a/drivers/net/e1000.h +++ b/drivers/net/e1000.h @@ -1,6 +1,8 @@ /***************************************************************************** * drivers/net/e1000.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c index 20b755363de..8393e79463e 100644 --- a/drivers/net/enc28j60.c +++ b/drivers/net/enc28j60.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/enc28j60.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/enc28j60.h b/drivers/net/enc28j60.h index 1206a70fc0d..0a9fbc5784e 100644 --- a/drivers/net/enc28j60.h +++ b/drivers/net/enc28j60.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/enc28j60.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/encx24j600.c b/drivers/net/encx24j600.c index 347541274ca..76e2e5840a0 100644 --- a/drivers/net/encx24j600.c +++ b/drivers/net/encx24j600.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/encx24j600.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/encx24j600.h b/drivers/net/encx24j600.h index a3b719bbd1f..d268e46c080 100644 --- a/drivers/net/encx24j600.h +++ b/drivers/net/encx24j600.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/encx24j600.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c index f209a5f98dd..0c0579146d7 100644 --- a/drivers/net/ftmac100.c +++ b/drivers/net/ftmac100.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/ftmac100.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/igc.c b/drivers/net/igc.c index 1dbaec901ef..2f3c802f55d 100644 --- a/drivers/net/igc.c +++ b/drivers/net/igc.c @@ -1,6 +1,8 @@ /***************************************************************************** * drivers/net/igc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/igc.h b/drivers/net/igc.h index 49dd237f493..95586d17d33 100644 --- a/drivers/net/igc.h +++ b/drivers/net/igc.h @@ -1,6 +1,8 @@ /***************************************************************************** * drivers/net/igc.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/ksz9477.c b/drivers/net/ksz9477.c index 7915dd89639..561536ea77a 100644 --- a/drivers/net/ksz9477.c +++ b/drivers/net/ksz9477.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/ksz9477.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/ksz9477_i2c.c b/drivers/net/ksz9477_i2c.c index beb5aaab38f..0b4cab05816 100644 --- a/drivers/net/ksz9477_i2c.c +++ b/drivers/net/ksz9477_i2c.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/ksz9477_i2c.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/ksz9477_reg.h b/drivers/net/ksz9477_reg.h index a40c52e37a4..f20ba341e77 100644 --- a/drivers/net/ksz9477_reg.h +++ b/drivers/net/ksz9477_reg.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/ksz9477_reg.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/lan91c111.c b/drivers/net/lan91c111.c index 629d8fd066e..21ae58df307 100644 --- a/drivers/net/lan91c111.c +++ b/drivers/net/lan91c111.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/lan91c111.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/lan91c111.h b/drivers/net/lan91c111.h index 262e7fc9307..9c317edd1cf 100644 --- a/drivers/net/lan91c111.h +++ b/drivers/net/lan91c111.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/lan91c111.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/lan9250.c b/drivers/net/lan9250.c index fa617ce4a02..7e3e621495c 100644 --- a/drivers/net/lan9250.c +++ b/drivers/net/lan9250.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/lan9250.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/lan9250.h b/drivers/net/lan9250.h index 6eff7e758ef..f937aa5fb5c 100644 --- a/drivers/net/lan9250.h +++ b/drivers/net/lan9250.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/lan9250.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index 30ad792dc9e..cf002d08c1a 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/loopback.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/netdev_upperhalf.c b/drivers/net/netdev_upperhalf.c index 304ad4696d7..efe295214e5 100644 --- a/drivers/net/netdev_upperhalf.c +++ b/drivers/net/netdev_upperhalf.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/netdev_upperhalf.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -752,7 +754,11 @@ static inline void netdev_upper_queue_work(FAR struct net_driver_s *dev) FAR struct netdev_upperhalf_s *upper = dev->d_private; #ifdef CONFIG_NETDEV_WORK_THREAD +# ifdef CONFIG_NETDEV_RSS int cpu = this_cpu(); +# else + const int cpu = 0; +# endif int semcount; if (nxsem_get_value(&upper->sem[cpu], &semcount) == OK && diff --git a/drivers/net/phy_notify.c b/drivers/net/phy_notify.c index 29655899688..6276dddd290 100644 --- a/drivers/net/phy_notify.c +++ b/drivers/net/phy_notify.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/phy_notify.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/rpmsgdrv.c b/drivers/net/rpmsgdrv.c index 1a4c9910ebf..f29544c60e7 100644 --- a/drivers/net/rpmsgdrv.c +++ b/drivers/net/rpmsgdrv.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/rpmsgdrv.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/skeleton.c b/drivers/net/skeleton.c index c58439a11db..09d29450d06 100644 --- a/drivers/net/skeleton.c +++ b/drivers/net/skeleton.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/skeleton.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/slip.c b/drivers/net/slip.c index 3a76d639e96..f9622a63e0a 100644 --- a/drivers/net/slip.c +++ b/drivers/net/slip.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/slip.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/telnet.c b/drivers/net/telnet.c index 52f743edf7a..75757541794 100644 --- a/drivers/net/telnet.c +++ b/drivers/net/telnet.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/telnet.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/tun.c b/drivers/net/tun.c index c63e98a3bc8..6a3cb3e955e 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c @@ -1,8 +1,9 @@ /**************************************************************************** * drivers/net/tun.c * - * Copyright (C) 2015-2016 Max Nekludov. All rights reserved. - * Author: Max Nekludov + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: (C) 2015-2016 Max Nekludov. All rights reserved. + * SPDX-FileContributor: Max Nekludov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/net/w5500.c b/drivers/net/w5500.c index 3e06ca30fb9..f79eaeafd12 100644 --- a/drivers/net/w5500.c +++ b/drivers/net/w5500.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/w5500.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/net/wifi_sim.c b/drivers/net/wifi_sim.c index 4460e471107..3b8f556e33e 100644 --- a/drivers/net/wifi_sim.c +++ b/drivers/net/wifi_sim.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/net/wifi_sim.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/CMakeLists.txt b/drivers/note/CMakeLists.txt index ff3807bcaeb..fa5a9a42e07 100644 --- a/drivers/note/CMakeLists.txt +++ b/drivers/note/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/note/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/note/Make.defs b/drivers/note/Make.defs index e76fc35b6d0..d27536bbc51 100644 --- a/drivers/note/Make.defs +++ b/drivers/note/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/note/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/note/note_driver.c b/drivers/note/note_driver.c index 63d89b7d9ba..11e6aed7a49 100644 --- a/drivers/note/note_driver.c +++ b/drivers/note/note_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/note_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/note_initialize.c b/drivers/note/note_initialize.c index 00383d26245..d319cecbec6 100644 --- a/drivers/note/note_initialize.c +++ b/drivers/note/note_initialize.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/note_initialize.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/notectl_driver.c b/drivers/note/notectl_driver.c index c1b5229a7a7..0aaefa8cc6f 100644 --- a/drivers/note/notectl_driver.c +++ b/drivers/note/notectl_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/notectl_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/notelog_driver.c b/drivers/note/notelog_driver.c index 790c804599d..2ef0f5885aa 100644 --- a/drivers/note/notelog_driver.c +++ b/drivers/note/notelog_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/notelog_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/noteram_driver.c b/drivers/note/noteram_driver.c index 7cfd5ed6419..d41d74a2d42 100644 --- a/drivers/note/noteram_driver.c +++ b/drivers/note/noteram_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/noteram_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/noterpmsg.h b/drivers/note/noterpmsg.h index 3eb2af1ed0f..742b7e26b23 100644 --- a/drivers/note/noterpmsg.h +++ b/drivers/note/noterpmsg.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/noterpmsg.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/noterpmsg_driver.c b/drivers/note/noterpmsg_driver.c index e0519f0da2d..be47721792f 100644 --- a/drivers/note/noterpmsg_driver.c +++ b/drivers/note/noterpmsg_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/noterpmsg_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/noterpmsg_server.c b/drivers/note/noterpmsg_server.c index 43e4f6ac572..3713620996d 100644 --- a/drivers/note/noterpmsg_server.c +++ b/drivers/note/noterpmsg_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/noterpmsg_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/notesnap_driver.c b/drivers/note/notesnap_driver.c index 2ab4dcfef69..636fc37f69e 100644 --- a/drivers/note/notesnap_driver.c +++ b/drivers/note/notesnap_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/notesnap_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/note/notestream_driver.c b/drivers/note/notestream_driver.c index b84436218e1..bf45520e4a4 100644 --- a/drivers/note/notestream_driver.c +++ b/drivers/note/notestream_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/note/notestream_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/CMakeLists.txt b/drivers/pci/CMakeLists.txt index 15ae0ac2088..6eb4bd08d8a 100644 --- a/drivers/pci/CMakeLists.txt +++ b/drivers/pci/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/pci/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/pci/Make.defs b/drivers/pci/Make.defs index 1a0bed40deb..654d0b63759 100644 --- a/drivers/pci/Make.defs +++ b/drivers/pci/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/pci/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index dde115ac1af..8749e6637d4 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_drivers.c b/drivers/pci/pci_drivers.c index d16fa45b556..44ab2e86ffb 100644 --- a/drivers/pci/pci_drivers.c +++ b/drivers/pci/pci_drivers.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_drivers.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_drivers.h b/drivers/pci/pci_drivers.h index 66cdb868ea1..72d4da7237c 100644 --- a/drivers/pci/pci_drivers.h +++ b/drivers/pci/pci_drivers.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_drivers.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_ecam.c b/drivers/pci/pci_ecam.c index 7e9dd94cf49..31929fc36aa 100644 --- a/drivers/pci/pci_ecam.c +++ b/drivers/pci/pci_ecam.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_ecam.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_ep_test.c b/drivers/pci/pci_ep_test.c index 9be69f2053a..a6dc9682d81 100644 --- a/drivers/pci/pci_ep_test.c +++ b/drivers/pci/pci_ep_test.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_ep_test.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_epc.c b/drivers/pci/pci_epc.c index 1a867c036fd..74ad9931381 100644 --- a/drivers/pci/pci_epc.c +++ b/drivers/pci/pci_epc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_epc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_epc_mem.c b/drivers/pci/pci_epc_mem.c index f85fc8ef936..f1bb2382d08 100644 --- a/drivers/pci/pci_epc_mem.c +++ b/drivers/pci/pci_epc_mem.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_epc_mem.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_epf.c b/drivers/pci/pci_epf.c index c748cf0306a..b1ca093f528 100644 --- a/drivers/pci/pci_epf.c +++ b/drivers/pci/pci_epf.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_epf.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_epf_test.c b/drivers/pci/pci_epf_test.c index 169f5b26fd4..049959ccc59 100644 --- a/drivers/pci/pci_epf_test.c +++ b/drivers/pci/pci_epf_test.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_epf_test.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_ivshmem.c b/drivers/pci/pci_ivshmem.c index 2a0d7eb84e0..8c66f0b1218 100644 --- a/drivers/pci/pci_ivshmem.c +++ b/drivers/pci/pci_ivshmem.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_ivshmem.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_qemu_edu.c b/drivers/pci/pci_qemu_edu.c index 521cf163e60..4f6dc7512eb 100644 --- a/drivers/pci/pci_qemu_edu.c +++ b/drivers/pci/pci_qemu_edu.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_qemu_edu.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_qemu_epc.c b/drivers/pci/pci_qemu_epc.c index e766a5db5fa..9e9baf85adf 100644 --- a/drivers/pci/pci_qemu_epc.c +++ b/drivers/pci/pci_qemu_epc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_qemu_epc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_qemu_test.c b/drivers/pci/pci_qemu_test.c index 47e357b1387..b7ff07802a6 100644 --- a/drivers/pci/pci_qemu_test.c +++ b/drivers/pci/pci_qemu_test.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_qemu_test.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pci/pci_uio_ivshmem.c b/drivers/pci/pci_uio_ivshmem.c index 54355f96d9a..cb22151541f 100644 --- a/drivers/pci/pci_uio_ivshmem.c +++ b/drivers/pci/pci_uio_ivshmem.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pci/pci_uio_ivshmem.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -120,7 +122,9 @@ static const struct file_operations g_uio_ivshmem_fops = NULL, /* ioctl */ uio_ivshmem_mmap, /* mmap */ NULL, /* truncate */ - uio_ivshmem_poll /* poll */ + uio_ivshmem_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , NULL /* unlink */ #endif diff --git a/drivers/pinctrl/CMakeLists.txt b/drivers/pinctrl/CMakeLists.txt index cd7e28a62b6..c0ae9dfe54c 100644 --- a/drivers/pinctrl/CMakeLists.txt +++ b/drivers/pinctrl/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/pinctrl/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/pinctrl/Make.defs b/drivers/pinctrl/Make.defs index 91f9a0dfe36..20ea1b6f565 100644 --- a/drivers/pinctrl/Make.defs +++ b/drivers/pinctrl/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/pinctrl/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/pinctrl/pinctrl.c b/drivers/pinctrl/pinctrl.c index b241be1c265..21fbf6b6a9c 100644 --- a/drivers/pinctrl/pinctrl.c +++ b/drivers/pinctrl/pinctrl.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pinctrl/pinctrl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pipes/CMakeLists.txt b/drivers/pipes/CMakeLists.txt index a476a0de408..68b8e1c5eae 100644 --- a/drivers/pipes/CMakeLists.txt +++ b/drivers/pipes/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/pipes/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/pipes/Make.defs b/drivers/pipes/Make.defs index 49010329d54..b4209856d4c 100644 --- a/drivers/pipes/Make.defs +++ b/drivers/pipes/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/pipes/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/pipes/fifo.c b/drivers/pipes/fifo.c index 2ff13232e54..d6bbc3d2bc5 100644 --- a/drivers/pipes/fifo.c +++ b/drivers/pipes/fifo.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pipes/fifo.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -49,7 +51,9 @@ static const struct file_operations g_fifo_fops = pipecommon_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - pipecommon_poll /* poll */ + pipecommon_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , pipecommon_unlink /* unlink */ #endif diff --git a/drivers/pipes/pipe.c b/drivers/pipes/pipe.c index caf0394d1f1..0dc7b14e704 100644 --- a/drivers/pipes/pipe.c +++ b/drivers/pipes/pipe.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pipes/pipe.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pipes/pipe_common.c b/drivers/pipes/pipe_common.c index f84b39711ef..594c1c198bd 100644 --- a/drivers/pipes/pipe_common.c +++ b/drivers/pipes/pipe_common.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pipes/pipe_common.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/pipes/pipe_common.h b/drivers/pipes/pipe_common.h index dc150998f8c..f9b9989328d 100644 --- a/drivers/pipes/pipe_common.h +++ b/drivers/pipes/pipe_common.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/pipes/pipe_common.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/CMakeLists.txt b/drivers/power/CMakeLists.txt index c52c4fdce35..9777585343b 100644 --- a/drivers/power/CMakeLists.txt +++ b/drivers/power/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/power/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/power/Make.defs b/drivers/power/Make.defs index 002149f3338..f25d9eadd98 100644 --- a/drivers/power/Make.defs +++ b/drivers/power/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/power/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/CMakeLists.txt b/drivers/power/battery/CMakeLists.txt index 282c8deacb9..311bdd3e0ce 100644 --- a/drivers/power/battery/CMakeLists.txt +++ b/drivers/power/battery/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/power/battery/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/power/battery/Make.defs b/drivers/power/battery/Make.defs index 6cedba89d03..419384a2bd3 100644 --- a/drivers/power/battery/Make.defs +++ b/drivers/power/battery/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/power/battery/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/axp202.c b/drivers/power/battery/axp202.c index 9187812b057..1c4bb2f2d49 100644 --- a/drivers/power/battery/axp202.c +++ b/drivers/power/battery/axp202.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/axp202.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/battery_charger.c b/drivers/power/battery/battery_charger.c index 12e78bd33e4..ba4f74a4ac6 100644 --- a/drivers/power/battery/battery_charger.c +++ b/drivers/power/battery/battery_charger.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/battery_charger.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/battery_gauge.c b/drivers/power/battery/battery_gauge.c index 97afd5cb8cb..3b52b5d827f 100644 --- a/drivers/power/battery/battery_gauge.c +++ b/drivers/power/battery/battery_gauge.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/battery_gauge.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/battery_monitor.c b/drivers/power/battery/battery_monitor.c index aa3a93d3c60..e01b6cc0763 100644 --- a/drivers/power/battery/battery_monitor.c +++ b/drivers/power/battery/battery_monitor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/battery_monitor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/bq2425x.c b/drivers/power/battery/bq2425x.c index 77b9a6c0bc2..746cd3b54a0 100644 --- a/drivers/power/battery/bq2425x.c +++ b/drivers/power/battery/bq2425x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/bq2425x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/bq2425x.h b/drivers/power/battery/bq2425x.h index ba633acc819..aff326f7ef3 100644 --- a/drivers/power/battery/bq2425x.h +++ b/drivers/power/battery/bq2425x.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/bq2425x.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/bq2429x.c b/drivers/power/battery/bq2429x.c index 071ac9bcdb3..216dee17c0a 100644 --- a/drivers/power/battery/bq2429x.c +++ b/drivers/power/battery/bq2429x.c @@ -1,14 +1,12 @@ /**************************************************************************** * drivers/power/battery/bq2429x.c - * Lower half driver for BQ2429x battery charger * - * Copyright (C) 2017 Neil Hancock. All rights reserved. - * - * Copyright (C) 2017 Haltian Ltd. All rights reserved. - * Author: Juha Niskanen - * - * Copyright (C) 2016 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2017 Neil Hancock. All rights reserved. + * SPDX-FileCopyrightText: 2017 Haltian Ltd. All rights reserved. + * SPDX-FileCopyrightText: 2016 Gregory Nutt. All rights reserved. + * SPDX-FileContributor: Gregory Nutt + * SPDX-FileContributor: Juha Niskanen * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/power/battery/bq27426.c b/drivers/power/battery/bq27426.c index 47550414c90..7cb37b926a9 100644 --- a/drivers/power/battery/bq27426.c +++ b/drivers/power/battery/bq27426.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/bq27426.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/bq769x0.c b/drivers/power/battery/bq769x0.c index afd412a1d05..2a74d6a74c4 100644 --- a/drivers/power/battery/bq769x0.c +++ b/drivers/power/battery/bq769x0.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/bq769x0.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/goldfish_battery.c b/drivers/power/battery/goldfish_battery.c index 3b51ad9f7a4..958e96c4285 100644 --- a/drivers/power/battery/goldfish_battery.c +++ b/drivers/power/battery/goldfish_battery.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/goldfish_battery.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/max1704x.c b/drivers/power/battery/max1704x.c index 151a385b4bb..30cf5737498 100644 --- a/drivers/power/battery/max1704x.c +++ b/drivers/power/battery/max1704x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/max1704x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/battery/mcp73871.c b/drivers/power/battery/mcp73871.c index d91f76d4f60..9ff619800af 100644 --- a/drivers/power/battery/mcp73871.c +++ b/drivers/power/battery/mcp73871.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/battery/mcp73871.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/CMakeLists.txt b/drivers/power/pm/CMakeLists.txt index 0c14f99a651..f17dbb5f376 100644 --- a/drivers/power/pm/CMakeLists.txt +++ b/drivers/power/pm/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/power/pm/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/power/pm/Make.defs b/drivers/power/pm/Make.defs index 4a81b2adaba..aa6384a9525 100644 --- a/drivers/power/pm/Make.defs +++ b/drivers/power/pm/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/power/pm/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/activity_governor.c b/drivers/power/pm/activity_governor.c index a2a7460a79f..c3701c78231 100644 --- a/drivers/power/pm/activity_governor.c +++ b/drivers/power/pm/activity_governor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/activity_governor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/greedy_governor.c b/drivers/power/pm/greedy_governor.c index 09e182caad4..6253b48233e 100644 --- a/drivers/power/pm/greedy_governor.c +++ b/drivers/power/pm/greedy_governor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/greedy_governor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm.h b/drivers/power/pm/pm.h index 2b78ffdf624..37d12cc365c 100644 --- a/drivers/power/pm/pm.h +++ b/drivers/power/pm/pm.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_activity.c b/drivers/power/pm/pm_activity.c index 18081a03274..6fd3c78ab14 100644 --- a/drivers/power/pm/pm_activity.c +++ b/drivers/power/pm/pm_activity.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_activity.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_autoupdate.c b/drivers/power/pm/pm_autoupdate.c index 0579c3a32a0..4fa9ed14607 100644 --- a/drivers/power/pm/pm_autoupdate.c +++ b/drivers/power/pm/pm_autoupdate.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_autoupdate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_changestate.c b/drivers/power/pm/pm_changestate.c index 0ac3419f7d8..c59de084a77 100644 --- a/drivers/power/pm/pm_changestate.c +++ b/drivers/power/pm/pm_changestate.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_changestate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_checkstate.c b/drivers/power/pm/pm_checkstate.c index 5b4f13bb266..66c68fd7d9c 100644 --- a/drivers/power/pm/pm_checkstate.c +++ b/drivers/power/pm/pm_checkstate.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_checkstate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_governor.c b/drivers/power/pm/pm_governor.c index 9d5a5eb7374..5c2414557e7 100644 --- a/drivers/power/pm/pm_governor.c +++ b/drivers/power/pm/pm_governor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_governor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_idle.c b/drivers/power/pm/pm_idle.c index 80d65a4ca85..8f926c3b65b 100644 --- a/drivers/power/pm/pm_idle.c +++ b/drivers/power/pm/pm_idle.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_idle.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_initialize.c b/drivers/power/pm/pm_initialize.c index 1c7beeb241a..9114a230ed6 100644 --- a/drivers/power/pm/pm_initialize.c +++ b/drivers/power/pm/pm_initialize.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_initialize.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_lock.c b/drivers/power/pm/pm_lock.c index 36903556702..d469a5d4b83 100644 --- a/drivers/power/pm/pm_lock.c +++ b/drivers/power/pm/pm_lock.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_lock.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_procfs.c b/drivers/power/pm/pm_procfs.c index 39f8d5303b7..b6154a96360 100644 --- a/drivers/power/pm/pm_procfs.c +++ b/drivers/power/pm/pm_procfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_procfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_register.c b/drivers/power/pm/pm_register.c index 81039c6b94e..2a2d41fccb5 100644 --- a/drivers/power/pm/pm_register.c +++ b/drivers/power/pm/pm_register.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_register.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_runtime.c b/drivers/power/pm/pm_runtime.c index 2edd7a6eec9..dca3fb0fe60 100644 --- a/drivers/power/pm/pm_runtime.c +++ b/drivers/power/pm/pm_runtime.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_runtime.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/pm_unregister.c b/drivers/power/pm/pm_unregister.c index f5951a5e818..cac9ef08355 100644 --- a/drivers/power/pm/pm_unregister.c +++ b/drivers/power/pm/pm_unregister.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/pm_unregister.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/pm/stability_governor.c b/drivers/power/pm/stability_governor.c index bffa27f6df8..40d8f44f61d 100644 --- a/drivers/power/pm/stability_governor.c +++ b/drivers/power/pm/stability_governor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/pm/stability_governor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/relay/CMakeLists.txt b/drivers/power/relay/CMakeLists.txt index b21047a387b..853d10fabdd 100644 --- a/drivers/power/relay/CMakeLists.txt +++ b/drivers/power/relay/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/power/relay/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/power/relay/Make.defs b/drivers/power/relay/Make.defs index 511d52f6109..03eb04ceffa 100644 --- a/drivers/power/relay/Make.defs +++ b/drivers/power/relay/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/power/relay/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/power/relay/relay.c b/drivers/power/relay/relay.c index 0179df82e94..e2f6909efa5 100644 --- a/drivers/power/relay/relay.c +++ b/drivers/power/relay/relay.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/relay/relay.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/relay/relay_gpio.c b/drivers/power/relay/relay_gpio.c index 6e468734a92..83fe350e4bd 100644 --- a/drivers/power/relay/relay_gpio.c +++ b/drivers/power/relay/relay_gpio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/relay/relay_gpio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/supply/CMakeLists.txt b/drivers/power/supply/CMakeLists.txt index 2c2b1a76c54..35d88d20d8f 100644 --- a/drivers/power/supply/CMakeLists.txt +++ b/drivers/power/supply/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/power/supply/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/power/supply/Make.defs b/drivers/power/supply/Make.defs index e4d42b3460b..b21ff288cd6 100644 --- a/drivers/power/supply/Make.defs +++ b/drivers/power/supply/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/power/supply/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/power/supply/act8945a.c b/drivers/power/supply/act8945a.c index d85b4866c00..c8c3a32d346 100644 --- a/drivers/power/supply/act8945a.c +++ b/drivers/power/supply/act8945a.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/supply/act8945a.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/supply/powerled.c b/drivers/power/supply/powerled.c index 92278bcc2cf..b9b1344ec33 100644 --- a/drivers/power/supply/powerled.c +++ b/drivers/power/supply/powerled.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/supply/powerled.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/supply/regulator.c b/drivers/power/supply/regulator.c index 4263477b16d..59bd5642bd7 100644 --- a/drivers/power/supply/regulator.c +++ b/drivers/power/supply/regulator.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/supply/regulator.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/supply/regulator_gpio.c b/drivers/power/supply/regulator_gpio.c index 30ba4a2b6fc..0d7b03864af 100644 --- a/drivers/power/supply/regulator_gpio.c +++ b/drivers/power/supply/regulator_gpio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/supply/regulator_gpio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/supply/regulator_rpmsg.c b/drivers/power/supply/regulator_rpmsg.c index 7672eff8c32..ac82197619f 100644 --- a/drivers/power/supply/regulator_rpmsg.c +++ b/drivers/power/supply/regulator_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/supply/regulator_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/power/supply/smps.c b/drivers/power/supply/smps.c index b20a15c237c..9a8dd42ea0b 100644 --- a/drivers/power/supply/smps.c +++ b/drivers/power/supply/smps.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/power/supply/smps.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rc/CMakeLists.txt b/drivers/rc/CMakeLists.txt index 949057b2e6c..c195e74a1f5 100644 --- a/drivers/rc/CMakeLists.txt +++ b/drivers/rc/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/rc/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/rc/Make.defs b/drivers/rc/Make.defs index 1ecf647ac37..e03fcb0b95d 100644 --- a/drivers/rc/Make.defs +++ b/drivers/rc/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/rc/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/rc/dummy.c b/drivers/rc/dummy.c index 46dc8b0b027..acd204311c8 100644 --- a/drivers/rc/dummy.c +++ b/drivers/rc/dummy.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rc/dummy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rc/lirc_dev.c b/drivers/rc/lirc_dev.c index 994f65349d2..57b2f672569 100644 --- a/drivers/rc/lirc_dev.c +++ b/drivers/rc/lirc_dev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rc/lirc_dev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/regmap/Make.defs b/drivers/regmap/Make.defs index 72e641e31fe..9f8cbbd96bc 100644 --- a/drivers/regmap/Make.defs +++ b/drivers/regmap/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/regmap/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/regmap/internal.h b/drivers/regmap/internal.h index 87c74a6f409..78a6ca1c19d 100644 --- a/drivers/regmap/internal.h +++ b/drivers/regmap/internal.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/regmap/internal.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/regmap/regmap.c b/drivers/regmap/regmap.c index 06523827413..952014f5531 100644 --- a/drivers/regmap/regmap.c +++ b/drivers/regmap/regmap.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/regmap/regmap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/regmap/regmap_i2c.c b/drivers/regmap/regmap_i2c.c index fc4458b8500..aacfd2102c4 100644 --- a/drivers/regmap/regmap_i2c.c +++ b/drivers/regmap/regmap_i2c.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/regmap/regmap_i2c.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/regmap/regmap_spi.c b/drivers/regmap/regmap_spi.c index 8d42ad940c6..f90f3b00600 100644 --- a/drivers/regmap/regmap_spi.c +++ b/drivers/regmap/regmap_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/regmap/regmap_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/reset/CMakeLists.txt b/drivers/reset/CMakeLists.txt index ced6a546165..b9c09148156 100644 --- a/drivers/reset/CMakeLists.txt +++ b/drivers/reset/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/reset/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/reset/Make.defs b/drivers/reset/Make.defs index 93aaa330561..ba815dd3266 100644 --- a/drivers/reset/Make.defs +++ b/drivers/reset/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/reset/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/reset/core.c b/drivers/reset/core.c index 7f14dcd0eac..23193f1cde3 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/reset/core.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/reset/reset_rpmsg.c b/drivers/reset/reset_rpmsg.c index c13358450c0..87a7031681e 100644 --- a/drivers/reset/reset_rpmsg.c +++ b/drivers/reset/reset_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/reset/reset_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rf/CMakeLists.txt b/drivers/rf/CMakeLists.txt index 7df1c070ae7..538abd2ec4a 100644 --- a/drivers/rf/CMakeLists.txt +++ b/drivers/rf/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/rf/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/rf/Make.defs b/drivers/rf/Make.defs index 090254bb233..6c35fb889a8 100644 --- a/drivers/rf/Make.defs +++ b/drivers/rf/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/rf/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/rmt/CMakeLists.txt b/drivers/rmt/CMakeLists.txt index 95d89bece44..8978f4c4d4a 100644 --- a/drivers/rmt/CMakeLists.txt +++ b/drivers/rmt/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/rmt/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/rmt/Make.defs b/drivers/rmt/Make.defs index 93e20c80484..3e4e6691723 100644 --- a/drivers/rmt/Make.defs +++ b/drivers/rmt/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/rmt/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/rmt/rmtchar.c b/drivers/rmt/rmtchar.c index 77b12ff3a91..5f477471c3c 100644 --- a/drivers/rmt/rmtchar.c +++ b/drivers/rmt/rmtchar.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rmt/rmtchar.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/CMakeLists.txt b/drivers/rpmsg/CMakeLists.txt index 62c18b5f7fa..9e0c34e98ac 100644 --- a/drivers/rpmsg/CMakeLists.txt +++ b/drivers/rpmsg/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/rpmsg/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/rpmsg/Make.defs b/drivers/rpmsg/Make.defs index 414280f6442..a98f5bd5836 100644 --- a/drivers/rpmsg/Make.defs +++ b/drivers/rpmsg/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/rpmsg/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg.c b/drivers/rpmsg/rpmsg.c index 6db73ba676c..63a4e8102f2 100644 --- a/drivers/rpmsg/rpmsg.c +++ b/drivers/rpmsg/rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_ping.c b/drivers/rpmsg/rpmsg_ping.c index 28f3bcf3085..d2873af0acc 100644 --- a/drivers/rpmsg/rpmsg_ping.c +++ b/drivers/rpmsg/rpmsg_ping.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_ping.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_ping.h b/drivers/rpmsg/rpmsg_ping.h index dc85939142c..acfe1bd7cf7 100644 --- a/drivers/rpmsg/rpmsg_ping.h +++ b/drivers/rpmsg/rpmsg_ping.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_ping.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_port.c b/drivers/rpmsg/rpmsg_port.c index 0e9233fbed2..2d11d243a67 100644 --- a/drivers/rpmsg/rpmsg_port.c +++ b/drivers/rpmsg/rpmsg_port.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_port.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_port.h b/drivers/rpmsg/rpmsg_port.h index a0f649a75e1..9e55058694e 100644 --- a/drivers/rpmsg/rpmsg_port.h +++ b/drivers/rpmsg/rpmsg_port.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_port.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_port_spi.c b/drivers/rpmsg/rpmsg_port_spi.c index 64b26cdabab..9552339f775 100644 --- a/drivers/rpmsg/rpmsg_port_spi.c +++ b/drivers/rpmsg/rpmsg_port_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_port_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_port_spi_slave.c b/drivers/rpmsg/rpmsg_port_spi_slave.c index 25a8f083657..609252c6b3b 100644 --- a/drivers/rpmsg/rpmsg_port_spi_slave.c +++ b/drivers/rpmsg/rpmsg_port_spi_slave.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_port_spi_slave.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_port_uart.c b/drivers/rpmsg/rpmsg_port_uart.c index 5fa87ffcaf9..6cfdfcdfd55 100644 --- a/drivers/rpmsg/rpmsg_port_uart.c +++ b/drivers/rpmsg/rpmsg_port_uart.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_port_uart.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_router.h b/drivers/rpmsg/rpmsg_router.h index c8b7f373645..8f7547f9ce5 100644 --- a/drivers/rpmsg/rpmsg_router.h +++ b/drivers/rpmsg/rpmsg_router.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_router.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_router_edge.c b/drivers/rpmsg/rpmsg_router_edge.c index fccdb68904a..294d008959b 100644 --- a/drivers/rpmsg/rpmsg_router_edge.c +++ b/drivers/rpmsg/rpmsg_router_edge.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_router_edge.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_router_hub.c b/drivers/rpmsg/rpmsg_router_hub.c index a150c719d96..e4a14c759ef 100644 --- a/drivers/rpmsg/rpmsg_router_hub.c +++ b/drivers/rpmsg/rpmsg_router_hub.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_router_hub.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_virtio.c b/drivers/rpmsg/rpmsg_virtio.c index 044b7691e41..9df2175d545 100644 --- a/drivers/rpmsg/rpmsg_virtio.c +++ b/drivers/rpmsg/rpmsg_virtio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_virtio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rpmsg/rpmsg_virtio_ivshmem.c b/drivers/rpmsg/rpmsg_virtio_ivshmem.c index e67d658b551..b4db30043d3 100644 --- a/drivers/rpmsg/rpmsg_virtio_ivshmem.c +++ b/drivers/rpmsg/rpmsg_virtio_ivshmem.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rpmsg/rpmsg_virtio_ivshmem.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rptun/CMakeLists.txt b/drivers/rptun/CMakeLists.txt index 2f15d50c1f2..3bf926f9e4f 100644 --- a/drivers/rptun/CMakeLists.txt +++ b/drivers/rptun/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/rptun/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/rptun/Make.defs b/drivers/rptun/Make.defs index 9019b26621a..12e35060447 100644 --- a/drivers/rptun/Make.defs +++ b/drivers/rptun/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/rptun/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/rptun/rptun.c b/drivers/rptun/rptun.c index 7589f786b20..4f704ff1ceb 100644 --- a/drivers/rptun/rptun.c +++ b/drivers/rptun/rptun.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rptun/rptun.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rptun/rptun_ivshmem.c b/drivers/rptun/rptun_ivshmem.c index 0e970e573cc..60398501291 100644 --- a/drivers/rptun/rptun_ivshmem.c +++ b/drivers/rptun/rptun_ivshmem.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rptun/rptun_ivshmem.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/rptun/rptun_secure.c b/drivers/rptun/rptun_secure.c index 539416c503b..1b6204a70c7 100644 --- a/drivers/rptun/rptun_secure.c +++ b/drivers/rptun/rptun_secure.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/rptun/rptun_secure.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/CMakeLists.txt b/drivers/segger/CMakeLists.txt index 8983d608383..53ff66cffa8 100644 --- a/drivers/segger/CMakeLists.txt +++ b/drivers/segger/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/segger/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/segger/Make.defs b/drivers/segger/Make.defs index 162cd4e3958..44b0b6ff524 100644 --- a/drivers/segger/Make.defs +++ b/drivers/segger/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/segger/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/config/Global.h b/drivers/segger/config/Global.h index 5d632302e61..4253075ce0f 100644 --- a/drivers/segger/config/Global.h +++ b/drivers/segger/config/Global.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/config/Global.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/config/SEGGER_RTT_Conf.h b/drivers/segger/config/SEGGER_RTT_Conf.h index 67c32eba776..bfab44081f0 100644 --- a/drivers/segger/config/SEGGER_RTT_Conf.h +++ b/drivers/segger/config/SEGGER_RTT_Conf.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/config/SEGGER_RTT_Conf.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/config/SEGGER_SYSVIEW_Conf.h b/drivers/segger/config/SEGGER_SYSVIEW_Conf.h index 46264a531f3..04d3a297a46 100644 --- a/drivers/segger/config/SEGGER_SYSVIEW_Conf.h +++ b/drivers/segger/config/SEGGER_SYSVIEW_Conf.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/config/SEGGER_SYSVIEW_Conf.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/note_rtt.c b/drivers/segger/note_rtt.c index c97e056dc4b..eea92aa7b11 100644 --- a/drivers/segger/note_rtt.c +++ b/drivers/segger/note_rtt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/note_rtt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/note_sysview.c b/drivers/segger/note_sysview.c index e190452cf93..1b5b15baf66 100644 --- a/drivers/segger/note_sysview.c +++ b/drivers/segger/note_sysview.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/note_sysview.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/serial_rtt.c b/drivers/segger/serial_rtt.c index f9fc5a35ae6..6128c92c79e 100644 --- a/drivers/segger/serial_rtt.c +++ b/drivers/segger/serial_rtt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/serial_rtt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/segger/stream_rtt.c b/drivers/segger/stream_rtt.c index e98d72896d3..381864c12ae 100644 --- a/drivers/segger/stream_rtt.c +++ b/drivers/segger/stream_rtt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/stream_rtt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -52,12 +54,12 @@ static void rttstream_putc(FAR struct lib_outstream_s *self, int ch) * Name: rttstream_puts ****************************************************************************/ -static int rttstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t rttstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_rttoutstream_s *stream = (FAR struct lib_rttoutstream_s *)self; - int ret; + ssize_t ret; SEGGER_RTT_BLOCK_IF_FIFO_FULL(0); ret = SEGGER_RTT_Write(stream->channel, buf, len); @@ -84,12 +86,12 @@ static int rttstream_getc(FAR struct lib_instream_s *self) * Name: rttstream_gets ****************************************************************************/ -static int rttstream_gets(FAR struct lib_instream_s *self, - FAR void * buffer, int size) +static ssize_t rttstream_gets(FAR struct lib_instream_s *self, + FAR void * buffer, size_t size) { FAR struct lib_rttinstream_s *stream = (FAR struct lib_rttinstream_s *)self; - int ret; + ssize_t ret; DEBUGASSERT(stream); ret = SEGGER_RTT_Read(stream->channel, buffer, size); diff --git a/drivers/segger/syslog_rtt.c b/drivers/segger/syslog_rtt.c index 702c537655d..684d210d3ca 100644 --- a/drivers/segger/syslog_rtt.c +++ b/drivers/segger/syslog_rtt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/segger/syslog_rtt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/CMakeLists.txt b/drivers/sensors/CMakeLists.txt index 7f1a998a162..577aff74dc4 100644 --- a/drivers/sensors/CMakeLists.txt +++ b/drivers/sensors/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/sensors/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/sensors/Make.defs b/drivers/sensors/Make.defs index 8a9f052cb2d..192114a6707 100644 --- a/drivers/sensors/Make.defs +++ b/drivers/sensors/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/sensors/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adt7320.c b/drivers/sensors/adt7320.c index e7662937604..8f01efb9d7b 100644 --- a/drivers/sensors/adt7320.c +++ b/drivers/sensors/adt7320.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adt7320.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adxl345.h b/drivers/sensors/adxl345.h index 4534c1a2a83..c67592bcc75 100644 --- a/drivers/sensors/adxl345.h +++ b/drivers/sensors/adxl345.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adxl345.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adxl345_base.c b/drivers/sensors/adxl345_base.c index c841f904981..56ec097997d 100644 --- a/drivers/sensors/adxl345_base.c +++ b/drivers/sensors/adxl345_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adxl345_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adxl345_i2c.c b/drivers/sensors/adxl345_i2c.c index be96561cc39..0515b6fb086 100644 --- a/drivers/sensors/adxl345_i2c.c +++ b/drivers/sensors/adxl345_i2c.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adxl345_i2c.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adxl345_spi.c b/drivers/sensors/adxl345_spi.c index ec45d90ba3b..137211a5b29 100644 --- a/drivers/sensors/adxl345_spi.c +++ b/drivers/sensors/adxl345_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adxl345_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adxl362_uorb.c b/drivers/sensors/adxl362_uorb.c index 03c411bdcd7..150161373fc 100644 --- a/drivers/sensors/adxl362_uorb.c +++ b/drivers/sensors/adxl362_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adxl362_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adxl372.c b/drivers/sensors/adxl372.c index b7c0ee689f4..e51893fc82c 100644 --- a/drivers/sensors/adxl372.c +++ b/drivers/sensors/adxl372.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adxl372.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/adxl372_uorb.c b/drivers/sensors/adxl372_uorb.c index ed4ad047034..d77eea916fe 100644 --- a/drivers/sensors/adxl372_uorb.c +++ b/drivers/sensors/adxl372_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/adxl372_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/aht10.c b/drivers/sensors/aht10.c index ccaa68c8c05..b56b0fe02d5 100644 --- a/drivers/sensors/aht10.c +++ b/drivers/sensors/aht10.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/aht10.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -118,7 +120,9 @@ static const struct file_operations g_aht10fops = aht10_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , aht10_unlink /* unlink */ #endif diff --git a/drivers/sensors/ak09912.c b/drivers/sensors/ak09912.c index 2c2c9102650..6c1f3eab077 100644 --- a/drivers/sensors/ak09912.c +++ b/drivers/sensors/ak09912.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/ak09912.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/amg88xx.c b/drivers/sensors/amg88xx.c index 05138b208ef..9a9bf903cec 100644 --- a/drivers/sensors/amg88xx.c +++ b/drivers/sensors/amg88xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/amg88xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/apds9922.c b/drivers/sensors/apds9922.c index 150dd4c8f39..d7a26e7df08 100644 --- a/drivers/sensors/apds9922.c +++ b/drivers/sensors/apds9922.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/apds9922.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/apds9960.c b/drivers/sensors/apds9960.c index 272c9f2185b..08aa6476209 100644 --- a/drivers/sensors/apds9960.c +++ b/drivers/sensors/apds9960.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/apds9960.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/as5048a.c b/drivers/sensors/as5048a.c index b49d8283ff3..817ada4ba33 100644 --- a/drivers/sensors/as5048a.c +++ b/drivers/sensors/as5048a.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/as5048a.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/as5048b.c b/drivers/sensors/as5048b.c index d6dd5942d91..022b0d21579 100644 --- a/drivers/sensors/as5048b.c +++ b/drivers/sensors/as5048b.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/as5048b.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/as726x.c b/drivers/sensors/as726x.c index de2955ceb67..42418860642 100644 --- a/drivers/sensors/as726x.c +++ b/drivers/sensors/as726x.c @@ -1,11 +1,10 @@ /**************************************************************************** * drivers/sensors/as726x.c - * Character driver for the AS7263 6-Ch NIR Spectral Sensing Engine - * and AS7262 Consumer Grade Smart 6-Channel VIS Sensor * - * Copyright (C) 2019 Fabian Justi. All rights reserved. - * Author: Fabian Justi and - * Andreas Kurz + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2019 Fabian Justi. All rights reserved. + * SPDX-FileContributor: Fabian Justi and + * SPDX-FileContributor: Andreas Kurz * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/sensors/bh1749nuc.c b/drivers/sensors/bh1749nuc.c index d9405fb1d83..e324e3845df 100644 --- a/drivers/sensors/bh1749nuc.c +++ b/drivers/sensors/bh1749nuc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bh1749nuc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bh1749nuc_base.c b/drivers/sensors/bh1749nuc_base.c index 35f5ff725bf..27caac9c531 100644 --- a/drivers/sensors/bh1749nuc_base.c +++ b/drivers/sensors/bh1749nuc_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bh1749nuc_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bh1749nuc_base.h b/drivers/sensors/bh1749nuc_base.h index 838ceff125f..b4f3e185560 100644 --- a/drivers/sensors/bh1749nuc_base.h +++ b/drivers/sensors/bh1749nuc_base.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bh1749nuc_base.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bh1749nuc_uorb.c b/drivers/sensors/bh1749nuc_uorb.c index 7bcfbc8a815..c434a45baa3 100644 --- a/drivers/sensors/bh1749nuc_uorb.c +++ b/drivers/sensors/bh1749nuc_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bh1749nuc_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bh1750fvi.c b/drivers/sensors/bh1750fvi.c index 553d1e68946..6ec8c5f781c 100644 --- a/drivers/sensors/bh1750fvi.c +++ b/drivers/sensors/bh1750fvi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bh1750fvi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bme680_uorb.c b/drivers/sensors/bme680_uorb.c index 14d6dcc00df..9832bedfeec 100644 --- a/drivers/sensors/bme680_uorb.c +++ b/drivers/sensors/bme680_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bme680_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmg160.c b/drivers/sensors/bmg160.c index 6cab5d472dc..545fba6bdf3 100644 --- a/drivers/sensors/bmg160.c +++ b/drivers/sensors/bmg160.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmg160.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi160.c b/drivers/sensors/bmi160.c index b68c3c852e9..08e0a1cfc42 100644 --- a/drivers/sensors/bmi160.c +++ b/drivers/sensors/bmi160.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi160.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi160_base.c b/drivers/sensors/bmi160_base.c index b43d2db4a19..8b9e0832d67 100644 --- a/drivers/sensors/bmi160_base.c +++ b/drivers/sensors/bmi160_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi160_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi160_base.h b/drivers/sensors/bmi160_base.h index 3ca65601190..baff9833948 100644 --- a/drivers/sensors/bmi160_base.h +++ b/drivers/sensors/bmi160_base.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi160_base.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi160_uorb.c b/drivers/sensors/bmi160_uorb.c index c62e8f65946..fff3c713f5c 100644 --- a/drivers/sensors/bmi160_uorb.c +++ b/drivers/sensors/bmi160_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi160_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi270.c b/drivers/sensors/bmi270.c index 60958986832..d0e2ae206f2 100644 --- a/drivers/sensors/bmi270.c +++ b/drivers/sensors/bmi270.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi270.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi270_base.c b/drivers/sensors/bmi270_base.c index 8585d5a75b8..2fdee53afee 100644 --- a/drivers/sensors/bmi270_base.c +++ b/drivers/sensors/bmi270_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi270_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi270_base.h b/drivers/sensors/bmi270_base.h index b70295f84fa..00220dbff0c 100644 --- a/drivers/sensors/bmi270_base.h +++ b/drivers/sensors/bmi270_base.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi270_base.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmi270_uorb.c b/drivers/sensors/bmi270_uorb.c index a9b46859537..e1b6cd139f7 100644 --- a/drivers/sensors/bmi270_uorb.c +++ b/drivers/sensors/bmi270_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmi270_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmm150_uorb.c b/drivers/sensors/bmm150_uorb.c index 673892443df..de065899776 100644 --- a/drivers/sensors/bmm150_uorb.c +++ b/drivers/sensors/bmm150_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmm150_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmp180.c b/drivers/sensors/bmp180.c index 2fd168f4b2b..b03a5d117f2 100644 --- a/drivers/sensors/bmp180.c +++ b/drivers/sensors/bmp180.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmp180.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmp180_base.c b/drivers/sensors/bmp180_base.c index f8e133ef8b7..16f3ebfc6f7 100644 --- a/drivers/sensors/bmp180_base.c +++ b/drivers/sensors/bmp180_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmp180_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmp180_base.h b/drivers/sensors/bmp180_base.h index 92507ec8a9a..0f5bdcdd011 100644 --- a/drivers/sensors/bmp180_base.h +++ b/drivers/sensors/bmp180_base.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmp180_base.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmp180_uorb.c b/drivers/sensors/bmp180_uorb.c index 78094d0402c..62809ae6d2f 100644 --- a/drivers/sensors/bmp180_uorb.c +++ b/drivers/sensors/bmp180_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmp180_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/bmp280_uorb.c b/drivers/sensors/bmp280_uorb.c index 8685e183c8e..7828944a061 100644 --- a/drivers/sensors/bmp280_uorb.c +++ b/drivers/sensors/bmp280_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/bmp280_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/dhtxx.c b/drivers/sensors/dhtxx.c index 243157cd58e..eb8344e646d 100644 --- a/drivers/sensors/dhtxx.c +++ b/drivers/sensors/dhtxx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/dhtxx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/ds18b20_uorb.c b/drivers/sensors/ds18b20_uorb.c index b3c795c6e5a..ddbdb851b88 100644 --- a/drivers/sensors/ds18b20_uorb.c +++ b/drivers/sensors/ds18b20_uorb.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/sensors/ds18b20_uorb.c - * Character driver for DS18B20 Digital Humidity and Temperature Module. + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/sensors/fakesensor_uorb.c b/drivers/sensors/fakesensor_uorb.c index d7326940dce..8b2937d7ae3 100644 --- a/drivers/sensors/fakesensor_uorb.c +++ b/drivers/sensors/fakesensor_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/fakesensor_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/fxos8700cq.c b/drivers/sensors/fxos8700cq.c index 41882cb93c0..b27ed00de96 100644 --- a/drivers/sensors/fxos8700cq.c +++ b/drivers/sensors/fxos8700cq.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/sensors/fxos8700cq.c - * Driver for Motion Sensor FXOS8700CQ (NXP) + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/sensors/gnss_uorb.c b/drivers/sensors/gnss_uorb.c index 3274d321b91..54810a21190 100644 --- a/drivers/sensors/gnss_uorb.c +++ b/drivers/sensors/gnss_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/gnss_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -176,10 +178,11 @@ static int gnss_activate(FAR struct sensor_lowerhalf_s *lower, if ((upper->crefs == 0 && enable) || (upper->crefs == 1 && !enable)) { ret = upper->lower->ops->activate(upper->lower, filep, enable); - if (ret >= 0) - { - upper->crefs += enable ? 1 : -1; - } + } + + if (ret >= 0) + { + upper->crefs += enable ? 1 : -1; } nxmutex_unlock(&upper->lock); diff --git a/drivers/sensors/goldfish_gnss_uorb.c b/drivers/sensors/goldfish_gnss_uorb.c index b0e1739ee56..86c45de1ec1 100644 --- a/drivers/sensors/goldfish_gnss_uorb.c +++ b/drivers/sensors/goldfish_gnss_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/goldfish_gnss_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/goldfish_sensor_uorb.c b/drivers/sensors/goldfish_sensor_uorb.c index a61f98cfe21..9370c2cd473 100644 --- a/drivers/sensors/goldfish_sensor_uorb.c +++ b/drivers/sensors/goldfish_sensor_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/goldfish_sensor_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/hall3ph.c b/drivers/sensors/hall3ph.c index 452b1cb8c77..090257a8649 100644 --- a/drivers/sensors/hall3ph.c +++ b/drivers/sensors/hall3ph.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/hall3ph.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/hc_sr04.c b/drivers/sensors/hc_sr04.c index 67d0378f2e3..6c52f97b9ba 100644 --- a/drivers/sensors/hc_sr04.c +++ b/drivers/sensors/hc_sr04.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/hc_sr04.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/hdc1008.c b/drivers/sensors/hdc1008.c index 77c73d1eca9..32c4bfd8ecc 100644 --- a/drivers/sensors/hdc1008.c +++ b/drivers/sensors/hdc1008.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/hdc1008.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -163,7 +165,9 @@ static const struct file_operations g_hdc1008fops = hdc1008_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , hdc1008_unlink /* unlink */ #endif diff --git a/drivers/sensors/hts221.c b/drivers/sensors/hts221.c index 931c746ce05..90d65529adc 100644 --- a/drivers/sensors/hts221.c +++ b/drivers/sensors/hts221.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/hts221.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/hyt271_uorb.c b/drivers/sensors/hyt271_uorb.c index 5111a8ad621..7796b3a88b0 100644 --- a/drivers/sensors/hyt271_uorb.c +++ b/drivers/sensors/hyt271_uorb.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/sensors/hyt271_uorb.c - * Character driver for HYT271 Digital Humidity and Temperature Module. + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/sensors/ina219.c b/drivers/sensors/ina219.c index 745101e0a1d..7f7a6b0f565 100644 --- a/drivers/sensors/ina219.c +++ b/drivers/sensors/ina219.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/ina219.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/ina226.c b/drivers/sensors/ina226.c index 913b2a336a5..93697a243d0 100644 --- a/drivers/sensors/ina226.c +++ b/drivers/sensors/ina226.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/ina226.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/ina3221.c b/drivers/sensors/ina3221.c index dc663444b46..f5064097d52 100644 --- a/drivers/sensors/ina3221.c +++ b/drivers/sensors/ina3221.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/ina3221.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/isl29023.c b/drivers/sensors/isl29023.c index f7a24700e6c..1dc758e58c7 100644 --- a/drivers/sensors/isl29023.c +++ b/drivers/sensors/isl29023.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/isl29023.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/kxtj9.c b/drivers/sensors/kxtj9.c index 4b0e6dd3858..a1a2f256a77 100644 --- a/drivers/sensors/kxtj9.c +++ b/drivers/sensors/kxtj9.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/kxtj9.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/l3gd20_uorb.c b/drivers/sensors/l3gd20_uorb.c index dee3de464ba..dc03126167c 100644 --- a/drivers/sensors/l3gd20_uorb.c +++ b/drivers/sensors/l3gd20_uorb.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/sensors/l3gd20_uorb.c - * Character driver for the ST L3GD20 3-Axis gyroscope. + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/sensors/lis2dh.c b/drivers/sensors/lis2dh.c index 216b5100fd7..49fe94065f7 100644 --- a/drivers/sensors/lis2dh.c +++ b/drivers/sensors/lis2dh.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lis2dh.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lis331dl.c b/drivers/sensors/lis331dl.c index de0e760696d..b14103b7e89 100644 --- a/drivers/sensors/lis331dl.c +++ b/drivers/sensors/lis331dl.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lis331dl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lis3dh.c b/drivers/sensors/lis3dh.c index f49a2d38e59..db9d6fc773a 100644 --- a/drivers/sensors/lis3dh.c +++ b/drivers/sensors/lis3dh.c @@ -1,8 +1,9 @@ /**************************************************************************** * drivers/sensors/lis3dh.c * - * Copyright (C) 2018 Extent3D. All rights reserved. - * Author: Matt Thompson + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (C) 2018 Extent3D. All rights reserved. + * SPDX-FileContributor: Matt Thompson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/sensors/lis3dsh.c b/drivers/sensors/lis3dsh.c index 3f8955db955..fadcba88a8e 100644 --- a/drivers/sensors/lis3dsh.c +++ b/drivers/sensors/lis3dsh.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lis3dsh.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lis3mdl.c b/drivers/sensors/lis3mdl.c index cb59deeb71c..6b750c9af39 100644 --- a/drivers/sensors/lis3mdl.c +++ b/drivers/sensors/lis3mdl.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lis3mdl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lm75.c b/drivers/sensors/lm75.c index 67a9e99eebc..3a3e871e1f9 100644 --- a/drivers/sensors/lm75.c +++ b/drivers/sensors/lm75.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lm75.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lm92.c b/drivers/sensors/lm92.c index 29d659fc778..bf19bbf8e22 100644 --- a/drivers/sensors/lm92.c +++ b/drivers/sensors/lm92.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lm92.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lps25h.c b/drivers/sensors/lps25h.c index 32d97be58ba..852d02f462b 100644 --- a/drivers/sensors/lps25h.c +++ b/drivers/sensors/lps25h.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lps25h.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lsm303agr.c b/drivers/sensors/lsm303agr.c index 0a977f47475..244d95499de 100644 --- a/drivers/sensors/lsm303agr.c +++ b/drivers/sensors/lsm303agr.c @@ -1,17 +1,13 @@ /**************************************************************************** * drivers/sensors/lsm303agr.c * - * Copyright (C) 2018 Inc. All rights reserved. - * Author: Ben vd Veen - * Alias: DisruptiveNL - * - * Based on: - * - * Copyright (C) 2016 Omni Hoverboards Inc. All rights reserved. - * Author: Paul Alexander Patience - * - * Copyright (C) 2016, 2019 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Inc. All rights reserved. + * SPDX-FileCopyrightText: 2016 Omni Hoverboards Inc. All rights reserved. + * SPDX-FileCopyrightText: 2016, 2019 Gregory Nutt. All rights reserved. + * SPDX-FileContributor: Ben vd Veen + * SPDX-FileContributor: Paul Alexander Patience + * SPDX-FileContributor: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/sensors/lsm330_spi.c b/drivers/sensors/lsm330_spi.c index f468b94ff63..bc439473805 100644 --- a/drivers/sensors/lsm330_spi.c +++ b/drivers/sensors/lsm330_spi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lsm330_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lsm6dsl.c b/drivers/sensors/lsm6dsl.c index bbac6b89630..cd676d2bd60 100644 --- a/drivers/sensors/lsm6dsl.c +++ b/drivers/sensors/lsm6dsl.c @@ -1,17 +1,13 @@ /**************************************************************************** * drivers/sensors/lsm6dsl.c * - * Copyright (C) 2018 Inc. All rights reserved. - * Author: Ben vd Veen - * Alias: DisruptiveNL - * - * Based on: - * - * Copyright (C) 2016 Omni Hoverboards Inc. All rights reserved. - * Author: Paul Alexander Patience - * - * Copyright (C) 2016, 2019 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Inc. All rights reserved. + * SPDX-FileCopyrightText: 2016 Omni Hoverboards Inc. All rights reserved. + * SPDX-FileCopyrightText: 2016, 2019 Gregory Nutt. All rights reserved. + * SPDX-FileContributor: Ben vd Veen + * SPDX-FileContributor: Paul Alexander Patience + * SPDX-FileContributor: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/sensors/lsm9ds1.c b/drivers/sensors/lsm9ds1.c index ece7affa774..9e08b95ffba 100644 --- a/drivers/sensors/lsm9ds1.c +++ b/drivers/sensors/lsm9ds1.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lsm9ds1.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lsm9ds1_base.c b/drivers/sensors/lsm9ds1_base.c index 43ce757a96c..30f11460d97 100644 --- a/drivers/sensors/lsm9ds1_base.c +++ b/drivers/sensors/lsm9ds1_base.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lsm9ds1_base.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lsm9ds1_base.h b/drivers/sensors/lsm9ds1_base.h index e972d65670e..c97540a91f5 100644 --- a/drivers/sensors/lsm9ds1_base.h +++ b/drivers/sensors/lsm9ds1_base.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lsm9ds1_base.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/lsm9ds1_uorb.c b/drivers/sensors/lsm9ds1_uorb.c index a1070ba31ce..db32087fbe5 100644 --- a/drivers/sensors/lsm9ds1_uorb.c +++ b/drivers/sensors/lsm9ds1_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/lsm9ds1_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/ltc4151.c b/drivers/sensors/ltc4151.c index 7830886da86..69d4c87254c 100644 --- a/drivers/sensors/ltc4151.c +++ b/drivers/sensors/ltc4151.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/ltc4151.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/ltr308_uorb.c b/drivers/sensors/ltr308_uorb.c index 125c138371f..cb30a5e7c82 100644 --- a/drivers/sensors/ltr308_uorb.c +++ b/drivers/sensors/ltr308_uorb.c @@ -1,6 +1,7 @@ /**************************************************************************** * drivers/sensors/ltr308_uorb.c - * Character driver for the LTR-308ALS-01 Lite-On ambient light sensor. + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/sensors/max31855.c b/drivers/sensors/max31855.c index 7dd4a6807b9..aa9a362a127 100644 --- a/drivers/sensors/max31855.c +++ b/drivers/sensors/max31855.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/max31855.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/max31865.c b/drivers/sensors/max31865.c index 816e0d5fc0d..76916a88f23 100644 --- a/drivers/sensors/max31865.c +++ b/drivers/sensors/max31865.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/max31865.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/max44009.c b/drivers/sensors/max44009.c index 76ec998690e..82ed1c6d59a 100644 --- a/drivers/sensors/max44009.c +++ b/drivers/sensors/max44009.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/max44009.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/max6675.c b/drivers/sensors/max6675.c index e54bbdb48cd..0ee50e9b5f7 100644 --- a/drivers/sensors/max6675.c +++ b/drivers/sensors/max6675.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/max6675.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/mb7040.c b/drivers/sensors/mb7040.c index a826839fca1..eb1989770e2 100644 --- a/drivers/sensors/mb7040.c +++ b/drivers/sensors/mb7040.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/mb7040.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/mcp9844.c b/drivers/sensors/mcp9844.c index a7c59555746..4cdc012fc94 100644 --- a/drivers/sensors/mcp9844.c +++ b/drivers/sensors/mcp9844.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/mcp9844.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/mlx90393.c b/drivers/sensors/mlx90393.c index 6fdde2066b4..659de1dff2b 100644 --- a/drivers/sensors/mlx90393.c +++ b/drivers/sensors/mlx90393.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/mlx90393.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/mlx90614.c b/drivers/sensors/mlx90614.c index 2465d901e5c..08cdb95bb26 100644 --- a/drivers/sensors/mlx90614.c +++ b/drivers/sensors/mlx90614.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/mlx90614.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/mpl115a.c b/drivers/sensors/mpl115a.c index 82198c24a01..266683666cc 100644 --- a/drivers/sensors/mpl115a.c +++ b/drivers/sensors/mpl115a.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/mpl115a.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/mpu60x0.c b/drivers/sensors/mpu60x0.c index 765cf138227..d7d8549ffbc 100644 --- a/drivers/sensors/mpu60x0.c +++ b/drivers/sensors/mpu60x0.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/mpu60x0.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/mpu9250_uorb.c b/drivers/sensors/mpu9250_uorb.c index 95e15345ec9..2ec20227c28 100644 --- a/drivers/sensors/mpu9250_uorb.c +++ b/drivers/sensors/mpu9250_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/mpu9250_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/ms56xx_uorb.c b/drivers/sensors/ms56xx_uorb.c index e93f9b7608f..d08112b2809 100644 --- a/drivers/sensors/ms56xx_uorb.c +++ b/drivers/sensors/ms56xx_uorb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/ms56xx_uorb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/ms58xx.c b/drivers/sensors/ms58xx.c index a6096b0a549..225e197e238 100644 --- a/drivers/sensors/ms58xx.c +++ b/drivers/sensors/ms58xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/ms58xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/msa301.c b/drivers/sensors/msa301.c index f5a9ba37263..3b395466779 100644 --- a/drivers/sensors/msa301.c +++ b/drivers/sensors/msa301.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/msa301.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/qencoder.c b/drivers/sensors/qencoder.c index 53421622f1e..d097b635433 100644 --- a/drivers/sensors/qencoder.c +++ b/drivers/sensors/qencoder.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/qencoder.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/scd30.c b/drivers/sensors/scd30.c index 906bc1ac115..61c5e3554a8 100644 --- a/drivers/sensors/scd30.c +++ b/drivers/sensors/scd30.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/scd30.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -184,7 +186,9 @@ static const struct file_operations g_scd30fops = scd30_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , scd30_unlink /* unlink */ #endif diff --git a/drivers/sensors/scd41.c b/drivers/sensors/scd41.c index 756c41a3cb6..12e7f173727 100644 --- a/drivers/sensors/scd41.c +++ b/drivers/sensors/scd41.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/scd41.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -192,7 +194,9 @@ static const struct file_operations g_scd41fops = scd41_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , scd41_unlink /* unlink */ #endif diff --git a/drivers/sensors/sensor.c b/drivers/sensors/sensor.c index b46fe44e856..0d2dee8c679 100644 --- a/drivers/sensors/sensor.c +++ b/drivers/sensors/sensor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/sensor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/sensor_rpmsg.c b/drivers/sensors/sensor_rpmsg.c index 1a9e97791b4..4bb378d696c 100644 --- a/drivers/sensors/sensor_rpmsg.c +++ b/drivers/sensors/sensor_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/sensor_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -788,18 +790,21 @@ static int sensor_rpmsg_control(FAR struct sensor_lowerhalf_s *lower, FAR struct sensor_rpmsg_dev_s *dev = lower->priv; FAR struct sensor_lowerhalf_s *drv = dev->drv; FAR struct sensor_ioctl_s *ioctl = (FAR void *)(uintptr_t)arg; + int ret = -ENOTTY; if (drv->ops->control) { - return drv->ops->control(drv, filep, cmd, arg); + ret = drv->ops->control(drv, filep, cmd, arg); } - else if (!(filep->f_oflags & SENSOR_REMOTE) && _SNIOCVALID(cmd)) + + if (ret == -ENOTTY && !(filep->f_oflags & SENSOR_REMOTE) && + _SNIOCVALID(cmd)) { return sensor_rpmsg_ioctl(dev, cmd, arg, sizeof(*ioctl) + ioctl->len, true); } - return -ENOTTY; + return ret; } static void sensor_rpmsg_data_worker(FAR void *arg) diff --git a/drivers/sensors/sgp30.c b/drivers/sensors/sgp30.c index f82656c3a8e..45794acf0dc 100644 --- a/drivers/sensors/sgp30.c +++ b/drivers/sensors/sgp30.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/sgp30.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -161,7 +163,9 @@ static const struct file_operations g_sgp30fops = sgp30_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , sgp30_unlink /* unlink */ #endif diff --git a/drivers/sensors/sht21.c b/drivers/sensors/sht21.c index 487c90ed1d0..936037b3b02 100644 --- a/drivers/sensors/sht21.c +++ b/drivers/sensors/sht21.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/sht21.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -133,7 +135,9 @@ static const struct file_operations g_sht21fops = sht21_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , sht21_unlink /* unlink */ #endif diff --git a/drivers/sensors/sht3x.c b/drivers/sensors/sht3x.c index 8fc52605f7d..adaf7a56313 100644 --- a/drivers/sensors/sht3x.c +++ b/drivers/sensors/sht3x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/sht3x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -172,7 +174,9 @@ static const struct file_operations g_sht3xfops = sht3x_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , sht3x_unlink /* unlink */ #endif diff --git a/drivers/sensors/sht4x.c b/drivers/sensors/sht4x.c index 239517776b6..7f61cb9bdfa 100644 --- a/drivers/sensors/sht4x.c +++ b/drivers/sensors/sht4x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/sht4x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/sps30.c b/drivers/sensors/sps30.c index 7e2c6ba51ba..855a0099ba0 100644 --- a/drivers/sensors/sps30.c +++ b/drivers/sensors/sps30.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/sps30.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -177,7 +179,9 @@ static const struct file_operations g_sps30fops = sps30_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , sps30_unlink /* unlink */ #endif diff --git a/drivers/sensors/t67xx.c b/drivers/sensors/t67xx.c index 9cbe25f90d0..d4168afe756 100644 --- a/drivers/sensors/t67xx.c +++ b/drivers/sensors/t67xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/t67xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/usensor.c b/drivers/sensors/usensor.c index 0271da5e5f2..8988d6242b3 100644 --- a/drivers/sensors/usensor.c +++ b/drivers/sensors/usensor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/usensor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/veml6070.c b/drivers/sensors/veml6070.c index 865463962e4..ccd7b364cf5 100644 --- a/drivers/sensors/veml6070.c +++ b/drivers/sensors/veml6070.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/veml6070.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/vl53l1x.c b/drivers/sensors/vl53l1x.c index 586e714da24..337a38166fe 100644 --- a/drivers/sensors/vl53l1x.c +++ b/drivers/sensors/vl53l1x.c @@ -1,9 +1,10 @@ /**************************************************************************** * drivers/sensors/vl53l1x.c - * Character driver for the ST vl53l1x distance. * - * Copyright (C) 2019 Acutronics Robotics - * Author: Acutronics Robotics (Juan Flores Muñoz) + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (C) 2019 Acutronics Robotics + * SPDX-FileCopyrightText: Acutronics Robotics + * SPDX-FileCopyrightText: (Juan Flores Muñoz) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/drivers/sensors/wtgahrs2_uorb.c b/drivers/sensors/wtgahrs2_uorb.c index 3158756e4e9..14bdeb223a7 100644 --- a/drivers/sensors/wtgahrs2_uorb.c +++ b/drivers/sensors/wtgahrs2_uorb.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/sensors/wtgahrs2_uorb.c - * Driver for the Wit-Motion WTGAHRS2 accelerometer, gyroscope, magnetic, - * angle, barometer, temperature, GNSS sensors by serial interface with host + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/drivers/sensors/xen1210.c b/drivers/sensors/xen1210.c index 23cda293a10..d1fb2308e2d 100644 --- a/drivers/sensors/xen1210.c +++ b/drivers/sensors/xen1210.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/xen1210.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/xen1210.h b/drivers/sensors/xen1210.h index fcf5063fb42..e5d4410cd74 100644 --- a/drivers/sensors/xen1210.h +++ b/drivers/sensors/xen1210.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/xen1210.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/sensors/zerocross.c b/drivers/sensors/zerocross.c index 430a01245c4..c72b065f3bc 100644 --- a/drivers/sensors/zerocross.c +++ b/drivers/sensors/zerocross.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/sensors/zerocross.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/CMakeLists.txt b/drivers/serial/CMakeLists.txt index d8f45ff3ac8..3dbd4bc9d3e 100644 --- a/drivers/serial/CMakeLists.txt +++ b/drivers/serial/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/serial/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/serial/Make.defs b/drivers/serial/Make.defs index 5be882d039d..8843bde2c92 100644 --- a/drivers/serial/Make.defs +++ b/drivers/serial/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/serial/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/ptmx.c b/drivers/serial/ptmx.c index 467afe09d09..f38da9c93fd 100644 --- a/drivers/serial/ptmx.c +++ b/drivers/serial/ptmx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/ptmx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -149,7 +151,7 @@ static int ptmx_minor_allocate(void) * prevent (unexpected) infinite loops. */ - if (startaddr == minor) + if (startaddr == g_ptmx.px_next) { /* We are back where we started... the are no free device address */ diff --git a/drivers/serial/pty.c b/drivers/serial/pty.c index 20610b791f6..11e7855424f 100644 --- a/drivers/serial/pty.c +++ b/drivers/serial/pty.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/pty.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -136,7 +138,9 @@ static const struct file_operations g_pty_fops = pty_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - pty_poll /* poll */ + pty_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , pty_unlink /* unlink */ #endif @@ -617,7 +621,7 @@ static ssize_t pty_write(FAR struct file *filep, #ifdef CONFIG_TTY_SIGINT if (pid > 0 && ch == CONFIG_TTY_SIGINT_CHAR) { - nxsig_tgkill(-1, pid, SIGINT); + nxsig_kill(pid, SIGINT); return 1; } #endif @@ -625,7 +629,7 @@ static ssize_t pty_write(FAR struct file *filep, #ifdef CONFIG_TTY_SIGTSTP if (pid > 0 && ch == CONFIG_TTY_SIGTSTP_CHAR) { - nxsig_tgkill(-1, pid, SIGTSTP); + nxsig_kill(pid, SIGTSTP); return 1; } #endif diff --git a/drivers/serial/pty.h b/drivers/serial/pty.h index 8526eb6772f..94a24e953f4 100644 --- a/drivers/serial/pty.h +++ b/drivers/serial/pty.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/pty.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c index 801b47edcfd..6915e8d1f35 100644 --- a/drivers/serial/serial.c +++ b/drivers/serial/serial.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/serial.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -145,7 +147,9 @@ static const struct file_operations g_serialops = uart_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - uart_poll /* poll */ + uart_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , uart_unlink /* unlink */ #endif diff --git a/drivers/serial/serial_cmsdk.c b/drivers/serial/serial_cmsdk.c index e488a598d30..2aea93a1720 100644 --- a/drivers/serial/serial_cmsdk.c +++ b/drivers/serial/serial_cmsdk.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/serial_cmsdk.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/serial_dma.c b/drivers/serial/serial_dma.c index 87d0bcf5e90..1e5f0df55f0 100644 --- a/drivers/serial/serial_dma.c +++ b/drivers/serial/serial_dma.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/serial_dma.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/serial_gdbstub.c b/drivers/serial/serial_gdbstub.c index 846543a0467..8e54d2a032b 100644 --- a/drivers/serial/serial_gdbstub.c +++ b/drivers/serial/serial_gdbstub.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/serial_gdbstub.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/serial_io.c b/drivers/serial/serial_io.c index 8a75ae05594..54f4542d8d5 100644 --- a/drivers/serial/serial_io.c +++ b/drivers/serial/serial_io.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/serial_io.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_16550.c b/drivers/serial/uart_16550.c index 6adff69fcc8..190e39b61f5 100644 --- a/drivers/serial/uart_16550.c +++ b/drivers/serial/uart_16550.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/uart_16550.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_bth4.c b/drivers/serial/uart_bth4.c index 5c0b1b22be5..5a2f00ee2cf 100644 --- a/drivers/serial/uart_bth4.c +++ b/drivers/serial/uart_bth4.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/uart_bth4.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_bth5.c b/drivers/serial/uart_bth5.c index 05e93707abf..fe3a0faf65b 100644 --- a/drivers/serial/uart_bth5.c +++ b/drivers/serial/uart_bth5.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/uart_bth5.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_hostfs.c b/drivers/serial/uart_hostfs.c index 0edb0e9ba54..93f95813855 100644 --- a/drivers/serial/uart_hostfs.c +++ b/drivers/serial/uart_hostfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/uart_hostfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_pci_16550.c b/drivers/serial/uart_pci_16550.c index 7afc80e0ec5..2294fa45139 100644 --- a/drivers/serial/uart_pci_16550.c +++ b/drivers/serial/uart_pci_16550.c @@ -1,6 +1,8 @@ /***************************************************************************** * drivers/serial/uart_pci_16550.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_pl011.c b/drivers/serial/uart_pl011.c index 4cd4f44640d..3532584747a 100644 --- a/drivers/serial/uart_pl011.c +++ b/drivers/serial/uart_pl011.c @@ -1,6 +1,8 @@ /*************************************************************************** * drivers/serial/uart_pl011.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_ram.c b/drivers/serial/uart_ram.c index 8c6a74421d8..a0042bfb0ec 100644 --- a/drivers/serial/uart_ram.c +++ b/drivers/serial/uart_ram.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/uart_ram.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/serial/uart_rpmsg.c b/drivers/serial/uart_rpmsg.c index 54e3777906b..7a8e2e828a4 100644 --- a/drivers/serial/uart_rpmsg.c +++ b/drivers/serial/uart_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/serial/uart_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/spi/CMakeLists.txt b/drivers/spi/CMakeLists.txt index e5464894207..3d23c79e074 100644 --- a/drivers/spi/CMakeLists.txt +++ b/drivers/spi/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/spi/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/spi/Make.defs b/drivers/spi/Make.defs index acfdf113a97..0bc88f17244 100644 --- a/drivers/spi/Make.defs +++ b/drivers/spi/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/spi/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/spi/qspi_flash.c b/drivers/spi/qspi_flash.c index 67bd52a8999..04fabcf70ab 100644 --- a/drivers/spi/qspi_flash.c +++ b/drivers/spi/qspi_flash.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/spi/qspi_flash.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 953cb22af53..c1d1caea452 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/spi/spi_bitbang.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/spi/spi_driver.c b/drivers/spi/spi_driver.c index c5e49852f6f..c0787e085dc 100644 --- a/drivers/spi/spi_driver.c +++ b/drivers/spi/spi_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/spi/spi_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -99,7 +101,9 @@ static const struct file_operations g_spidrvr_fops = spidrvr_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , spidrvr_unlink /* unlink */ #endif diff --git a/drivers/spi/spi_flash.c b/drivers/spi/spi_flash.c index 9f71497e0a1..12ce0089025 100644 --- a/drivers/spi/spi_flash.c +++ b/drivers/spi/spi_flash.c @@ -1,6 +1,8 @@ /************************************************************************************ * drivers/spi/spi_flash.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/spi/spi_slave_driver.c b/drivers/spi/spi_slave_driver.c index a5ef0a9f8ce..73293d697d9 100644 --- a/drivers/spi/spi_slave_driver.c +++ b/drivers/spi/spi_slave_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/spi/spi_slave_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -138,7 +140,9 @@ static const struct file_operations g_spislavefops = NULL, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - spi_slave_poll /* poll */ + spi_slave_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , spi_slave_unlink /* unlink */ #endif diff --git a/drivers/spi/spi_transfer.c b/drivers/spi/spi_transfer.c index a56b6de9ce4..c99a5541952 100644 --- a/drivers/spi/spi_transfer.c +++ b/drivers/spi/spi_transfer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/spi/spi_transfer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/CMakeLists.txt b/drivers/syslog/CMakeLists.txt index 1090ac65bba..045a87d81fa 100644 --- a/drivers/syslog/CMakeLists.txt +++ b/drivers/syslog/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/syslog/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/syslog/Make.defs b/drivers/syslog/Make.defs index db6dd00002a..6b4e5521f77 100644 --- a/drivers/syslog/Make.defs +++ b/drivers/syslog/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/syslog/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/ramlog.c b/drivers/syslog/ramlog.c index 5b345865b3f..404ce17965b 100644 --- a/drivers/syslog/ramlog.c +++ b/drivers/syslog/ramlog.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/ramlog.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog.h b/drivers/syslog/syslog.h index 486d702aeeb..af32be328a4 100644 --- a/drivers/syslog/syslog.h +++ b/drivers/syslog/syslog.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -194,8 +196,7 @@ void syslog_register(void); * ch - The character to add to the interrupt buffer (must be positive). * * Returned Value: - * Zero success, the character is echoed back to the caller. A negated - * errno value is returned on any failure. + * None * * Assumptions: * Called only from interrupt handling logic; Interrupts will be disabled. @@ -203,7 +204,7 @@ void syslog_register(void); ****************************************************************************/ #ifdef CONFIG_SYSLOG_INTBUFFER -int syslog_add_intbuffer(int ch); +void syslog_add_intbuffer(FAR const char *buffer, size_t buflen); #endif /**************************************************************************** @@ -217,8 +218,7 @@ int syslog_add_intbuffer(int ch); * force - Use the force() method of the channel vs. the putc() method. * * Returned Value: - * On success, the character is echoed back to the caller. A negated - * errno value is returned on any failure. + * None * * Assumptions: * Interrupts may or may not be disabled. @@ -226,8 +226,30 @@ int syslog_add_intbuffer(int ch); ****************************************************************************/ #ifdef CONFIG_SYSLOG_INTBUFFER -int syslog_flush_intbuffer(bool force); +void syslog_flush_intbuffer(bool force); #endif + +/**************************************************************************** + * Name: syslog_write_foreach + * + * Description: + * This provides a default write method for syslog devices that do not + * support multiple byte writes This functions simply loops, outputting + * one character at a time. + * + * Input Parameters: + * buffer - The buffer containing the data to be output + * buflen - The number of bytes in the buffer + * force - Use the force() method of the channel vs. the putc() method. + * + * Returned Value: + * On success, the number of characters written is returned. A negated + * errno value is returned on any failure. + * + ****************************************************************************/ + +ssize_t syslog_write_foreach(FAR const char *buffer, + size_t buflen, bool force); #endif /* CONFIG_SYSLOG */ #undef EXTERN diff --git a/drivers/syslog/syslog_channel.c b/drivers/syslog/syslog_channel.c index 95c0dea2db2..a7893359d77 100644 --- a/drivers/syslog/syslog_channel.c +++ b/drivers/syslog/syslog_channel.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_channel.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_chardev.c b/drivers/syslog/syslog_chardev.c index f8472dae35d..2b7d7f4dc56 100644 --- a/drivers/syslog/syslog_chardev.c +++ b/drivers/syslog/syslog_chardev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_chardev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_console.c b/drivers/syslog/syslog_console.c index 5d04c6d58d6..cd433c7d060 100644 --- a/drivers/syslog/syslog_console.c +++ b/drivers/syslog/syslog_console.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_console.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_consolechannel.c b/drivers/syslog/syslog_consolechannel.c index b82f787bf69..bd53d7cce2e 100644 --- a/drivers/syslog/syslog_consolechannel.c +++ b/drivers/syslog/syslog_consolechannel.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_consolechannel.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_devchannel.c b/drivers/syslog/syslog_devchannel.c index b1967560688..4ba0f91e3d7 100644 --- a/drivers/syslog/syslog_devchannel.c +++ b/drivers/syslog/syslog_devchannel.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_devchannel.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_device.c b/drivers/syslog/syslog_device.c index 90a1d1838cb..bd08fac6e20 100644 --- a/drivers/syslog/syslog_device.c +++ b/drivers/syslog/syslog_device.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_device.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_filechannel.c b/drivers/syslog/syslog_filechannel.c index b8a6555c61d..0644833339c 100644 --- a/drivers/syslog/syslog_filechannel.c +++ b/drivers/syslog/syslog_filechannel.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_filechannel.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_flush.c b/drivers/syslog/syslog_flush.c index 2102cbff22b..590821fc698 100644 --- a/drivers/syslog/syslog_flush.c +++ b/drivers/syslog/syslog_flush.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_flush.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_initialize.c b/drivers/syslog/syslog_initialize.c index b104f6f738a..eca3697fb47 100644 --- a/drivers/syslog/syslog_initialize.c +++ b/drivers/syslog/syslog_initialize.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_initialize.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_intbuffer.c b/drivers/syslog/syslog_intbuffer.c index 43b7c599ed0..0877f14514f 100644 --- a/drivers/syslog/syslog_intbuffer.c +++ b/drivers/syslog/syslog_intbuffer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_intbuffer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -30,7 +32,8 @@ #include #include -#include +#include +#include #include "syslog.h" @@ -51,79 +54,72 @@ /* This structure encapsulates the interrupt buffer state */ -struct g_syslog_intbuffer_s +struct syslog_intbuffer_s { - volatile uint16_t si_inndx; - volatile uint16_t si_outndx; - uint8_t si_buffer[CONFIG_SYSLOG_INTBUFSIZE]; + struct circbuf_s circ; + spinlock_t splock; + uint8_t buffer[CONFIG_SYSLOG_INTBUFSIZE]; }; /**************************************************************************** * Private Data ****************************************************************************/ -static struct g_syslog_intbuffer_s g_syslog_intbuffer; +static struct syslog_intbuffer_s g_syslog_intbuffer = +{ + CIRCBUF_INITIALIZER(g_syslog_intbuffer.buffer, + sizeof(g_syslog_intbuffer.buffer)), + SP_UNLOCKED, +}; /**************************************************************************** - * Private Data + * Private Functions ****************************************************************************/ /**************************************************************************** - * Name: syslog_remove_intbuffer + * Name: syslog_flush_internal * * Description: - * Extract any characters that may have been added to the interrupt buffer + * Flush any characters that may have been added to the interrupt buffer * to the SYSLOG device. * * Input Parameters: - * None + * force - Use the force() method of the channel vs. the putc() method. * * Returned Value: - * On success, the extracted character is returned. EOF is returned if - * the interrupt buffer is empty. + * None * * Assumptions: * Interrupts may or may not be disabled. * ****************************************************************************/ -int syslog_remove_intbuffer(void) +void syslog_flush_internal(bool force, size_t buflen) { irqstate_t flags; - uint32_t outndx; - int ret = EOF; + char *buffer; + size_t size; - /* Extraction of the character and adjustment of the circular buffer - * indices must be performed in a critical section to protect from - * concurrent modification from interrupt handlers. + /* This logic is performed with the scheduler disabled to protect from + * concurrent modification by other tasks. */ - flags = enter_critical_section(); - - /* Check if the interrupt buffer is empty */ + flags = spin_lock_irqsave_wo_note(&g_syslog_intbuffer.splock); - outndx = (uint32_t)g_syslog_intbuffer.si_outndx; - if (outndx != (uint32_t)g_syslog_intbuffer.si_inndx) + do { - /* Not empty.. Take the next character from the interrupt buffer */ - - ret = g_syslog_intbuffer.si_buffer[outndx]; - - /* Increment the OUT index, handling wrap-around */ - - if (++outndx >= CONFIG_SYSLOG_INTBUFSIZE) + buffer = circbuf_get_readptr(&g_syslog_intbuffer.circ, &size); + if (size > 0) { - outndx -= CONFIG_SYSLOG_INTBUFSIZE; + size = (size >= buflen) ? buflen : size; + syslog_write_foreach(buffer, size, force); + circbuf_readcommit(&g_syslog_intbuffer.circ, size); + buflen -= size; } - - g_syslog_intbuffer.si_outndx = (uint16_t)outndx; } + while (size > 0 && buflen > 0); - leave_critical_section(flags); - - /* Now we can send the extracted character to the SYSLOG device */ - - return ret; + spin_unlock_irqrestore_wo_note(&g_syslog_intbuffer.splock, flags); } /**************************************************************************** @@ -142,8 +138,7 @@ int syslog_remove_intbuffer(void) * ch - The character to add to the interrupt buffer (must be positive). * * Returned Value: - * Zero success, the character is echoed back to the caller. A negated - * errno value is returned on any failure. + * None * * Assumptions: * - Called either from (1) interrupt handling logic with interrupts @@ -153,92 +148,36 @@ int syslog_remove_intbuffer(void) * ****************************************************************************/ -int syslog_add_intbuffer(int ch) +void syslog_add_intbuffer(FAR const char *buffer, size_t buflen) { irqstate_t flags; - uint32_t inndx; - uint32_t outndx; - uint32_t endndx; - unsigned int inuse; - int ret = OK; + size_t space; /* Disable concurrent modification from interrupt handling logic */ - flags = enter_critical_section(); - - /* How much space is left in the intbuffer? */ + flags = spin_lock_irqsave_wo_note(&g_syslog_intbuffer.splock); - inndx = (uint32_t)g_syslog_intbuffer.si_inndx; - outndx = (uint32_t)g_syslog_intbuffer.si_outndx; + space = circbuf_space(&g_syslog_intbuffer.circ); - endndx = inndx; - if (endndx < outndx) + if (space >= buflen) { - endndx += CONFIG_SYSLOG_INTBUFSIZE; + circbuf_write(&g_syslog_intbuffer.circ, buffer, buflen); } - - inuse = (unsigned int)(endndx - outndx); - - /* Is there space for another character */ - - if (inuse == CONFIG_SYSLOG_INTBUFSIZE - 1) + else if (buflen <= sizeof(g_syslog_intbuffer.buffer)) { - int oldch = syslog_remove_intbuffer(); - int i; - - for (i = 0; i < CONFIG_SYSLOG_MAX_CHANNELS; i++) - { - FAR syslog_channel_t *channel = g_syslog_channel[i]; - - if (channel == NULL) - { - break; - } - -#ifdef CONFIG_SYSLOG_IOCTL - if (channel->sc_state & SYSLOG_CHANNEL_DISABLE) - { - continue; - } -#endif - - if (channel->sc_ops->sc_force == NULL) - { - continue; - } - -#ifdef CONFIG_SYSLOG_CRLF - /* Check for LF */ - - if (oldch == '\n' && - !(channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF)) - { - /* Add CR */ - - channel->sc_ops->sc_force(channel, '\r'); - } -#endif - - channel->sc_ops->sc_force(channel, oldch); - } - - ret = -ENOSPC; + syslog_flush_internal(true, buflen - space); + circbuf_write(&g_syslog_intbuffer.circ, buffer, buflen); } - - /* Copy one character */ - - g_syslog_intbuffer.si_buffer[inndx] = (uint8_t)ch; - - /* Increment the IN index, handling wrap-around */ - - if (++inndx >= CONFIG_SYSLOG_INTBUFSIZE) + else { - inndx -= CONFIG_SYSLOG_INTBUFSIZE; + syslog_flush_intbuffer(true); + space = buflen - sizeof(g_syslog_intbuffer.buffer); + syslog_write_foreach(buffer, space, true); + circbuf_write(&g_syslog_intbuffer.circ, + buffer + space, buflen - space); } - g_syslog_intbuffer.si_inndx = (uint16_t)inndx; - leave_critical_section(flags); - return ret; + spin_unlock_irqrestore_wo_note(&g_syslog_intbuffer.splock, flags); } /**************************************************************************** @@ -260,75 +199,9 @@ int syslog_add_intbuffer(int ch) * ****************************************************************************/ -int syslog_flush_intbuffer(bool force) +void syslog_flush_intbuffer(bool force) { - irqstate_t flags; - int ch; - - /* This logic is performed with the scheduler disabled to protect from - * concurrent modification by other tasks. - */ - - flags = enter_critical_section(); - - for (; ; ) - { - int i; - - /* Transfer one character to time. This is inefficient, but is - * done in this way to: (1) Deal with concurrent modification of - * the interrupt buffer from interrupt activity, (2) Avoid keeper - * interrupts disabled for a long time, and (3) to handler - * wrap-around of the circular buffer indices. - */ - - ch = syslog_remove_intbuffer(); - if (ch == EOF) - { - break; - } - - for (i = 0; i < CONFIG_SYSLOG_MAX_CHANNELS; i++) - { - FAR syslog_channel_t *channel = g_syslog_channel[i]; - syslog_putc_t putfunc; - - if (channel == NULL) - { - break; - } - -#ifdef CONFIG_SYSLOG_IOCTL - if (channel->sc_state & SYSLOG_CHANNEL_DISABLE) - { - continue; - } -#endif - - /* Select which putc function to use for this flush */ - - putfunc = force ? channel->sc_ops->sc_force : - channel->sc_ops->sc_putc; - -#ifdef CONFIG_SYSLOG_CRLF - /* Check for LF */ - - if (ch == '\n' && - !(channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF)) - { - /* Add CR */ - - putfunc(channel, '\r'); - } -#endif - - putfunc(channel, ch); - } - } - - leave_critical_section(flags); - - return ch; + syslog_flush_internal(force, sizeof(g_syslog_intbuffer.buffer)); } #endif /* CONFIG_SYSLOG_INTBUFFER */ diff --git a/drivers/syslog/syslog_putc.c b/drivers/syslog/syslog_putc.c index 1bb6b3255fb..44c4c6fc31f 100644 --- a/drivers/syslog/syslog_putc.c +++ b/drivers/syslog/syslog_putc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_putc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_rpmsg.c b/drivers/syslog/syslog_rpmsg.c index e5450a7b85e..446726b8e9b 100644 --- a/drivers/syslog/syslog_rpmsg.c +++ b/drivers/syslog/syslog_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_rpmsg.h b/drivers/syslog/syslog_rpmsg.h index b410a8d7db3..84206f2fa38 100644 --- a/drivers/syslog/syslog_rpmsg.h +++ b/drivers/syslog/syslog_rpmsg.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_rpmsg.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_rpmsg_server.c b/drivers/syslog/syslog_rpmsg_server.c index d171a616710..05c4dd1291b 100644 --- a/drivers/syslog/syslog_rpmsg_server.c +++ b/drivers/syslog/syslog_rpmsg_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_rpmsg_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_stream.c b/drivers/syslog/syslog_stream.c index 0b37ae6f8ed..51c8985a96a 100644 --- a/drivers/syslog/syslog_stream.c +++ b/drivers/syslog/syslog_stream.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_stream.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/syslog/syslog_write.c b/drivers/syslog/syslog_write.c index f8d8ae739f6..285f7547ab4 100644 --- a/drivers/syslog/syslog_write.c +++ b/drivers/syslog/syslog_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/syslog_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -75,7 +77,11 @@ static bool syslog_safe_to_block(void) } /**************************************************************************** - * Name: syslog_default_write + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: syslog_write_foreach * * Description: * This provides a default write method for syslog devices that do not @@ -92,227 +98,118 @@ static bool syslog_safe_to_block(void) * ****************************************************************************/ -static ssize_t syslog_default_write(FAR const char *buffer, size_t buflen) +ssize_t syslog_write_foreach(FAR const char *buffer, + size_t buflen, bool force) { - size_t nwritten; + syslog_write_t write; + syslog_putc_t putc; + size_t nwritten = 0; + ssize_t ret; + int i; - if (!syslog_safe_to_block()) + for (i = 0; i < CONFIG_SYSLOG_MAX_CHANNELS; i++) { -#ifdef CONFIG_SYSLOG_INTBUFFER - if (up_interrupt_context()) + FAR syslog_channel_t *channel = g_syslog_channel[i]; + + if (channel == NULL) { - for (nwritten = 0; nwritten < buflen; nwritten++) - { - syslog_add_intbuffer(buffer[nwritten]); - } + break; + } + +#ifdef CONFIG_SYSLOG_IOCTL + if (channel->sc_state & SYSLOG_CHANNEL_DISABLE) + { + continue; } - else #endif + + write = !force ? channel->sc_ops->sc_write : + channel->sc_ops->sc_write_force; + if (write != NULL) { - int i; + nwritten = 0; - for (i = 0; i < CONFIG_SYSLOG_MAX_CHANNELS; i++) +#ifdef CONFIG_SYSLOG_CRLF + if (!(channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF)) { - FAR syslog_channel_t *channel = g_syslog_channel[i]; - nwritten = 0; - - if (channel == NULL) - { - break; - } - -#ifdef CONFIG_SYSLOG_IOCTL - if (channel->sc_state & SYSLOG_CHANNEL_DISABLE) - { - continue; - } -#endif + size_t head; - if (channel->sc_ops->sc_write_force != NULL) + for (head = 0; head < buflen; head++) { -#ifdef CONFIG_SYSLOG_CRLF - if (!(channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF)) + if (buffer[head] != '\n') { - size_t head; - - for (head = 0; head < buflen; head++) - { - ssize_t ret; - - /* Check for LF */ - - if (buffer[head] != '\n') - { - continue; - } - - ret = channel->sc_ops->sc_write_force(channel, - buffer + nwritten, - head - nwritten); - if (ret < 0) - { - return ret; - } - - ret = channel->sc_ops->sc_write_force(channel, - "\r\n", 2); - if (ret < 0) - { - return ret; - } - - nwritten = head + 1; - } + continue; } -#endif - if (nwritten < buflen) + ret = write(channel, buffer + nwritten, head - nwritten); + if (ret >= 0) { - ssize_t ret; - - ret = channel->sc_ops->sc_write_force(channel, - buffer + nwritten, - buflen - nwritten); - if (ret < 0) - { - return ret; - } - else - { - nwritten += ret; - } + ret = write(channel, "\r\n", 2); } - } - else - { - DEBUGASSERT(channel->sc_ops->sc_force != NULL); - for (nwritten = 0; nwritten < buflen; nwritten++) - { -#ifdef CONFIG_SYSLOG_CRLF - /* Check for LF */ - if (buffer[nwritten] == '\n' && - !(channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF)) - { - /* Add CR */ + if (ret < 0) + { + return ret; + } - channel->sc_ops->sc_force(channel, '\r'); - } + nwritten = head + 1; + } + } #endif - channel->sc_ops->sc_force(channel, buffer[nwritten]); - } + if (nwritten < buflen) + { + ret = write(channel, buffer + nwritten, buflen - nwritten); + if (ret < 0) + { + return ret; + } + else + { + nwritten += ret; } } } - } - else - { - int i; - - for (i = 0; i < CONFIG_SYSLOG_MAX_CHANNELS; i++) + else { - FAR syslog_channel_t *channel = g_syslog_channel[i]; - nwritten = 0; - - if (channel == NULL) - { - break; - } - -#ifdef CONFIG_SYSLOG_IOCTL - if (channel->sc_state & SYSLOG_CHANNEL_DISABLE) + putc = !force ? channel->sc_ops->sc_putc : + channel->sc_ops->sc_force; + if (putc == NULL) { continue; } -#endif - if (channel->sc_ops->sc_write != NULL) - { #ifdef CONFIG_SYSLOG_CRLF - if (!(channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF)) - { - size_t head; - - for (head = 0; head < buflen; head++) - { - size_t ret; - - /* Check for LF */ - - if (buffer[head] != '\n') - { - continue; - } - - ret = channel->sc_ops->sc_write(channel, - buffer + nwritten, - head - nwritten); - if (ret < 0) - { - return ret; - } - - /* Add CR */ - - ret = channel->sc_ops->sc_write(channel, "\r\n", 2); - if (ret < 0) - { - return ret; - } - - nwritten = head + 1; - } - } + if (channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF) #endif - - if (nwritten < buflen) + { + for (nwritten = 0; nwritten < buflen; nwritten++) { - ssize_t ret; - - ret = channel->sc_ops->sc_write(channel, - buffer + nwritten, - buflen - nwritten); - if (ret < 0) - { - return ret; - } - else - { - nwritten += ret; - } + putc(channel, buffer[nwritten]); } } +#ifdef CONFIG_SYSLOG_CRLF else { - DEBUGASSERT(channel->sc_ops->sc_putc != NULL); for (nwritten = 0; nwritten < buflen; nwritten++) { -#ifdef CONFIG_SYSLOG_CRLF - /* Check for LF */ - - if (buffer[nwritten] == '\n' && - !(channel->sc_state & SYSLOG_CHANNEL_DISABLE_CRLF)) + if (buffer[nwritten] == '\n') { /* Add CR */ - channel->sc_ops->sc_putc(channel, '\r'); + putc(channel, '\r'); } -#endif - channel->sc_ops->sc_putc(channel, buffer[nwritten]); + putc(channel, buffer[nwritten]); } } +#endif } } return nwritten; } -/**************************************************************************** - * Public Functions - ****************************************************************************/ - /**************************************************************************** * Name: syslog_write * @@ -331,8 +228,15 @@ static ssize_t syslog_default_write(FAR const char *buffer, size_t buflen) ssize_t syslog_write(FAR const char *buffer, size_t buflen) { + bool force = !syslog_safe_to_block(); + #ifdef CONFIG_SYSLOG_INTBUFFER - if (!up_interrupt_context() && !sched_idletask()) + if (force) + { + syslog_add_intbuffer(buffer, buflen); + return buflen; + } + else { /* Flush any characters that may have been added to the interrupt * buffer. @@ -342,5 +246,5 @@ ssize_t syslog_write(FAR const char *buffer, size_t buflen) } #endif - return syslog_default_write(buffer, buflen); + return syslog_write_foreach(buffer, buflen, force); } diff --git a/drivers/syslog/vsyslog.c b/drivers/syslog/vsyslog.c index 0a825166493..9cb27c9ba37 100644 --- a/drivers/syslog/vsyslog.c +++ b/drivers/syslog/vsyslog.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/syslog/vsyslog.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/thermal/CMakeLists.txt b/drivers/thermal/CMakeLists.txt index 7d013af432b..47298d87331 100644 --- a/drivers/thermal/CMakeLists.txt +++ b/drivers/thermal/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/thermal/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this @@ -17,7 +19,6 @@ # the License. # # ############################################################################## -# ############################################################################## # Include thermal sources diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 98087070068..6602f27c2d9 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -6,6 +6,7 @@ menuconfig THERMAL bool "Thermal framework" default n + depends on SCHED_LPWORK ---help--- Enable thermal framework. diff --git a/drivers/thermal/Make.defs b/drivers/thermal/Make.defs index 28b0af0c639..facc84a0d2a 100644 --- a/drivers/thermal/Make.defs +++ b/drivers/thermal/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/thermal/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 0f5f2fc46b6..5bea526773a 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/thermal/thermal_core.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index e60ac51417a..f264bd91bf5 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/thermal/thermal_core.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/thermal/thermal_cpufreq_cooling.c b/drivers/thermal/thermal_cpufreq_cooling.c index dd826fbd09c..d8782920ea7 100644 --- a/drivers/thermal/thermal_cpufreq_cooling.c +++ b/drivers/thermal/thermal_cpufreq_cooling.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/thermal/thermal_cpufreq_cooling.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/thermal/thermal_dummy.c b/drivers/thermal/thermal_dummy.c index ee35b8c8579..9db3b7cdcf2 100644 --- a/drivers/thermal/thermal_dummy.c +++ b/drivers/thermal/thermal_dummy.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/thermal/thermal_dummy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -46,6 +48,7 @@ struct dummy_zone_device_s { int temperature; bool raising; + bool temp_jump; }; struct dummy_cooling_device_s @@ -107,9 +110,9 @@ static int dummy_cpufreq_resume (FAR struct cpufreq_policy *driver); static const struct thermal_zone_trip_s g_dummy_trips[] = { - {.name = "cpu_crit", .temp = 90, .hyst = 10, .type = THERMAL_CRITICAL}, - {.name = "cpu_alert1", .temp = 70, .hyst = 10, .type = THERMAL_HOT}, - {.name = "cpu_alert0", .temp = 60, .hyst = 10, .type = THERMAL_NORMAL}, + {.name = "cpu_crit", .temp = 90, .hyst = 5, .type = THERMAL_CRITICAL}, + {.name = "cpu_alert1", .temp = 70, .hyst = 5, .type = THERMAL_HOT}, + {.name = "cpu_alert0", .temp = 60, .hyst = 5, .type = THERMAL_NORMAL}, }; static const struct thermal_zone_map_s g_dummy_maps[] = @@ -159,6 +162,7 @@ static struct dummy_zone_device_s g_dummy_zone = { .temperature = 45, .raising = true, + .temp_jump = true, }; /* Cooling Device - fan0 */ @@ -262,7 +266,8 @@ static int dummy_zdev_get_temp(FAR struct thermal_zone_device_s *zdev, s->temperature--; } - *temp = s->temperature; + *temp = s->temperature + (s->temp_jump ? 2 : -2); + s->temp_jump = !s->temp_jump; return OK; } diff --git a/drivers/thermal/thermal_procfs.c b/drivers/thermal/thermal_procfs.c index efef0ea1629..ff5f03f5e36 100644 --- a/drivers/thermal/thermal_procfs.c +++ b/drivers/thermal/thermal_procfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/thermal/thermal_procfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -144,15 +146,26 @@ static ssize_t thermal_procfs_read(FAR struct file *filep, { ins->cdev->ops->get_state(ins->cdev, ¤t); procfs_sprintf(buffer, buflen, &offset, - "z:%s t:%d t:%d h:%u l:%u c:%s s:%u|%u\n", + "z:%s t:%d t:%d h:%u l:%u c:%s ", ins->zdev->name, ins->zdev->temperature, ins->trip, ins->upper, ins->lower, - ins->cdev->name, - current, - ins->target); + ins->cdev->name); + + if (ins->target == THERMAL_NO_TARGET) + { + procfs_sprintf(buffer, buflen, &offset, "s:%u|%s", + current, "(invalid)"); + } + else + { + procfs_sprintf(buffer, buflen, &offset, "s:%u|%u", + current, ins->target); + } + + procfs_sprintf(buffer, buflen, &offset, "\n"); } if (offset < 0) diff --git a/drivers/thermal/thermal_step_wise.c b/drivers/thermal/thermal_step_wise.c index 5405ba8ee8d..979e0dc4e4e 100644 --- a/drivers/thermal/thermal_step_wise.c +++ b/drivers/thermal/thermal_step_wise.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/thermal/thermal_step_wise.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -150,8 +152,10 @@ static int step_wise_throttle(FAR struct thermal_zone_device_s *zdev, enum thermal_trend_e trend; unsigned int next_state; bool throttle = false; + int hyst_temp; int trip_temp; + thermal_zone_get_trip_hyst(zdev, trip, &hyst_temp); thermal_zone_get_trip_temp(zdev, trip, &trip_temp); trend = thermal_zone_get_trend(zdev); @@ -160,6 +164,10 @@ static int step_wise_throttle(FAR struct thermal_zone_device_s *zdev, { throttle = true; } + else if (zdev->temperature > trip_temp - hyst_temp) + { + return OK; + } list_for_every_entry(&zdev->instance_list, instance, struct thermal_instance_s, zdev_node) diff --git a/drivers/timers/CMakeLists.txt b/drivers/timers/CMakeLists.txt index e4bd3deff74..60fdda858e9 100644 --- a/drivers/timers/CMakeLists.txt +++ b/drivers/timers/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/timers/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this @@ -17,7 +19,6 @@ # the License. # # ############################################################################## -# ############################################################################## set(SRCS) diff --git a/drivers/timers/Make.defs b/drivers/timers/Make.defs index 01dd9d21147..ddf2620ffac 100644 --- a/drivers/timers/Make.defs +++ b/drivers/timers/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/timers/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/arch_alarm.c b/drivers/timers/arch_alarm.c index f9f646c734f..d558410f71a 100644 --- a/drivers/timers/arch_alarm.c +++ b/drivers/timers/arch_alarm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/arch_alarm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/arch_rtc.c b/drivers/timers/arch_rtc.c index 70eead776ab..ba496555a58 100644 --- a/drivers/timers/arch_rtc.c +++ b/drivers/timers/arch_rtc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/arch_rtc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/arch_timer.c b/drivers/timers/arch_timer.c index 8ef700ce284..a0725d00cf7 100644 --- a/drivers/timers/arch_timer.c +++ b/drivers/timers/arch_timer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/arch_timer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/capture.c b/drivers/timers/capture.c index fa2db25d142..f9fd1c4cccf 100644 --- a/drivers/timers/capture.c +++ b/drivers/timers/capture.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/capture.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/cs2100-cp.c b/drivers/timers/cs2100-cp.c index 5ade1a65112..d9578a2c77e 100644 --- a/drivers/timers/cs2100-cp.c +++ b/drivers/timers/cs2100-cp.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/cs2100-cp.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/ds3231.c b/drivers/timers/ds3231.c index 329f925334f..b333a490f2e 100644 --- a/drivers/timers/ds3231.c +++ b/drivers/timers/ds3231.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/ds3231.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/ds3231.h b/drivers/timers/ds3231.h index 1da501f1eb7..c399d7cd06a 100644 --- a/drivers/timers/ds3231.h +++ b/drivers/timers/ds3231.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/ds3231.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/goldfish_timer.c b/drivers/timers/goldfish_timer.c index 843d6d6da01..05b2a8575e7 100644 --- a/drivers/timers/goldfish_timer.c +++ b/drivers/timers/goldfish_timer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/goldfish_timer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/mcp794xx.c b/drivers/timers/mcp794xx.c index 2734c87f5a2..4cb4ce9b2d4 100644 --- a/drivers/timers/mcp794xx.c +++ b/drivers/timers/mcp794xx.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/mcp794xx.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/mcp794xx.h b/drivers/timers/mcp794xx.h index b1188987e7e..076a12daa3e 100644 --- a/drivers/timers/mcp794xx.h +++ b/drivers/timers/mcp794xx.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/mcp794xx.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/oneshot.c b/drivers/timers/oneshot.c index f51abbdb702..dc8c6e4657d 100644 --- a/drivers/timers/oneshot.c +++ b/drivers/timers/oneshot.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/oneshot.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/pcf85263.c b/drivers/timers/pcf85263.c index 0c7de5899a4..e3ea68cc261 100644 --- a/drivers/timers/pcf85263.c +++ b/drivers/timers/pcf85263.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/pcf85263.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/pcf85263.h b/drivers/timers/pcf85263.h index ccdf6fd9eb7..01845ed8db5 100644 --- a/drivers/timers/pcf85263.h +++ b/drivers/timers/pcf85263.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/pcf85263.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/pl031.c b/drivers/timers/pl031.c index e2414540c5d..29133cbfce9 100644 --- a/drivers/timers/pl031.c +++ b/drivers/timers/pl031.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/pl031.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/pwm.c b/drivers/timers/pwm.c index 9e627fdcde2..0f91ce1936e 100644 --- a/drivers/timers/pwm.c +++ b/drivers/timers/pwm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/pwm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/rpmsg_rtc.c b/drivers/timers/rpmsg_rtc.c index f224b6b3531..31cff5f16d4 100644 --- a/drivers/timers/rpmsg_rtc.c +++ b/drivers/timers/rpmsg_rtc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/rpmsg_rtc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/rtc.c b/drivers/timers/rtc.c index 21db78a246f..cd26dcb2e4b 100644 --- a/drivers/timers/rtc.c +++ b/drivers/timers/rtc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/rtc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -131,7 +133,9 @@ static const struct file_operations g_rtc_fops = rtc_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , rtc_unlink /* unlink */ #endif diff --git a/drivers/timers/rx8010.c b/drivers/timers/rx8010.c index c7a93823c53..5b5b6dc5a78 100644 --- a/drivers/timers/rx8010.c +++ b/drivers/timers/rx8010.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/rx8010.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/rx8010.h b/drivers/timers/rx8010.h index 99798571d34..a84759ad902 100644 --- a/drivers/timers/rx8010.h +++ b/drivers/timers/rx8010.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/rx8010.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/timer.c b/drivers/timers/timer.c index f206cfefc71..3e6fc41a510 100644 --- a/drivers/timers/timer.c +++ b/drivers/timers/timer.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/timer.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/timers/watchdog.c b/drivers/timers/watchdog.c index e16e8d92440..5079b03082e 100644 --- a/drivers/timers/watchdog.c +++ b/drivers/timers/watchdog.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/timers/watchdog.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/CMakeLists.txt b/drivers/usbdev/CMakeLists.txt index ac6fc2ea9a7..6fef1b4ad4a 100644 --- a/drivers/usbdev/CMakeLists.txt +++ b/drivers/usbdev/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/usbdev/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/usbdev/Make.defs b/drivers/usbdev/Make.defs index 647a83792c7..8532b800f38 100644 --- a/drivers/usbdev/Make.defs +++ b/drivers/usbdev/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/usbdev/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/adb.c b/drivers/usbdev/adb.c index 4ceacfb45dc..b2d49da4d3d 100644 --- a/drivers/usbdev/adb.c +++ b/drivers/usbdev/adb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/adb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c index 5859a143d5b..403ad6e230c 100644 --- a/drivers/usbdev/cdcacm.c +++ b/drivers/usbdev/cdcacm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/cdcacm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/cdcacm.h b/drivers/usbdev/cdcacm.h index d9f6ee0930f..e362cae037e 100644 --- a/drivers/usbdev/cdcacm.h +++ b/drivers/usbdev/cdcacm.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/cdcacm.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/cdcacm_desc.c b/drivers/usbdev/cdcacm_desc.c index 028a4f3b8d4..9b3974d7f1e 100644 --- a/drivers/usbdev/cdcacm_desc.c +++ b/drivers/usbdev/cdcacm_desc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/cdcacm_desc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/cdcecm.c b/drivers/usbdev/cdcecm.c index ad109e7c768..17f3da76140 100644 --- a/drivers/usbdev/cdcecm.c +++ b/drivers/usbdev/cdcecm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/cdcecm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/cdcecm.h b/drivers/usbdev/cdcecm.h index e221076fa47..8c92c65b34a 100644 --- a/drivers/usbdev/cdcecm.h +++ b/drivers/usbdev/cdcecm.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/cdcecm.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/cdcncm.c b/drivers/usbdev/cdcncm.c index e9d1c773d22..86daf73c5f8 100644 --- a/drivers/usbdev/cdcncm.c +++ b/drivers/usbdev/cdcncm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/cdcncm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/composite.c b/drivers/usbdev/composite.c index d95e61ee3d2..4c955503ebd 100644 --- a/drivers/usbdev/composite.c +++ b/drivers/usbdev/composite.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/composite.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/composite.h b/drivers/usbdev/composite.h index 859e3e24116..aa69f3ba117 100644 --- a/drivers/usbdev/composite.h +++ b/drivers/usbdev/composite.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/composite.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/composite_desc.c b/drivers/usbdev/composite_desc.c index a5f959a2714..428ba5b8082 100644 --- a/drivers/usbdev/composite_desc.c +++ b/drivers/usbdev/composite_desc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/composite_desc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/dfu.c b/drivers/usbdev/dfu.c index 80c6aa8be27..cea02eea563 100644 --- a/drivers/usbdev/dfu.c +++ b/drivers/usbdev/dfu.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/dfu.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/mtp.c b/drivers/usbdev/mtp.c index 0ac07647d51..b97b5ec3e9c 100644 --- a/drivers/usbdev/mtp.c +++ b/drivers/usbdev/mtp.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/mtp.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/pl2303.c b/drivers/usbdev/pl2303.c index a36d39d0536..2f688987e9f 100644 --- a/drivers/usbdev/pl2303.c +++ b/drivers/usbdev/pl2303.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/pl2303.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/rndis.c b/drivers/usbdev/rndis.c index 3d73e1a2283..2ca239f27d5 100644 --- a/drivers/usbdev/rndis.c +++ b/drivers/usbdev/rndis.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/rndis.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/rndis_std.h b/drivers/usbdev/rndis_std.h index 3b75e3951ff..1dd756fcad1 100644 --- a/drivers/usbdev/rndis_std.h +++ b/drivers/usbdev/rndis_std.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/rndis_std.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbdev_desc.c b/drivers/usbdev/usbdev_desc.c index e25c6228b56..c81b09a0834 100644 --- a/drivers/usbdev/usbdev_desc.c +++ b/drivers/usbdev/usbdev_desc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbdev_desc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbdev_fs.c b/drivers/usbdev/usbdev_fs.c index 99646cab598..feae8fbd47a 100644 --- a/drivers/usbdev/usbdev_fs.c +++ b/drivers/usbdev/usbdev_fs.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbdev_fs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbdev_fs.h b/drivers/usbdev/usbdev_fs.h index d3b0534330f..7d2a6370170 100644 --- a/drivers/usbdev/usbdev_fs.h +++ b/drivers/usbdev/usbdev_fs.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbdev_fs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbdev_req.c b/drivers/usbdev/usbdev_req.c index e2f57aa8a09..d9b4467dd92 100644 --- a/drivers/usbdev/usbdev_req.c +++ b/drivers/usbdev/usbdev_req.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbdev_req.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbdev_strings.c b/drivers/usbdev/usbdev_strings.c index 75005b771b2..692c66d969f 100644 --- a/drivers/usbdev/usbdev_strings.c +++ b/drivers/usbdev/usbdev_strings.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbdev_strings.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbdev_trace.c b/drivers/usbdev/usbdev_trace.c index af6e723905c..87012282b0d 100644 --- a/drivers/usbdev/usbdev_trace.c +++ b/drivers/usbdev/usbdev_trace.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbdev_trace.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbdev_trprintf.c b/drivers/usbdev/usbdev_trprintf.c index 9389d916362..07ba41872db 100644 --- a/drivers/usbdev/usbdev_trprintf.c +++ b/drivers/usbdev/usbdev_trprintf.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbdev_trprintf.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbmsc.c b/drivers/usbdev/usbmsc.c index ff7dc703fc7..28ff61eff3a 100644 --- a/drivers/usbdev/usbmsc.c +++ b/drivers/usbdev/usbmsc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbmsc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbmsc.h b/drivers/usbdev/usbmsc.h index 732b4c68630..cb3800eeb84 100644 --- a/drivers/usbdev/usbmsc.h +++ b/drivers/usbdev/usbmsc.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbmsc.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbmsc_desc.c b/drivers/usbdev/usbmsc_desc.c index 2b4064d68fc..c0d94cfe1e2 100644 --- a/drivers/usbdev/usbmsc_desc.c +++ b/drivers/usbdev/usbmsc_desc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbmsc_desc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbdev/usbmsc_scsi.c b/drivers/usbdev/usbmsc_scsi.c index 9ff3844aec8..03eb5cf169f 100644 --- a/drivers/usbdev/usbmsc_scsi.c +++ b/drivers/usbdev/usbmsc_scsi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbdev/usbmsc_scsi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/CMakeLists.txt b/drivers/usbhost/CMakeLists.txt index f8d1d30b5ba..ec6373286fd 100644 --- a/drivers/usbhost/CMakeLists.txt +++ b/drivers/usbhost/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/usbhost/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/usbhost/Make.defs b/drivers/usbhost/Make.defs index 02b4ffa8112..a226d61495e 100644 --- a/drivers/usbhost/Make.defs +++ b/drivers/usbhost/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/usbhost/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_bthci.c b/drivers/usbhost/usbhost_bthci.c index 7e3fa477879..6f7e1d43ff5 100644 --- a/drivers/usbhost/usbhost_bthci.c +++ b/drivers/usbhost/usbhost_bthci.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_bthci.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_cdcacm.c b/drivers/usbhost/usbhost_cdcacm.c index bc4df2fe0fe..3648e70b5da 100644 --- a/drivers/usbhost/usbhost_cdcacm.c +++ b/drivers/usbhost/usbhost_cdcacm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_cdcacm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_cdcmbim.c b/drivers/usbhost/usbhost_cdcmbim.c index 8ce26bfb05b..2acc4bb3ed3 100644 --- a/drivers/usbhost/usbhost_cdcmbim.c +++ b/drivers/usbhost/usbhost_cdcmbim.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_cdcmbim.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_composite.c b/drivers/usbhost/usbhost_composite.c index 3bcbfff6688..602b8447561 100644 --- a/drivers/usbhost/usbhost_composite.c +++ b/drivers/usbhost/usbhost_composite.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_composite.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_composite.h b/drivers/usbhost/usbhost_composite.h index ee92b1e6815..5e77dd3ac79 100644 --- a/drivers/usbhost/usbhost_composite.h +++ b/drivers/usbhost/usbhost_composite.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_composite.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_devaddr.c b/drivers/usbhost/usbhost_devaddr.c index e90d9bc4978..2a718ceaf73 100644 --- a/drivers/usbhost/usbhost_devaddr.c +++ b/drivers/usbhost/usbhost_devaddr.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_devaddr.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_enumerate.c b/drivers/usbhost/usbhost_enumerate.c index fa1b3997fc3..f74875b2d3a 100644 --- a/drivers/usbhost/usbhost_enumerate.c +++ b/drivers/usbhost/usbhost_enumerate.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_enumerate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_findclass.c b/drivers/usbhost/usbhost_findclass.c index 16e9e9c9389..d6ee6bcbffc 100644 --- a/drivers/usbhost/usbhost_findclass.c +++ b/drivers/usbhost/usbhost_findclass.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_findclass.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_ft232r.c b/drivers/usbhost/usbhost_ft232r.c index 89c78aca1e4..7f17d81f0b3 100644 --- a/drivers/usbhost/usbhost_ft232r.c +++ b/drivers/usbhost/usbhost_ft232r.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_ft232r.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_hidkbd.c b/drivers/usbhost/usbhost_hidkbd.c index f3f9725e84f..0d12730c2e7 100644 --- a/drivers/usbhost/usbhost_hidkbd.c +++ b/drivers/usbhost/usbhost_hidkbd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_hidkbd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_hidmouse.c b/drivers/usbhost/usbhost_hidmouse.c index 3886f926f9a..1dc61a8eb31 100644 --- a/drivers/usbhost/usbhost_hidmouse.c +++ b/drivers/usbhost/usbhost_hidmouse.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_hidmouse.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_hub.c b/drivers/usbhost/usbhost_hub.c index dc54230341e..ee642fbeffc 100644 --- a/drivers/usbhost/usbhost_hub.c +++ b/drivers/usbhost/usbhost_hub.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_hub.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_max3421e.c b/drivers/usbhost/usbhost_max3421e.c index 02a34602db1..6956fe55e8f 100644 --- a/drivers/usbhost/usbhost_max3421e.c +++ b/drivers/usbhost/usbhost_max3421e.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_max3421e.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_registerclass.c b/drivers/usbhost/usbhost_registerclass.c index a84d6762999..bdd141ae572 100644 --- a/drivers/usbhost/usbhost_registerclass.c +++ b/drivers/usbhost/usbhost_registerclass.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_registerclass.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_registry.c b/drivers/usbhost/usbhost_registry.c index c5df49ae413..0aaf8995c69 100644 --- a/drivers/usbhost/usbhost_registry.c +++ b/drivers/usbhost/usbhost_registry.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_registry.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_registry.h b/drivers/usbhost/usbhost_registry.h index 369edb50e43..e1f28b3830d 100644 --- a/drivers/usbhost/usbhost_registry.h +++ b/drivers/usbhost/usbhost_registry.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_registry.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_skeleton.c b/drivers/usbhost/usbhost_skeleton.c index 5e0ecc971b8..a11340752f3 100644 --- a/drivers/usbhost/usbhost_skeleton.c +++ b/drivers/usbhost/usbhost_skeleton.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_skeleton.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_storage.c b/drivers/usbhost/usbhost_storage.c index db62e18aaac..7f60769815c 100644 --- a/drivers/usbhost/usbhost_storage.c +++ b/drivers/usbhost/usbhost_storage.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_storage.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_trace.c b/drivers/usbhost/usbhost_trace.c index b8b267bd180..378fc13be1b 100644 --- a/drivers/usbhost/usbhost_trace.c +++ b/drivers/usbhost/usbhost_trace.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_trace.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbhost/usbhost_xboxcontroller.c b/drivers/usbhost/usbhost_xboxcontroller.c index 1e1883b1ac5..01acb84f4f7 100644 --- a/drivers/usbhost/usbhost_xboxcontroller.c +++ b/drivers/usbhost/usbhost_xboxcontroller.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbhost/usbhost_xboxcontroller.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbmisc/CMakeLists.txt b/drivers/usbmisc/CMakeLists.txt index 6365366150e..936a9b8f21c 100644 --- a/drivers/usbmisc/CMakeLists.txt +++ b/drivers/usbmisc/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/usbmisc/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/usbmisc/Make.defs b/drivers/usbmisc/Make.defs index 10437f72fa1..e185ff14cce 100644 --- a/drivers/usbmisc/Make.defs +++ b/drivers/usbmisc/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/usbmisc/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/usbmisc/fusb301.c b/drivers/usbmisc/fusb301.c index df5dd950cf7..e992c6f8736 100644 --- a/drivers/usbmisc/fusb301.c +++ b/drivers/usbmisc/fusb301.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbmisc/fusb301.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbmisc/fusb302.c b/drivers/usbmisc/fusb302.c index 9cd65f38d3e..920662894a3 100644 --- a/drivers/usbmisc/fusb302.c +++ b/drivers/usbmisc/fusb302.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbmisc/fusb302.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbmisc/fusb303.c b/drivers/usbmisc/fusb303.c index 7bb456282d0..ef96612550e 100644 --- a/drivers/usbmisc/fusb303.c +++ b/drivers/usbmisc/fusb303.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbmisc/fusb303.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usbmonitor/CMakeLists.txt b/drivers/usbmonitor/CMakeLists.txt index 19df1270206..557e9f89aaf 100644 --- a/drivers/usbmonitor/CMakeLists.txt +++ b/drivers/usbmonitor/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/usbmonitor/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/usbmonitor/Make.defs b/drivers/usbmonitor/Make.defs index 17d251b2238..dd767926a58 100644 --- a/drivers/usbmonitor/Make.defs +++ b/drivers/usbmonitor/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/usbmonitor/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/usbmonitor/usbmonitor.c b/drivers/usbmonitor/usbmonitor.c index a15fddae6b8..b9c0da75ec1 100644 --- a/drivers/usbmonitor/usbmonitor.c +++ b/drivers/usbmonitor/usbmonitor.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usbmonitor/usbmonitor.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usrsock/CMakeLists.txt b/drivers/usrsock/CMakeLists.txt index dc1bb8bb027..839c7662f4b 100644 --- a/drivers/usrsock/CMakeLists.txt +++ b/drivers/usrsock/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/usrsock/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/usrsock/Make.defs b/drivers/usrsock/Make.defs index e08d90d368a..99db1b5cd95 100644 --- a/drivers/usrsock/Make.defs +++ b/drivers/usrsock/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/usrsock/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/usrsock/usrsock_dev.c b/drivers/usrsock/usrsock_dev.c index c04ba4542bb..45f38731204 100644 --- a/drivers/usrsock/usrsock_dev.c +++ b/drivers/usrsock/usrsock_dev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usrsock/usrsock_dev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usrsock/usrsock_rpmsg.c b/drivers/usrsock/usrsock_rpmsg.c index 01c5b417d9a..a9d6c237586 100644 --- a/drivers/usrsock/usrsock_rpmsg.c +++ b/drivers/usrsock/usrsock_rpmsg.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usrsock/usrsock_rpmsg.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/usrsock/usrsock_rpmsg_server.c b/drivers/usrsock/usrsock_rpmsg_server.c index 7ea3e6d477a..c85bf7293d5 100644 --- a/drivers/usrsock/usrsock_rpmsg_server.c +++ b/drivers/usrsock/usrsock_rpmsg_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/usrsock/usrsock_rpmsg_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/vhost/CMakeLists.txt b/drivers/vhost/CMakeLists.txt index ccd76303ceb..4955d47a4e7 100644 --- a/drivers/vhost/CMakeLists.txt +++ b/drivers/vhost/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/vhost/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/vhost/Make.defs b/drivers/vhost/Make.defs index 13e67ff48ce..4a70eef5943 100644 --- a/drivers/vhost/Make.defs +++ b/drivers/vhost/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/vhost/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/vhost/vhost-rng.c b/drivers/vhost/vhost-rng.c index 057c748223d..a9cdec309b7 100644 --- a/drivers/vhost/vhost-rng.c +++ b/drivers/vhost/vhost-rng.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/vhost/vhost-rng.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/vhost/vhost-rng.h b/drivers/vhost/vhost-rng.h index a03e417c4a1..35490a7cb20 100644 --- a/drivers/vhost/vhost-rng.h +++ b/drivers/vhost/vhost-rng.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/vhost/vhost-rng.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 9df624f95ac..eebcf24303c 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/vhost/vhost.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/CMakeLists.txt b/drivers/video/CMakeLists.txt index 949fd0aa206..7e07c20cd36 100644 --- a/drivers/video/CMakeLists.txt +++ b/drivers/video/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/video/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/video/Make.defs b/drivers/video/Make.defs index 91b9371c332..e2edc640b52 100644 --- a/drivers/video/Make.defs +++ b/drivers/video/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/video/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/video/fb.c b/drivers/video/fb.c index 94c63cb1711..05a04917891 100644 --- a/drivers/video/fb.c +++ b/drivers/video/fb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/fb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -1726,7 +1728,7 @@ int fb_register_device(int display, int plane, char devname[16]; int nplanes; int ret; - size_t i; + ssize_t i; /* Allocate a framebuffer state instance */ diff --git a/drivers/video/goldfish_camera.c b/drivers/video/goldfish_camera.c index 8984f46ecce..fff70d45ccb 100644 --- a/drivers/video/goldfish_camera.c +++ b/drivers/video/goldfish_camera.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/goldfish_camera.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/goldfish_fb.c b/drivers/video/goldfish_fb.c index eee45a2eb4d..58a5925c051 100644 --- a/drivers/video/goldfish_fb.c +++ b/drivers/video/goldfish_fb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/goldfish_fb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/goldfish_gpu_fb.c b/drivers/video/goldfish_gpu_fb.c index 0457189c036..2a1952499e0 100644 --- a/drivers/video/goldfish_gpu_fb.c +++ b/drivers/video/goldfish_gpu_fb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/goldfish_gpu_fb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -563,6 +565,10 @@ int goldfish_gpu_fb_register(int display) fb->vtable.getplaneinfo = goldfish_gpu_fb_getplaneinfo; fb->vtable.getvideoinfo = goldfish_gpu_fb_getvideoinfo; + /* Clear goldfish_gpu_fb */ + + goldfish_gpu_fb_commit(fb, fb->planeinfo.fbmem); + /* Create the vsync thread */ snprintf(arg1, 32, "%p", fb); diff --git a/drivers/video/isx012.c b/drivers/video/isx012.c index 97910971e85..9c5a950b053 100644 --- a/drivers/video/isx012.c +++ b/drivers/video/isx012.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/isx012.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/isx012_range.h b/drivers/video/isx012_range.h index 144687370a2..acf6440b8f4 100644 --- a/drivers/video/isx012_range.h +++ b/drivers/video/isx012_range.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/isx012_range.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/isx012_reg.h b/drivers/video/isx012_reg.h index 2c4e41d093f..73ef749f934 100644 --- a/drivers/video/isx012_reg.h +++ b/drivers/video/isx012_reg.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/isx012_reg.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/isx019.c b/drivers/video/isx019.c index 72c17556771..ba91fb8cf90 100644 --- a/drivers/video/isx019.c +++ b/drivers/video/isx019.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/isx019.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/isx019_range.h b/drivers/video/isx019_range.h index 9489c1fc12d..bd3fa4871fb 100644 --- a/drivers/video/isx019_range.h +++ b/drivers/video/isx019_range.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/isx019_range.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/isx019_reg.h b/drivers/video/isx019_reg.h index d6e9af65899..68e44515152 100644 --- a/drivers/video/isx019_reg.h +++ b/drivers/video/isx019_reg.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/isx019_reg.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/max7456.c b/drivers/video/max7456.c index 2683911258f..9365ac2aabe 100644 --- a/drivers/video/max7456.c +++ b/drivers/video/max7456.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/max7456.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/mipidsi/CMakeLists.txt b/drivers/video/mipidsi/CMakeLists.txt index 22d32ab0edf..6225ef9aecb 100644 --- a/drivers/video/mipidsi/CMakeLists.txt +++ b/drivers/video/mipidsi/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/video/mipidsi/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/video/mipidsi/Make.defs b/drivers/video/mipidsi/Make.defs index 10fd40d4644..1e77c0d703b 100644 --- a/drivers/video/mipidsi/Make.defs +++ b/drivers/video/mipidsi/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/video/mipidsi/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/video/mipidsi/mipi_dsi.h b/drivers/video/mipidsi/mipi_dsi.h index 13af6c42220..b7db643701f 100644 --- a/drivers/video/mipidsi/mipi_dsi.h +++ b/drivers/video/mipidsi/mipi_dsi.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/mipidsi/mipi_dsi.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/mipidsi/mipi_dsi_device.c b/drivers/video/mipidsi/mipi_dsi_device.c index 2cf6aca456e..13f2a0fde59 100644 --- a/drivers/video/mipidsi/mipi_dsi_device.c +++ b/drivers/video/mipidsi/mipi_dsi_device.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/mipidsi/mipi_dsi_device.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/mipidsi/mipi_dsi_device_driver.c b/drivers/video/mipidsi/mipi_dsi_device_driver.c index 7c066fafd22..9acbfcbdbd0 100644 --- a/drivers/video/mipidsi/mipi_dsi_device_driver.c +++ b/drivers/video/mipidsi/mipi_dsi_device_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/mipidsi/mipi_dsi_device_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/mipidsi/mipi_dsi_host.c b/drivers/video/mipidsi/mipi_dsi_host.c index b443a1560f8..5e3ecd5c9ab 100644 --- a/drivers/video/mipidsi/mipi_dsi_host.c +++ b/drivers/video/mipidsi/mipi_dsi_host.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/mipidsi/mipi_dsi_host.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/mipidsi/mipi_dsi_host_driver.c b/drivers/video/mipidsi/mipi_dsi_host_driver.c index c5d89307db5..429cbbc4a19 100644 --- a/drivers/video/mipidsi/mipi_dsi_host_driver.c +++ b/drivers/video/mipidsi/mipi_dsi_host_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/mipidsi/mipi_dsi_host_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/mipidsi/mipi_dsi_packet.c b/drivers/video/mipidsi/mipi_dsi_packet.c index b50d1f3def9..8f4f6e96755 100644 --- a/drivers/video/mipidsi/mipi_dsi_packet.c +++ b/drivers/video/mipidsi/mipi_dsi_packet.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/mipidsi/mipi_dsi_packet.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/ov2640.c b/drivers/video/ov2640.c index 67bdd9948c6..ec071517082 100644 --- a/drivers/video/ov2640.c +++ b/drivers/video/ov2640.c @@ -1,43 +1,22 @@ /**************************************************************************** * drivers/video/ov2640.c - * OV2640 Color CMOS UXGA (2.0 MegaPixel) CameraChip * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: Apache-2.0 * - * WARNING: Some of the information in the data tables below came from other - * projects with conflicting licenses: Linux and ArduCAM. Those both have - * GPL licenses. I am not sure if it is proper or not to lift the content - * of those tables and still retain this BSD license. I am guessing so, but - * I am not copyright attorney so you should use this driver in products at - * your own risk. + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * http://www.apache.org/licenses/LICENSE-2.0 * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name NuttX nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. * ****************************************************************************/ diff --git a/drivers/video/v4l2_cap.c b/drivers/video/v4l2_cap.c index 3c938c788e5..39f48a0a154 100644 --- a/drivers/video/v4l2_cap.c +++ b/drivers/video/v4l2_cap.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/v4l2_cap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -351,6 +353,8 @@ static const struct file_operations g_capture_fops = capture_mmap, /* mmap */ NULL, /* truncate */ capture_poll, /* poll */ + NULL, /* readv */ + NULL, /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS capture_unlink, /* unlink */ #endif diff --git a/drivers/video/v4l2_core.c b/drivers/video/v4l2_core.c index 674308daaef..72da4481928 100644 --- a/drivers/video/v4l2_core.c +++ b/drivers/video/v4l2_core.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/v4l2_core.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -65,6 +67,8 @@ static const struct file_operations g_v4l2_fops = v4l2_mmap, /* mmap */ NULL, /* truncate */ v4l2_poll, /* poll */ + NULL, /* readv */ + NULL, /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS v4l2_unlink, /* unlink */ #endif diff --git a/drivers/video/v4l2_m2m.c b/drivers/video/v4l2_m2m.c index 951cc4ca4e7..cc4f7ad19b8 100644 --- a/drivers/video/v4l2_m2m.c +++ b/drivers/video/v4l2_m2m.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/v4l2_m2m.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/video_framebuff.c b/drivers/video/video_framebuff.c index 110a01d64d7..f74f550e6be 100644 --- a/drivers/video/video_framebuff.c +++ b/drivers/video/video_framebuff.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/video_framebuff.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/video_framebuff.h b/drivers/video/video_framebuff.h index 1aed3de6e57..5623cd6acb2 100644 --- a/drivers/video/video_framebuff.h +++ b/drivers/video/video_framebuff.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/video_framebuff.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/CMakeLists.txt b/drivers/video/vnc/CMakeLists.txt index 27388a8fc49..a8b3b174c18 100644 --- a/drivers/video/vnc/CMakeLists.txt +++ b/drivers/video/vnc/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/video/vnc/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/video/vnc/Make.defs b/drivers/video/vnc/Make.defs index 1ca46a7c5c2..70b8da1b8a4 100644 --- a/drivers/video/vnc/Make.defs +++ b/drivers/video/vnc/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/video/vnc/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_color.c b/drivers/video/vnc/vnc_color.c index d2320d83241..b3bf86c47a7 100644 --- a/drivers/video/vnc/vnc_color.c +++ b/drivers/video/vnc/vnc_color.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_color.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_fbdev.c b/drivers/video/vnc/vnc_fbdev.c index 85d148bf8f5..d51fbbd2e61 100644 --- a/drivers/video/vnc/vnc_fbdev.c +++ b/drivers/video/vnc/vnc_fbdev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_fbdev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_kbd.c b/drivers/video/vnc/vnc_kbd.c index 3d26abf9269..30c82616cd8 100644 --- a/drivers/video/vnc/vnc_kbd.c +++ b/drivers/video/vnc/vnc_kbd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_kbd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_keymap.c b/drivers/video/vnc/vnc_keymap.c index 911f7f7c473..3abec1e1339 100644 --- a/drivers/video/vnc/vnc_keymap.c +++ b/drivers/video/vnc/vnc_keymap.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_keymap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_negotiate.c b/drivers/video/vnc/vnc_negotiate.c index acdd64a78cc..f764a18b70e 100644 --- a/drivers/video/vnc/vnc_negotiate.c +++ b/drivers/video/vnc/vnc_negotiate.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_negotiate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_raw.c b/drivers/video/vnc/vnc_raw.c index 28ef2926632..79438eeb9b4 100644 --- a/drivers/video/vnc/vnc_raw.c +++ b/drivers/video/vnc/vnc_raw.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_raw.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_receiver.c b/drivers/video/vnc/vnc_receiver.c index 7c0840d385c..533710d884e 100644 --- a/drivers/video/vnc/vnc_receiver.c +++ b/drivers/video/vnc/vnc_receiver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_receiver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_rre.c b/drivers/video/vnc/vnc_rre.c index de5b48e11b7..410e12ed800 100644 --- a/drivers/video/vnc/vnc_rre.c +++ b/drivers/video/vnc/vnc_rre.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_rre.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_server.c b/drivers/video/vnc/vnc_server.c index fe1bef919dd..f0c501ec4da 100644 --- a/drivers/video/vnc/vnc_server.c +++ b/drivers/video/vnc/vnc_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_server.h b/drivers/video/vnc/vnc_server.h index 26af7ca2a74..c5d90205bce 100644 --- a/drivers/video/vnc/vnc_server.h +++ b/drivers/video/vnc/vnc_server.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_server.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_touch.c b/drivers/video/vnc/vnc_touch.c index 2535a79124c..1c6b1aadef8 100644 --- a/drivers/video/vnc/vnc_touch.c +++ b/drivers/video/vnc/vnc_touch.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_touch.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/video/vnc/vnc_updater.c b/drivers/video/vnc/vnc_updater.c index 9481481a4dc..54749eeb2fb 100644 --- a/drivers/video/vnc/vnc_updater.c +++ b/drivers/video/vnc/vnc_updater.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/video/vnc/vnc_updater.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/CMakeLists.txt b/drivers/virtio/CMakeLists.txt index b2aee03bf94..40573d07cf6 100644 --- a/drivers/virtio/CMakeLists.txt +++ b/drivers/virtio/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/virtio/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/virtio/Make.defs b/drivers/virtio/Make.defs index a51c677447a..46a1d928e50 100644 --- a/drivers/virtio/Make.defs +++ b/drivers/virtio/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/virtio/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-blk.c b/drivers/virtio/virtio-blk.c index b1211e81799..e8f3c26c66c 100644 --- a/drivers/virtio/virtio-blk.c +++ b/drivers/virtio/virtio-blk.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-blk.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-blk.h b/drivers/virtio/virtio-blk.h index d51ffd128aa..dc0d75f3f29 100644 --- a/drivers/virtio/virtio-blk.h +++ b/drivers/virtio/virtio-blk.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-blk.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-gpu.c b/drivers/virtio/virtio-gpu.c index 5991f822398..1c8c404fe43 100644 --- a/drivers/virtio/virtio-gpu.c +++ b/drivers/virtio/virtio-gpu.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-gpu.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-gpu.h b/drivers/virtio/virtio-gpu.h index dd72cc57b9c..6e47f506c75 100644 --- a/drivers/virtio/virtio-gpu.h +++ b/drivers/virtio/virtio-gpu.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-gpu.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-input.c b/drivers/virtio/virtio-input.c index 922230e01ca..bf0176d2f4c 100644 --- a/drivers/virtio/virtio-input.c +++ b/drivers/virtio/virtio-input.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-input.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-input.h b/drivers/virtio/virtio-input.h index c99b63bce95..749444414de 100644 --- a/drivers/virtio/virtio-input.h +++ b/drivers/virtio/virtio-input.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-input.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-mmio.c b/drivers/virtio/virtio-mmio.c index efa62e13fdb..2c7757b8898 100644 --- a/drivers/virtio/virtio-mmio.c +++ b/drivers/virtio/virtio-mmio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-mmio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-net.c b/drivers/virtio/virtio-net.c index ced5cff5b55..172b007389f 100644 --- a/drivers/virtio/virtio-net.c +++ b/drivers/virtio/virtio-net.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-net.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-net.h b/drivers/virtio/virtio-net.h index 9d5d1cc89dd..2491b7f451c 100644 --- a/drivers/virtio/virtio-net.h +++ b/drivers/virtio/virtio-net.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-net.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-pci-legacy.c b/drivers/virtio/virtio-pci-legacy.c index 2fa293298aa..4869db36884 100644 --- a/drivers/virtio/virtio-pci-legacy.c +++ b/drivers/virtio/virtio-pci-legacy.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-pci-legacy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-pci-modern.c b/drivers/virtio/virtio-pci-modern.c index 75451eda825..85b54880f57 100644 --- a/drivers/virtio/virtio-pci-modern.c +++ b/drivers/virtio/virtio-pci-modern.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-pci-modern.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-pci.c b/drivers/virtio/virtio-pci.c index dd88fab518d..0189c4b1bcc 100644 --- a/drivers/virtio/virtio-pci.c +++ b/drivers/virtio/virtio-pci.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-pci.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-pci.h b/drivers/virtio/virtio-pci.h index 70d3c544e25..69c7d9e9cc4 100644 --- a/drivers/virtio/virtio-pci.h +++ b/drivers/virtio/virtio-pci.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-pci.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-rng.c b/drivers/virtio/virtio-rng.c index a3e4501e7be..318994ada77 100644 --- a/drivers/virtio/virtio-rng.c +++ b/drivers/virtio/virtio-rng.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-rng.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -91,6 +93,8 @@ static const struct file_operations g_virtio_rng_ops = NULL, /* mmap */ NULL, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS NULL, /* unlink */ #endif diff --git a/drivers/virtio/virtio-rng.h b/drivers/virtio/virtio-rng.h index 71c9b8db9e1..549730c2331 100644 --- a/drivers/virtio/virtio-rng.h +++ b/drivers/virtio/virtio-rng.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-rng.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-rpmb.c b/drivers/virtio/virtio-rpmb.c index f855ad063cf..eb40dc5058f 100644 --- a/drivers/virtio/virtio-rpmb.c +++ b/drivers/virtio/virtio-rpmb.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-rpmb.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -90,6 +92,8 @@ static const struct file_operations g_virtio_rpmb_ops = NULL, /* mmap */ NULL, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS NULL, /* unlink */ #endif diff --git a/drivers/virtio/virtio-rpmb.h b/drivers/virtio/virtio-rpmb.h index 4cc14f920d2..8cefc58555b 100644 --- a/drivers/virtio/virtio-rpmb.h +++ b/drivers/virtio/virtio-rpmb.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-rpmb.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-serial.c b/drivers/virtio/virtio-serial.c index 7a7a913f77a..2719acc29d4 100644 --- a/drivers/virtio/virtio-serial.c +++ b/drivers/virtio/virtio-serial.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-serial.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-serial.h b/drivers/virtio/virtio-serial.h index 07be952ab3b..faaf63284d8 100644 --- a/drivers/virtio/virtio-serial.h +++ b/drivers/virtio/virtio-serial.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-serial.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-snd.c b/drivers/virtio/virtio-snd.c index 959bafce1b9..ea861aba936 100644 --- a/drivers/virtio/virtio-snd.c +++ b/drivers/virtio/virtio-snd.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-snd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio-snd.h b/drivers/virtio/virtio-snd.h index 8d22f52bbe4..fb992ffbcb5 100644 --- a/drivers/virtio/virtio-snd.h +++ b/drivers/virtio/virtio-snd.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio-snd.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 1addf34b0bf..571cbfb35da 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/virtio/virtio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/CMakeLists.txt b/drivers/wireless/CMakeLists.txt index cb9661dc06d..b4b9a40f5fe 100644 --- a/drivers/wireless/CMakeLists.txt +++ b/drivers/wireless/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/ISM1_868MHzGFSK100kbps.c b/drivers/wireless/ISM1_868MHzGFSK100kbps.c index 97204376f85..d8c4451d9fc 100644 --- a/drivers/wireless/ISM1_868MHzGFSK100kbps.c +++ b/drivers/wireless/ISM1_868MHzGFSK100kbps.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ISM1_868MHzGFSK100kbps.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ISM2_433MHzMSK500kbps.c b/drivers/wireless/ISM2_433MHzMSK500kbps.c index b82695ac8e3..8bce748db47 100644 --- a/drivers/wireless/ISM2_433MHzMSK500kbps.c +++ b/drivers/wireless/ISM2_433MHzMSK500kbps.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ISM2_433MHzMSK500kbps.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ISM2_905MHzGFSK250kbps.c b/drivers/wireless/ISM2_905MHzGFSK250kbps.c index 6e278bbe542..bc725395502 100644 --- a/drivers/wireless/ISM2_905MHzGFSK250kbps.c +++ b/drivers/wireless/ISM2_905MHzGFSK250kbps.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ISM2_905MHzGFSK250kbps.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/Make.defs b/drivers/wireless/Make.defs index 0cff34b2f1a..e6456364a45 100644 --- a/drivers/wireless/Make.defs +++ b/drivers/wireless/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/CMakeLists.txt b/drivers/wireless/bluetooth/CMakeLists.txt index 0a7f133f8e8..2aa6d9e1410 100644 --- a/drivers/wireless/bluetooth/CMakeLists.txt +++ b/drivers/wireless/bluetooth/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/bluetooth/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/bluetooth/Make.defs b/drivers/wireless/bluetooth/Make.defs index 0b10e46f06c..93c62c6a8d3 100644 --- a/drivers/wireless/bluetooth/Make.defs +++ b/drivers/wireless/bluetooth/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/bluetooth/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_bridge.c b/drivers/wireless/bluetooth/bt_bridge.c index c694d4bf149..d53f62cfaa0 100644 --- a/drivers/wireless/bluetooth/bt_bridge.c +++ b/drivers/wireless/bluetooth/bt_bridge.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_bridge.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_driver.c b/drivers/wireless/bluetooth/bt_driver.c index c30ef44825a..b7d4ce4b2e7 100644 --- a/drivers/wireless/bluetooth/bt_driver.c +++ b/drivers/wireless/bluetooth/bt_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_null.c b/drivers/wireless/bluetooth/bt_null.c index b3c49284f9b..8ea3e98f3c0 100644 --- a/drivers/wireless/bluetooth/bt_null.c +++ b/drivers/wireless/bluetooth/bt_null.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_null.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_rpmsghci.c b/drivers/wireless/bluetooth/bt_rpmsghci.c index 72aa10b3fdd..4d96621d994 100644 --- a/drivers/wireless/bluetooth/bt_rpmsghci.c +++ b/drivers/wireless/bluetooth/bt_rpmsghci.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_rpmsghci.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_rpmsghci.h b/drivers/wireless/bluetooth/bt_rpmsghci.h index f34b0bd6afe..806eed64e8e 100644 --- a/drivers/wireless/bluetooth/bt_rpmsghci.h +++ b/drivers/wireless/bluetooth/bt_rpmsghci.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_rpmsghci.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_rpmsghci_server.c b/drivers/wireless/bluetooth/bt_rpmsghci_server.c index c7cde082f47..d373c38a6b4 100644 --- a/drivers/wireless/bluetooth/bt_rpmsghci_server.c +++ b/drivers/wireless/bluetooth/bt_rpmsghci_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_rpmsghci_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_slip.c b/drivers/wireless/bluetooth/bt_slip.c index 08a857f0eb5..b886a4b2949 100644 --- a/drivers/wireless/bluetooth/bt_slip.c +++ b/drivers/wireless/bluetooth/bt_slip.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_slip.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_uart.c b/drivers/wireless/bluetooth/bt_uart.c index d53c9616fd4..8324e2e2c16 100644 --- a/drivers/wireless/bluetooth/bt_uart.c +++ b/drivers/wireless/bluetooth/bt_uart.c @@ -1,8 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_uart.c * - * Copyright (c) 2016, Intel Corporation - * All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2016, Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -57,14 +57,13 @@ ****************************************************************************/ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper, - FAR uint8_t *buffer, size_t buflen, - size_t minread) + FAR uint8_t *buffer, size_t buflen) { FAR const struct btuart_lowerhalf_s *lower; ssize_t ntotal = 0; ssize_t nread; - wlinfo("buflen %zu minread %zu\n", buflen, minread); + wlinfo("buflen %zu\n", buflen); DEBUGASSERT(upper != NULL && upper->lower != NULL); lower = upper->lower; @@ -73,20 +72,14 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper, while (buflen > 0) { nread = lower->read(lower, buffer, buflen); - if (nread == 0 || nread == -EINTR) + if (nread == -EINTR) { - wlwarn("Got zero bytes from UART\n"); - if (ntotal < minread) - { - continue; - } - - break; + continue; } - else if (nread < 0) + else if (nread <= 0) { wlwarn("Returned error %zd\n", nread); - return nread; + return ntotal > 0 ? ntotal : nread; } wlinfo("read %zd remaining %zu\n", nread, buflen - nread); @@ -102,87 +95,95 @@ static ssize_t btuart_read(FAR struct btuart_upperhalf_s *upper, static void btuart_rxwork(FAR void *arg) { FAR struct btuart_upperhalf_s *upper; - uint8_t data[CONFIG_BLUETOOTH_UART_RXBUFSIZE]; enum bt_buf_type_e type; - unsigned int hdrlen; unsigned int pktlen; ssize_t nread; union { struct bt_hci_evt_hdr_s evt; struct bt_hci_acl_hdr_s acl; + struct bt_hci_iso_hdr_s iso; } *hdr; upper = (FAR struct btuart_upperhalf_s *)arg; - /* Beginning of a new packet. - * Read the first byte to get the packet type. - */ + nread = btuart_read(upper, &upper->rxbuf[upper->rxlen], + sizeof(upper->rxbuf) - upper->rxlen); + if (nread <= 0) + { + wlerr("ERROR: btuart_read failed: %zd\n", nread); + return; + } + + upper->rxlen += (uint16_t)nread; - while (true) + while (upper->rxlen) { - nread = btuart_read(upper, data, H4_HEADER_SIZE, 0); - if (nread != H4_HEADER_SIZE) - { - wlwarn("WARNING: Unable to read H4 packet type: %zd\n", nread); - break; - } + hdr = (FAR void *)&upper->rxbuf[H4_HEADER_SIZE]; - if (data[0] == H4_EVT) + switch (upper->rxbuf[0]) { - hdrlen = sizeof(struct bt_hci_evt_hdr_s); - } - else if (data[0] == H4_ACL) - { - hdrlen = sizeof(struct bt_hci_acl_hdr_s); - } - else - { - wlerr("ERROR: Unknown H4 type %u\n", data[0]); - break; - } + case H4_EVT: + if (upper->rxlen < H4_HEADER_SIZE + + sizeof(struct bt_hci_evt_hdr_s)) + { + wlwarn("WARNING: Incomplete HCI event header\n"); + return; + } - nread = btuart_read(upper, data + H4_HEADER_SIZE, - hdrlen, hdrlen); - if (nread != hdrlen) - { - wlwarn("WARNING: Unable to read H4 packet header: %zd\n", nread); + type = BT_EVT; + pktlen = H4_HEADER_SIZE + + sizeof(struct bt_hci_evt_hdr_s) + hdr->evt.len; break; - } - hdr = (FAR void *)(data + H4_HEADER_SIZE); + case H4_ACL: + if (upper->rxlen < H4_HEADER_SIZE + + sizeof(struct bt_hci_acl_hdr_s)) + { + wlwarn("WARNING: Incomplete HCI ACL header\n"); + return; + } - if (data[0] == H4_EVT) - { - pktlen = hdr->evt.len; - type = BT_EVT; - } - else if (data[0] == H4_ACL) - { - pktlen = hdr->acl.len; type = BT_ACL_IN; - } - else - { - wlerr("ERROR: Unknown H4 type %u\n", data[0]); + pktlen = H4_HEADER_SIZE + + sizeof(struct bt_hci_acl_hdr_s) + hdr->acl.len; break; + + case H4_ISO: + if (upper->rxlen < H4_HEADER_SIZE + + sizeof(struct bt_hci_iso_hdr_s)) + { + wlwarn("WARNING: Incomplete HCI ISO header\n"); + return; + } + + type = BT_ISO_IN; + pktlen = H4_HEADER_SIZE + + sizeof(struct bt_hci_iso_hdr_s) + hdr->iso.len; + break; + + default: + wlerr("ERROR: Unknown H4 type %u\n", upper->rxbuf[0]); + return; } - nread = btuart_read(upper, data + H4_HEADER_SIZE + hdrlen, - pktlen, pktlen); - if (nread != pktlen) + if (upper->rxlen < pktlen) { - wlwarn("WARNING: Unable to read H4 packet: %zd\n", nread); - break; + wlwarn("WARNING: Incomplete packet: rxlen=%u, pktlen=%u\n", + upper->rxlen, pktlen); + return; } /* Pass buffer to the stack */ - BT_DUMP("Received", data, H4_HEADER_SIZE + hdrlen + pktlen); - bt_netdev_receive(&upper->dev, type, data + H4_HEADER_SIZE, - hdrlen + pktlen); + BT_DUMP("Received", upper->rxbuf, pktlen); + bt_netdev_receive(&upper->dev, type, &upper->rxbuf[H4_HEADER_SIZE], + pktlen - H4_HEADER_SIZE); + + upper->rxlen -= pktlen; + memmove(upper->rxbuf, upper->rxbuf + pktlen, upper->rxlen); } } diff --git a/drivers/wireless/bluetooth/bt_uart.h b/drivers/wireless/bluetooth/bt_uart.h index ff3cef12442..02a4b403184 100644 --- a/drivers/wireless/bluetooth/bt_uart.h +++ b/drivers/wireless/bluetooth/bt_uart.h @@ -1,8 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_uart.h * - * Copyright (c) 2016, Intel Corporation - * All rights reserved. + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2016, Intel Corporation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -75,6 +75,9 @@ struct btuart_upperhalf_s FAR const struct btuart_lowerhalf_s *lower; + uint16_t rxlen; + uint8_t rxbuf[CONFIG_BLUETOOTH_UART_RXBUFSIZE]; + /* Work queue support */ struct work_s work; diff --git a/drivers/wireless/bluetooth/bt_uart_bcm4343x.c b/drivers/wireless/bluetooth/bt_uart_bcm4343x.c index fca7969a8f4..78622ee0b54 100644 --- a/drivers/wireless/bluetooth/bt_uart_bcm4343x.c +++ b/drivers/wireless/bluetooth/bt_uart_bcm4343x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_uart_bcm4343x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_uart_cc2564.c b/drivers/wireless/bluetooth/bt_uart_cc2564.c index 79fa40468a8..23cca82670f 100644 --- a/drivers/wireless/bluetooth/bt_uart_cc2564.c +++ b/drivers/wireless/bluetooth/bt_uart_cc2564.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_uart_cc2564.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_uart_generic.c b/drivers/wireless/bluetooth/bt_uart_generic.c index 90255ae8c16..0f22f265587 100644 --- a/drivers/wireless/bluetooth/bt_uart_generic.c +++ b/drivers/wireless/bluetooth/bt_uart_generic.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_uart_generic.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/bluetooth/bt_uart_shim.c b/drivers/wireless/bluetooth/bt_uart_shim.c index fdd42bd66c7..73c07c69c54 100644 --- a/drivers/wireless/bluetooth/bt_uart_shim.c +++ b/drivers/wireless/bluetooth/bt_uart_shim.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/bluetooth/bt_uart_shim.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/cc1101.c b/drivers/wireless/cc1101.c index 0a1e0da7aad..7a936989bb0 100644 --- a/drivers/wireless/cc1101.c +++ b/drivers/wireless/cc1101.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/cc1101.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/gs2200m.c b/drivers/wireless/gs2200m.c index 42a62152401..e982093ea50 100644 --- a/drivers/wireless/gs2200m.c +++ b/drivers/wireless/gs2200m.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/gs2200m.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/CMakeLists.txt b/drivers/wireless/ieee80211/CMakeLists.txt index ec843bf0858..c94ff6b9a46 100644 --- a/drivers/wireless/ieee80211/CMakeLists.txt +++ b/drivers/wireless/ieee80211/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/ieee80211/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/ieee80211/Make.defs b/drivers/wireless/ieee80211/Make.defs index 91756f47a10..f13ddc03be6 100644 --- a/drivers/wireless/ieee80211/Make.defs +++ b/drivers/wireless/ieee80211/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/ieee80211/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt b/drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt index bdceda54e91..e8f5b8caf59 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt +++ b/drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/ieee80211/bcm43xxx/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/ieee80211/bcm43xxx/Make.defs b/drivers/wireless/ieee80211/bcm43xxx/Make.defs index 418e8a1a703..e5af0cb6936 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/Make.defs +++ b/drivers/wireless/ieee80211/bcm43xxx/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/ieee80211/bcm43xxx/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.c index de1f1b78eaa..61a36827f0b 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.h index 40f1d0cbee0..880abe5ccae 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_bdc.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c index f4c3ad292dd..0857d9fda59 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h index 0624a9cacd7..424d349b9fd 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_cdc.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_4301x.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_4301x.c index 5d5f2bf180d..dcfcc4a07e4 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_4301x.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_4301x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_4301x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43362.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43362.c index 12e9f682aa0..2c41c154520 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43362.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43362.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43362.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43438.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43438.c index 281de11f04d..e8a800377e0 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43438.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43438.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43438.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43455.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43455.c index 449bf6a4790..e0bcb31e5ab 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43455.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43455.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_43455.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_data.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_data.h index 703e7bbf27f..4f7c23e3bfe 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_data.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_data.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_chip_data.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.c index 5991e1fb242..08352049cca 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_core.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h index c6377ab192b..0893778e676 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_core.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c index bdf5cbd74ac..064e0bb1ac8 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h index f405ce5c681..f11e25f4ff2 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c index 501979674ed..1b56a207cdf 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_gpio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c index e4397d80529..2c94554d3b6 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.h index 06b00d9a167..52d585ff0f5 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c index ed2768c0822..afec9ae4b75 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h index 06ae58fda2f..39c1ecd7a51 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_gspi_f2_frame.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.c index 7cc7add2532..5ce09213688 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h index 5710356d55e..8a5bcda284a 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_interface.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_ioctl.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_ioctl.h index 9de31747f83..be78ae2e331 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_ioctl.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_ioctl.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_ioctl.h - * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright (c) 2015 Broadcom. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -22,7 +24,6 @@ * Broadcom wireless connectivity products and solely for the purpose of * enabling the functionalities of such Broadcom products. * - * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING, * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c index 3583f980eb4..01f192e6c7c 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h index 33ce35c9a0e..a46c906bd5a 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_netdev.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c index d268a09d679..dd9a052f40a 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.h index 8ebe9abaed6..4ec81f4e99d 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_core.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_core.h index cd86afe8731..af0ac97c572 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_core.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_core.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_core.h * + * SPDX-License-Identifier: ISC + * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_regs.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_regs.h index 8e03fc814da..b14d3c4d21f 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_regs.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_regs.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_sdio_regs.h * + * SPDX-License-Identifier: ISC + * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c index fd84cf6f72c..624aa93f8f4 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.h index 057308c16fc..40ace231356 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_sdpcm.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.c b/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.c index dd39f819b9a..5ad2ad14a86 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.c +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h b/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h index 0c58a18f61d..d1eef04bd7b 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h +++ b/drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/bcmf_utils.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/cyw_chip_43439.c b/drivers/wireless/ieee80211/bcm43xxx/cyw_chip_43439.c index 828e72e5bf1..bbb5fb3243c 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/cyw_chip_43439.c +++ b/drivers/wireless/ieee80211/bcm43xxx/cyw_chip_43439.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/cyw_chip_43439.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee80211/bcm43xxx/cyw_reg_def.h b/drivers/wireless/ieee80211/bcm43xxx/cyw_reg_def.h index d309a1bf7a9..4ec8fcb2d63 100644 --- a/drivers/wireless/ieee80211/bcm43xxx/cyw_reg_def.h +++ b/drivers/wireless/ieee80211/bcm43xxx/cyw_reg_def.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee80211/bcm43xxx/cyw_reg_def.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/CMakeLists.txt b/drivers/wireless/ieee802154/CMakeLists.txt index 7e783407168..c3384f8a114 100644 --- a/drivers/wireless/ieee802154/CMakeLists.txt +++ b/drivers/wireless/ieee802154/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/ieee802154/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/ieee802154/Make.defs b/drivers/wireless/ieee802154/Make.defs index f7507cdc8d0..37a434668d2 100644 --- a/drivers/wireless/ieee802154/Make.defs +++ b/drivers/wireless/ieee802154/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/ieee802154/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt b/drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt index c903232cf04..478ac9877ae 100644 --- a/drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt +++ b/drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/ieee802154/at86rf23x/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/ieee802154/at86rf23x/Make.defs b/drivers/wireless/ieee802154/at86rf23x/Make.defs index c33419d87e7..e9fb04b5f44 100644 --- a/drivers/wireless/ieee802154/at86rf23x/Make.defs +++ b/drivers/wireless/ieee802154/at86rf23x/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/ieee802154/at86rf23x/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c index c9c2f42b9b1..a8033844055 100644 --- a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c +++ b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/at86rf23x/at86rf23x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.h b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.h index c1ad0dc9c18..400fa92aa34 100644 --- a/drivers/wireless/ieee802154/at86rf23x/at86rf23x.h +++ b/drivers/wireless/ieee802154/at86rf23x/at86rf23x.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/at86rf23x/at86rf23x.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt b/drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt index d0ef694da6d..6ea351fb539 100644 --- a/drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt +++ b/drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/ieee802154/mrf24j40/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/ieee802154/mrf24j40/Make.defs b/drivers/wireless/ieee802154/mrf24j40/Make.defs index 4ead845a9b9..a06d7359e83 100644 --- a/drivers/wireless/ieee802154/mrf24j40/Make.defs +++ b/drivers/wireless/ieee802154/mrf24j40/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/ieee802154/mrf24j40/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c b/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c index 567b5ceebd5..0d322e7abae 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40.h b/drivers/wireless/ieee802154/mrf24j40/mrf24j40.h index 5a3db74f228..fcd2c368b43 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40.h +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.c b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.c index b49d611df9c..864a7dc0d52 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.c +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.h b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.h index fdc85122f11..0eeff63076f 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.h +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_getset.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_interrupt.c b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_interrupt.c index 3bb937defea..5bfad655254 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_interrupt.c +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_interrupt.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_interrupt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.c b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.c index ee31c028865..89e817ebd36 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.c +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.h b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.h index 52ec787cddf..3bddc91cba2 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.h +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_radif.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_reg.h b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_reg.h index b538c0735cd..a4723354fec 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_reg.h +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_reg.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_reg.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.c b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.c index 2bd30d74694..98f05fc3845 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.c +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.h b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.h index c28ef99b6df..8e9a202a5fb 100644 --- a/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.h +++ b/drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/mrf24j40/mrf24j40_regops.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/xbee/CMakeLists.txt b/drivers/wireless/ieee802154/xbee/CMakeLists.txt index 62f8d33f66b..8dfd2de8a5f 100644 --- a/drivers/wireless/ieee802154/xbee/CMakeLists.txt +++ b/drivers/wireless/ieee802154/xbee/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/ieee802154/xbee/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/ieee802154/xbee/Make.defs b/drivers/wireless/ieee802154/xbee/Make.defs index 3b060074280..fab81d061d5 100644 --- a/drivers/wireless/ieee802154/xbee/Make.defs +++ b/drivers/wireless/ieee802154/xbee/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/ieee802154/xbee/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/xbee/xbee.c b/drivers/wireless/ieee802154/xbee/xbee.c index cf8c522d66c..29a65eadbd1 100644 --- a/drivers/wireless/ieee802154/xbee/xbee.c +++ b/drivers/wireless/ieee802154/xbee/xbee.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/xbee/xbee.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/xbee/xbee.h b/drivers/wireless/ieee802154/xbee/xbee.h index d42836eb8a7..1302f6e7dc3 100644 --- a/drivers/wireless/ieee802154/xbee/xbee.h +++ b/drivers/wireless/ieee802154/xbee/xbee.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/xbee/xbee.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/xbee/xbee_ioctl.c b/drivers/wireless/ieee802154/xbee/xbee_ioctl.c index bc3e7423ef9..5088d4e3ac9 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_ioctl.c +++ b/drivers/wireless/ieee802154/xbee/xbee_ioctl.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/xbee/xbee_ioctl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/xbee/xbee_mac.c b/drivers/wireless/ieee802154/xbee/xbee_mac.c index 3fd8032573e..8911993ca24 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_mac.c +++ b/drivers/wireless/ieee802154/xbee/xbee_mac.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/xbee/xbee_mac.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/xbee/xbee_mac.h b/drivers/wireless/ieee802154/xbee/xbee_mac.h index de1194ffa17..6521c3e15b4 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_mac.h +++ b/drivers/wireless/ieee802154/xbee/xbee_mac.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/xbee/xbee_mac.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/ieee802154/xbee/xbee_netdev.c b/drivers/wireless/ieee802154/xbee/xbee_netdev.c index b6106d0c5fa..46ee9b69d99 100644 --- a/drivers/wireless/ieee802154/xbee/xbee_netdev.c +++ b/drivers/wireless/ieee802154/xbee/xbee_netdev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/ieee802154/xbee/xbee_netdev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/lpwan/CMakeLists.txt b/drivers/wireless/lpwan/CMakeLists.txt index fc506637d48..6f924b9ab8d 100644 --- a/drivers/wireless/lpwan/CMakeLists.txt +++ b/drivers/wireless/lpwan/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/lpwan/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/lpwan/Make.defs b/drivers/wireless/lpwan/Make.defs index 0ca5d3dfe83..023bff806f2 100644 --- a/drivers/wireless/lpwan/Make.defs +++ b/drivers/wireless/lpwan/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/lpwan/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/lpwan/sx127x/CMakeLists.txt b/drivers/wireless/lpwan/sx127x/CMakeLists.txt index ca540a2267e..292b4dad505 100644 --- a/drivers/wireless/lpwan/sx127x/CMakeLists.txt +++ b/drivers/wireless/lpwan/sx127x/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/lpwan/sx127x/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/lpwan/sx127x/Make.defs b/drivers/wireless/lpwan/sx127x/Make.defs index 3d85ef7a17a..4037713897c 100644 --- a/drivers/wireless/lpwan/sx127x/Make.defs +++ b/drivers/wireless/lpwan/sx127x/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/lpwan/sx127x/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/lpwan/sx127x/sx127x.c b/drivers/wireless/lpwan/sx127x/sx127x.c index b576f6ef8de..655d21c983c 100644 --- a/drivers/wireless/lpwan/sx127x/sx127x.c +++ b/drivers/wireless/lpwan/sx127x/sx127x.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/lpwan/sx127x/sx127x.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/lpwan/sx127x/sx127x.h b/drivers/wireless/lpwan/sx127x/sx127x.h index 07d67eb82e9..4db4fb8b838 100644 --- a/drivers/wireless/lpwan/sx127x/sx127x.h +++ b/drivers/wireless/lpwan/sx127x/sx127x.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/lpwan/sx127x/sx127x.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/nrf24l01.c b/drivers/wireless/nrf24l01.c index 12c2a3937e8..716386f7e97 100644 --- a/drivers/wireless/nrf24l01.c +++ b/drivers/wireless/nrf24l01.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/nrf24l01.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/nrf24l01.h b/drivers/wireless/nrf24l01.h index 46bc6c0b798..bdaa5489152 100644 --- a/drivers/wireless/nrf24l01.h +++ b/drivers/wireless/nrf24l01.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/nrf24l01.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/CMakeLists.txt b/drivers/wireless/spirit/CMakeLists.txt index 8608c4a5bfc..17a9e2ac166 100644 --- a/drivers/wireless/spirit/CMakeLists.txt +++ b/drivers/wireless/spirit/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/spirit/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/spirit/Make.defs b/drivers/wireless/spirit/Make.defs index a4d6117f30e..b7f635f8f57 100644 --- a/drivers/wireless/spirit/Make.defs +++ b/drivers/wireless/spirit/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/spirit/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/drivers/CMakeLists.txt b/drivers/wireless/spirit/drivers/CMakeLists.txt index e2ed2dbac56..9f287eabb84 100644 --- a/drivers/wireless/spirit/drivers/CMakeLists.txt +++ b/drivers/wireless/spirit/drivers/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/spirit/drivers/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/spirit/drivers/Make.defs b/drivers/wireless/spirit/drivers/Make.defs index 0f2207731bd..30d07327de5 100644 --- a/drivers/wireless/spirit/drivers/Make.defs +++ b/drivers/wireless/spirit/drivers/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/spirit/drivers/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/drivers/spirit_netdev.c b/drivers/wireless/spirit/drivers/spirit_netdev.c index ccc244d0f69..975024a6345 100644 --- a/drivers/wireless/spirit/drivers/spirit_netdev.c +++ b/drivers/wireless/spirit/drivers/spirit_netdev.c @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/spirit/drivers/spirit_netdev.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/include/Make.defs b/drivers/wireless/spirit/include/Make.defs index 2c2b8b4fc65..637018eef6c 100644 --- a/drivers/wireless/spirit/include/Make.defs +++ b/drivers/wireless/spirit/include/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/spirit/include/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/include/spirit_aes.h b/drivers/wireless/spirit/include/spirit_aes.h index 588869d6adc..18182b2feba 100644 --- a/drivers/wireless/spirit/include/spirit_aes.h +++ b/drivers/wireless/spirit/include/spirit_aes.h @@ -1,8 +1,9 @@ /**************************************************************************** * drivers/wireless/spirit/include/spirit_aes.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_calibration.h b/drivers/wireless/spirit/include/spirit_calibration.h index 9bc5775190c..015ef8ba39f 100644 --- a/drivers/wireless/spirit/include/spirit_calibration.h +++ b/drivers/wireless/spirit/include/spirit_calibration.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_calibration.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_commands.h b/drivers/wireless/spirit/include/spirit_commands.h index 21bad5f0690..11c1b150501 100644 --- a/drivers/wireless/spirit/include/spirit_commands.h +++ b/drivers/wireless/spirit/include/spirit_commands.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_commands.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_config.h b/drivers/wireless/spirit/include/spirit_config.h index 22d9beb3ad6..60deeeeebd0 100644 --- a/drivers/wireless/spirit/include/spirit_config.h +++ b/drivers/wireless/spirit/include/spirit_config.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_config.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_csma.h b/drivers/wireless/spirit/include/spirit_csma.h index 56543c7e6c2..b8921c62019 100644 --- a/drivers/wireless/spirit/include/spirit_csma.h +++ b/drivers/wireless/spirit/include/spirit_csma.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_csma.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_directrf.h b/drivers/wireless/spirit/include/spirit_directrf.h index 960b8be8e5b..c75be13d37f 100644 --- a/drivers/wireless/spirit/include/spirit_directrf.h +++ b/drivers/wireless/spirit/include/spirit_directrf.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_directrf.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_general.h b/drivers/wireless/spirit/include/spirit_general.h index 0727e44dd32..a60623f34ec 100644 --- a/drivers/wireless/spirit/include/spirit_general.h +++ b/drivers/wireless/spirit/include/spirit_general.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_general.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_gpio.h b/drivers/wireless/spirit/include/spirit_gpio.h index baa6918deb0..d7844d48db9 100644 --- a/drivers/wireless/spirit/include/spirit_gpio.h +++ b/drivers/wireless/spirit/include/spirit_gpio.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_gpio.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_irq.h b/drivers/wireless/spirit/include/spirit_irq.h index f0cd0ba40b3..45bd898224b 100644 --- a/drivers/wireless/spirit/include/spirit_irq.h +++ b/drivers/wireless/spirit/include/spirit_irq.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_irq.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_linearfifo.h b/drivers/wireless/spirit/include/spirit_linearfifo.h index c4c226c15f2..85430be338f 100644 --- a/drivers/wireless/spirit/include/spirit_linearfifo.h +++ b/drivers/wireless/spirit/include/spirit_linearfifo.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_linearfifo.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_management.h b/drivers/wireless/spirit/include/spirit_management.h index 8a6ad37fd5f..d12dafb3b93 100644 --- a/drivers/wireless/spirit/include/spirit_management.h +++ b/drivers/wireless/spirit/include/spirit_management.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_management.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_pktbasic.h b/drivers/wireless/spirit/include/spirit_pktbasic.h index 92502d9b185..4d46955012e 100644 --- a/drivers/wireless/spirit/include/spirit_pktbasic.h +++ b/drivers/wireless/spirit/include/spirit_pktbasic.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_pktbasic.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_pktcommon.h b/drivers/wireless/spirit/include/spirit_pktcommon.h index 762519a4449..81e60ea1cc0 100644 --- a/drivers/wireless/spirit/include/spirit_pktcommon.h +++ b/drivers/wireless/spirit/include/spirit_pktcommon.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_pktcommon.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_pktmbus.h b/drivers/wireless/spirit/include/spirit_pktmbus.h index 3907dfff5a9..ad04fcf2c9a 100644 --- a/drivers/wireless/spirit/include/spirit_pktmbus.h +++ b/drivers/wireless/spirit/include/spirit_pktmbus.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_pktmbus.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_pktstack.h b/drivers/wireless/spirit/include/spirit_pktstack.h index a0e66d693bd..a15edd13025 100644 --- a/drivers/wireless/spirit/include/spirit_pktstack.h +++ b/drivers/wireless/spirit/include/spirit_pktstack.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_pktstack.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_qi.h b/drivers/wireless/spirit/include/spirit_qi.h index 1c75a874687..64fb8b6a16f 100644 --- a/drivers/wireless/spirit/include/spirit_qi.h +++ b/drivers/wireless/spirit/include/spirit_qi.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_qi.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_radio.h b/drivers/wireless/spirit/include/spirit_radio.h index 7ceed89ec0c..8fef9a2231c 100644 --- a/drivers/wireless/spirit/include/spirit_radio.h +++ b/drivers/wireless/spirit/include/spirit_radio.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_radio.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_regs.h b/drivers/wireless/spirit/include/spirit_regs.h index 4637f502a32..7a1097491ba 100644 --- a/drivers/wireless/spirit/include/spirit_regs.h +++ b/drivers/wireless/spirit/include/spirit_regs.h @@ -1,8 +1,9 @@ /**************************************************************************** * drivers/wireless/spirit/include/spirit_regs.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_spi.h b/drivers/wireless/spirit/include/spirit_spi.h index d5d380a6eb7..5cf1f0927dc 100644 --- a/drivers/wireless/spirit/include/spirit_spi.h +++ b/drivers/wireless/spirit/include/spirit_spi.h @@ -1,6 +1,8 @@ /**************************************************************************** * drivers/wireless/spirit/include/spirit_spi.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/include/spirit_timer.h b/drivers/wireless/spirit/include/spirit_timer.h index 3298c29e57c..8e8f086dd5f 100644 --- a/drivers/wireless/spirit/include/spirit_timer.h +++ b/drivers/wireless/spirit/include/spirit_timer.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_timer.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/include/spirit_types.h b/drivers/wireless/spirit/include/spirit_types.h index 65670818b5d..0684486e2ca 100644 --- a/drivers/wireless/spirit/include/spirit_types.h +++ b/drivers/wireless/spirit/include/spirit_types.h @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/include/spirit_types.h * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/CMakeLists.txt b/drivers/wireless/spirit/lib/CMakeLists.txt index 51a62b8d765..2c618be6ca5 100644 --- a/drivers/wireless/spirit/lib/CMakeLists.txt +++ b/drivers/wireless/spirit/lib/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # drivers/wireless/spirit/lib/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/drivers/wireless/spirit/lib/Make.defs b/drivers/wireless/spirit/lib/Make.defs index 9fa16161ff2..ed28c64624b 100644 --- a/drivers/wireless/spirit/lib/Make.defs +++ b/drivers/wireless/spirit/lib/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # drivers/wireless/spirit/lib/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/lib/spirit_aes.c b/drivers/wireless/spirit/lib/spirit_aes.c index 27b97ddbe41..aa67801ad10 100644 --- a/drivers/wireless/spirit/lib/spirit_aes.c +++ b/drivers/wireless/spirit/lib/spirit_aes.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_aes.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_calibration.c b/drivers/wireless/spirit/lib/spirit_calibration.c index e35984fd215..2b6b7bc752f 100644 --- a/drivers/wireless/spirit/lib/spirit_calibration.c +++ b/drivers/wireless/spirit/lib/spirit_calibration.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_calibration.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_csma.c b/drivers/wireless/spirit/lib/spirit_csma.c index 2f09e0f4fac..5bf8d485548 100644 --- a/drivers/wireless/spirit/lib/spirit_csma.c +++ b/drivers/wireless/spirit/lib/spirit_csma.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_csma.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_directrf.c b/drivers/wireless/spirit/lib/spirit_directrf.c index dd993ab989d..48d41d73e87 100644 --- a/drivers/wireless/spirit/lib/spirit_directrf.c +++ b/drivers/wireless/spirit/lib/spirit_directrf.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_directrf.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_general.c b/drivers/wireless/spirit/lib/spirit_general.c index ed6c3eb472e..918ad11e525 100644 --- a/drivers/wireless/spirit/lib/spirit_general.c +++ b/drivers/wireless/spirit/lib/spirit_general.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_general.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_gpio.c b/drivers/wireless/spirit/lib/spirit_gpio.c index adee0ccd44a..640a14411c6 100644 --- a/drivers/wireless/spirit/lib/spirit_gpio.c +++ b/drivers/wireless/spirit/lib/spirit_gpio.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_gpio.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_irq.c b/drivers/wireless/spirit/lib/spirit_irq.c index a52ac44ce98..a7389c5c711 100644 --- a/drivers/wireless/spirit/lib/spirit_irq.c +++ b/drivers/wireless/spirit/lib/spirit_irq.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_irq.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_linearfifo.c b/drivers/wireless/spirit/lib/spirit_linearfifo.c index d675e289fcb..86c76bd810c 100644 --- a/drivers/wireless/spirit/lib/spirit_linearfifo.c +++ b/drivers/wireless/spirit/lib/spirit_linearfifo.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_linearfifo.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_management.c b/drivers/wireless/spirit/lib/spirit_management.c index 54ca112ca37..8b48d6a841c 100644 --- a/drivers/wireless/spirit/lib/spirit_management.c +++ b/drivers/wireless/spirit/lib/spirit_management.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_management.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_pktbasic.c b/drivers/wireless/spirit/lib/spirit_pktbasic.c index e2c41e1368c..89fd3070304 100644 --- a/drivers/wireless/spirit/lib/spirit_pktbasic.c +++ b/drivers/wireless/spirit/lib/spirit_pktbasic.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_pktbasic.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_pktcommon.c b/drivers/wireless/spirit/lib/spirit_pktcommon.c index 24f8ef20b67..0be9b4910a4 100644 --- a/drivers/wireless/spirit/lib/spirit_pktcommon.c +++ b/drivers/wireless/spirit/lib/spirit_pktcommon.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_pktcommon.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_pktmbus.c b/drivers/wireless/spirit/lib/spirit_pktmbus.c index 0b0f79e0d0f..49effbef895 100644 --- a/drivers/wireless/spirit/lib/spirit_pktmbus.c +++ b/drivers/wireless/spirit/lib/spirit_pktmbus.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_pktmbus.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_pktstack.c b/drivers/wireless/spirit/lib/spirit_pktstack.c index 28a130ae10d..2881cc0d510 100644 --- a/drivers/wireless/spirit/lib/spirit_pktstack.c +++ b/drivers/wireless/spirit/lib/spirit_pktstack.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_pktstack.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_qi.c b/drivers/wireless/spirit/lib/spirit_qi.c index ceb1f4b82f4..e5f04c778dc 100644 --- a/drivers/wireless/spirit/lib/spirit_qi.c +++ b/drivers/wireless/spirit/lib/spirit_qi.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_qi.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_radio.c b/drivers/wireless/spirit/lib/spirit_radio.c index f33b067059e..7616ffff6b5 100644 --- a/drivers/wireless/spirit/lib/spirit_radio.c +++ b/drivers/wireless/spirit/lib/spirit_radio.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_radio.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/drivers/wireless/spirit/lib/spirit_spi.c b/drivers/wireless/spirit/lib/spirit_spi.c index 2c7302d381e..88fa9609e2b 100644 --- a/drivers/wireless/spirit/lib/spirit_spi.c +++ b/drivers/wireless/spirit/lib/spirit_spi.c @@ -1,6 +1,8 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_spi.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/drivers/wireless/spirit/lib/spirit_timer.c b/drivers/wireless/spirit/lib/spirit_timer.c index 532bb2459dd..5c241033531 100644 --- a/drivers/wireless/spirit/lib/spirit_timer.c +++ b/drivers/wireless/spirit/lib/spirit_timer.c @@ -1,8 +1,9 @@ /****************************************************************************** * drivers/wireless/spirit/lib/spirit_timer.c * - * Copyright(c) 2015 STMicroelectronics - * Author: VMA division - AMS + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: Copyright(c) 2015 STMicroelectronics + * SPDX-FileContributor: Author: VMA division - AMS * Version 3.2.2 08-July-2015 * * Redistribution and use in source and binary forms, with or without diff --git a/fs/CMakeLists.txt b/fs/CMakeLists.txt index abdaa0f078d..eced35e6f71 100644 --- a/fs/CMakeLists.txt +++ b/fs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/Kconfig b/fs/Kconfig index 1484fea5056..1e72530bd05 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -136,6 +136,7 @@ config FS_REFCOUNT source "fs/vfs/Kconfig" source "fs/aio/Kconfig" +source "fs/archivefs/Kconfig" source "fs/semaphore/Kconfig" source "fs/event/Kconfig" source "fs/mqueue/Kconfig" @@ -163,3 +164,4 @@ source "fs/zipfs/Kconfig" source "fs/mnemofs/Kconfig" source "fs/yaffs/Kconfig" source "fs/v9fs/Kconfig" +source "fs/lrofs/Kconfig" diff --git a/libs/libc/bin/CMakeLists.txt b/fs/Make.defs similarity index 96% rename from libs/libc/bin/CMakeLists.txt rename to fs/Make.defs index fea4d0ab13c..00739fab5d4 100644 --- a/libs/libc/bin/CMakeLists.txt +++ b/fs/Make.defs @@ -1,5 +1,5 @@ # ############################################################################## -# libs/libc/bin/CMakeLists.txt +# fs/Make.defs # # SPDX-License-Identifier: Apache-2.0 # diff --git a/fs/Makefile b/fs/Makefile index 55098d82fdc..76392c35b83 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -1,6 +1,8 @@ ############################################################################ # fs/Makefile # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The @@ -44,6 +46,7 @@ include event/Make.defs ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) +include archivefs/Make.defs include mount/Make.defs include partition/Make.defs include fat/Make.defs @@ -67,6 +70,7 @@ include yaffs/Make.defs include mnemofs/Make.defs include v9fs/Make.defs include notify/Make.defs +include lrofs/Make.defs endif CFLAGS += ${INCDIR_PREFIX}$(TOPDIR)$(DELIM)fs diff --git a/fs/aio/CMakeLists.txt b/fs/aio/CMakeLists.txt index 5c5bd47152d..835a379438d 100644 --- a/fs/aio/CMakeLists.txt +++ b/fs/aio/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/aio/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/aio/Make.defs b/fs/aio/Make.defs index 4dd8b22c6f2..48862477e49 100644 --- a/fs/aio/Make.defs +++ b/fs/aio/Make.defs @@ -1,15 +1,17 @@ ############################################################################ # fs/aio/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The # ASF licenses this file to you under the Apache License, Version 2.0 (the # "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at - +# # http://www.apache.org/licenses/LICENSE-2.0 - +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the diff --git a/fs/aio/aio_cancel.c b/fs/aio/aio_cancel.c index a3a6ca9cd92..ceb31dd4a41 100644 --- a/fs/aio/aio_cancel.c +++ b/fs/aio/aio_cancel.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aio_cancel.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/aio/aio_fsync.c b/fs/aio/aio_fsync.c index 9c2075a6c17..28ed46a46ea 100644 --- a/fs/aio/aio_fsync.c +++ b/fs/aio/aio_fsync.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aio_fsync.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/aio/aio_initialize.c b/fs/aio/aio_initialize.c index b611e4289ad..8364cbc33de 100644 --- a/fs/aio/aio_initialize.c +++ b/fs/aio/aio_initialize.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aio_initialize.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/aio/aio_queue.c b/fs/aio/aio_queue.c index 719d40fd523..67b00c2caa0 100644 --- a/fs/aio/aio_queue.c +++ b/fs/aio/aio_queue.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aio_queue.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/aio/aio_read.c b/fs/aio/aio_read.c index 468934bf804..a472e5cdd18 100644 --- a/fs/aio/aio_read.c +++ b/fs/aio/aio_read.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aio_read.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/aio/aio_signal.c b/fs/aio/aio_signal.c index f0ba64a8c61..d41224c31d3 100644 --- a/fs/aio/aio_signal.c +++ b/fs/aio/aio_signal.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aio_signal.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/aio/aio_write.c b/fs/aio/aio_write.c index 829d1de0192..9677894a0b6 100644 --- a/fs/aio/aio_write.c +++ b/fs/aio/aio_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aio_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/aio/aioc_contain.c b/fs/aio/aioc_contain.c index 42cb5424a0f..283d5b01c56 100644 --- a/fs/aio/aioc_contain.c +++ b/fs/aio/aioc_contain.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/aio/aioc_contain.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/libs/libc/kbin/CMakeLists.txt b/fs/archivefs/CMakeLists.txt similarity index 80% rename from libs/libc/kbin/CMakeLists.txt rename to fs/archivefs/CMakeLists.txt index 50be8cb28f4..5f17eae141e 100644 --- a/libs/libc/kbin/CMakeLists.txt +++ b/fs/archivefs/CMakeLists.txt @@ -1,7 +1,5 @@ # ############################################################################## -# libs/libc/kbin/CMakeLists.txt -# -# SPDX-License-Identifier: Apache-2.0 +# fs/archivefs/CMakeLists.txt # # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for @@ -19,4 +17,11 @@ # the License. # # ############################################################################## +if(NOT CONFIG_DISABLE_MOUNTPOINT) + if(CONFIG_FS_ARCHIVEFS) + + target_sources(fs PRIVATE archivefs.c) + target_include_directories(fs PRIVATE libarchive/libarchive/libarchive) + endif() +endif() diff --git a/fs/archivefs/Kconfig b/fs/archivefs/Kconfig new file mode 100644 index 00000000000..f56367b86cb --- /dev/null +++ b/fs/archivefs/Kconfig @@ -0,0 +1,86 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config FS_ARCHIVEFS + bool "ARCHIVE File System" + default n + +if FS_ARCHIVEFS + +config FS_ARCHIVEFS_BUFFER_SIZE + int "Buffer size" + default 32768 + ---help--- + libarchive requires a buffer to read and write data. + +config FS_ARCHIVEFS_FORMAT_ALL + bool "support archive all format" + default n + ---help--- + All format support will increase binary size. +if !FS_ARCHIVEFS_FORMAT_ALL +config FS_ARCHIVEFS_FORMAT_ZIP + bool "support archive xar format" + default y + +config FS_ARCHIVEFS_FORMAT_7ZIP + bool "support archive 7zip format" + default n + +config FS_ARCHIVEFS_FORMAT_AR + bool "support archive ar format" + default n + +config FS_ARCHIVEFS_FORMAT_CAB + bool "support archive cab format" + default n + +config FS_ARCHIVEFS_FORMAT_CPIO + bool "support archive cpio format" + default n + +config FS_ARCHIVEFS_FORMAT_EMTY + bool "support archive emty format" + default n + +config FS_ARCHIVEFS_FORMAT_ISO9660 + bool "support archive iso9660 format" + default n + +config FS_ARCHIVEFS_FORMAT_LHA + bool "support archive lha format" + default n + +config FS_ARCHIVEFS_FORMAT_MTREE + bool "support archive mtree format" + default n + +config FS_ARCHIVEFS_FORMAT_RAR + bool "support archive rar format" + default n + +config FS_ARCHIVEFS_FORMAT_RAR_V5 + bool "support archive rar_v5 format" + default n + +config FS_ARCHIVEFS_FORMAT_RAW + bool "support archive raw format" + default n + +config FS_ARCHIVEFS_FORMAT_TAR + bool "support archive raw format" + default n + +config FS_ARCHIVEFS_FORMAT_WARC + bool "support archive warc format" + default n + +config FS_ARCHIVEFS_FORMAT_XAR + bool "support archive xar format" + default n + +endif + +endif diff --git a/mm/bin/CMakeLists.txt b/fs/archivefs/Make.defs similarity index 80% rename from mm/bin/CMakeLists.txt rename to fs/archivefs/Make.defs index feecd2a0a17..b014d24fa4f 100644 --- a/mm/bin/CMakeLists.txt +++ b/fs/archivefs/Make.defs @@ -1,7 +1,5 @@ ############################################################################ -# mm/bin/CMakeLists.txt -# -# SPDX-License-Identifier: Apache-2.0 +# fs/archivefs/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,4 +16,15 @@ # License for the specific language governing permissions and limitations # under the License. # -########################################################################### +############################################################################ + +ifeq ($(CONFIG_FS_ARCHIVEFS),y) + +CFLAGS += ${INCDIR_PREFIX}archivefs/libarchive/libarchive/libarchive + +CSRCS += archivefs.c + +DEPPATH += --dep-path archivefs +VPATH += :archivefs + +endif diff --git a/fs/archivefs/archivefs.c b/fs/archivefs/archivefs.c new file mode 100644 index 00000000000..acef047197a --- /dev/null +++ b/fs/archivefs/archivefs.c @@ -0,0 +1,765 @@ +/**************************************************************************** + * fs/archivefs/archivefs.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "fs_heap.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct archivefs_priv_s +{ + FAR struct archive_entry *entry; + FAR struct archive *a; + + /* callback data */ + + struct file file; + char buffer[CONFIG_FS_ARCHIVEFS_BUFFER_SIZE]; + + /* seek data */ + + FAR char *seekbuf; + mutex_t lock; +}; + +struct archivefs_dir_s +{ + struct fs_dirent_s dir; + FAR struct archivefs_priv_s *priv; +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int archivefs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode); +static int archivefs_close(FAR struct file *filep); +static ssize_t archivefs_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static off_t archivefs_seek(FAR struct file *filep, off_t offset, + int whence); +static int archivefs_dup(FAR const struct file *oldp, + FAR struct file *newp); +static int archivefs_fstat(FAR const struct file *filep, + FAR struct stat *buf); +static int archivefs_opendir(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct fs_dirent_s **dir); +static int archivefs_closedir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); +static int archivefs_readdir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir, + FAR struct dirent *entry); +static int archivefs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); +static int archivefs_statfs(FAR struct inode *mountpt, + FAR struct statfs *buf); +static int archivefs_stat(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct stat *buf); +static int archivefs_bind(FAR struct inode *driver, FAR const void *data, + FAR void **handle); +static int archivefs_unbind(FAR void *handle, FAR struct inode **driver, + unsigned int flags); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +const struct mountpt_operations g_archivefs_operations = +{ + archivefs_open, /* open */ + archivefs_close, /* close */ + archivefs_read, /* read */ + NULL, /* write */ + archivefs_seek, /* seek */ + NULL, /* ioctl */ + NULL, /* mmap */ + NULL, /* truncate */ + NULL, /* poll */ + NULL, /* sync */ + archivefs_dup, /* dup */ + archivefs_fstat, /* fstat */ + NULL, /* fchstat */ + + archivefs_opendir, /* opendir */ + archivefs_closedir, /* closedir */ + archivefs_readdir, /* readdir */ + archivefs_rewinddir, /* rewinddir */ + + archivefs_bind, /* bind */ + archivefs_unbind, /* unbind */ + archivefs_statfs, /* statfs */ + + NULL, /* unlink */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* rename */ + archivefs_stat, /* stat */ + NULL /* chstat */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int archivefs_convert_result(int ret) +{ + switch (ret) + { + case ARCHIVE_RETRY: + return -EAGAIN; + case ARCHIVE_WARN: + return -ENOEXEC; + case ARCHIVE_FAILED: + return -EINVAL; + case ARCHIVE_FATAL: + return -EPERM; + + default: + return ret; + } +} + +static int archivefs_close_cb(FAR struct archive *a, FAR void *client_data) +{ + FAR struct archivefs_priv_s *priv = client_data; + + return file_close(&priv->file); +} + +static la_ssize_t archivefs_read_cb(FAR struct archive *a, + FAR void *client_data, + FAR const void **buff) +{ + FAR struct archivefs_priv_s *priv = client_data; + ssize_t ret; + + ret = file_read(&priv->file, priv->buffer, + CONFIG_FS_ARCHIVEFS_BUFFER_SIZE); + if (ret <= 0) + { + return ret; + } + + *buff = priv->buffer; + return ret; +} + +static la_int64_t archivefs_seek_cb(FAR struct archive *a, + FAR void *client_data, + la_int64_t offset, int whence) +{ + FAR struct archivefs_priv_s *priv = client_data; + + return file_seek(&priv->file, offset, whence); +} + +static off_t archivefs_skip(FAR struct archivefs_priv_s *priv, off_t amount) +{ + off_t next = 0; + + if (priv->seekbuf == NULL) + { + priv->seekbuf = fs_heap_malloc(CONFIG_FS_ARCHIVEFS_BUFFER_SIZE); + if (priv->seekbuf == NULL) + { + return -ENOMEM; + } + } + + while (next < amount) + { + off_t remain = amount - next; + + if (remain > CONFIG_FS_ARCHIVEFS_BUFFER_SIZE) + { + remain = CONFIG_FS_ARCHIVEFS_BUFFER_SIZE; + } + + remain = archive_read_data(priv->a, priv->seekbuf, remain); + remain = archivefs_convert_result(remain); + if (remain <= 0) + { + return next ? next : remain; + } + + next += remain; + } + + return next; +} + +int archivefs_new(FAR const char *abspath, FAR const char *relpath, + FAR struct archivefs_priv_s **priv) +{ + FAR struct archivefs_priv_s *newp; + int ret = -ENOMEM; + + newp = fs_heap_zalloc(sizeof(struct archivefs_priv_s)); + if (newp == NULL) + { + return ret; + } + + newp->a = archive_read_new(); + if (newp->a == NULL) + { + ferr("ERROR: archive_read_new() failed\n"); + goto err_with_priv; + } + + nxmutex_init(&newp->lock); +#ifdef CONFIG_FS_ARCHIVEFS_FORMAT_ALL + ret = archivefs_convert_result(archive_read_support_format_all(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_all() failed\n"); + goto err_with_lock; + } +#else +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_ZIP + ret = archivefs_convert_result(archive_read_support_format_zip(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_zip() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_7ZIP + ret = archivefs_convert_result(archive_read_support_format_7zip(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_7zip() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_AR + ret = archivefs_convert_result(archive_read_support_format_ar(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_ar() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_CAB + ret = archivefs_convert_result(archive_read_support_format_cab(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_cab() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_CPIO + ret = archivefs_convert_result(archive_read_support_format_cpio(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_cpio() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_EMPTY + ret = archivefs_convert_result(archive_read_support_format_empty(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_empty() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_ISO9660 + ret = archive_read_support_format_iso9660(newp->a); + ret = archivefs_convert_result(ret); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_iso9660() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_LHA + ret = archivefs_convert_result(archive_read_support_format_lha(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_lha() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_MTREE + ret = archivefs_convert_result(archive_read_support_format_mtree(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_mtree() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_RAR + ret = archivefs_convert_result(archive_read_support_format_rar(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_rar() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_RAR_V5 + ret = archivefs_convert_result(archive_read_support_format_rar5(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_rar5() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_RAW + ret = archivefs_convert_result(archive_read_support_format_raw(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_raw() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_TAR + ret = archivefs_convert_result(archive_read_support_format_tar(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_tar() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_WARC + ret = archivefs_convert_result(archive_read_support_format_warc(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_warc() failed\n"); + goto err_with_lock; + } +# endif + +# ifdef CONFIG_FS_ARCHIVEFS_FORMAT_XAR + ret = archivefs_convert_result(archive_read_support_format_xar(newp->a)); + if (ret < 0) + { + ferr("ERROR: archive_read_support_format_xar() failed\n"); + goto err_with_lock; + } +# endif +#endif + + ret = file_open(&newp->file, abspath, O_RDONLY); + if (ret < 0) + { + ferr("ERROR: file_open() failed\n"); + goto err_with_lock; + } + + archive_read_set_seek_callback(newp->a, archivefs_seek_cb); + ret = archive_read_open(newp->a, newp, NULL, + archivefs_read_cb, archivefs_close_cb); + ret = archivefs_convert_result(ret); + if (ret < 0) + { + ferr("ERROR: archive_read_open() failed\n"); + goto err_with_open; + } + + newp->entry = archive_entry_new2(newp->a); + if (newp->entry == NULL) + { + ferr("ERROR: archive_entry_new2() failed\n"); + ret = -ENOMEM; + goto err_with_close; + } + + if (relpath == NULL) + { + /* Open root dir */ + + *priv = newp; + return OK; + } + + while (true) + { + ret = archive_read_next_header2(newp->a, newp->entry); + ret = archivefs_convert_result(ret); + if (ret < 0) + { + break; + } + + if (strcmp(archive_entry_pathname(newp->entry), relpath) == 0) + { + *priv = newp; + return OK; + } + } + + ret = -ENOENT; + archive_entry_free(newp->entry); +err_with_close: + archive_read_close(newp->a); +err_with_open: + file_close(&newp->file); +err_with_lock: + nxmutex_destroy(&newp->lock); + archive_read_free(newp->a); +err_with_priv: + fs_heap_free(newp); + return ret; +} + +static void archivefs_free(FAR struct archivefs_priv_s *priv) +{ + if (priv->seekbuf != NULL) + { + fs_heap_free(priv->seekbuf); + } + + archive_entry_free(priv->entry); + archive_read_close(priv->a); + nxmutex_destroy(&priv->lock); + archive_read_free(priv->a); + fs_heap_free(priv); +} + +static int archivefs_stats_common(FAR struct archivefs_priv_s *priv, + FAR struct stat *buf) +{ + FAR const struct stat *stat = archive_entry_stat(priv->entry); + + if (stat == NULL) + { + return -EINVAL; + } + + memcpy(buf, stat, sizeof(struct stat)); + return OK; +} + +/**************************************************************************** + * Archivefs methods + ****************************************************************************/ + +static int archivefs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode) +{ + FAR const char *abspath = filep->f_inode->i_private; + FAR struct archivefs_priv_s *priv; + int ret; + + ret = archivefs_new(abspath, relpath, &priv); + if (ret < 0) + { + return ret; + } + + filep->f_priv = priv; + return OK; +} + +static int archivefs_close(FAR struct file *filep) +{ + FAR struct archivefs_priv_s *priv = filep->f_priv; + + archivefs_free(priv); + return OK; +} + +static ssize_t archivefs_read(FAR struct file *filep, FAR char *buffer, + size_t buflen) +{ + FAR struct archivefs_priv_s *priv = filep->f_priv; + ssize_t ret; + + nxmutex_lock(&priv->lock); + ret = archivefs_convert_result(archive_read_data(priv->a, buffer, buflen)); + if (ret > 0) + { + filep->f_pos += ret; + } + + nxmutex_unlock(&priv->lock); + return ret; +} + +static off_t archivefs_seek(FAR struct file *filep, off_t offset, + int whence) +{ + FAR const char *abspath = filep->f_inode->i_private; + FAR struct archivefs_priv_s *priv = filep->f_priv; + FAR struct archivefs_priv_s *newp; + off_t ret = 0; + + nxmutex_lock(&priv->lock); + switch (whence) + { + case SEEK_SET: + break; + case SEEK_CUR: + offset += filep->f_pos; + break; + case SEEK_END: + offset += archive_entry_size(priv->entry); + break; + default: + ret = -EINVAL; + goto err_with_lock; + } + + if (filep->f_pos == offset) + { + goto err_with_lock; + } + else if (filep->f_pos > offset) + { + ret = archivefs_new(abspath, archive_entry_pathname(priv->entry), + &newp); + if (ret < 0) + { + goto err_with_lock; + } + + nxmutex_unlock(&priv->lock); + archivefs_free(priv); + priv = newp; + nxmutex_lock(&priv->lock); + filep->f_priv = newp; + filep->f_pos = 0; + } + + ret = archivefs_skip(priv, offset - filep->f_pos); + if (ret < 0) + { + goto err_with_lock; + } + + filep->f_pos += ret; + +err_with_lock: + nxmutex_unlock(&priv->lock); + return ret < 0 ? ret : filep->f_pos; +} + +static int archivefs_dup(FAR const struct file *oldp, FAR struct file *newp) +{ + FAR struct archivefs_priv_s *priv = oldp->f_priv; + FAR const char *relpath = archive_entry_pathname(priv->entry); + + return archivefs_open(newp, relpath, oldp->f_oflags, 0); +} + +static int archivefs_fstat(FAR const struct file *filep, + FAR struct stat *buf) +{ + FAR struct archivefs_priv_s *priv = filep->f_priv; + + return archivefs_stats_common(priv, buf); +} + +static int archivefs_opendir(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct fs_dirent_s **dir) +{ + FAR const char *abspath = mountpt->i_private; + FAR struct archivefs_dir_s *adir; + int ret; + + adir = fs_heap_zalloc(sizeof(struct archivefs_dir_s)); + if (adir == NULL) + { + return -ENOMEM; + } + + ret = archivefs_new(abspath, NULL, &adir->priv); + if (ret < 0) + { + fs_heap_free(adir); + return ret; + } + + *dir = &adir->dir; + return OK; +} + +static int archivefs_closedir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir) +{ + FAR struct archivefs_dir_s *adir = (FAR struct archivefs_dir_s *)dir; + + archivefs_free(adir->priv); + fs_heap_free(adir); + return OK; +} + +static int archivefs_readdir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir, + FAR struct dirent *entry) +{ + FAR struct archivefs_dir_s *adir = (FAR struct archivefs_dir_s *)dir; + FAR struct archivefs_priv_s *priv = adir->priv; + int ret; + + nxmutex_lock(&priv->lock); + ret = archive_read_next_header2(priv->a, priv->entry); + ret = archivefs_convert_result(ret); + if (ret < 0) + { + goto err; + } + + if (ret == ARCHIVE_EOF) + { + ret = EOF; + goto err; + } + + strlcpy(entry->d_name, archive_entry_pathname(priv->entry), + sizeof(entry->d_name)); +err: + nxmutex_unlock(&priv->lock); + return ret; +} + +static int archivefs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir) +{ + FAR struct archivefs_dir_s *adir = (FAR struct archivefs_dir_s *)dir; + FAR struct archivefs_priv_s *priv = adir->priv; + + nxmutex_lock(&priv->lock); + archive_entry_free(priv->entry); + priv->entry = archive_entry_new2(priv->a); + if (priv->entry == NULL) + { + nxmutex_unlock(&priv->lock); + return -ENOMEM; + } + + nxmutex_unlock(&priv->lock); + return OK; +} + +static int archivefs_statfs(FAR struct inode *mountpt, + FAR struct statfs *buf) +{ + buf->f_type = ARCHIVEFS_MAGIC; + buf->f_namelen = NAME_MAX; + return OK; +} + +static int archivefs_stat(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct stat *buf) +{ + FAR const char *abspath = mountpt->i_private; + FAR struct archivefs_priv_s *priv; + int ret; + + if (relpath[0] == 0) + { + buf->st_mode = S_IFDIR | 0555; + return OK; + } + + ret = archivefs_new(abspath, relpath, &priv); + if (ret < 0) + { + return ret; + } + + ret = archivefs_stats_common(priv, buf); + archivefs_free(priv); + return ret; +} + +static int archivefs_bind(FAR struct inode *driver, FAR const void *data, + FAR void **handle) +{ + FAR struct archivefs_priv_s *priv; + FAR char *abspath; + int ret; + + if (data == NULL) + { + return -ENODEV; + } + + /* Try access to archive file */ + + ret = archivefs_new(data, NULL, &priv); + if (ret < 0) + { + return ret; + } + + archivefs_free(priv); + abspath = fs_heap_zalloc(PATH_MAX); + if (abspath == NULL) + { + return -ENOMEM; + } + + *handle = abspath; + strlcpy(abspath, data, PATH_MAX); + return OK; +} + +static int archivefs_unbind(FAR void *handle, FAR struct inode **driver, + unsigned int flags) +{ + fs_heap_free(handle); + return OK; +} diff --git a/fs/archivefs/libarchive b/fs/archivefs/libarchive new file mode 120000 index 00000000000..e19d28690f8 --- /dev/null +++ b/fs/archivefs/libarchive @@ -0,0 +1 @@ +../../../apps/system/libarchive \ No newline at end of file diff --git a/fs/binfs/CMakeLists.txt b/fs/binfs/CMakeLists.txt index 178382efc1a..918867dff9f 100644 --- a/fs/binfs/CMakeLists.txt +++ b/fs/binfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/binfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/binfs/Make.defs b/fs/binfs/Make.defs index 5c6e822809e..600b04ade5e 100644 --- a/fs/binfs/Make.defs +++ b/fs/binfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/binfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/binfs/fs_binfs.c b/fs/binfs/fs_binfs.c index 694ecbfbe61..945ede5c985 100644 --- a/fs/binfs/fs_binfs.c +++ b/fs/binfs/fs_binfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/binfs/fs_binfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -112,6 +114,8 @@ const struct mountpt_operations g_binfs_operations = NULL, /* mmap */ NULL, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ NULL, /* sync */ binfs_dup, /* dup */ diff --git a/fs/cromfs/CMakeLists.txt b/fs/cromfs/CMakeLists.txt index f9b79fffd41..72fe37dfece 100644 --- a/fs/cromfs/CMakeLists.txt +++ b/fs/cromfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/cromfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/cromfs/Make.defs b/fs/cromfs/Make.defs index 38a4e75fbdc..607d67534bd 100644 --- a/fs/cromfs/Make.defs +++ b/fs/cromfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/cromfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/cromfs/cromfs.h b/fs/cromfs/cromfs.h index a50135ba745..ce581ed784c 100644 --- a/fs/cromfs/cromfs.h +++ b/fs/cromfs/cromfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/cromfs/cromfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/cromfs/fs_cromfs.c b/fs/cromfs/fs_cromfs.c index 769639ebbe5..d30fa8ccac4 100644 --- a/fs/cromfs/fs_cromfs.c +++ b/fs/cromfs/fs_cromfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/cromfs/fs_cromfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -192,6 +194,8 @@ const struct mountpt_operations g_cromfs_operations = NULL, /* mmap */ NULL, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ NULL, /* sync */ cromfs_dup, /* dup */ diff --git a/fs/driver/CMakeLists.txt b/fs/driver/CMakeLists.txt index 30056cd659f..74d4381b5ef 100644 --- a/fs/driver/CMakeLists.txt +++ b/fs/driver/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/driver/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/driver/Make.defs b/fs/driver/Make.defs index e0e9fcf5d93..452b933930b 100644 --- a/fs/driver/Make.defs +++ b/fs/driver/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/driver/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/driver/driver.h b/fs/driver/driver.h index 05d719821fd..7f89ccfca91 100644 --- a/fs/driver/driver.h +++ b/fs/driver/driver.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/driver.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_blockpartition.c b/fs/driver/fs_blockpartition.c index 45a6852b55a..005bf4e9de9 100644 --- a/fs/driver/fs_blockpartition.c +++ b/fs/driver/fs_blockpartition.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_blockpartition.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_blockproxy.c b/fs/driver/fs_blockproxy.c index 95dc376ce49..5db3752f613 100644 --- a/fs/driver/fs_blockproxy.c +++ b/fs/driver/fs_blockproxy.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_blockproxy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_closeblockdriver.c b/fs/driver/fs_closeblockdriver.c index 2493b5858af..6b04f17b03f 100644 --- a/fs/driver/fs_closeblockdriver.c +++ b/fs/driver/fs_closeblockdriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_closeblockdriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_closemtddriver.c b/fs/driver/fs_closemtddriver.c index 3d9d6922a73..3b8735eb63e 100644 --- a/fs/driver/fs_closemtddriver.c +++ b/fs/driver/fs_closemtddriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_closemtddriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_findblockdriver.c b/fs/driver/fs_findblockdriver.c index a0b86a3ae7d..894088cf457 100644 --- a/fs/driver/fs_findblockdriver.c +++ b/fs/driver/fs_findblockdriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_findblockdriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_findmtddriver.c b/fs/driver/fs_findmtddriver.c index ed6a9555e69..f6ccf4ec19f 100644 --- a/fs/driver/fs_findmtddriver.c +++ b/fs/driver/fs_findmtddriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_findmtddriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_mtdpartition.c b/fs/driver/fs_mtdpartition.c index 1641e723705..43ee7b34301 100644 --- a/fs/driver/fs_mtdpartition.c +++ b/fs/driver/fs_mtdpartition.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_mtdpartition.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_mtdproxy.c b/fs/driver/fs_mtdproxy.c index c0ecb5a135b..659cbb6c403 100644 --- a/fs/driver/fs_mtdproxy.c +++ b/fs/driver/fs_mtdproxy.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_mtdproxy.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_openblockdriver.c b/fs/driver/fs_openblockdriver.c index 7f5503a419e..7dbb3f5f3ae 100644 --- a/fs/driver/fs_openblockdriver.c +++ b/fs/driver/fs_openblockdriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_openblockdriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_registerblockdriver.c b/fs/driver/fs_registerblockdriver.c index 6c9308e407f..51798bfc35b 100644 --- a/fs/driver/fs_registerblockdriver.c +++ b/fs/driver/fs_registerblockdriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_registerblockdriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_registerdriver.c b/fs/driver/fs_registerdriver.c index d7bdb43f23d..eda177d4e6f 100644 --- a/fs/driver/fs_registerdriver.c +++ b/fs/driver/fs_registerdriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_registerdriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_registermtddriver.c b/fs/driver/fs_registermtddriver.c index 5d8cff872c5..4fc63a7e2c0 100644 --- a/fs/driver/fs_registermtddriver.c +++ b/fs/driver/fs_registermtddriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_registermtddriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_registerpipedriver.c b/fs/driver/fs_registerpipedriver.c index fccb484f2aa..9b1dfdeb83a 100644 --- a/fs/driver/fs_registerpipedriver.c +++ b/fs/driver/fs_registerpipedriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_registerpipedriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_unregisterblockdriver.c b/fs/driver/fs_unregisterblockdriver.c index 22df0fed4f0..b1c66fac027 100644 --- a/fs/driver/fs_unregisterblockdriver.c +++ b/fs/driver/fs_unregisterblockdriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_unregisterblockdriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_unregisterdriver.c b/fs/driver/fs_unregisterdriver.c index 0dca9584d2e..441e397bdb7 100644 --- a/fs/driver/fs_unregisterdriver.c +++ b/fs/driver/fs_unregisterdriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_unregisterdriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_unregistermtddriver.c b/fs/driver/fs_unregistermtddriver.c index 724d569acb9..8babd5020d6 100644 --- a/fs/driver/fs_unregistermtddriver.c +++ b/fs/driver/fs_unregistermtddriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_unregistermtddriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/driver/fs_unregisterpipedriver.c b/fs/driver/fs_unregisterpipedriver.c index c89ce1b663c..9e530505cbb 100644 --- a/fs/driver/fs_unregisterpipedriver.c +++ b/fs/driver/fs_unregisterpipedriver.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/driver/fs_unregisterpipedriver.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/event/CMakeLists.txt b/fs/event/CMakeLists.txt index dafb34388e7..55d077cb0ce 100644 --- a/fs/event/CMakeLists.txt +++ b/fs/event/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/event/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/event/Make.defs b/fs/event/Make.defs index ef2d12a506d..19762f6467e 100644 --- a/fs/event/Make.defs +++ b/fs/event/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/events/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/event/event.h b/fs/event/event.h index be05e67a524..0434ecc88ac 100644 --- a/fs/event/event.h +++ b/fs/event/event.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/event/event.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/event/event_close.c b/fs/event/event_close.c index ae922943c4b..1749cf1eda5 100644 --- a/fs/event/event_close.c +++ b/fs/event/event_close.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/event/event_close.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/event/event_open.c b/fs/event/event_open.c index 2aa54851783..f0b2bf76c52 100644 --- a/fs/event/event_open.c +++ b/fs/event/event_open.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/event/event_open.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/fat/CMakeLists.txt b/fs/fat/CMakeLists.txt index 6e9546881f3..a47da476a53 100644 --- a/fs/fat/CMakeLists.txt +++ b/fs/fat/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/fat/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/fat/Make.defs b/fs/fat/Make.defs index 925f851074e..8aa605afd0c 100644 --- a/fs/fat/Make.defs +++ b/fs/fat/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/fat/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/fat/fs_fat32.c b/fs/fat/fs_fat32.c index 40e913ac4c2..cc7f4d96964 100644 --- a/fs/fat/fs_fat32.c +++ b/fs/fat/fs_fat32.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fat/fs_fat32.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -132,6 +134,9 @@ const struct mountpt_operations g_fat_operations = NULL, /* mmap */ fat_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ + fat_sync, /* sync */ fat_dup, /* dup */ fat_fstat, /* fstat */ diff --git a/fs/fat/fs_fat32.h b/fs/fat/fs_fat32.h index 8daa87118f1..497994cb034 100644 --- a/fs/fat/fs_fat32.h +++ b/fs/fat/fs_fat32.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fat/fs_fat32.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/fat/fs_fat32attrib.c b/fs/fat/fs_fat32attrib.c index ecc03d0deff..66880492234 100644 --- a/fs/fat/fs_fat32attrib.c +++ b/fs/fat/fs_fat32attrib.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fat/fs_fat32attrib.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/fat/fs_fat32dirent.c b/fs/fat/fs_fat32dirent.c index 4adb9109cad..9b311f250a8 100644 --- a/fs/fat/fs_fat32dirent.c +++ b/fs/fat/fs_fat32dirent.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fat/fs_fat32dirent.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/fat/fs_fat32util.c b/fs/fat/fs_fat32util.c index 5e121302de5..c03df449c07 100644 --- a/fs/fat/fs_fat32util.c +++ b/fs/fat/fs_fat32util.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fat/fs_fat32util.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/fatfs/fatfs_vfs.c b/fs/fatfs/fatfs_vfs.c index 26fa02546ab..bdcaeedae5c 100644 --- a/fs/fatfs/fatfs_vfs.c +++ b/fs/fatfs/fatfs_vfs.c @@ -170,6 +170,8 @@ const struct mountpt_operations g_fatfs_operations = NULL, /* mmap */ fatfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ fatfs_sync, /* sync */ fatfs_dup, /* dup */ diff --git a/fs/fs_heap.c b/fs/fs_heap.c index cf956b8d018..c74d666e81b 100644 --- a/fs/fs_heap.c +++ b/fs/fs_heap.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fs_heap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -135,4 +137,9 @@ int fs_heap_asprintf(FAR char **strp, FAR const char *fmt, ...) return len; } +struct mallinfo_task fs_heap_mallinfo_task(FAR const struct malltask *task) +{ + return mm_mallinfo_task(g_fs_heap, task); +} + #endif diff --git a/fs/fs_heap.h b/fs/fs_heap.h index 5dc48dad8e4..bbd756931c2 100644 --- a/fs/fs_heap.h +++ b/fs/fs_heap.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fs_heap.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -49,17 +51,19 @@ FAR char *fs_heap_strdup(FAR const char *s) malloc_like; FAR char *fs_heap_strndup(FAR const char *s, size_t size) malloc_like; int fs_heap_asprintf(FAR char **strp, FAR const char *fmt, ...) printf_like(2, 3); +struct mallinfo_task fs_heap_mallinfo_task(FAR const struct malltask *task); #else # define fs_heap_initialize() -# define fs_heap_zalloc kmm_zalloc -# define fs_heap_malloc kmm_malloc -# define fs_heap_malloc_size kmm_malloc_size -# define fs_heap_realloc kmm_realloc -# define fs_heap_memalign kmm_memalign -# define fs_heap_free kmm_free -# define fs_heap_strdup strdup -# define fs_heap_strndup strndup -# define fs_heap_asprintf asprintf +# define fs_heap_zalloc kmm_zalloc +# define fs_heap_malloc kmm_malloc +# define fs_heap_malloc_size kmm_malloc_size +# define fs_heap_realloc kmm_realloc +# define fs_heap_memalign kmm_memalign +# define fs_heap_free kmm_free +# define fs_heap_mallinfo_task kmm_mallinfo_task +# define fs_heap_strdup strdup +# define fs_heap_strndup strndup +# define fs_heap_asprintf asprintf #endif #endif diff --git a/fs/fs_initialize.c b/fs/fs_initialize.c index d82753920b0..3c281fcbf2f 100644 --- a/fs/fs_initialize.c +++ b/fs/fs_initialize.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/fs_initialize.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/hostfs/CMakeLists.txt b/fs/hostfs/CMakeLists.txt index dcbc26aaee9..b920e2c2a85 100644 --- a/fs/hostfs/CMakeLists.txt +++ b/fs/hostfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/hostfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/hostfs/Make.defs b/fs/hostfs/Make.defs index a18589c6bfa..101e5a51583 100644 --- a/fs/hostfs/Make.defs +++ b/fs/hostfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/hostfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/hostfs/hostfs.c b/fs/hostfs/hostfs.c index 72f6cb2f9d4..511a043c363 100644 --- a/fs/hostfs/hostfs.c +++ b/fs/hostfs/hostfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/hostfs/hostfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -148,6 +150,8 @@ const struct mountpt_operations g_hostfs_operations = NULL, /* mmap */ hostfs_ftruncate, /* ftruncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ hostfs_sync, /* sync */ hostfs_dup, /* dup */ @@ -292,7 +296,7 @@ static int hostfs_open(FAR struct file *filep, FAR const char *relpath, { /* Error opening file */ - ret = -EBADF; + ret = hf->fd; goto errout_with_buffer; } diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h index 015370fea7b..096be6ae75a 100644 --- a/fs/hostfs/hostfs.h +++ b/fs/hostfs/hostfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/hostfs/hostfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/CMakeLists.txt b/fs/inode/CMakeLists.txt index b1301aa5cba..52a12b424d2 100644 --- a/fs/inode/CMakeLists.txt +++ b/fs/inode/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/inode/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/inode/Make.defs b/fs/inode/Make.defs index 503cfdcc342..353ed11c3b1 100644 --- a/fs/inode/Make.defs +++ b/fs/inode/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/inode/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_files.c b/fs/inode/fs_files.c index ca16c13127a..a2dd8400a01 100644 --- a/fs/inode/fs_files.c +++ b/fs/inode/fs_files.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_files.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -196,7 +198,7 @@ static int files_extend(FAR struct filelist *list, size_t row) spin_unlock_irqrestore(NULL, flags); - if (tmp != NULL && tmp != &list->fl_prefile) + if (tmp != NULL) { fs_heap_free(tmp); } @@ -361,14 +363,7 @@ static int nx_dup3_from_tcb(FAR struct tcb_s *tcb, int fd1, int fd2, void files_initlist(FAR struct filelist *list) { - /* The first row will reuse pre-allocated files, which will avoid - * unnecessary allocator accesses during file initialization. - */ - - list->fl_rows = 1; list->fl_crefs = 1; - list->fl_files = &list->fl_prefile; - list->fl_prefile = list->fl_prefiles; } /**************************************************************************** @@ -386,6 +381,14 @@ void files_dumplist(FAR struct filelist *list) int count = files_countlist(list); int i; + syslog(LOG_INFO, "%-4s%-4s%-8s%-5s%-10s%-14s" +#if CONFIG_FS_BACKTRACE > 0 + " BACKTRACE" +#endif + "\n", + "PID", "FD", "FLAGS", "TYPE", "POS", "PATH" + ); + path = lib_get_pathbuffer(); if (path == NULL) { @@ -395,6 +398,7 @@ void files_dumplist(FAR struct filelist *list) for (i = 0; i < count; i++) { FAR struct file *filep = files_fget(list, i); + #if CONFIG_FS_BACKTRACE > 0 char buf[BACKTRACE_BUFFER_SIZE(CONFIG_FS_BACKTRACE)]; #endif @@ -496,16 +500,11 @@ void files_putlist(FAR struct filelist *list) file_close(&list->fl_files[i][j]); } - if (i != 0) - { - fs_heap_free(list->fl_files[i]); - } + fs_heap_free(list->fl_files[i]); + list->fl_rows--; } - if (list->fl_files != &list->fl_prefile) - { - fs_heap_free(list->fl_files); - } + fs_heap_free(list->fl_files); } /**************************************************************************** diff --git a/fs/inode/fs_foreachinode.c b/fs/inode/fs_foreachinode.c index 17a4f27fcb2..d456dcfd695 100644 --- a/fs/inode/fs_foreachinode.c +++ b/fs/inode/fs_foreachinode.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_foreachinode.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inode.c b/fs/inode/fs_inode.c index d2c392af7c2..b957a8ccecd 100644 --- a/fs/inode/fs_inode.c +++ b/fs/inode/fs_inode.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inode.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inodeaddref.c b/fs/inode/fs_inodeaddref.c index abfb4a77c6c..240c0a07b75 100644 --- a/fs/inode/fs_inodeaddref.c +++ b/fs/inode/fs_inodeaddref.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inodeaddref.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inodebasename.c b/fs/inode/fs_inodebasename.c index 46af67f2399..79b2568d38b 100644 --- a/fs/inode/fs_inodebasename.c +++ b/fs/inode/fs_inodebasename.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inodebasename.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inodefind.c b/fs/inode/fs_inodefind.c index ccf2e465462..f53b502b4e2 100644 --- a/fs/inode/fs_inodefind.c +++ b/fs/inode/fs_inodefind.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inodefind.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inodefree.c b/fs/inode/fs_inodefree.c index 99e6ee487f1..7b7fc314c85 100644 --- a/fs/inode/fs_inodefree.c +++ b/fs/inode/fs_inodefree.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inodefree.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inodegetpath.c b/fs/inode/fs_inodegetpath.c index 2142f3dbf7b..5f76858ab2b 100644 --- a/fs/inode/fs_inodegetpath.c +++ b/fs/inode/fs_inodegetpath.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inodegetpath.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inoderelease.c b/fs/inode/fs_inoderelease.c index 0c5a680c66c..214fa98d597 100644 --- a/fs/inode/fs_inoderelease.c +++ b/fs/inode/fs_inoderelease.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inoderelease.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inoderemove.c b/fs/inode/fs_inoderemove.c index 83e5b85bea6..792eabe0a5d 100644 --- a/fs/inode/fs_inoderemove.c +++ b/fs/inode/fs_inoderemove.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inoderemove.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inodereserve.c b/fs/inode/fs_inodereserve.c index 13498373f95..35fae49dd7f 100644 --- a/fs/inode/fs_inodereserve.c +++ b/fs/inode/fs_inodereserve.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inodereserve.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c index baaf33af34c..1aecb529ad0 100644 --- a/fs/inode/fs_inodesearch.c +++ b/fs/inode/fs_inodesearch.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/fs_inodesearch.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/inode/inode.h b/fs/inode/inode.h index ad0c2b0bdfe..0eb860a934f 100644 --- a/fs/inode/inode.h +++ b/fs/inode/inode.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/inode/inode.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/littlefs/CMakeLists.txt b/fs/littlefs/CMakeLists.txt index cfae1838ebe..fcc269c9910 100644 --- a/fs/littlefs/CMakeLists.txt +++ b/fs/littlefs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/littlefs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/littlefs/Kconfig b/fs/littlefs/Kconfig index 66fe7bec0c0..6cd32e64a26 100644 --- a/fs/littlefs/Kconfig +++ b/fs/littlefs/Kconfig @@ -119,4 +119,12 @@ config FS_LITTLEFS_ATTR_MAX Note: Many of tools to generate LITTLEFS images use 1022 for this by default. + +config FS_LITTLEFS_ATTR_UPDATE + bool "LITTLEFS update attributes" + depends on FS_LITTLEFS_ATTR_MAX > 0 + default y + ---help--- + Enable support for attributes when create a file. + endif diff --git a/fs/littlefs/Make.defs b/fs/littlefs/Make.defs index 992574b1302..70b6a79bcbd 100644 --- a/fs/littlefs/Make.defs +++ b/fs/littlefs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/littlefs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/littlefs/lfs_vfs.c b/fs/littlefs/lfs_vfs.c index 249b945e7a9..d2d6782e9dd 100644 --- a/fs/littlefs/lfs_vfs.c +++ b/fs/littlefs/lfs_vfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/littlefs/lfs_vfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -112,8 +114,6 @@ static int littlefs_dup(FAR const struct file *oldp, FAR struct file *newp); static int littlefs_fstat(FAR const struct file *filep, FAR struct stat *buf); -static int littlefs_fchstat(FAR const struct file *filep, - FAR const struct stat *buf, int flags); static int littlefs_truncate(FAR struct file *filep, off_t length); @@ -146,9 +146,13 @@ static int littlefs_rename(FAR struct inode *mountpt, FAR const char *newrelpath); static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath, FAR struct stat *buf); +#ifdef CONFIG_FS_LITTLEFS_ATTR_UPDATE +static int littlefs_fchstat(FAR const struct file *filep, + FAR const struct stat *buf, int flags); static int littlefs_chstat(FAR struct inode *mountpt, FAR const char *relpath, FAR const struct stat *buf, int flags); +#endif /**************************************************************************** * Public Data @@ -170,11 +174,17 @@ const struct mountpt_operations g_littlefs_operations = NULL, /* mmap */ littlefs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ littlefs_sync, /* sync */ littlefs_dup, /* dup */ littlefs_fstat, /* fstat */ +#ifdef CONFIG_FS_LITTLEFS_ATTR_UPDATE littlefs_fchstat, /* fchstat */ +#else + NULL, +#endif littlefs_opendir, /* opendir */ littlefs_closedir, /* closedir */ @@ -190,7 +200,11 @@ const struct mountpt_operations g_littlefs_operations = littlefs_rmdir, /* rmdir */ littlefs_rename, /* rename */ littlefs_stat, /* stat */ +#ifdef CONFIG_FS_LITTLEFS_ATTR_UPDATE littlefs_chstat /* chstat */ +#else + NULL, +#endif }; /**************************************************************************** @@ -343,6 +357,7 @@ static int littlefs_open(FAR struct file *filep, FAR const char *relpath, goto errout; } +#ifdef CONFIG_FS_LITTLEFS_ATTR_UPDATE if (oflags & LFS_O_CREAT) { struct littlefs_attr_s attr; @@ -362,6 +377,7 @@ static int littlefs_open(FAR struct file *filep, FAR const char *relpath, goto errout_with_file; } } +#endif /* In append mode, we need to set the file pointer to the end of the * file. @@ -756,7 +772,7 @@ static int littlefs_fstat(FAR const struct file *filep, FAR struct stat *buf) &attr, sizeof(attr))); if (ret < 0) { - if (ret != -ENODATA) + if (ret != -ENODATA && ret != -ENOENT) { goto errout; } @@ -784,6 +800,7 @@ static int littlefs_fstat(FAR const struct file *filep, FAR struct stat *buf) return ret; } +#ifdef CONFIG_FS_LITTLEFS_ATTR_UPDATE static int littlefs_fchstat(FAR const struct file *filep, FAR const struct stat *buf, int flags) { @@ -861,6 +878,7 @@ static int littlefs_fchstat(FAR const struct file *filep, nxmutex_unlock(&fs->lock); return ret; } +#endif /**************************************************************************** * Name: littlefs_truncate @@ -1696,6 +1714,7 @@ static int littlefs_stat(FAR struct inode *mountpt, FAR const char *relpath, return ret; } +#ifdef CONFIG_FS_LITTLEFS_ATTR_UPDATE static int littlefs_chstat(FAR struct inode *mountpt, FAR const char *relpath, FAR const struct stat *buf, int flags) @@ -1769,3 +1788,4 @@ static int littlefs_chstat(FAR struct inode *mountpt, nxmutex_unlock(&fs->lock); return ret; } +#endif diff --git a/fs/littlefs/lfs_vfs.h b/fs/littlefs/lfs_vfs.h index 7b621e6f06e..56311669a97 100644 --- a/fs/littlefs/lfs_vfs.h +++ b/fs/littlefs/lfs_vfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/littlefs/lfs_vfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/libs/libnx/kbin/CMakeLists.txt b/fs/lrofs/CMakeLists.txt similarity index 76% rename from libs/libnx/kbin/CMakeLists.txt rename to fs/lrofs/CMakeLists.txt index 12168ff7e38..2779ac3d3b7 100644 --- a/libs/libnx/kbin/CMakeLists.txt +++ b/fs/lrofs/CMakeLists.txt @@ -1,7 +1,5 @@ # ############################################################################## -# libs/libnx/kbin/CMakeLists.txt -# -# SPDX-License-Identifier: Apache-2.0 +# fs/lrofs/CMakeLists.txt # # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for @@ -20,3 +18,13 @@ # # ############################################################################## +if(CONFIG_FS_LROFS) + + target_sources(fs PRIVATE fs_lrofs.c fs_lrofsutil.c) + + if(CONFIG_TRACE_LROFS_FS) + set_source_files_properties(fs_lrofs.c DIRECTORY .. + PROPERTIES COMPILE_FLAGS -finstrument-functions) + endif() + +endif() diff --git a/fs/lrofs/Kconfig b/fs/lrofs/Kconfig new file mode 100644 index 00000000000..ab03aba622e --- /dev/null +++ b/fs/lrofs/Kconfig @@ -0,0 +1,11 @@ +# +# For a description of the syntax of this configuration file, +# see the file kconfig-language.txt in the NuttX tools repository. +# + +config FS_LROFS + bool "LROFS file system" + default n + depends on !DISABLE_MOUNTPOINT + ---help--- + Enable LROFS filesystem support diff --git a/libs/libc/bin/Makefile b/fs/lrofs/Make.defs similarity index 74% rename from libs/libc/bin/Makefile rename to fs/lrofs/Make.defs index 735ba9133f2..83eee23f5e1 100644 --- a/libs/libc/bin/Makefile +++ b/fs/lrofs/Make.defs @@ -1,7 +1,5 @@ ############################################################################ -# libs/libc/bin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 +# fs/lrofs/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,18 +16,20 @@ # License for the specific language governing permissions and limitations # under the License. # -########################################################################### +############################################################################ -include $(TOPDIR)/Make.defs +ifeq ($(CONFIG_FS_LROFS),y) +# Files required for LROFS file system support -all: -.PHONY: clean distclean +CSRCS += fs_lrofs.c fs_lrofsutil.c -# Clean Targets: +ifeq ($(CONFIG_TRACE_LROFS_FS),y) +lrofs/fs_lrofs.c_CFLAGS += -finstrument-functions +endif -clean: - $(call CLEAN) +# Include ROMFS build support -# Deep clean -- removes all traces of the configuration +DEPPATH += --dep-path lrofs +VPATH += :lrofs -distclean: clean +endif diff --git a/fs/lrofs/fs_lrofs.c b/fs/lrofs/fs_lrofs.c new file mode 100644 index 00000000000..1f0559af8f5 --- /dev/null +++ b/fs/lrofs/fs_lrofs.c @@ -0,0 +1,1699 @@ +/**************************************************************************** + * fs/lrofs/fs_lrofs.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "fs_lrofs.h" +#include "fs_heap.h" + +/**************************************************************************** + * Pre-processor Declarations + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* This structure represents one entry node in the lrofs file system */ + +struct lrofs_dir_s +{ + struct fs_dirent_s base; /* Vfs directory structure */ + FAR struct lrofs_nodeinfo_s **firstnode; /* The address of first node in the directory */ + FAR struct lrofs_nodeinfo_s **currnode; /* The address of current node into the directory */ + FAR struct lrofs_nodeinfo_s *nodeinfo; /* The address of the directory */ + uint16_t count; /* Number of nodes in the directory */ +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int lrofs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode); +static int lrofs_close(FAR struct file *filep); +static ssize_t lrofs_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); +static ssize_t lrofs_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen); +static off_t lrofs_seek(FAR struct file *filep, off_t offset, int whence); +static int lrofs_ioctl(FAR struct file *filep, int cmd, + unsigned long arg); +static int lrofs_mmap(FAR struct file *filep, + FAR struct mm_map_entry_s *map); +static int lrofs_truncate(FAR struct file *filep, off_t length); +static int lrofs_sync(FAR struct file *filep); +static int lrofs_dup(FAR const struct file *oldp, + FAR struct file *newp); +static int lrofs_fstat(FAR const struct file *filep, + FAR struct stat *buf); + +static int lrofs_opendir(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct fs_dirent_s **dir); +static int lrofs_closedir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); +static int lrofs_readdir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir, + FAR struct dirent *entry); +static int lrofs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); + +static int lrofs_bind(FAR struct inode *blkdriver, FAR const void *data, + FAR void **handle); +static int lrofs_unbind(FAR void *handle, FAR struct inode **blkdriver, + unsigned int flags); +static int lrofs_statfs(FAR struct inode *mountpt, + FAR struct statfs *buf); + +static int lrofs_unlink(FAR struct inode *mountpt, + FAR const char *relpath); +static int lrofs_mkdir(FAR struct inode *mountpt, + FAR const char *relpath, mode_t mode); +static int lrofs_rmdir(FAR struct inode *mountpt, + FAR const char *relpath); +static int lrofs_rename(FAR struct inode *mountpt, + FAR const char *oldrelpath, + FAR const char *newrelpath); +static int lrofs_stat_common(uint8_t type, uint32_t size, + uint16_t sectorsize, FAR struct stat *buf); +static int lrofs_stat(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct stat *buf); + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +const struct mountpt_operations g_lrofs_operations = +{ + lrofs_open, /* open */ + lrofs_close, /* close */ + lrofs_read, /* read */ + lrofs_write, /* write */ + lrofs_seek, /* seek */ + lrofs_ioctl, /* ioctl */ + lrofs_mmap, /* mmap */ + lrofs_truncate, /* truncate */ + NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ + + lrofs_sync, /* sync */ + lrofs_dup, /* dup */ + lrofs_fstat, /* fstat */ + NULL, /* fchstat */ + + lrofs_opendir, /* opendir */ + lrofs_closedir, /* closedir */ + lrofs_readdir, /* readdir */ + lrofs_rewinddir, /* rewinddir */ + + lrofs_bind, /* bind */ + lrofs_unbind, /* unbind */ + lrofs_statfs, /* statfs */ + + lrofs_unlink, /* unlink */ + lrofs_mkdir, /* mkdir */ + lrofs_rmdir, /* rmdir */ + lrofs_rename, /* rename */ + lrofs_stat, /* stat */ + NULL /* chstat */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lrofs_open + ****************************************************************************/ + +static int lrofs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + FAR struct lrofs_nodeinfo_s *ln; + size_t len; + int ret; + + DEBUGASSERT(filep->f_priv == NULL); + + /* Get mountpoint private data from the inode reference from the file + * structure + */ + + lm = filep->f_inode->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + + if (oflags & (O_WRONLY | O_APPEND | O_TRUNC | O_CREAT)) + { + nxrmutex_unlock(&lm->lm_lock); + nxsem_wait_uninterruptible(&lm->lm_sem); + nxrmutex_lock(&lm->lm_lock); + } + + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_sem; + } + + /* Locate the directory entry for this path */ + + ln = lrofs_finddirentry(lm, relpath); + if (ln == NULL) + { + if (oflags & O_CREAT) + { + /* Create a new file */ + + ret = lrofs_create(lm, &ln, relpath, false); + if (ret < 0) + { + ferr("ERROR: Failed to create file '%s': %d\n", + relpath, ret); + goto errout_with_sem; + } + } + else + { + finfo("ERROR: Failed to find directory entry for '%s'.\n", + relpath); + ret = -ENOENT; + goto errout_with_sem; + } + } + + /* The full path exists -- but is the final component a file + * or a directory? Or some other Unix file type that is not + * appropriate in this context. + * + * REVISIT: This logic should follow hard/soft link file + * types. At present, it returns the ENXIO. + */ + + if (IS_DIRECTORY(ln->ln_next)) + { + /* It is a directory */ + + ret = -EISDIR; + ferr("ERROR: '%s' is a directory\n", relpath); + goto errout_with_sem; + } + else if (!IS_FILE(ln->ln_next)) + { + /* ENXIO indicates "The named file is a character special or + * block special file, and the device associated with this + * special file does not exist." + * + * Here we also return ENXIO if the file is not a directory + * or a regular file. + */ + + ret = -ENXIO; + ferr("ERROR: '%s' is a special file\n", relpath); + goto errout_with_sem; + } + + /* Create an instance of the file private data to describe the opened + * file. + */ + + len = strlen(relpath); + lf = fs_heap_zalloc(sizeof(struct lrofs_file_s) + len); + if (!lf) + { + ferr("ERROR: Failed to allocate private data\n"); + ret = -ENOMEM; + goto errout_with_sem; + } + + /* Initialize the file private data (only need to initialize + * non-zero elements) + */ + + lf->lf_ln = ln; + lf->lf_size = ln->ln_size; + lf->lf_type = (uint8_t)(ln->ln_next & RFNEXT_ALLMODEMASK); + memcpy(lf->lf_path, relpath, len + 1); + + /* Get the start of the file data */ + + ret = lrofs_datastart(lm, ln, &lf->lf_startoffset); + if (ret < 0) + { + ferr("ERROR: Failed to locate start of file data: %d\n", ret); + fs_heap_free(lf); + goto errout_with_sem; + } + + /* Configure buffering to support access to this file */ + + ret = lrofs_fileconfigure(lm, lf); + if (ret < 0) + { + ferr("ERROR: Failed configure buffering: %d\n", ret); + fs_heap_free(lf); + goto errout_with_sem; + } + + /* Attach the private date to the struct file instance */ + + filep->f_priv = lf; + lm->lm_refs++; + + if (oflags & O_TRUNC) + { + ret = lrofs_truncate_file(filep, 0); + if (ret < 0) + { + ferr("ERROR: Failed to truncate file '%s': %d\n", + lf->lf_path, ret); + } + } + + /* If the file is only created for read */ + + if ((oflags & (O_WRONLY | O_APPEND | O_TRUNC | O_CREAT)) == O_CREAT) + { + nxsem_post(&lm->lm_sem); + } + + nxrmutex_unlock(&lm->lm_lock); + return ret; + +errout_with_sem: + if (oflags & (O_WRONLY | O_APPEND | O_TRUNC | O_CREAT)) + { + nxsem_post(&lm->lm_sem); + } + + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_close + ****************************************************************************/ + +static int lrofs_close(FAR struct file *filep) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Recover our private data from the struct file instance */ + + lf = filep->f_priv; + lm = filep->f_inode->i_private; + + nxrmutex_lock(&lm->lm_lock); + + lm->lm_refs--; + + if (filep->f_oflags & (O_WRONLY | O_APPEND | O_TRUNC)) + { + nxsem_post(&lm->lm_sem); + } + + nxrmutex_unlock(&lm->lm_lock); + + /* Do not check if the mount is healthy. We must support closing of + * the file even when there is healthy mount. + */ + + /* Deallocate the memory structures created when the open method + * was called. + * + * Free the sector buffer that was used to manage partial sector + * accesses. + */ + + if (!lm->lm_xipbase && lf->lf_buffer) + { + fs_heap_free(lf->lf_buffer); + } + + /* Then free the file structure itself. */ + + fs_heap_free(lf); + filep->f_priv = NULL; + return 0; +} + +/**************************************************************************** + * Name: lrofs_read + ****************************************************************************/ + +static ssize_t lrofs_read(FAR struct file *filep, FAR char *buffer, + size_t buflen) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + unsigned int bytesread; + unsigned int readsize = 0; + unsigned int nsectors; + uint32_t offset; + size_t bytesleft; + off_t sector; + FAR uint8_t *userbuffer = (FAR uint8_t *)buffer; + int sectorndx; + int ret; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Recover our private data from the struct file instance */ + + lf = filep->f_priv; + lm = filep->f_inode->i_private; + + /* Make sure that the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Get the number of bytes left in the file */ + + bytesleft = lf->lf_size - filep->f_pos; + + /* Truncate read count so that it does not exceed the number + * of bytes left in the file. + */ + + if (buflen > bytesleft) + { + buflen = bytesleft; + } + + /* Loop until either (1) all data has been transferred, or (2) an + * error occurs. + */ + + while (buflen > 0) + { + /* Get the first sector and index to read from. */ + + offset = lf->lf_startoffset + filep->f_pos; + sector = SEC_NSECTORS(lm, offset); + sectorndx = offset & SEC_NDXMASK(lm); + + /* Check if the user has provided a buffer large enough to + * hold one or more complete sectors -AND- the read is + * aligned to a sector boundary. + */ + + nsectors = SEC_NSECTORS(lm, buflen); + if (nsectors >= lf->lf_ncachesector && sectorndx == 0) + { + /* Read maximum contiguous sectors directly to the user's + * buffer without using our tiny read buffer. + */ + + /* Read all of the sectors directly into user memory */ + + ret = lrofs_hwread(lm, userbuffer, sector, nsectors); + if (ret < 0) + { + ferr("ERROR: lrofs_hwread failed: %d\n", ret); + goto errout_with_lock; + } + + bytesread = nsectors * lm->lm_hwsectorsize; + } + else + { + /* We are reading a partial sector. First, read the whole sector + * into the file data buffer. This is a caching buffer so if + * it is already there then all is well. + */ + + ret = lrofs_filecacheread(lm, lf, sector); + if (ret < 0) + { + ferr("ERROR: lrofs_filecacheread failed: %d\n", ret); + goto errout_with_lock; + } + + /* Copy the partial sector into the user buffer */ + + bytesread = (lf->lf_cachesector + lf->lf_ncachesector - sector) * + lm->lm_hwsectorsize - sectorndx; + sectorndx = lf->lf_ncachesector * lm->lm_hwsectorsize - bytesread; + if (bytesread > buflen) + { + /* We will not read to the end of the buffer */ + + bytesread = buflen; + } + + memcpy(userbuffer, &lf->lf_buffer[sectorndx], bytesread); + } + + /* Set up for the next sector read */ + + userbuffer += bytesread; + filep->f_pos += bytesread; + readsize += bytesread; + buflen -= bytesread; + } + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return readsize ? readsize : ret; +} + +/**************************************************************************** + * Name: lrofs_write + ****************************************************************************/ + +static ssize_t lrofs_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + ssize_t ret; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Recover our private data from the struct file instance */ + + lf = filep->f_priv; + lm = filep->f_inode->i_private; + + /* Make sure that the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + if (filep->f_oflags & O_APPEND) + { + filep->f_pos = lf->lf_size; + } + + if (filep->f_pos > lf->lf_size) + { + ret = lrofs_truncate_file(filep, filep->f_pos); + if (ret < 0) + { + ferr("ERROR: Failed to truncate file '%s': %d\n", + lf->lf_path, ret); + goto errout_with_lock; + } + } + + ret = lrofs_write_file(filep, buffer, buflen); + if (ret < 0) + { + ferr("ERROR: Failed to write file '%s': %d\n", + lf->lf_path, ret); + } + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_seek + ****************************************************************************/ + +static off_t lrofs_seek(FAR struct file *filep, off_t offset, int whence) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + off_t position; + int ret; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Recover our private data from the struct file instance */ + + lf = filep->f_priv; + lm = filep->f_inode->i_private; + + /* Map the offset according to the whence option */ + + switch (whence) + { + case SEEK_SET: /* The offset is set to offset bytes. */ + position = offset; + break; + + case SEEK_CUR: /* The offset is set to its current location plus + * offset bytes. */ + + position = offset + filep->f_pos; + break; + + case SEEK_END: /* The offset is set to the size of the file plus + * offset bytes. */ + + position = offset + lf->lf_size; + break; + + default: + ferr("ERROR: Whence is invalid: %d\n", whence); + return -EINVAL; + } + + /* Make sure that the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Set file position and return success */ + + filep->f_pos = position; + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_ioctl + ****************************************************************************/ + +static int lrofs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) +{ + FAR struct lrofs_file_s *lf; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Recover our private data from the struct file instance */ + + lf = filep->f_priv; + + if (cmd == FIOC_FILEPATH) + { + FAR char *ptr = (FAR char *)((uintptr_t)arg); + inode_getpath(filep->f_inode, ptr, PATH_MAX); + strlcat(ptr, lf->lf_path, PATH_MAX); + return 0; + } + else if (cmd == FIOC_XIPBASE) + { + FAR struct lrofs_mountpt_s *lm = filep->f_inode->i_private; + FAR uintptr_t *ptr = (FAR uintptr_t *)arg; + + if (lm->lm_xipbase != 0) + { + *ptr = (uintptr_t)lm->lm_xipbase + lf->lf_startoffset; + return 0; + } + else + { + return -ENXIO; + } + } + + return -ENOTTY; +} + +/**************************************************************************** + * Name: lrofs_mmap + ****************************************************************************/ + +static int lrofs_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Recover our private data from the struct file instance */ + + lf = filep->f_priv; + lm = filep->f_inode->i_private; + + /* Return the address on the media corresponding to the start of + * the file. + */ + + if (lm->lm_xipbase && map->offset >= 0 && map->offset < lf->lf_size && + map->length != 0 && map->offset + map->length <= lf->lf_size) + { + map->vaddr = lm->lm_xipbase + lf->lf_startoffset + map->offset; + return 0; + } + + return -ENOTTY; +} + +/**************************************************************************** + * Name: lrofs_truncate + ****************************************************************************/ + +static int lrofs_truncate(FAR struct file *filep, off_t length) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + int ret; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Recover our private data from the struct file instance */ + + lf = filep->f_priv; + lm = filep->f_inode->i_private; + + /* Make sure that the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + ret = lrofs_truncate_file(filep, length); + if (ret < 0) + { + ferr("ERROR: Failed to truncate file '%s': %d\n", + lf->lf_path, ret); + } + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_sync + ****************************************************************************/ + +static int lrofs_sync(FAR struct file *filep) +{ + /* There is nothing to do here. Data will be write to flash directly */ + + return OK; +} + +/**************************************************************************** + * Name: lrofs_dup + ****************************************************************************/ + +static int lrofs_dup(FAR const struct file *oldp, FAR struct file *newp) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *old_lf; + FAR struct lrofs_file_s *new_lf; + size_t len; + int ret; + + DEBUGASSERT(oldp->f_priv != NULL && + newp->f_priv == NULL && + newp->f_inode != NULL); + + /* Get mountpoint private data from the inode reference from the file + * structure + */ + + lm = newp->f_inode->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Recover the old private data from the old struct file instance */ + + old_lf = oldp->f_priv; + + /* Create an new instance of the file private data to describe the new + * dup'ed file. + */ + + len = strlen(old_lf->lf_path); + new_lf = fs_heap_malloc(sizeof(struct lrofs_file_s) + len); + if (!new_lf) + { + ferr("ERROR: Failed to allocate private data\n"); + ret = -ENOMEM; + goto errout_with_lock; + } + + /* Copy all file private data (except for the buffer) */ + + new_lf->lf_ln = old_lf->lf_ln; + new_lf->lf_startoffset = old_lf->lf_startoffset; + new_lf->lf_size = old_lf->lf_size; + new_lf->lf_type = old_lf->lf_type; + memcpy(new_lf->lf_path, old_lf->lf_path, len + 1); + + /* Configure buffering to support access to this file */ + + ret = lrofs_fileconfigure(lm, new_lf); + if (ret < 0) + { + fs_heap_free(new_lf); + ferr("ERROR: Failed configure buffering: %d\n", ret); + goto errout_with_lock; + } + + /* Attach the new private date to the new struct file instance */ + + newp->f_priv = new_lf; + lm->lm_refs++; + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_fstat + ****************************************************************************/ + +static int lrofs_fstat(FAR const struct file *filep, FAR struct stat *buf) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_file_s *lf; + int ret; + + DEBUGASSERT(filep->f_priv != NULL); + + /* Get mountpoint private data from the inode reference from the file + * structure + */ + + lf = filep->f_priv; + lm = filep->f_inode->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret >= 0) + { + /* Return information about the directory entry */ + + ret = lrofs_stat_common(lf->lf_type, lf->lf_size, + lm->lm_hwsectorsize, buf); + } + + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_opendir + ****************************************************************************/ + +static int lrofs_opendir(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct fs_dirent_s **dir) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_dir_s *ldir; + FAR struct lrofs_nodeinfo_s *ln; + int ret; + + DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); + + /* Recover our private data from the inode instance */ + + lm = mountpt->i_private; + + ldir = fs_heap_zalloc(sizeof(*ldir)); + if (ldir == NULL) + { + return -ENOMEM; + } + + /* Make sure that the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Find the requested directory */ + + ln = lrofs_finddirentry(lm, relpath); + if (ln == NULL) + { + ferr("ERROR: Failed to find directory '%s': %d\n", relpath, ret); + ret = -ENOENT; + goto errout_with_lock; + } + + /* Verify that it is some kind of directory */ + + if (!IS_DIRECTORY(ln->ln_next)) + { + /* The entry is not a directory */ + + ferr("ERROR: '%s' is not a directory\n", relpath); + ret = -ENOTDIR; + goto errout_with_lock; + } + + /* The entry is a directory */ + + ldir->firstnode = ln->ln_child; + ldir->currnode = ln->ln_child; + ldir->count = ln->ln_count; + ldir->nodeinfo = ln; + *dir = &ldir->base; + nxrmutex_unlock(&lm->lm_lock); + return 0; + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + fs_heap_free(ldir); + return ret; +} + +/**************************************************************************** + * Name: lrofs_closedir + ****************************************************************************/ + +static int lrofs_closedir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir) +{ + DEBUGASSERT(dir); + fs_heap_free(dir); + return 0; +} + +/**************************************************************************** + * Name: lrofs_readdir + ****************************************************************************/ + +static int lrofs_readdir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir, + FAR struct dirent *entry) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_dir_s *ldir; + FAR struct lrofs_nodeinfo_s *ln; + uint32_t next; + int ret; + + DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); + + /* Recover our private data from the inode instance */ + + lm = mountpt->i_private; + ldir = (FAR struct lrofs_dir_s *)dir; + ln = ldir->nodeinfo; + + /* Make sure that the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: omfs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Loop, skipping over unsupported items in the file system */ + + for (; ; ) + { + if (ldir->count != ln->ln_count) + { + ldir->currnode = ldir->firstnode; + ldir->count = ln->ln_count; + } + + /* Have we reached the end of the directory */ + + if (!ln->ln_count || !ldir->currnode || !(*ldir->currnode)) + { + /* We signal the end of the directory by returning the + * special error -ENOENT + */ + + ret = -ENOENT; + goto errout_with_lock; + } + + next = (*ldir->currnode)->ln_next; + strlcpy(entry->d_name, (*ldir->currnode)->ln_name, + sizeof(entry->d_name)); + ldir->currnode++; + + /* Check the file type */ + + if (IS_DIRECTORY(next)) + { + entry->d_type = DTYPE_DIRECTORY; + break; + } + else if (IS_FILE(next)) + { + entry->d_type = DTYPE_FILE; + break; + } + else if (IS_SOFTLINK(next)) + { + entry->d_type = DTYPE_LINK; + break; + } + } + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_rewinddir + ****************************************************************************/ + +static int lrofs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_dir_s *ldir; + int ret; + + DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); + + /* Recover our private data from the inode instance */ + + lm = mountpt->i_private; + ldir = (FAR struct lrofs_dir_s *)dir; + + /* Make sure that the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret >= 0) + { + ldir->currnode = ldir->firstnode; + } + + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_bind + ****************************************************************************/ + +static int lrofs_bind(FAR struct inode *blkdriver, FAR const void *data, + FAR void **handle) +{ + FAR struct lrofs_mountpt_s *lm; + int ret; + + if (blkdriver == NULL) + { + ferr("ERROR: No block driver/ops\n"); + return -ENODEV; + } + + if (blkdriver->u.i_bops->open != NULL && + (ret = blkdriver->u.i_bops->open(blkdriver)) < 0) + { + ferr("ERROR: No open method\n"); + return ret; + } + + /* Create an instance of the mountpt state structure */ + + lm = fs_heap_zalloc(sizeof(struct lrofs_mountpt_s)); + if (!lm) + { + ferr("ERROR: Failed to allocate mountpoint structure\n"); + ret = -ENOMEM; + goto errout; + } + + /* Initialize the allocated mountpt state structure. The filesystem is + * responsible for one reference on the blkdriver inode and does not + * have to addref() here (but does have to release in ubind(). + */ + + nxrmutex_init(&lm->lm_lock); /* Initialize the mutex that controls access */ + lm->lm_blkdriver = blkdriver; /* Save the block driver reference */ + + /* Get the hardware configuration and setup buffering appropriately */ + + ret = lrofs_hwconfigure(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_hwconfigure failed: %d\n", ret); + goto errout_with_mount; + } + + if (data && strstr(data, "forceformat")) + { + ret = lrofs_mkfs(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_mkfs failed: %d\n", ret); + goto errout_with_buffer; + } + } + + /* Then complete the mount by getting the ROMFS configuratrion from + * the ROMF header + */ + + ret = lrofs_fsconfigure(lm, data); + if (ret < 0) + { + if (data && strstr(data, "autoformat")) + { + ret = lrofs_mkfs(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_mkfs failed: %d\n", ret); + goto errout_with_buffer; + } + + ret = lrofs_fsconfigure(lm, data); + if (ret < 0) + { + ferr("ERROR: lrofs_fsconfigure failed: %d\n", ret); + goto errout_with_buffer; + } + } + else + { + ferr("ERROR: lrofs_fsconfigure failed: %d\n", ret); + goto errout_with_buffer; + } + } + + nxsem_init(&lm->lm_sem, 0, 1); + + /* Mounted! */ + + *handle = lm; + return 0; + +errout_with_buffer: + fs_heap_free(lm->lm_devbuffer); + +errout_with_mount: + nxrmutex_destroy(&lm->lm_lock); + fs_heap_free(lm); + +errout: + if (blkdriver->u.i_bops->close != NULL) + { + blkdriver->u.i_bops->close(blkdriver); + } + + return ret; +} + +/**************************************************************************** + * Name: lrofs_unbind + ****************************************************************************/ + +static int lrofs_unbind(FAR void *handle, FAR struct inode **blkdriver, + unsigned int flags) +{ + FAR struct lrofs_mountpt_s *lm = handle; + int ret; + + /* Check if there are sill any files opened on the filesystem. */ + + nxrmutex_lock(&lm->lm_lock); + + if (lm->lm_refs) + { + /* We cannot unmount now.. there are open files */ + + fwarn("WARNING: There are open files\n"); + + /* This implementation currently only supports unmounting if there are + * no open file references. + */ + + ret = flags ? -ENOSYS : -EBUSY; + } + else + { + /* Unmount ... close the block driver */ + + if (lm->lm_blkdriver) + { + FAR struct inode *inode = lm->lm_blkdriver; + if (inode) + { + if (INODE_IS_BLOCK(inode) && inode->u.i_bops->close != NULL) + { + inode->u.i_bops->close(inode); + } + + /* We hold a reference to the block driver but should + * not but mucking with inodes in this context. So, we will + * just return our contained reference to the block driver + * inode and let the umount logic dispose of it. + */ + + if (blkdriver) + { + *blkdriver = inode; + } + } + } + + /* Release the mountpoint private data */ + + lrofs_freenode(lm->lm_root); + nxrmutex_destroy(&lm->lm_lock); + nxsem_destroy(&lm->lm_sem); + lrofs_free_sparelist(&lm->lm_sparelist); + fs_heap_free(lm->lm_devbuffer); + fs_heap_free(lm); + return 0; + } + + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_statfs + ****************************************************************************/ + +static int lrofs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) +{ + FAR struct lrofs_mountpt_s *lm; + int ret; + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + lm = mountpt->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Fill in the statfs info */ + + buf->f_type = LROFS_MAGIC; + + /* We will claim that the optimal transfer size is the size of one sector */ + + buf->f_bsize = lm->lm_hwsectorsize; + + /* Everything else follows in units of sectors */ + + buf->f_blocks = lm->lm_hwnsectors; + buf->f_bfree = buf->f_blocks - + SEC_NSECTORS(lm, lm->lm_volsize + SEC_NDXMASK(lm)); + buf->f_bavail = buf->f_bfree; + buf->f_namelen = NAME_MAX; + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_stat_common + ****************************************************************************/ + +static int lrofs_stat_common(uint8_t type, uint32_t size, + uint16_t sectorsize, FAR struct stat *buf) +{ + memset(buf, 0, sizeof(struct stat)); + if (IS_DIRECTORY(type)) + { + /* It's a read-execute directory name */ + + buf->st_mode = S_IFDIR | S_IROTH | S_IXOTH | S_IRGRP | S_IXGRP | + S_IRUSR | S_IXUSR; + } + else if (IS_FILE(type) || IS_SOFTLINK(type)) + { + if (IS_FILE(type)) + { + buf->st_mode = S_IFREG; + } + else + { + buf->st_mode = S_IFLNK; + } + + /* It's a read-only file name */ + + buf->st_mode |= S_IROTH | S_IRGRP | S_IRUSR; + if (IS_EXECUTABLE(type)) + { + /* It's a read-execute file name */ + + buf->st_mode |= S_IXOTH | S_IXGRP | S_IXUSR; + } + } + else + { + /* Otherwise, pretend like the unsupported type does not exist */ + + finfo("Unsupported type: %d\n", type); + return -ENOENT; + } + + /* File/directory size, access block size */ + + buf->st_size = size; + buf->st_blksize = sectorsize; + buf->st_blocks = (buf->st_size + sectorsize - 1) / sectorsize; + return 0; +} + +/**************************************************************************** + * Name: lrofs_stat + ****************************************************************************/ + +static int lrofs_stat(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct stat *buf) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_nodeinfo_s *ln; + uint8_t type; + int ret; + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + lm = mountpt->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Find the directory entry corresponding to relpath. */ + + ln = lrofs_finddirentry(lm, relpath); + + /* If nothing was found, then we fail with EEXIST */ + + if (ln == NULL) + { + finfo("Failed to find directory: %d\n", ret); + ret = -ENOENT; + goto errout_with_lock; + } + + /* Return information about the directory entry */ + + type = (uint8_t)(ln->ln_next & RFNEXT_ALLMODEMASK); + ret = lrofs_stat_common(type, ln->ln_size, lm->lm_hwsectorsize, buf); + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_unlink + ****************************************************************************/ + +static int lrofs_unlink(FAR struct inode *mountpt, FAR const char *relpath) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_nodeinfo_s *ln; + int ret; + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + lm = mountpt->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Find the directory entry corresponding to relpath. */ + + ln = lrofs_finddirentry(lm, relpath); + + /* If nothing was found, then we fail with EEXIST */ + + if (ln == NULL) + { + finfo("Failed to find directory: %d\n", ret); + ret = -ENOENT; + goto errout_with_lock; + } + + /* Verify that it is some kind of file */ + + if (IS_DIRECTORY(ln->ln_next)) + { + /* It is a directory */ + + ferr("ERROR: '%s' is a directory\n", relpath); + ret = -EISDIR; + goto errout_with_lock; + } + else if (!IS_FILE(ln->ln_next)) + { + /* ENXIO indicates "The named file is a character special or + * block special file, and the device associated with this + * special file does not exist." + * + * Here we also return ENXIO if the file is not a directory + * or a regular file. + */ + + ferr("ERROR: '%s' is a special file\n", relpath); + ret = -ENXIO; + goto errout_with_lock; + } + + /* Make sure that only one writer operating on the filesystem */ + + nxrmutex_unlock(&lm->lm_lock); + nxsem_wait_uninterruptible(&lm->lm_sem); + nxrmutex_lock(&lm->lm_lock); + + /* Remove the file */ + + ret = lrofs_remove(lm, ln->ln_parent, relpath, false); + nxsem_post(&lm->lm_sem); + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_mkdir + ****************************************************************************/ + +static int lrofs_mkdir(FAR struct inode *mountpt, FAR const char *relpath, + mode_t mode) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_nodeinfo_s *ln; + int ret; + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + lm = mountpt->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Find the nodeinfo corresponding to relpath. */ + + ln = lrofs_finddirentry(lm, relpath); + + /* If something was found, then we fail with EEXIST */ + + if (ln != NULL) + { + finfo("The directory is exist: %d\n", ret); + ret = -EEXIST; + goto errout_with_lock; + } + + nxrmutex_unlock(&lm->lm_lock); + nxsem_wait_uninterruptible(&lm->lm_sem); + nxrmutex_lock(&lm->lm_lock); + + /* Create the directory */ + + ret = lrofs_create(lm, &ln, relpath, true); + nxsem_post(&lm->lm_sem); + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_rmdir + ****************************************************************************/ + +static int lrofs_rmdir(FAR struct inode *mountpt, FAR const char *relpath) +{ + FAR struct lrofs_mountpt_s *lm; + FAR struct lrofs_nodeinfo_s *ln; + int ret; + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + lm = mountpt->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Find the directory entry corresponding to relpath. */ + + ln = lrofs_finddirentry(lm, relpath); + if (ln == NULL) + { + finfo("Failed to find directory:%s,%d\n", relpath, ret); + ret = -ENOENT; + goto errout_with_lock; + } + + /* Verify that it is some kind of directory */ + + if (!IS_DIRECTORY(ln->ln_next)) + { + ferr("ERROR: '%s' is not a directory\n", relpath); + ret = -ENOTDIR; + goto errout_with_lock; + } + + if (ln->ln_count > 2) + { + ferr("ERROR: '%s' is not empty\n", relpath); + ret = -ENOTEMPTY; + goto errout_with_lock; + } + + nxrmutex_unlock(&lm->lm_lock); + nxsem_wait_uninterruptible(&lm->lm_sem); + nxrmutex_lock(&lm->lm_lock); + + /* Remove the directory */ + + ret = lrofs_remove(lm, ln->ln_parent, relpath, true); + nxsem_post(&lm->lm_sem); + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Name: lrofs_rename + ****************************************************************************/ + +static int lrofs_rename(FAR struct inode *mountpt, + FAR const char *oldrelpath, + FAR const char *newrelpath) +{ + FAR struct lrofs_nodeinfo_s *ln_old; + FAR struct lrofs_nodeinfo_s *ln_new; + FAR struct lrofs_nodeinfo_s *ln_newpath; + FAR struct lrofs_mountpt_s *lm; + FAR char *newpath; + FAR char *newname; + int ret; + + DEBUGASSERT(mountpt && mountpt->i_private); + + /* Get the mountpoint private data from the inode structure */ + + lm = mountpt->i_private; + + /* Check if the mount is still healthy */ + + nxrmutex_lock(&lm->lm_lock); + ret = lrofs_checkmount(lm); + if (ret < 0) + { + ferr("ERROR: lrofs_checkmount failed: %d\n", ret); + goto errout_with_lock; + } + + /* Find the file entry corresponding to old relpath. */ + + ln_old = lrofs_finddirentry(lm, oldrelpath); + if (ln_old == NULL) + { + ferr("Failed to find the source file: %d\n", ret); + ret = -ENOENT; + goto errout_with_lock; + } + + /* Find the file entry corresponding to new relpath. */ + + ln_new = lrofs_finddirentry(lm, newrelpath); + if ((ln_new != NULL) && !IS_DIRECTORY(ln_new->ln_next)) + { + ferr("The dist file is exist: %d\n", ret); + ret = -EEXIST; + goto errout_with_lock; + } + + if (ln_new == NULL) + { + FAR struct lrofs_nodeinfo_s *ln_oldpath = ln_old->ln_parent; + newname = basename((FAR char *)newrelpath); + newpath = dirname((FAR char *)newrelpath); + if (strcmp(newpath, ".") == 0) + { + ln_newpath = lm->lm_root; + } + else + { + ln_new = lrofs_finddirentry(lm, newpath); + if (ln_new == NULL) + { + finfo("Failed to find new path: %d\n", ret); + ret = -ENOENT; + goto errout_with_lock; + } + + if (ln_new->ln_offset == ln_oldpath->ln_offset) + { + /* Move file to same dir, just rename */ + + ln_newpath = ln_oldpath; + } + else + { + ln_newpath = ln_new; + } + } + } + else + { + /* Move file to a new dir */ + + newname = NULL; + ln_newpath = ln_new; + } + + nxrmutex_unlock(&lm->lm_lock); + nxsem_wait_uninterruptible(&lm->lm_sem); + nxrmutex_lock(&lm->lm_lock); + + /* Rename the file or directory */ + + ret = lrofs_rename_file(lm, ln_old, ln_newpath, newname); + nxsem_post(&lm->lm_sem); + +errout_with_lock: + nxrmutex_unlock(&lm->lm_lock); + return ret; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ diff --git a/fs/lrofs/fs_lrofs.h b/fs/lrofs/fs_lrofs.h new file mode 100644 index 00000000000..a8d925e9b09 --- /dev/null +++ b/fs/lrofs/fs_lrofs.h @@ -0,0 +1,248 @@ +/**************************************************************************** + * fs/lrofs/fs_lrofs.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __FS_LROFS_FS_LROFS_H +#define __FS_LROFS_FS_LROFS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include + +#include +#include + +#include "inode/inode.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Volume header (multi-byte values are big-endian) */ + +#define ROMFS_VHDR_ROM1FS 0 /* 0-7: "-rom1fs-" */ +#define ROMFS_VHDR_SIZE 8 /* 8-11: Number of accessible bytes in this fs. */ +#define ROMFS_VHDR_CHKSUM 12 /* 12-15: Checksum of the first 512 bytes. */ +#define ROMFS_VHDR_VOLNAME 16 /* 16-..: Zero terminated volume name, padded to + * 16 byte boundary. */ + +#define ROMFS_VHDR_MAGIC "-rom1fs-" + +/* File header offset (multi-byte values are big-endian) */ + +#define ROMFS_FHDR_NEXT 0 /* 0-3: Offset of the next file header + * (zero if no more files) */ +#define ROMFS_FHDR_INFO 4 /* 4-7: Info for directories/hard links/ + * devices */ +#define ROMFS_FHDR_SIZE 8 /* 8-11: Size of this file in bytes */ +#define ROMFS_FHDR_CHKSUM 12 /* 12-15: Checksum covering the meta data, + * including the file name, and + * padding. */ +#define ROMFS_FHDR_NAME 16 /* 16-..: Zero terminated volume name, padded + * to 16 byte boundary. */ + +/* Bits 0-3 of the rf_next offset provide mode information. These are the + * values specified in + */ + +#define RFNEXT_MODEMASK 7 /* Bits 0-2: Mode; bit 3: Executable */ +#define RFNEXT_ALLMODEMASK 15 /* Bits 0-3: All mode bits */ +#define RFNEXT_OFFSETMASK (~15) /* Bits n-3: Offset to next entry */ + +#define RFNEXT_HARDLINK 0 /* rf_info = Link destination file header */ +#define RFNEXT_DIRECTORY 1 /* rf_info = First file's header */ +#define RFNEXT_FILE 2 /* rf_info = Unused, must be zero */ +#define RFNEXT_SOFTLINK 3 /* rf_info = Unused, must be zero */ +#define RFNEXT_BLOCKDEV 4 /* rf_info = 16/16 bits major/minor number */ +#define RFNEXT_CHARDEV 5 /* rf_info = 16/16 bits major/minor number */ +#define RFNEXT_SOCKET 6 /* rf_info = Unused, must be zero */ +#define RFNEXT_FIFO 7 /* rf_info = Unused, must be zero */ +#define RFNEXT_EXEC 8 /* Modifier of RFNEXT_DIRECTORY and RFNEXT_FILE */ + +#define IS_MODE(rfn,mode) ((((uint32_t)(rfn))&RFNEXT_MODEMASK)==(mode)) +#define IS_HARDLINK(rfn) IS_MODE(rfn,RFNEXT_HARDLINK) +#define IS_DIRECTORY(rfn) IS_MODE(rfn,RFNEXT_DIRECTORY) +#define IS_FILE(rfn) IS_MODE(rfn,RFNEXT_FILE) +#define IS_SOFTLINK(rfn) IS_MODE(rfn,RFNEXT_SOFTLINK) +#define IS_BLOCKDEV(rfn) IS_MODE(rfn,RFNEXT_BLOCKDEV) +#define IS_CHARDEV(rfn) IS_MODE(rfn,RFNEXT_CHARDEV) +#define IS_SOCKET(rfn) IS_MODE(rfn,RFNEXT_SOCKET) +#define IS_FIFO(rfn) IS_MODE(rfn,RFNEXT_FIFO) +#define IS_EXECUTABLE(rfn) (((rfn) & RFNEXT_EXEC) != 0) + +/* RFNEXT_SOFTLINK, RFNEXT_BLOCKDEV, RFNEXT_CHARDEV, RFNEXT_SOCKET, and + * RFNEXT_FIFO are not presently supported in NuttX. + */ + +/* Alignment macros */ + +#define ROMFS_ALIGNMENT 16 +#define ROMFS_MAXPADDING (ROMFS_ALIGNMENT-1) +#define ROMFS_ALIGNMASK (~ROMFS_MAXPADDING) +#define ROMFS_ALIGNUP(addr) ((((uint32_t)(addr))+ROMFS_MAXPADDING)&ROMFS_ALIGNMASK) +#define ROMFS_ALIGNDOWN(addr) (((uint32_t)(addr))&ROMFS_ALIGNMASK) + +/* Offset and sector conversions */ + +#define SEC_NDXMASK(r) ((r)->lm_hwsectorsize - 1) +#define SEC_NSECTORS(r,o) ((o) / (r)->lm_hwsectorsize) +#define SEC_ALIGN(r,o) ((o) & ~SEC_NDXMASK(r)) +#define SEC_ALIGNUP(r,o) (((o) + (r)->lm_hwsectorsize - 1) & ~SEC_NDXMASK(r)) + +/* Maximum numbr of links that will be followed before we decide that there + * is a problem. + */ + +#define ROMF_MAX_LINKS 64 + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* This structure represents the spare list. An instance of this + * structure is retained as file header and file data size on each mountpoint + * that is mounted with a lrofs filesystem. + */ + +struct lrofs_sparenode_s +{ + struct list_node node; + uint32_t start; + uint32_t end; +}; + +struct lrofs_mountpt_s +{ + FAR struct inode *lm_blkdriver; /* The block driver inode that hosts the lrofs */ + FAR struct lrofs_nodeinfo_s *lm_root; /* The node for root node */ + bool lm_mounted; /* true: The file system is ready */ + uint16_t lm_hwsectorsize; /* HW: Sector size reported by block driver */ + rmutex_t lm_lock; /* Used to assume thread-safe access */ + uint32_t lm_refs; /* The references for all files opened on this mountpoint */ + uint32_t lm_hwnsectors; /* HW: The number of sectors reported by the hardware */ + uint32_t lm_volsize; /* Size of the ROMFS volume */ + uint32_t lm_cachesector; /* Current sector in the rm_buffer */ + FAR uint8_t *lm_xipbase; /* Base address of directly accessible media */ + FAR uint8_t *lm_buffer; /* Device sector buffer, allocated if rm_xipbase==0 */ + FAR uint8_t *lm_devbuffer; /* Device sector buffer, allocated for write if rm_xipbase != 0 */ + sem_t lm_sem; /* The semaphore to assume write safe */ + struct list_node lm_sparelist; /* The list of spare space */ +}; + +struct lrofs_nodeinfo_s +{ + uint32_t ln_origoffset; /* Offset of origin file header */ + uint32_t ln_offset; /* Offset of real file header */ + uint32_t ln_next; /* Offset of the next file header+flags */ + uint32_t ln_size; /* Size (if file) */ + FAR struct lrofs_nodeinfo_s *ln_parent; /* The parent node in the upper level */ + FAR struct lrofs_nodeinfo_s **ln_child; /* The node array for link to lower level */ + uint16_t ln_count; /* The count of node in rn_child level */ + uint16_t ln_max; /* The max count of node in rn_child level */ + uint8_t ln_namesize; /* The length of name of the entry */ + char ln_name[1]; /* The name to the entry */ +}; + +/* This structure represents on open file under the mountpoint. An instance + * of this structure is retained as struct file specific information on each + * opened file. + */ + +struct lrofs_file_s +{ + uint32_t lf_startoffset; /* Offset to the start of the file data */ + uint32_t lf_endsector; /* Last sector of the file data */ + uint32_t lf_size; /* Size of the file in bytes */ + uint32_t lf_cachesector; /* First sector in the rf_buffer */ + uint32_t lf_ncachesector; /* Number of sectors in the rf_buffer */ + FAR struct lrofs_nodeinfo_s *lf_ln; /* The node struct addr of the file */ + FAR uint8_t *lf_buffer; /* File sector buffer, allocated if rm_xipbase==0 */ + uint8_t lf_type; /* File type (for fstat()) */ + char lf_path[1]; /* Path of open file */ +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +int lrofs_checkmount(FAR struct lrofs_mountpt_s *lm); +int lrofs_datastart(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln, + FAR uint32_t *start); +int lrofs_fileconfigure(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_file_s *lf); +int lrofs_hwread(FAR struct lrofs_mountpt_s *lm, FAR uint8_t *buffer, + uint32_t sector, unsigned int nsectors); +void lrofs_freenode(FAR struct lrofs_nodeinfo_s *nodeinfo); +int lrofs_parsedirentry(FAR struct lrofs_mountpt_s *lm, uint32_t offset, + FAR uint32_t *poffset, uint32_t *pnext, + FAR uint32_t *pinfo, FAR uint32_t *psize); +int lrofs_parsefilename(FAR struct lrofs_mountpt_s *lm, uint32_t offset, + FAR char *pname); +FAR struct lrofs_nodeinfo_s * +lrofs_finddirentry(FAR struct lrofs_mountpt_s *lm, + FAR const char *path); +int lrofs_filecacheread(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_file_s *lf, + uint32_t sector); +int lrofs_hwconfigure(FAR struct lrofs_mountpt_s *lm); +int lrofs_fsconfigure(FAR struct lrofs_mountpt_s *lm, + FAR const void *data); +int lrofs_mkfs(FAR struct lrofs_mountpt_s *lm); +int lrofs_create(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s **ln, + FAR const char *relpath, + bool isdir); +int lrofs_remove(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln_parent, + FAR const char *relpath, + bool isdir); +int lrofs_write_file(FAR struct file *filep, + FAR const char *buffer, + size_t buflen); +int lrofs_truncate_file(FAR struct file *filep, + off_t length); +int lrofs_rename_file(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln_old, + FAR struct lrofs_nodeinfo_s *ln_newpath, + FAR const char *newname); +void lrofs_free_sparelist(FAR struct list_node *list); +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __FS_LROFS_FS_LROFS_H */ \ No newline at end of file diff --git a/fs/lrofs/fs_lrofsutil.c b/fs/lrofs/fs_lrofsutil.c new file mode 100644 index 00000000000..84f7b85b1d8 --- /dev/null +++ b/fs/lrofs/fs_lrofsutil.c @@ -0,0 +1,2498 @@ +/**************************************************************************** + * fs/lrofs/fs_lrofsutil.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "fs_lrofs.h" +#include "fs_heap.h" + +/**************************************************************************** + * Pre-processor Declarations + ****************************************************************************/ + +#define LINK_NOT_FOLLOWED 0 +#define LINK_FOLLOWED 1 +#define NODEINFO_NINCR 4 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct lrofs_entryname_s +{ + FAR const char *le_name; + size_t le_len; +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static int lrofs_nodeinfo_search(FAR const void *a, FAR const void *b) +{ + FAR struct lrofs_nodeinfo_s *ln = *(FAR struct lrofs_nodeinfo_s **)b; + FAR const struct lrofs_entryname_s *le = a; + FAR const char *name = ln->ln_name; + size_t len = ln->ln_namesize; + int ret; + + if (len > le->le_len) + { + len = le->le_len; + } + + ret = memcmp(le->le_name, name, len); + if (ret == 0) + { + if (le->le_name[len] == '/' || le->le_name[len] == '\0') + { + return name[len] == '\0' ? 0 : -1; + } + else + { + return 1; + } + } + + return ret; +} + +static int lrofs_nodeinfo_compare(FAR const void *a, FAR const void *b) +{ + FAR struct lrofs_nodeinfo_s *ln = *(FAR struct lrofs_nodeinfo_s **)a; + struct lrofs_entryname_s le; + + le.le_name = ln->ln_name; + le.le_len = ln->ln_namesize; + return lrofs_nodeinfo_search(&le, b); +} + +/**************************************************************************** + * Name: lrofs_devmemcpy + ****************************************************************************/ + +static void lrofs_devmemcpy(FAR struct lrofs_mountpt_s *lm, + int ndx, FAR const void *buf, size_t len) +{ + memcpy(lm->lm_devbuffer + ndx, buf, len); +} + +/**************************************************************************** + * Name: lrofs_devstrcpy + ****************************************************************************/ + +static void lrofs_devstrcpy(FAR struct lrofs_mountpt_s *lm, + int ndx, FAR const char *buf) +{ + strcpy((FAR char *)lm->lm_devbuffer + ndx, buf); +} + +/**************************************************************************** + * Name: lrofs_devload32 + * + * Description: + * Load the big-endian 32-bit value to the mount device buffer + * + ****************************************************************************/ + +static uint32_t lrofs_devload32(FAR struct lrofs_mountpt_s *lm, int ndx) +{ + return ((((uint32_t)lm->lm_devbuffer[ndx] & 0xff) << 24) | + (((uint32_t)lm->lm_devbuffer[ndx + 1] & 0xff) << 16) | + (((uint32_t)lm->lm_devbuffer[ndx + 2] & 0xff) << 8) | + ((uint32_t)lm->lm_devbuffer[ndx + 3] & 0xff)); +} + +/**************************************************************************** + * Name: lrofs_devread32 + * + * Description: + * Read the big-endian 32-bit value from the mount device buffer + * + * Assumption: + * All values are aligned to 32-bit boundaries + * + ****************************************************************************/ + +static uint32_t lrofs_devread32(FAR struct lrofs_mountpt_s *lm, int ndx) +{ + /* This should not read past the end of the sector since the directory + * entries are aligned at 16-byte boundaries. + */ + + return ((((uint32_t)lm->lm_buffer[ndx] & 0xff) << 24) | + (((uint32_t)lm->lm_buffer[ndx + 1] & 0xff) << 16) | + (((uint32_t)lm->lm_buffer[ndx + 2] & 0xff) << 8) | + ((uint32_t)lm->lm_buffer[ndx + 3] & 0xff)); +} + +/**************************************************************************** + * Name: lrofs_devwrite32 + * + * Description: + * Write the big-endian 32-bit value to the mount device buffer + * + ****************************************************************************/ + +static void lrofs_devwrite32(FAR struct lrofs_mountpt_s *lm, + int ndx, uint32_t value) +{ + /* Write the 32-bit value to the specified index in the buffer */ + + lm->lm_devbuffer[ndx] = (uint8_t)(value >> 24) & 0xff; + lm->lm_devbuffer[ndx + 1] = (uint8_t)(value >> 16) & 0xff; + lm->lm_devbuffer[ndx + 2] = (uint8_t)(value >> 8) & 0xff; + lm->lm_devbuffer[ndx + 3] = (uint8_t)(value & 0xff); +} + +/**************************************************************************** + * Name: lrofs_hwwrite + * + * Description: + * Write the specified number of sectors to the block device + * + ****************************************************************************/ + +static int lrofs_hwwrite(FAR struct lrofs_mountpt_s *lm, FAR uint8_t *buffer, + uint32_t sector, unsigned int nsectors) +{ + FAR struct inode *inode = lm->lm_blkdriver; + ssize_t ret = -ENODEV; + + if (inode->u.i_bops->write) + { + ret = inode->u.i_bops->write(inode, buffer, sector, nsectors); + } + + if (ret == (ssize_t)nsectors) + { + ret = 0; + } + + return ret; +} + +/**************************************************************************** + * Name: lrofs_devcachewrite + * + * Description: + * Write the specified sector for specified offset into the sector cache. + * + ****************************************************************************/ + +static int lrofs_devcachewrite(FAR struct lrofs_mountpt_s *lm, + uint32_t sector) +{ + int ret; + + ret = lrofs_hwwrite(lm, lm->lm_devbuffer, sector, 1); + if (ret >= 0) + { + lm->lm_cachesector = sector; + } + else + { + lm->lm_cachesector = (uint32_t)-1; + } + + return ret; +} + +/**************************************************************************** + * Name: lrofs_filecachewrite + * + * Description: + * Write the specified sector for specified offset into the sector cache. + * + ****************************************************************************/ + +static int lrofs_filecachewrite(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_file_s *lf) +{ + int ret; + + ret = lrofs_hwwrite(lm, lf->lf_buffer, lf->lf_cachesector, + lf->lf_ncachesector); + if (ret < 0) + { + ferr("ERROR: lrofs_hwwrite failed: %d\n", ret); + } + + return ret; +} + +/**************************************************************************** + * Name: lrofs_devcacheload + * + * Description: + * Read the specified sector for specified offset into the sector cache. + * Return the index into the sector corresponding to the offset + * + ****************************************************************************/ + +static int16_t lrofs_devcacheload(FAR struct lrofs_mountpt_s *lm, + uint32_t offset) +{ + uint32_t sector; + int ret; + + sector = SEC_NSECTORS(lm, offset); + if (lm->lm_cachesector != sector) + { + ret = lrofs_hwread(lm, lm->lm_devbuffer, sector, 1); + if (ret < 0) + { + return (int16_t)ret; + } + + lm->lm_cachesector = sector; + } + + return offset & SEC_NDXMASK(lm); +} + +/**************************************************************************** + * Name: lrofs_searchdir + * + * Description: + * This is part of the lrofs_finddirentry. Search the directory + * beginning at nodeinfo->rn_offset for entryname. + * + ****************************************************************************/ + +static FAR struct lrofs_nodeinfo_s * +lrofs_searchdir(FAR struct lrofs_mountpt_s *lm, FAR const char *entryname, + int entrylen, FAR struct lrofs_nodeinfo_s *ln) +{ + FAR struct lrofs_nodeinfo_s **cnodeinfo; + struct lrofs_entryname_s le; + + le.le_name = entryname; + le.le_len = entrylen; + cnodeinfo = bsearch(&le, ln->ln_child, ln->ln_count, + sizeof(*ln->ln_child), lrofs_nodeinfo_search); + if (cnodeinfo) + { + return *cnodeinfo; + } + + return NULL; +} + +/**************************************************************************** + * Name: lrofs_alloc_sparenode + * + * Description: + * Allocate the spare node + * + ****************************************************************************/ + +static FAR struct lrofs_sparenode_s * +lrofs_alloc_sparenode(uint32_t start, uint32_t end) +{ + FAR struct lrofs_sparenode_s *node; + node = fs_heap_malloc(sizeof(struct lrofs_sparenode_s)); + if (node == NULL) + { + ferr("lrofs_alloc_sparenode: no memory\n"); + return NULL; + } + + node->start = start; + node->end = end; + return node; +} + +/**************************************************************************** + * Name: lrofs_init_sparelist + * + * Description: + * Init the sparelist + * + ****************************************************************************/ + +static int lrofs_init_sparelist(FAR struct lrofs_mountpt_s *lm) +{ + FAR struct lrofs_sparenode_s *node; + + list_initialize(&lm->lm_sparelist); + node = lrofs_alloc_sparenode(0, lm->lm_hwsectorsize * + lm->lm_hwnsectors); + if (node == NULL) + { + return -ENOMEM; + } + + list_add_head(&lm->lm_sparelist, &node->node); + lm->lm_volsize = 0; + return 0; +} + +/**************************************************************************** + * Name: lrofs_alloc_spareregion + * + * Description: + * Allocate the spare region + * + ****************************************************************************/ + +static int lrofs_alloc_spareregion(FAR struct list_node *list, + uint32_t start, uint32_t end) +{ + FAR struct lrofs_sparenode_s *node; + + list_for_every_entry(list, node, struct lrofs_sparenode_s, node) + { + /* Find the node that start ~ end + * is in node->start ~ node->end + */ + + if (start == node->start && end == node->end) + { + /* Delete the node */ + + list_delete(&node->node); + fs_heap_free(node); + return 0; + } + else if (start == node->start && end < node->end) + { + /* Update the node */ + + node->start = end; + return 0; + } + else if (end == node->end && start > node->start) + { + /* Update the node */ + + node->end = start; + return 0; + } + else if (start > node->start && end < node->end) + { + /* Split the node */ + + FAR struct lrofs_sparenode_s *new; + new = lrofs_alloc_sparenode(end, node->end); + if (new == NULL) + { + return -ENOMEM; + } + + node->end = start; + list_add_after(&node->node, &new->node); + return 0; + } + } + + /* Not found */ + + ferr("No space for start %" PRIu32 ", end %" PRIu32 "\n", start, end); + return -ENOENT; +} + +/**************************************************************************** + * Name: lrofs_free_spareregion + * + * Description: + * Free the spare region + * + ****************************************************************************/ + +static int lrofs_free_spareregion(FAR struct list_node *list, + uint32_t start, uint32_t end) +{ + FAR struct lrofs_sparenode_s *node; + FAR struct lrofs_sparenode_s *next; + FAR struct lrofs_sparenode_s *new; + + list_for_every_entry(list, node, struct lrofs_sparenode_s, node) + { + /* Check if the freed space is adjacent to the node */ + + if (start == node->end) + { + /* Update the node */ + + node->end = end; + + /* Check if the freed space is adjacent to the next node */ + + if (node->node.next != list) + { + next = container_of(node->node.next, struct lrofs_sparenode_s, + node); + if (end == next->start) + { + /* Merge the node */ + + node->end = next->end; + list_delete(&next->node); + fs_heap_free(next); + } + } + + return 0; + } + else if (end == node->start) + { + /* Update the node */ + + node->start = start; + return 0; + } + else if (end < node->start) + { + new = lrofs_alloc_sparenode(start, end); + if (new == NULL) + { + return -ENOMEM; + } + + list_add_before(&node->node, &new->node); + return 0; + } + } + + ferr("No spare area fixed for start %" PRIu32 " end %" PRIu32 "\n", + start, end); + return -ENOENT; +} + +/**************************************************************************** + * Name: lrofs_find_alinged_fileaddr + * + * Description: + * Find the aligned file address + * + ****************************************************************************/ + +static uint32_t lrofs_find_alinged_fileaddr(FAR struct lrofs_mountpt_s *lm, + uint32_t start, uint32_t maxsize, + uint32_t size) +{ + uint32_t offset = SEC_ALIGNUP(lm, start); + uint32_t head_addr; + + while (offset - start < size) + { + offset += lm->lm_hwsectorsize; + if (offset > start + maxsize) + { + return 0; + } + } + + head_addr = offset - size; + if (head_addr >= start && head_addr + size <= start + maxsize) + { + return head_addr; + } + + return 0; +} + +/**************************************************************************** + * Name: lrofs_add_sparenode + * + * Description: + * Add the spare node + * + ****************************************************************************/ + +static uint32_t lrofs_add_sparenode(FAR struct lrofs_mountpt_s *lm, + uint32_t size, bool isdir) +{ + FAR struct list_node *list = &lm->lm_sparelist; + FAR struct lrofs_sparenode_s *node; + uint32_t offset = 0; + + if (isdir) + { + list_for_every_entry(list, node, struct lrofs_sparenode_s, node) + { + if (node->end - node->start >= size) + { + uint32_t aligned = SEC_ALIGNUP(lm, node->start); + offset = ROMFS_ALIGNUP(node->start); + if (aligned - offset < size) + { + offset = aligned; + } + + if (offset + size <= node->end) + { + lrofs_alloc_spareregion(list, offset, offset + size); + return offset; + } + } + } + } + else + { + /* Return the max size spare node for file */ + + uint32_t maxsize = 0; + list_for_every_entry(list, node, struct lrofs_sparenode_s, node) + { + if (node->end - node->start > maxsize) + { + offset = node->start; + maxsize = node->end - node->start; + } + } + + if (maxsize >= size) + { + offset = lrofs_find_alinged_fileaddr(lm, offset, maxsize, size); + if (offset) + { + lrofs_alloc_spareregion(list, offset, offset + size); + return offset; + } + } + } + + return 0; +} + +/**************************************************************************** + * Name: lrofs_update_parentnode + * + * Description: + * Update the parent node + * + ****************************************************************************/ + +static int lrofs_update_parentnode(FAR struct lrofs_nodeinfo_s *ln_parent, + FAR struct lrofs_nodeinfo_s *ln) +{ + if (ln_parent->ln_child == NULL || + ln_parent->ln_count == ln_parent->ln_max - 1) + { + FAR void *tmp; + tmp = fs_heap_realloc(ln_parent->ln_child, + (ln_parent->ln_max + NODEINFO_NINCR) * + sizeof(*ln_parent->ln_child)); + if (tmp == NULL) + { + return -ENOMEM; + } + + ln_parent->ln_child = tmp; + memset(ln_parent->ln_child + ln_parent->ln_max, 0, NODEINFO_NINCR * + sizeof(*ln_parent->ln_child)); + ln_parent->ln_max += NODEINFO_NINCR; + } + + ln_parent->ln_child[ln_parent->ln_count++] = ln; + if (ln_parent->ln_count > 1) + { + qsort(ln_parent->ln_child, ln_parent->ln_count, + sizeof(*ln_parent->ln_child), lrofs_nodeinfo_compare); + } + + return OK; +} + +/**************************************************************************** + * Name: lrofs_find_parentnode + * + * Description: + * Find the parent node + * + ****************************************************************************/ + +static FAR struct lrofs_nodeinfo_s * +lrofs_find_parentnode(FAR struct lrofs_mountpt_s *lm, FAR const char *path) +{ + FAR struct lrofs_nodeinfo_s *ln_parent; + FAR struct lrofs_nodeinfo_s **pinfo; + FAR char *parentpath; + struct lrofs_entryname_s le; + + le.le_name = basename((FAR char *)path); + le.le_len = strlen(le.le_name); + parentpath = dirname((FAR char *)path); + if (strcmp(parentpath, ".") == 0) + { + ln_parent = lm->lm_root; + } + else + { + ln_parent = lrofs_finddirentry(lm, parentpath); + if (ln_parent == NULL) + { + return NULL; + } + } + + pinfo = bsearch(&le, ln_parent->ln_child, ln_parent->ln_count, + sizeof(*(ln_parent->ln_child)), lrofs_nodeinfo_search); + if (pinfo) + { + return *pinfo; + } + + return NULL; +} + +/**************************************************************************** + * Name: lrofs_get_prevnode + * + * Description: + * Get the previous node + * + ****************************************************************************/ + +static FAR struct lrofs_nodeinfo_s * +lrofs_get_prevnode(FAR struct lrofs_nodeinfo_s *ln, FAR bool *firstchild) +{ + FAR struct lrofs_nodeinfo_s *ln_parent = ln->ln_parent; + FAR struct lrofs_nodeinfo_s *ln_prevnode; + int i; + + *firstchild = false; + if (ln_parent == NULL) + { + return NULL; + } + + for (i = 0; i < ln_parent->ln_count; i++) + { + ln_prevnode = ln_parent->ln_child[i]; + if ((ln_prevnode->ln_next & RFNEXT_OFFSETMASK) == + (ln->ln_origoffset & RFNEXT_OFFSETMASK)) + { + return ln_prevnode; + } + } + + *firstchild = true; + return ln_parent; +} + +/**************************************************************************** + * Name: lrofs_add_disk + * + * Description: + * Add the node to disk + * + ****************************************************************************/ + +static int lrofs_add_disk(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln_prev, + FAR struct lrofs_nodeinfo_s *ln, + uint32_t type, bool firstchild) +{ + FAR struct lrofs_nodeinfo_s *ln_parent = ln->ln_parent; + uint32_t node_info = 0; + uint32_t pre_next; + int16_t ndx; + int ret; + + /* Get the node sector index linkoffset */ + + ndx = lrofs_devcacheload(lm, ln->ln_origoffset); + if (ndx < 0) + { + return ndx; + } + + if (strcmp(ln->ln_name, ".") == 0) + { + node_info = ln_parent->ln_origoffset & RFNEXT_OFFSETMASK; + } + else if (strcmp(ln->ln_name, "..") == 0) + { + node_info = (ln_parent->ln_parent == NULL) ? 32 : + ln_parent->ln_origoffset & RFNEXT_OFFSETMASK; + } + + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_INFO, node_info); + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_NEXT, type); + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_SIZE, 0); + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_CHKSUM, 0); + memcpy(lm->lm_devbuffer + ndx + ROMFS_FHDR_NAME, ln->ln_name, + ln->ln_namesize + 1); + ret = lrofs_devcachewrite(lm, SEC_NSECTORS(lm, ln->ln_origoffset)); + if (ret < 0) + { + return ret; + } + + /* Get the prevnode sector index */ + + ndx = lrofs_devcacheload(lm, ln_prev->ln_origoffset); + if (ndx < 0) + { + return ndx; + } + + /* Update the prevnode next */ + + if (firstchild) + { + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_INFO, + (ln->ln_origoffset & RFNEXT_OFFSETMASK)); + return lrofs_devcachewrite(lm, + SEC_NSECTORS(lm, ln_prev->ln_origoffset)); + } + + pre_next = lrofs_devload32(lm, ndx + ROMFS_FHDR_NEXT); + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_NEXT, + (ln->ln_origoffset & RFNEXT_OFFSETMASK) | + (pre_next & RFNEXT_ALLMODEMASK)); + + return lrofs_devcachewrite(lm, SEC_NSECTORS(lm, ln_prev->ln_origoffset)); +} + +/**************************************************************************** + * Name: lrofs_alloc_nodeinfo + * + * Description: + * Alloc the nodeinfo + * + ****************************************************************************/ + +static FAR struct lrofs_nodeinfo_s * +lrofs_alloc_nodeinfo(uint32_t offset, uint32_t size, uint32_t next, + FAR const char *name) +{ + FAR struct lrofs_nodeinfo_s *ln; + + ln = fs_heap_zalloc(sizeof(struct lrofs_nodeinfo_s) + strlen(name)); + if (ln == NULL) + { + return NULL; + } + + ln->ln_origoffset = offset; + ln->ln_offset = offset; + ln->ln_next = next; + ln->ln_size = size; + ln->ln_namesize = strlen(name); + memcpy(ln->ln_name, name, strlen(name) + 1); + return ln; +} + +/**************************************************************************** + * Name: lrofs_remove_disk + * + * Description: + * Remove the node from disk + * + ****************************************************************************/ + +static int lrofs_remove_disk(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln_prev, + FAR struct lrofs_nodeinfo_s *ln, + bool firstchild) +{ + uint32_t node_next; + uint32_t pre_next; + int16_t ndx; + + /* Get the node sector index */ + + ndx = lrofs_devcacheload(lm, ln->ln_origoffset); + if (ndx < 0) + { + return ndx; + } + + node_next = lrofs_devload32(lm, ndx + ROMFS_FHDR_NEXT); + + /* Get the prevnode sector index */ + + ndx = lrofs_devcacheload(lm, ln_prev->ln_origoffset); + if (ndx < 0) + { + return ndx; + } + + pre_next = lrofs_devload32(lm, ndx + ROMFS_FHDR_NEXT); + if (firstchild) + { + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_INFO, + (node_next & RFNEXT_OFFSETMASK)); + return lrofs_devcachewrite(lm, + SEC_NSECTORS(lm, ln_prev->ln_origoffset)); + } + + /* Update the prevnode next */ + + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_NEXT, + (node_next & RFNEXT_OFFSETMASK) | + (pre_next & RFNEXT_ALLMODEMASK)); + + return lrofs_devcachewrite(lm, SEC_NSECTORS(lm, ln_prev->ln_origoffset)); +} + +/**************************************************************************** + * Name: lrofs_cachenode + * + * Description: + * Alloc all entry node at once when filesystem is mounted + * + ****************************************************************************/ + +static int lrofs_cachenode(FAR struct lrofs_mountpt_s *lm, + uint32_t origoffset, uint32_t offset, + uint32_t next, uint32_t size, + FAR const char *name, + FAR struct lrofs_nodeinfo_s **pnodeinfo, + FAR struct lrofs_nodeinfo_s *parent) +{ + FAR struct lrofs_nodeinfo_s **child; + FAR struct lrofs_nodeinfo_s *ln; + char childname[NAME_MAX + 1]; + uint16_t count = 0; + uint32_t totalsize; + uint32_t info; + size_t nsize; + int ret; + + nsize = strlen(name); + ln = fs_heap_zalloc(sizeof(struct lrofs_nodeinfo_s) + nsize); + if (ln == NULL) + { + return -ENOMEM; + } + + *pnodeinfo = ln; + ln->ln_origoffset = origoffset; + ln->ln_parent = parent; + ln->ln_offset = offset; + ln->ln_next = next; + ln->ln_namesize = nsize; + memcpy(ln->ln_name, name, nsize + 1); + + totalsize = ROMFS_ALIGNUP(ROMFS_FHDR_NAME + nsize + 1); + if (offset == origoffset) + { + totalsize += ROMFS_ALIGNUP(size); + } + + lm->lm_volsize += totalsize; + ret = lrofs_alloc_spareregion(&lm->lm_sparelist, origoffset, + origoffset + totalsize); + if (ret < 0) + { + return ret; + } + + if (!IS_DIRECTORY(next) || (strcmp(name, ".") == 0) || + (strcmp(name, "..") == 0)) + { + ln->ln_size = size; + return 0; + } + + origoffset = offset; + child = ln->ln_child; + + do + { + /* Fetch the directory entry at this offset */ + + ret = lrofs_parsedirentry(lm, origoffset, &offset, &next, &info, + &size); + if (ret < 0) + { + return ret; + } + + ret = lrofs_parsefilename(lm, origoffset, childname); + if (ret < 0) + { + return ret; + } + + if (child == NULL || ln->ln_count == count - 1) + { + FAR void *tmp; + tmp = fs_heap_realloc(ln->ln_child, (count + NODEINFO_NINCR) * + sizeof(*ln->ln_child)); + if (tmp == NULL) + { + return -ENOMEM; + } + + ln->ln_child = tmp; + memset(ln->ln_child + count, 0, NODEINFO_NINCR * + sizeof(*ln->ln_child)); + count += NODEINFO_NINCR; + } + + child = &ln->ln_child[ln->ln_count++]; + if (IS_DIRECTORY(next)) + { + offset = info; + } + + ln->ln_max = count; + ret = lrofs_cachenode(lm, origoffset, offset, next, size, + childname, child, ln); + if (ret < 0) + { + ln->ln_count--; + return ret; + } + + next &= RFNEXT_OFFSETMASK; + origoffset = next; + } + while (next != 0); + + if (ln->ln_count > 1) + { + qsort(ln->ln_child, ln->ln_count, sizeof(*ln->ln_child), + lrofs_nodeinfo_compare); + } + + return 0; +} + +/**************************************************************************** + * Name: lrofs_update_filesize + * + * Description: + * Update the file size to lrofs + * + ****************************************************************************/ + +static int lrofs_update_filesize(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln, + uint32_t size) +{ + int16_t ndx; + + /* Get the node sector index */ + + ndx = lrofs_devcacheload(lm, ln->ln_offset); + if (ndx < 0) + { + return ndx; + } + + /* Update the node size */ + + lrofs_devwrite32(lm, ndx + ROMFS_FHDR_SIZE, size); + return lrofs_devcachewrite(lm, + SEC_NSECTORS((FAR struct lrofs_mountpt_s *)lm, + ln->ln_origoffset)); +} + +/**************************************************************************** + * Name: lrofs_do_create + * + * Description: + * Create the node + * + ****************************************************************************/ + +static FAR struct lrofs_nodeinfo_s * +lrofs_do_create(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln_parent, + uint32_t offset, uint32_t size, uint16_t type, + FAR const char *name, bool firstchild) +{ + FAR struct lrofs_nodeinfo_s *ln; + FAR struct lrofs_nodeinfo_s *ln_prev = ln_parent; + int ret; + int i; + + /* Init nodeinfo for file */ + + ln = lrofs_alloc_nodeinfo(offset, size, type, name); + if (ln == NULL) + { + return NULL; + } + + /* Update the node parent addr */ + + ln->ln_parent = ln_parent; + + /* Wirte the node to disk */ + + if (strcmp(name, ".") == 0 || strcmp(name, "..") == 0) + { + type = RFNEXT_HARDLINK; + } + + if (!firstchild) + { + for (i = 0; i < ln_parent->ln_count; i++) + { + ln_prev = ln_parent->ln_child[i]; + if ((ln_prev->ln_next & RFNEXT_OFFSETMASK) == 0) + { + break; + } + } + } + + ret = lrofs_add_disk(lm, ln_prev, ln, type, firstchild); + if (ret < 0) + { + fs_heap_free(ln); + return NULL; + } + + /* Update the prevnode nodeinfo */ + + if (!firstchild) + { + ln_prev->ln_next = (ln->ln_origoffset & RFNEXT_OFFSETMASK) | + (ln_prev->ln_next & RFNEXT_ALLMODEMASK); + } + + /* Update the parent nodeinfo */ + + ret = lrofs_update_parentnode(ln_parent, ln); + if (ret < 0) + { + fs_heap_free(ln); + return NULL; + } + + return ln; +} + +/**************************************************************************** + * Name: lrofs_devcacheread + * + * Description: + * Read the specified sector for specified offset into the sector cache. + * Return the index into the sector corresponding to the offset + * + ****************************************************************************/ + +static int16_t lrofs_devcacheread(FAR struct lrofs_mountpt_s *lm, + uint32_t offset) +{ + uint32_t sector; + int ret; + + /* lm->lm_cachesector holds the current sector that is buffer in or + * referenced by lm->lm_buffer. If the requested sector is the same as this + * this then we do nothing. + */ + + sector = SEC_NSECTORS(lm, offset); + if (lm->lm_cachesector != sector) + { + /* Check the access mode */ + + if (lm->lm_xipbase) + { + /* In XIP mode, rf_buffer is just an offset pointer into the device + * address space. + */ + + lm->lm_buffer = lm->lm_xipbase + SEC_ALIGN(lm, offset); + } + else + { + /* In non-XIP mode, we will have to read the new sector. */ + + ret = lrofs_hwread(lm, lm->lm_buffer, sector, 1); + if (ret < 0) + { + return (int16_t)ret; + } + } + + /* Update the cached sector number */ + + lm->lm_cachesector = sector; + } + + /* Return the offset */ + + return offset & SEC_NDXMASK(lm); +} + +/**************************************************************************** + * Name: lrofs_followhardlinks + * + * Description: + * Given the offset to a file header, check if the file is a hardlink. + * If so, traverse the hard links until the terminal, non-linked header + * so found and return that offset. + * + * Return value: + * < 0 : An error occurred + * 0 : No link followed + * 1 : Link followed, poffset is the new volume offset + * + ****************************************************************************/ + +static int lrofs_followhardlinks(FAR struct lrofs_mountpt_s *lm, + uint32_t offset, FAR uint32_t *poffset) +{ + uint32_t next; + int16_t ndx; + int i; + int ret = LINK_NOT_FOLLOWED; + + /* Loop while we are redirected by hardlinks */ + + for (i = 0; i < ROMF_MAX_LINKS; i++) + { + /* Read the sector containing the offset into memory */ + + ndx = lrofs_devcacheread(lm, offset); + if (ndx < 0) + { + return ndx; + } + + /* Check if this is a hard link */ + + next = lrofs_devread32(lm, ndx + ROMFS_FHDR_NEXT); + if (!IS_HARDLINK(next)) + { + *poffset = offset; + return ret; + } + + /* Follow the hard-link. Set return to indicate that we followed a + * link and that poffset was set to the link offset is valid. + */ + + offset = lrofs_devread32(lm, ndx + ROMFS_FHDR_INFO); + ret = LINK_FOLLOWED; + } + + return -ELOOP; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lrofs_checkmount + * + * Description: Check if the mountpoint is still valid. + * + * The caller should hold the mountpoint semaphore + * + ****************************************************************************/ + +int lrofs_checkmount(FAR struct lrofs_mountpt_s *lm) +{ + FAR struct inode *inode; + struct geometry geo; + int ret; + + /* If the rm_mounted flag is false, then we have already handled the loss + * of the mount. + */ + + DEBUGASSERT(lm && lm->lm_blkdriver); + if (lm->lm_mounted) + { + /* We still think the mount is healthy. Check an see if this is + * still the case + */ + + inode = lm->lm_blkdriver; + if (inode->u.i_bops->geometry) + { + ret = inode->u.i_bops->geometry(inode, &geo); + if (ret >= 0 && geo.geo_available && !geo.geo_mediachanged) + { + return 0; + } + } + + /* If we get here, the mount is NOT healthy */ + + lm->lm_mounted = false; + } + + return -ENODEV; +} + +/**************************************************************************** + * Name: lrofs_freenode + * + * Description: + * Free the node + * + ****************************************************************************/ + +void lrofs_freenode(FAR struct lrofs_nodeinfo_s *nodeinfo) +{ + int i; + + if (IS_DIRECTORY(nodeinfo->ln_next)) + { + for (i = 0; i < nodeinfo->ln_count; i++) + { + lrofs_freenode(nodeinfo->ln_child[i]); + } + + fs_heap_free(nodeinfo->ln_child); + } + + fs_heap_free(nodeinfo); +} + +/**************************************************************************** + * Name: lrofs_hwread + * + * Description: Read the specified sector into the sector buffer + * + ****************************************************************************/ + +int lrofs_hwread(FAR struct lrofs_mountpt_s *lm, FAR uint8_t *buffer, + uint32_t sector, unsigned int nsectors) +{ + int ret = 0; + + /* Check the access mode */ + + if (lm->lm_xipbase) + { + /* In XIP mode, we just copy the requested data */ + + memcpy(buffer, + lm->lm_xipbase + sector * lm->lm_hwsectorsize, + nsectors * lm->lm_hwsectorsize); + } + else + { + /* In non-XIP mode, we have to read the data from the device */ + + FAR struct inode *inode = lm->lm_blkdriver; + ssize_t nsectorsread = + inode->u.i_bops->read(inode, buffer, sector, nsectors); + + if (nsectorsread < 0) + { + ret = nsectorsread; + } + else if (nsectorsread != (ssize_t)nsectors) + { + ret = -EINVAL; + } + } + + return ret; +} + +/**************************************************************************** + * Name: lrofs_filecacheread + * + * Description: + * Read the specified sector into the sector cache + * + ****************************************************************************/ + +int lrofs_filecacheread(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_file_s *lf, uint32_t sector) +{ + int ret; + + /* lf->lf_cachesector holds the current sector that is buffer in or + * referenced by lf->lf_buffer. If the requested sector is the same as this + * sector then we do nothing. + */ + + if (lf->lf_cachesector > sector || + lf->lf_cachesector + lf->lf_ncachesector <= sector) + { + /* Check the access mode */ + + if (lm->lm_xipbase) + { + /* In XIP mode, rf_buffer is just an offset pointer into the device + * address space. + */ + + lf->lf_buffer = lm->lm_xipbase + sector * lm->lm_hwsectorsize; + finfo("XIP buffer: %p\n", lf->lf_buffer); + } + else + { + /* In non-XIP mode, we will have to read the new sector. */ + + ret = lrofs_hwread(lm, lf->lf_buffer, sector, lf->lf_ncachesector); + if (ret < 0) + { + ferr("ERROR: lrofs_hwread failed: %d\n", ret); + return ret; + } + } + + /* Update the cached sector number */ + + lf->lf_cachesector = sector; + } + + return 0; +} + +/**************************************************************************** + * Name: lrofs_free_sparelist + * + * Description: + * Free the sparelist + * + ****************************************************************************/ + +void lrofs_free_sparelist(FAR struct list_node *list) +{ + FAR struct lrofs_sparenode_s *node; + FAR struct lrofs_sparenode_s *tmp; + + list_for_every_entry_safe(list, node, tmp, struct lrofs_sparenode_s, node) + { + list_delete(&node->node); + fs_heap_free(node); + } +} + +/**************************************************************************** + * Name: lrofs_finddirentry + * + * Description: + * Given a path to something that may or may not be in the file system, + * return the directory entry of the item. + * + ****************************************************************************/ + +FAR struct lrofs_nodeinfo_s * +lrofs_finddirentry(FAR struct lrofs_mountpt_s *lm, + FAR const char *path) +{ + FAR struct lrofs_nodeinfo_s *ln; + FAR const char *entryname; + FAR const char *terminator; + int entrylen; + + /* Start with the first element after the root directory */ + + ln = lm->lm_root; + + /* The root directory is a special case */ + + if (!path || path[0] == '\0') + { + return ln; + } + + /* Then loop for each directory/file component in the full path */ + + entryname = path; + terminator = NULL; + + for (; ; ) + { + /* Find the start of the next path component */ + + while (*entryname == '/') entryname++; + + /* Find the end of the next path component */ + + terminator = strchr(entryname, '/'); + if (!terminator) + { + entrylen = strlen(entryname); + } + else + { + entrylen = terminator - entryname; + } + + if (entrylen == 0) + { + return ln; + } + + /* Long path segment names will be truncated to NAME_MAX */ + + if (entrylen > NAME_MAX) + { + entrylen = NAME_MAX; + } + + /* Then find the entry in the current directory with the + * matching name. + */ + + ln = lrofs_searchdir(lm, entryname, entrylen, ln); + if (ln == NULL) + { + return NULL; + } + + /* Was that the last path component? */ + + if (!terminator) + { + /* Yes.. return success */ + + return ln; + } + + /* No... If that was not the last path component, then it had + * better have been a directory + */ + + if (!IS_DIRECTORY(ln->ln_next)) + { + return NULL; + } + + /* Setup to search the next directory for the next component + * of the path + */ + + entryname = terminator; + } + + return NULL; /* Won't get here */ +} + +/**************************************************************************** + * Name: lrofs_parsedirentry + * + * Description: + * Return the directory entry at this offset. If rf is NULL, then the + * mount device resources are used. Otherwise, file resources are used. + * + ****************************************************************************/ + +int lrofs_parsedirentry(FAR struct lrofs_mountpt_s *lm, uint32_t offset, + FAR uint32_t *poffset, uint32_t *pnext, + FAR uint32_t *pinfo, FAR uint32_t *psize) +{ + uint32_t save; + uint32_t next; + int16_t ndx; + int ret; + + /* Read the sector into memory */ + + ndx = lrofs_devcacheread(lm, offset); + if (ndx < 0) + { + return ndx; + } + + /* Yes.. Save the first 'next' value. That has the offset needed to + * traverse the parent directory. But we may need to change the type + * after we follow the hard links. + */ + + save = lrofs_devread32(lm, ndx + ROMFS_FHDR_NEXT); + + /* Traverse hardlinks as necessary to get to the real file header */ + + ret = lrofs_followhardlinks(lm, offset, poffset); + if (ret < 0) + { + return ret; + } + else if (ret > 0) + { + /* The link was followed */ + + ndx = lrofs_devcacheread(lm, *poffset); + if (ndx < 0) + { + return ndx; + } + } + + /* Because everything is chunked and aligned to 16-bit boundaries, + * we know that most the basic node info fits into the sector. The + * associated name may not, however. + * + * NOTE: Since ROMFS directory entries are aligned to 16-byte boundaries, + * we are assured that ndx + ROMFS_FHDR_INFO/SIZE will lie wholly within + * the sector buffer. + */ + + next = lrofs_devread32(lm, ndx + ROMFS_FHDR_NEXT); + *pnext = (save & RFNEXT_OFFSETMASK) | (next & RFNEXT_ALLMODEMASK); + *pinfo = lrofs_devread32(lm, ndx + ROMFS_FHDR_INFO); + *psize = lrofs_devread32(lm, ndx + ROMFS_FHDR_SIZE); + + return 0; +} + +/**************************************************************************** + * Name: lrofs_parsefilename + * + * Description: + * Return the filename from directory entry at this offset + * + ****************************************************************************/ + +int lrofs_parsefilename(FAR struct lrofs_mountpt_s *lm, uint32_t offset, + FAR char *pname) +{ + int16_t ndx; + uint16_t namelen = 0; + uint16_t chunklen; + bool done = false; + + /* Loop until the whole name is obtained or until NAME_MAX characters + * of the name have been parsed. + */ + + offset += ROMFS_FHDR_NAME; + while (namelen < NAME_MAX && !done) + { + /* Read the sector into memory */ + + ndx = lrofs_devcacheread(lm, offset + namelen); + if (ndx < 0) + { + return ndx; + } + + /* Is the name terminated in this 16-byte block */ + + if (lm->lm_buffer[ndx + 15] == '\0') + { + /* Yes.. then this chunk is less than 16 */ + + chunklen = strlen((FAR char *)&lm->lm_buffer[ndx]); + done = true; + } + else + { + /* No.. then this chunk is 16 bytes in length */ + + chunklen = 16; + } + + /* Check if we would exceed the NAME_MAX */ + + if (namelen + chunklen > NAME_MAX) + { + chunklen = NAME_MAX - namelen; + done = true; + } + + /* Copy the chunk */ + + memcpy(&pname[namelen], &lm->lm_buffer[ndx], chunklen); + namelen += chunklen; + } + + /* Terminate the name (NAME_MAX+1 chars total) and return success */ + + pname[namelen] = '\0'; + return 0; +} + +/**************************************************************************** + * Name: lrofs_datastart + * + * Description: + * Given the offset to a file header, return the offset to the start of + * the file data + * + ****************************************************************************/ + +int lrofs_datastart(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln, + FAR uint32_t *start) +{ + *start = ROMFS_ALIGNUP(ln->ln_offset + + ROMFS_FHDR_NAME + ln->ln_namesize + 1); + return 0; +} + +/**************************************************************************** + * Name: lrofs_hwconfigure + * + * Description: + * This function is called as part of the ROMFS mount operation. + * It configures the ROMFS filestem for use on this block driver. This + * include the accounting for the geometry of the device, setting up any + * XIP modes of operation, and/or allocating any cache buffers. + * + ****************************************************************************/ + +int lrofs_hwconfigure(FAR struct lrofs_mountpt_s *lm) +{ + FAR struct inode *inode = lm->lm_blkdriver; + struct geometry geo; + int ret; + + /* Get the underlying device geometry */ + + ret = inode->u.i_bops->geometry(inode, &geo); + if (ret < 0) + { + return ret; + } + + if (!geo.geo_available) + { + return -EBUSY; + } + + /* Save that information in the mount structure */ + + lm->lm_hwsectorsize = geo.geo_sectorsize; + lm->lm_hwnsectors = geo.geo_nsectors; + lm->lm_cachesector = (uint32_t)-1; + + /* Allocate the device cache buffer for normal sector accesses */ + + lm->lm_devbuffer = fs_heap_malloc(lm->lm_hwsectorsize); + if (!lm->lm_devbuffer) + { + return -ENOMEM; + } + + /* Determine if block driver supports the XIP mode of operation */ + + if (inode->u.i_bops->ioctl) + { + ret = inode->u.i_bops->ioctl(inode, BIOC_XIPBASE, + (unsigned long)&lm->lm_xipbase); + if (ret >= 0 && lm->lm_xipbase) + { + /* Yes.. Then we will directly access the media (vs. + * copying into an allocated sector buffer. + */ + + lm->lm_buffer = lm->lm_xipbase; + lm->lm_cachesector = 0; + return 0; + } + } + + /* The device cache buffer for normal sector accesses */ + + lm->lm_buffer = lm->lm_devbuffer; + return 0; +} + +/**************************************************************************** + * Name: lrofs_fsconfigure + * + * Description: + * This function is called as part of the ROMFS mount operation It + * sets up the mount structure to include configuration information + * contained in the ROMFS header. This is the place where we actually + * determine if the media contains a ROMFS filesystem. + * + ****************************************************************************/ + +int lrofs_fsconfigure(FAR struct lrofs_mountpt_s *lm, FAR const void *data) +{ + FAR const char *name; + int ret; + uint32_t rootoffset; + + /* Then get information about the ROMFS filesystem on the devices managed + * by this block driver. Read sector zero which contains the volume header. + */ + + ret = lrofs_devcacheread(lm, 0); + if (ret < 0) + { + return ret; + } + + /* Verify the magic number at that identifies this as a ROMFS filesystem */ + + if (memcmp(lm->lm_buffer, ROMFS_VHDR_MAGIC, ROMFS_VHDR_SIZE) != 0) + { + return -EINVAL; + } + + /* Then extract the values we need from the header and return success */ + + lm->lm_volsize = lrofs_devread32(lm, ROMFS_VHDR_SIZE); + + /* The root directory entry begins right after the header */ + + name = (FAR const char *)&lm->lm_buffer[ROMFS_VHDR_VOLNAME]; + rootoffset = ROMFS_ALIGNUP(ROMFS_VHDR_VOLNAME + strlen(name) + 1); + ret = lrofs_init_sparelist(lm); + if (ret < 0) + { + return ret; + } + + ret = lrofs_cachenode(lm, 0, rootoffset, RFNEXT_DIRECTORY, + 0, "", &lm->lm_root, NULL); + if (ret < 0) + { + lrofs_free_sparelist(&lm->lm_sparelist); + lrofs_freenode(lm->lm_root); + return ret; + } + + lm->lm_mounted = true; + return 0; +} + +/**************************************************************************** + * Name: lrofs_fileconfigure + * + * Description: + * This function is called as part of the ROMFS file open operation It + * sets up the file structure to handle buffer appropriately, depending + * upon XIP mode or not. + * + ****************************************************************************/ + +int lrofs_fileconfigure(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_file_s *lf) +{ + /* Check if XIP access mode is supported. If so, then we do not need + * to allocate anything. + */ + + if (lm->lm_xipbase) + { + /* We'll put a valid address in rf_buffer just in case. */ + + lf->lf_cachesector = 0; + lf->lf_buffer = lm->lm_xipbase; + lf->lf_ncachesector = 1; + } + else + { + uint32_t startsector; + uint32_t endoffset; + uint32_t nsectors; + + endoffset = lf->lf_startoffset + lf->lf_size; + if (lf->lf_size) + { + endoffset--; + } + + lf->lf_endsector = SEC_NSECTORS(lm, endoffset); + startsector = SEC_NSECTORS(lm, lf->lf_startoffset); + nsectors = lf->lf_endsector - startsector + 1; + if (nsectors > CONFIG_FS_ROMFS_CACHE_FILE_NSECTORS) + { + nsectors = CONFIG_FS_ROMFS_CACHE_FILE_NSECTORS; + } + + /* Nothing in the cache buffer */ + + lf->lf_cachesector = (uint32_t)-1; + lf->lf_ncachesector = nsectors; + + /* Create a file buffer to support partial sector accesses */ + + lf->lf_buffer = fs_heap_malloc(lm->lm_hwsectorsize * + lf->lf_ncachesector); + if (!lf->lf_buffer) + { + return -ENOMEM; + } + } + + return 0; +} + +/**************************************************************************** + * Name: lrofs_create + * + * Description: + * Create the file or dir to lrofs + * + ****************************************************************************/ + +int lrofs_create(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s **ln, + FAR const char *relpath, bool isdir) +{ + FAR struct lrofs_nodeinfo_s *ln_new; + FAR struct lrofs_nodeinfo_s *ln_p1 = NULL; + FAR struct lrofs_nodeinfo_s *ln_p2 = NULL; + FAR struct lrofs_nodeinfo_s *ln_parent; + FAR char *path = fs_heap_strdup(relpath); + FAR char *name; + uint32_t offset; + uint32_t size; + int ret = OK; + + /* Get the parent nodeinfo */ + + name = basename(path); + if (name == path) + { + ln_parent = lm->lm_root; + } + else + { + ln_parent = lrofs_find_parentnode(lm, dirname((FAR char *)path)); + if (ln_parent == NULL) + { + fs_heap_free(path); + return -ENOENT; + } + } + + /* Alloc the node space from lrofs sparelist */ + + size = ROMFS_ALIGNUP(ROMFS_VHDR_VOLNAME + strlen(name) + 1); + if (isdir) + { + /* Add node size of ./.. (64) */ + + size += 64; + } + + offset = lrofs_add_sparenode(lm, size, isdir); + if (offset == 0) + { + fs_heap_free(path); + return -ENOSPC; + } + + ln_new = lrofs_do_create(lm, ln_parent, offset, 0, + isdir ? RFNEXT_DIRECTORY : RFNEXT_FILE, + name, false); + if (ln_new == NULL) + { + fs_heap_free(path); + return -ENOMEM; + } + + /* If is dir then add ./.. node + * type in nodeinfo is dir in phymem is hardlink + */ + + if (isdir) + { + ln_p1 = lrofs_do_create(lm, ln_new, offset + size - 64, 0, + RFNEXT_DIRECTORY, ".", true); + if (ln_p1 == NULL) + { + ret = -ENOMEM; + goto error_out; + } + + ln_p2 = lrofs_do_create(lm, ln_new, offset + size - 32, 0, + RFNEXT_DIRECTORY, "..", false); + if (ln_p2 == NULL) + { + ret = -ENOMEM; + goto error_out; + } + } + + lm->lm_volsize += size; + *ln = ln_new; + fs_heap_free(path); + return ret; + +error_out: + if (ln_new != NULL) + { + fs_heap_free(ln_new); + } + + if (isdir) + { + if (ln_p1 != NULL) + { + fs_heap_free(ln_p1); + } + + if (ln_p2 != NULL) + { + fs_heap_free(ln_p2); + } + } + + lrofs_free_spareregion(&lm->lm_sparelist, offset, offset + size); + fs_heap_free(path); + return ret; +} + +/**************************************************************************** + * Name: lrofs_write_file + * + * Description: + * Write the file to lrofs + * + ****************************************************************************/ + +int lrofs_write_file(FAR struct file *filep, FAR const char *buffer, + size_t buflen) +{ + FAR struct lrofs_mountpt_s *lm = filep->f_inode->i_private; + FAR struct lrofs_file_s *lf = filep->f_priv; + FAR uint8_t *userbuffer = (FAR uint8_t *)buffer; + FAR struct lrofs_nodeinfo_s *ln = lf->lf_ln; + unsigned int byteswritten; + unsigned int writesize = 0; + unsigned int nsectors; + uint32_t offset; + uint32_t savedoffset; + uint32_t sector; + off_t savedbuflen; + int sectorndx; + int ret; + + /* Check if there has enough space on disk */ + + offset = lf->lf_startoffset + filep->f_pos; + savedoffset = lf->lf_startoffset + lf->lf_size; + if (filep->f_pos < lf->lf_size) + { + /* We are writing to an existing file. Check if we need to extend + * the file. + */ + + savedbuflen = filep->f_pos + buflen - lf->lf_size; + } + else + { + savedbuflen = buflen; + } + + if (savedbuflen > 0 && + lrofs_alloc_spareregion(&lm->lm_sparelist, + savedoffset, + savedoffset + savedbuflen) != 0) + { + ferr("ERROR: lrofs_alloc_spareregion failed\n"); + return -ENOSPC; + } + + /* Loop until either (1) all data has been transferred, or (2) an + * error occurs. + */ + + while (buflen > 0) + { + /* Get the first sector and index to read from. */ + + offset = lf->lf_startoffset + filep->f_pos; + sector = SEC_NSECTORS(lm, offset); + sectorndx = offset & SEC_NDXMASK(lm); + nsectors = SEC_NSECTORS(lm, buflen); + if (nsectors >= lf->lf_ncachesector && sectorndx == 0) + { + ret = lrofs_hwwrite(lm, userbuffer, sector, nsectors); + if (ret < 0) + { + ferr("ERROR: lrofs_hwwrite failed: %d\n", ret); + goto error_out; + } + + byteswritten = nsectors * lm->lm_hwsectorsize; + } + else + { + /* We are writing a partial sector. First, read the whole sector + * into the file data buffer. This is a caching buffer so if + * it is already there then all is well. + */ + + ret = lrofs_filecacheread(lm, lf, sector); + if (ret < 0) + { + ferr("ERROR: lrofs_filecacheread failed: %d\n", ret); + goto error_out; + } + + /* Copy the partial sector into the write buffer */ + + byteswritten = (lf->lf_cachesector + lf->lf_ncachesector - + sector) * lm->lm_hwsectorsize - sectorndx; + sectorndx = lf->lf_ncachesector * lm->lm_hwsectorsize - + byteswritten; + if (byteswritten > buflen) + { + /* We will not write to the end of the buffer */ + + byteswritten = buflen; + } + + memcpy(&lf->lf_buffer[sectorndx], userbuffer, byteswritten); + + /* Write the whole sector into the file data buffer. */ + + ret = lrofs_filecachewrite(lm, lf); + if (ret < 0) + { + ferr("ERROR: lrofs_filecachewrite failed: %d\n", ret); + goto error_out; + } + } + + userbuffer += byteswritten; + filep->f_pos += byteswritten; + writesize += byteswritten; + buflen -= byteswritten; + } + + /* Update the file size */ + + if (savedbuflen > 0) + { + ln->ln_size = filep->f_pos; + lf->lf_size = filep->f_pos; + lf->lf_endsector = SEC_NSECTORS(lm, lf->lf_startoffset + lf->lf_size); + lm->lm_volsize += writesize; + + ret = lrofs_update_filesize(lm, ln, lf->lf_size); + if (ret < 0) + { + ferr("ERROR: lrofs_update_filesize failed: %d\n", ret); + goto error_out; + } + } + + return writesize; + +error_out: + if (savedbuflen > 0) + { + lrofs_free_spareregion(&lm->lm_sparelist, savedoffset, + savedoffset + savedbuflen); + } + + return ret; +} + +/**************************************************************************** + * Name: lrofs_truncate_file + * + * Description: + * Truncate the file to lrofs + * + ****************************************************************************/ + +int lrofs_truncate_file(FAR struct file *filep, off_t length) +{ + FAR struct lrofs_mountpt_s *lm = filep->f_inode->i_private; + FAR struct lrofs_file_s *lf = filep->f_priv; + FAR struct lrofs_nodeinfo_s *ln = lf->lf_ln; + off_t remain = length - lf->lf_size; + int ret; + + if (length < lf->lf_size) + { + /* Free the space on disk */ + + ret = lrofs_free_spareregion(&lm->lm_sparelist, + lf->lf_startoffset + length, + lf->lf_startoffset + lf->lf_size); + if (ret < 0) + { + ferr("ERROR: lrofs_free_spareregion failed\n"); + return ret; + } + + lm->lm_volsize -= lf->lf_size - length; + } + else if (length > lf->lf_size) + { + /* Alloc the space on disk */ + + ret = lrofs_alloc_spareregion(&lm->lm_sparelist, + lf->lf_startoffset + lf->lf_size, + lf->lf_startoffset + length); + if (ret < 0) + { + ferr("ERROR: lrofs_alloc_spareregion failed\n"); + return ret; + } + + lm->lm_volsize += length - lf->lf_size; + } + + /* Update the file size */ + + ln->ln_size = length; + lf->lf_size = length; + lf->lf_endsector = SEC_NSECTORS(lm, lf->lf_startoffset + lf->lf_size); + + /* Update the file size to disk */ + + ret = lrofs_update_filesize(lm, ln, lf->lf_size); + if (ret < 0) + { + ferr("ERROR: lrofs_update_filesize failed: %d\n", ret); + return ret; + } + + if (remain > 0) + { + FAR char *buffer = NULL; + uint32_t buff_len = lm->lm_hwsectorsize * lf->lf_ncachesector; + off_t savepos = filep->f_pos; + + buffer = fs_heap_zalloc(buff_len); + if (buffer == NULL) + { + return -ENOMEM; + } + + while (remain > 0) + { + if (remain >= buff_len) + { + ret = lrofs_write_file(filep, buffer, buff_len); + } + else + { + ret = lrofs_write_file(filep, buffer, remain); + } + + if (ret < 0) + { + fs_heap_free(buffer); + return ret; + } + + remain -= ret; + } + + fs_heap_free(buffer); + filep->f_pos = savepos; + } + + return OK; +} + +/**************************************************************************** + * Name: lrofs_mkfs + * + * Description: + * Format the lrofs filesystem + * + ****************************************************************************/ + +int lrofs_mkfs(FAR struct lrofs_mountpt_s *lm) +{ + /* Write the magic number at that identifies this as a ROMFS filesystem */ + + lrofs_devmemcpy(lm, ROMFS_VHDR_ROM1FS, ROMFS_VHDR_MAGIC, ROMFS_VHDR_SIZE); + + /* Init the ROMFS volume size */ + + lrofs_devwrite32(lm, ROMFS_VHDR_SIZE, 0x60); + + /* Write the volume name */ + + lrofs_devstrcpy(lm, ROMFS_VHDR_VOLNAME, "lrofs"); + + /* Write the root node . */ + + lrofs_devwrite32(lm, 0x20 + ROMFS_FHDR_NEXT, 0x40 | RFNEXT_DIRECTORY); + lrofs_devwrite32(lm, 0x20 + ROMFS_FHDR_INFO, 0x20); + lrofs_devwrite32(lm, 0x20 + ROMFS_FHDR_SIZE, 0); + lrofs_devwrite32(lm, 0x20 + ROMFS_FHDR_CHKSUM, 0); + lrofs_devstrcpy(lm, 0x20 + ROMFS_FHDR_NAME, "."); + + /* Write the root node .. */ + + lrofs_devwrite32(lm, 0x40 + ROMFS_FHDR_NEXT, RFNEXT_HARDLINK); + lrofs_devwrite32(lm, 0x40 + ROMFS_FHDR_INFO, 0x20); + lrofs_devwrite32(lm, 0x40 + ROMFS_FHDR_SIZE, 0); + lrofs_devwrite32(lm, 0x40 + ROMFS_FHDR_CHKSUM, 0); + lrofs_devstrcpy(lm, 0x40 + ROMFS_FHDR_NAME, ".."); + + /* Write the buffer to sector zero */ + + return lrofs_devcachewrite(lm, 0); +} + +/**************************************************************************** + * Name: lrofs_remove + * + * Description: + * Unlink the dir from lrofs + * + ****************************************************************************/ + +int lrofs_remove(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln_parent, + FAR const char *relpath, bool isdir) +{ + FAR struct lrofs_nodeinfo_s *ln_prev; + FAR struct lrofs_nodeinfo_s **pinfo; + FAR struct lrofs_nodeinfo_s *ln; + struct lrofs_entryname_s le; + uint32_t totalsize; + bool firstchild; + int ret; + + if (ln_parent == NULL) + { + return -ENOENT; + } + + /* Get the real nodeinfo addr */ + + le.le_name = basename((FAR char *)relpath); + le.le_len = strlen(le.le_name); + pinfo = bsearch(&le, ln_parent->ln_child, ln_parent->ln_count, + sizeof(*ln_parent->ln_child), lrofs_nodeinfo_search); + ln = *pinfo; + if (ln == NULL) + { + return -ENOENT; + } + + /* Get the prev nodeinfo */ + + ln_prev = lrofs_get_prevnode(ln, &firstchild); + if (ln_prev == NULL) + { + return -ENOENT; + } + + /* Remove the node from disk */ + + ret = lrofs_remove_disk(lm, ln_prev, ln, firstchild); + if (ret < 0) + { + return ret; + } + + /* Update the prevnode nodeinfo */ + + if (!firstchild) + { + ln_prev->ln_next = (ln->ln_next & RFNEXT_OFFSETMASK) | + (ln_prev->ln_next & RFNEXT_ALLMODEMASK); + } + + /* Return the node space to lrofs sparelist */ + + totalsize = ROMFS_ALIGNUP(ROMFS_VHDR_VOLNAME + ln->ln_namesize + 1) + + ln->ln_size; + lm->lm_volsize -= totalsize; + lrofs_free_spareregion(&lm->lm_sparelist, ln->ln_origoffset, + ln->ln_origoffset + totalsize); + + /* Update parent cache node */ + + if (ln_parent->ln_count > 1) + { + *pinfo = ln_parent->ln_child[ln_parent->ln_count - 1]; + ln_parent->ln_child[ln_parent->ln_count - 1] = NULL; + ln_parent->ln_count--; + qsort(ln_parent->ln_child, ln_parent->ln_count, + sizeof(*ln_parent->ln_child), lrofs_nodeinfo_compare); + } + else if (ln_parent->ln_count == 1) + { + ln_parent->ln_count = 0; + if (ln_parent->ln_child != NULL) + { + fs_heap_free(ln_parent->ln_child); + ln_parent->ln_child = NULL; + } + } + + /* If is dir then free remain child node ./.. */ + + if (isdir) + { + FAR struct lrofs_nodeinfo_s *ln_temp; + for (int i = 0; i < ln->ln_count; i++) + { + ln_temp = ln->ln_child[i]; + totalsize = ROMFS_ALIGNUP(ROMFS_VHDR_VOLNAME + + ln_temp->ln_namesize + 1) + + ln_temp->ln_size; + lm->lm_volsize -= totalsize; + lrofs_free_spareregion(&lm->lm_sparelist, + ln_temp->ln_origoffset, + ln_temp->ln_origoffset + totalsize); + fs_heap_free(ln_temp); + } + + fs_heap_free(ln->ln_child); + } + + fs_heap_free(ln); + return OK; +} + +/**************************************************************************** + * Name: lrofs_rename_file + * + * Description: + * Rename the file to lrofs + * + ****************************************************************************/ + +int lrofs_rename_file(FAR struct lrofs_mountpt_s *lm, + FAR struct lrofs_nodeinfo_s *ln_old, + FAR struct lrofs_nodeinfo_s *ln_newpath, + FAR const char *newname) +{ + FAR struct lrofs_nodeinfo_s *ln_prev; + FAR struct lrofs_nodeinfo_s *ln_parent; + bool firstchild; + int ret; + + DEBUGASSERT(ln_old != NULL && ln_newpath != NULL); + + /* Get the old prev nodeinfo */ + + ln_prev = lrofs_get_prevnode(ln_old, &firstchild); + if (ln_prev == NULL) + { + return -ENOENT; + } + + /* Remove the node from disk */ + + ret = lrofs_remove_disk(lm, ln_prev, ln_old, firstchild); + if (ret < 0) + { + return ret; + } + + /* Update the prevnode nodeinfo */ + + if (!firstchild) + { + ln_prev->ln_next = (ln_old->ln_next & RFNEXT_OFFSETMASK) | + (ln_prev->ln_next & RFNEXT_ALLMODEMASK); + } + + /* Update parent cache node */ + + ln_parent = ln_old->ln_parent; + if (ln_parent->ln_count > 1) + { + for (int i = 0; i < ln_parent->ln_count; i++) + { + if (ln_parent->ln_child[i] == ln_old) + { + ln_parent->ln_child[i] = + ln_parent->ln_child[ln_parent->ln_count - 1]; + break; + } + } + + ln_parent->ln_child[ln_parent->ln_count - 1] = NULL; + ln_parent->ln_count--; + qsort(ln_parent->ln_child, ln_parent->ln_count, + sizeof(*ln_parent->ln_child), lrofs_nodeinfo_compare); + } + else if (ln_parent->ln_count == 1) + { + ln_parent->ln_count = 0; + if (ln_parent->ln_child != NULL) + { + fs_heap_free(ln_parent->ln_child); + ln_parent->ln_child = NULL; + } + } + + /* Get new prev nodeinfo */ + + for (int i = 0 ; i < ln_newpath->ln_count; i++) + { + ln_prev = ln_newpath->ln_child[i]; + if ((ln_prev->ln_next & RFNEXT_OFFSETMASK) == 0) + { + break; + } + } + + ret = lrofs_add_disk(lm, ln_prev, ln_old, + ln_old->ln_next & RFNEXT_ALLMODEMASK, false); + if (ret < 0) + { + ferr("ERROR: lrofs_add_disk failed: %d\n", ret); + return ret; + } + + /* Update the new prevnode nodeinfo */ + + ln_prev->ln_next = (ln_old->ln_origoffset & RFNEXT_OFFSETMASK) | + (ln_prev->ln_next & RFNEXT_ALLMODEMASK); + + if (newname != NULL) + { + if (strlen(newname) <= ln_old->ln_namesize) + { + ln_old->ln_namesize = strlen(newname); + memcpy(ln_old->ln_name, newname, strlen(newname) + 1); + } + else + { + FAR struct lrofs_nodeinfo_s *tmp = lrofs_alloc_nodeinfo( + ln_old->ln_origoffset, + ln_old->ln_size, + ln_old->ln_next, + newname); + if (tmp == NULL) + { + return -ENOMEM; + } + + tmp->ln_offset = ln_old->ln_offset; + fs_heap_free(ln_old); + ln_old = tmp; + } + } + + /* Update the parent nodeinfo */ + + ret = lrofs_update_parentnode(ln_newpath, ln_old); + if (ret < 0) + { + ferr("ERROR: lrofs_update_parentnode failed: %d\n", ret); + return ret; + } + + ln_old->ln_parent = ln_newpath; + return OK; +} diff --git a/fs/mmap/CMakeLists.txt b/fs/mmap/CMakeLists.txt index d788cf02b14..fcd5f956a42 100644 --- a/fs/mmap/CMakeLists.txt +++ b/fs/mmap/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/mmap/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/mmap/Make.defs b/fs/mmap/Make.defs index 09d757f8999..88be6c15763 100644 --- a/fs/mmap/Make.defs +++ b/fs/mmap/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/mmap/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_anonmap.c b/fs/mmap/fs_anonmap.c index 02038b02223..2eacc93c03a 100644 --- a/fs/mmap/fs_anonmap.c +++ b/fs/mmap/fs_anonmap.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_anonmap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_anonmap.h b/fs/mmap/fs_anonmap.h index 6415d15b093..b00ff8bd804 100644 --- a/fs/mmap/fs_anonmap.h +++ b/fs/mmap/fs_anonmap.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_anonmap.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_mmap.c b/fs/mmap/fs_mmap.c index e1ee0ee89f2..9b8263c9535 100644 --- a/fs/mmap/fs_mmap.c +++ b/fs/mmap/fs_mmap.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_mmap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_mmisc.c b/fs/mmap/fs_mmisc.c index a7ede82060c..658e8cae5a5 100644 --- a/fs/mmap/fs_mmisc.c +++ b/fs/mmap/fs_mmisc.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_mmisc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_msync.c b/fs/mmap/fs_msync.c index f2efe33c2e7..823770fe2e2 100644 --- a/fs/mmap/fs_msync.c +++ b/fs/mmap/fs_msync.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_msync.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_munmap.c b/fs/mmap/fs_munmap.c index e07fdf4469c..7dbc4921835 100644 --- a/fs/mmap/fs_munmap.c +++ b/fs/mmap/fs_munmap.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_munmap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c index cfe96d5393c..f91f6b95995 100644 --- a/fs/mmap/fs_rammap.c +++ b/fs/mmap/fs_rammap.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_rammap.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mmap/fs_rammap.h b/fs/mmap/fs_rammap.h index 9833c8f899f..7c46a215097 100644 --- a/fs/mmap/fs_rammap.h +++ b/fs/mmap/fs_rammap.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mmap/fs_rammap.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mnemofs/CMakeLists.txt b/fs/mnemofs/CMakeLists.txt index 1ed0b9147ea..059b0ec1024 100644 --- a/fs/mnemofs/CMakeLists.txt +++ b/fs/mnemofs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/mnemofs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/mnemofs/Make.defs b/fs/mnemofs/Make.defs index ad98a7af724..b3daca808da 100644 --- a/fs/mnemofs/Make.defs +++ b/fs/mnemofs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/mnemofs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The @@ -66,4 +68,4 @@ CSRCS += mnemofs.c DEPPATH += --dep-path mnemofs VPATH += :mnemofs -endif \ No newline at end of file +endif diff --git a/fs/mnemofs/mnemofs.c b/fs/mnemofs/mnemofs.c index 219abdabcae..2dc5838f258 100644 --- a/fs/mnemofs/mnemofs.c +++ b/fs/mnemofs/mnemofs.c @@ -1,6 +1,7 @@ /**************************************************************************** * fs/mnemofs/mnemofs.c - * mnemofs: Filesystem for NAND Flash storage devices. + * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -188,6 +189,8 @@ const struct mountpt_operations g_mnemofs_operations = NULL, /* mmap */ mnemofs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ mnemofs_sync, /* sync */ mnemofs_dup, /* dup */ diff --git a/fs/mnemofs/mnemofs.h b/fs/mnemofs/mnemofs.h index 1c8faefb954..290b19c602e 100644 --- a/fs/mnemofs/mnemofs.h +++ b/fs/mnemofs/mnemofs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mnemofs/mnemofs.h * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mnemofs/mnemofs_blkalloc.c b/fs/mnemofs/mnemofs_blkalloc.c index 90e6176d5e2..fdf972125b3 100644 --- a/fs/mnemofs/mnemofs_blkalloc.c +++ b/fs/mnemofs/mnemofs_blkalloc.c @@ -1,6 +1,7 @@ /**************************************************************************** * fs/mnemofs/mnemofs_blkalloc.c - * Block Allocator for mnemofs + * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/fs/mnemofs/mnemofs_ctz.c b/fs/mnemofs/mnemofs_ctz.c index faf3e72a25b..2c6f7bdceb4 100644 --- a/fs/mnemofs/mnemofs_ctz.c +++ b/fs/mnemofs/mnemofs_ctz.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mnemofs/mnemofs_ctz.c * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mnemofs/mnemofs_fsobj.c b/fs/mnemofs/mnemofs_fsobj.c index a2009d7f4fe..15b6b7e72dd 100644 --- a/fs/mnemofs/mnemofs_fsobj.c +++ b/fs/mnemofs/mnemofs_fsobj.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mnemofs/mnemofs_fsobj.c * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mnemofs/mnemofs_journal.c b/fs/mnemofs/mnemofs_journal.c index 7d13ddc2901..8a3159259fa 100644 --- a/fs/mnemofs/mnemofs_journal.c +++ b/fs/mnemofs/mnemofs_journal.c @@ -1,6 +1,7 @@ /**************************************************************************** * fs/mnemofs/mnemofs_journal.c - * Journal of mnemofs. + * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/fs/mnemofs/mnemofs_lru.c b/fs/mnemofs/mnemofs_lru.c index 8913620a2d4..34b513e24ed 100644 --- a/fs/mnemofs/mnemofs_lru.c +++ b/fs/mnemofs/mnemofs_lru.c @@ -1,6 +1,7 @@ /**************************************************************************** * fs/mnemofs/mnemofs_lru.c - * LRU cache of mnemofs. + * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/fs/mnemofs/mnemofs_master.c b/fs/mnemofs/mnemofs_master.c index 8b1dbf7d271..4f90735b5e8 100644 --- a/fs/mnemofs/mnemofs_master.c +++ b/fs/mnemofs/mnemofs_master.c @@ -1,6 +1,7 @@ /**************************************************************************** * fs/mnemofs/mnemofs_master.c - * Master node of mnemofs. + * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/fs/mnemofs/mnemofs_rw.c b/fs/mnemofs/mnemofs_rw.c index 6250ea9f157..bc596937e86 100644 --- a/fs/mnemofs/mnemofs_rw.c +++ b/fs/mnemofs/mnemofs_rw.c @@ -1,6 +1,7 @@ /**************************************************************************** * fs/mnemofs/mnemofs_rw.c - * Read/Write utilities for mnemofs + * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/fs/mnemofs/mnemofs_util.c b/fs/mnemofs/mnemofs_util.c index e8fd5f10b22..b6edb9cf197 100644 --- a/fs/mnemofs/mnemofs_util.c +++ b/fs/mnemofs/mnemofs_util.c @@ -1,6 +1,7 @@ /**************************************************************************** * fs/mnemofs/mnemofs_util.c - * Utilities for mnemofs + * + * SPDX-License-Identifier: Apache-2.0 or BSD-3-Clause * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/fs/mount/CMakeLists.txt b/fs/mount/CMakeLists.txt index f50d991f9a9..f02cae57a31 100644 --- a/fs/mount/CMakeLists.txt +++ b/fs/mount/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/mount/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/mount/Make.defs b/fs/mount/Make.defs index b19d4a60fc7..181613283d0 100644 --- a/fs/mount/Make.defs +++ b/fs/mount/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/mount/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/mount/fs_automount.c b/fs/mount/fs_automount.c index 167a9ec8869..e96f742577d 100644 --- a/fs/mount/fs_automount.c +++ b/fs/mount/fs_automount.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mount/fs_automount.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -811,7 +813,7 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower) FAR char *devpath = lib_get_pathbuffer(); if (devpath == NULL) { - return; + return NULL; } #endif /* CONFIG_FS_AUTOMOUNTER_DRIVER */ @@ -824,6 +826,9 @@ FAR void *automount_initialize(FAR const struct automount_lower_s *lower) if (priv == NULL) { ferr("ERROR: Failed to allocate state structure\n"); +#ifdef CONFIG_FS_AUTOMOUNTER_DRIVER + lib_put_pathbuffer(devpath); +#endif /* CONFIG_FS_AUTOMOUNTER_DRIVER */ return NULL; } diff --git a/fs/mount/fs_foreachmountpoint.c b/fs/mount/fs_foreachmountpoint.c index 7214228bc02..a2f304c7f58 100644 --- a/fs/mount/fs_foreachmountpoint.c +++ b/fs/mount/fs_foreachmountpoint.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mount/fs_foreachmountpoint.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mount/fs_gettype.c b/fs/mount/fs_gettype.c index 24b573f8a9a..5633f0fb8a1 100644 --- a/fs/mount/fs_gettype.c +++ b/fs/mount/fs_gettype.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mount/fs_gettype.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -171,6 +173,12 @@ FAR const char *fs_gettype(FAR struct statfs *statbuf) break; #endif +#ifdef CONFIG_FS_LROFS + case LROFS_MAGIC: + fstype = "lrofs"; + break; +#endif + default: fstype = "Unrecognized"; break; diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c index b2590631f1c..87833325fe6 100644 --- a/fs/mount/fs_mount.c +++ b/fs/mount/fs_mount.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mount/fs_mount.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -53,7 +55,7 @@ #if defined(CONFIG_FS_FAT) || defined(CONFIG_FS_ROMFS) || \ defined(CONFIG_FS_SMARTFS) || defined(CONFIG_FS_LITTLEFS) || \ - defined(CONFIG_FS_FATFS) + defined(CONFIG_FS_FATFS) || defined(CONFIG_FS_LROFS) # define BDFS_SUPPORT 1 #endif @@ -72,7 +74,8 @@ defined(CONFIG_FS_TMPFS) || defined(CONFIG_FS_USERFS) || \ defined(CONFIG_FS_CROMFS) || defined(CONFIG_FS_UNIONFS) || \ defined(CONFIG_FS_HOSTFS) || defined(CONFIG_FS_ZIPFS) || \ - defined(CONFIG_FS_RPMSGFS) || defined(CONFIG_FS_V9FS) + defined(CONFIG_FS_RPMSGFS) || defined(CONFIG_FS_V9FS) || \ + defined(CONFIG_FS_ARCHIVEFS) # define NODFS_SUPPORT #endif @@ -108,6 +111,9 @@ extern const struct mountpt_operations g_smartfs_operations; #ifdef CONFIG_FS_LITTLEFS extern const struct mountpt_operations g_littlefs_operations; #endif +#ifdef CONFIG_FS_LROFS +extern const struct mountpt_operations g_lrofs_operations; +#endif static const struct fsmap_t g_bdfsmap[] = { @@ -125,6 +131,9 @@ static const struct fsmap_t g_bdfsmap[] = #endif #ifdef CONFIG_FS_LITTLEFS { "littlefs", &g_littlefs_operations }, +#endif +#ifdef CONFIG_FS_LROFS + { "lrofs", &g_lrofs_operations }, #endif { NULL, NULL }, }; @@ -203,6 +212,9 @@ extern const struct mountpt_operations g_zipfs_operations; #ifdef CONFIG_FS_V9FS extern const struct mountpt_operations g_v9fs_operations; #endif +#ifdef CONFIG_FS_ARCHIVEFS +extern const struct mountpt_operations g_archivefs_operations; +#endif static const struct fsmap_t g_nonbdfsmap[] = { @@ -241,6 +253,9 @@ static const struct fsmap_t g_nonbdfsmap[] = #endif #ifdef CONFIG_FS_V9FS { "v9fs", &g_v9fs_operations}, +#endif +#ifdef CONFIG_FS_ARCHIVEFS + { "archivefs", &g_archivefs_operations}, #endif { NULL, NULL }, }; diff --git a/fs/mount/fs_procfs_mount.c b/fs/mount/fs_procfs_mount.c index 0a6b0c7937e..91392dba694 100644 --- a/fs/mount/fs_procfs_mount.c +++ b/fs/mount/fs_procfs_mount.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mount/fs_procfs_mount.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mount/fs_umount2.c b/fs/mount/fs_umount2.c index 632f85d4ae7..546f6ff98fb 100644 --- a/fs/mount/fs_umount2.c +++ b/fs/mount/fs_umount2.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mount/fs_umount2.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mount/mount.h b/fs/mount/mount.h index dcfd8336113..d6a2247f1fd 100644 --- a/fs/mount/mount.h +++ b/fs/mount/mount.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mount/mount.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mqueue/CMakeLists.txt b/fs/mqueue/CMakeLists.txt index 5f7150a2a75..805da116fc1 100644 --- a/fs/mqueue/CMakeLists.txt +++ b/fs/mqueue/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/mqueue/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/mqueue/Make.defs b/fs/mqueue/Make.defs index 77263daeb11..2ee6e83f6f7 100644 --- a/fs/mqueue/Make.defs +++ b/fs/mqueue/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/mqueue/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/mqueue/mq_close.c b/fs/mqueue/mq_close.c index 9c3b3600484..6d12a438ec1 100644 --- a/fs/mqueue/mq_close.c +++ b/fs/mqueue/mq_close.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mqueue/mq_close.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mqueue/mq_open.c b/fs/mqueue/mq_open.c index 73eb895c196..d2e5cc79bc8 100644 --- a/fs/mqueue/mq_open.c +++ b/fs/mqueue/mq_open.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mqueue/mq_open.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mqueue/mq_unlink.c b/fs/mqueue/mq_unlink.c index 2148b4895f2..fb4d9d1550a 100644 --- a/fs/mqueue/mq_unlink.c +++ b/fs/mqueue/mq_unlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mqueue/mq_unlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/mqueue/mqueue.h b/fs/mqueue/mqueue.h index 3b7e84ceb00..a3ed24a95fc 100644 --- a/fs/mqueue/mqueue.h +++ b/fs/mqueue/mqueue.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/mqueue/mqueue.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nfs/CMakeLists.txt b/fs/nfs/CMakeLists.txt index affb76ef23a..6de78d02810 100644 --- a/fs/nfs/CMakeLists.txt +++ b/fs/nfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/nfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/nfs/Make.defs b/fs/nfs/Make.defs index 4215011b713..781c91a90c2 100644 --- a/fs/nfs/Make.defs +++ b/fs/nfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/nfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/nfs/nfs.h b/fs/nfs/nfs.h index 2d2061aae1b..f7228ea5578 100644 --- a/fs/nfs/nfs.h +++ b/fs/nfs/nfs.h @@ -1,10 +1,11 @@ /**************************************************************************** * fs/nfs/nfs.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * diff --git a/fs/nfs/nfs_mount.h b/fs/nfs/nfs_mount.h index 17660b1fe88..f589000de0d 100644 --- a/fs/nfs/nfs_mount.h +++ b/fs/nfs/nfs_mount.h @@ -1,10 +1,11 @@ /**************************************************************************** * fs/nfs/nfs_mount.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * diff --git a/fs/nfs/nfs_node.h b/fs/nfs/nfs_node.h index ca6303f5615..e2e609206a3 100644 --- a/fs/nfs/nfs_node.h +++ b/fs/nfs/nfs_node.h @@ -1,10 +1,11 @@ /**************************************************************************** * fs/nfs/nfs_node.h * - * Copyright (C) 2012-2013, 2017 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * diff --git a/fs/nfs/nfs_proto.h b/fs/nfs/nfs_proto.h index 11d30cd6273..05e7fac0a00 100644 --- a/fs/nfs/nfs_proto.h +++ b/fs/nfs/nfs_proto.h @@ -1,10 +1,11 @@ /**************************************************************************** * fs/nfs/nfs_proto.h * - * Copyright (C) 2012, 2018 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * diff --git a/fs/nfs/nfs_util.c b/fs/nfs/nfs_util.c index 0caef811c71..0aa432fce27 100644 --- a/fs/nfs/nfs_util.c +++ b/fs/nfs/nfs_util.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nfs/nfs_util.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nfs/nfs_vfsops.c b/fs/nfs/nfs_vfsops.c index 3a32bc03d2d..2d0e1af9394 100644 --- a/fs/nfs/nfs_vfsops.c +++ b/fs/nfs/nfs_vfsops.c @@ -1,11 +1,11 @@ /**************************************************************************** * fs/nfs/nfs_vfsops.c * - * Copyright (C) 2012-2013, 2015, 2017-2018 Gregory Nutt. All rights - * reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012-2018 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * @@ -203,6 +203,8 @@ const struct mountpt_operations g_nfs_operations = NULL, /* mmap */ nfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ nfs_sync, /* sync */ nfs_dup, /* dup */ diff --git a/fs/nfs/rpc.h b/fs/nfs/rpc.h index 3c8437f47b3..9c4b269e82a 100644 --- a/fs/nfs/rpc.h +++ b/fs/nfs/rpc.h @@ -1,10 +1,11 @@ /**************************************************************************** * fs/nfs/rpc.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * diff --git a/fs/nfs/rpc_clnt.c b/fs/nfs/rpc_clnt.c index eba6c1eff10..33b402dcc31 100644 --- a/fs/nfs/rpc_clnt.c +++ b/fs/nfs/rpc_clnt.c @@ -1,10 +1,11 @@ /**************************************************************************** * fs/nfs/rpc_clnt.c * - * Copyright (C) 2012-2013, 2018 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012-2018 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * diff --git a/fs/nfs/xdr_subs.h b/fs/nfs/xdr_subs.h index 53264197926..78838af1289 100644 --- a/fs/nfs/xdr_subs.h +++ b/fs/nfs/xdr_subs.h @@ -1,12 +1,11 @@ /**************************************************************************** * fs/nfs/xdr_subs.h - * Definitions for Sun RPC Version 2, from - * "RPC: Remote Procedure Call Protocol Specification" RFC1057 * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2012 Gregory Nutt. All rights reserved. + * SPDX-FileCopyrightText: 2012 Jose Pablo Rojas Vargas. All rights reserved. + * SPDX-FileContributor: Jose Pablo Rojas Vargas + * SPDX-FileContributor: Gregory Nutt * * Leveraged from OpenBSD: * diff --git a/fs/notify/CMakeLists.txt b/fs/notify/CMakeLists.txt index d66cf2932a9..9594cc62fe2 100644 --- a/fs/notify/CMakeLists.txt +++ b/fs/notify/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/notify/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/notify/Make.defs b/fs/notify/Make.defs index d61c4d84ec9..6b7fc42ec9d 100644 --- a/fs/notify/Make.defs +++ b/fs/notify/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/notify/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/notify/inotify.c b/fs/notify/inotify.c index e6e93da1f90..6370c4b41c5 100644 --- a/fs/notify/inotify.c +++ b/fs/notify/inotify.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/notify/inotify.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/notify/notify.h b/fs/notify/notify.h index dad750513fa..4016b737d74 100644 --- a/fs/notify/notify.h +++ b/fs/notify/notify.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/notify/notify.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/CMakeLists.txt b/fs/nxffs/CMakeLists.txt index 7880d5d8206..f77bcb9b28d 100644 --- a/fs/nxffs/CMakeLists.txt +++ b/fs/nxffs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/nxffs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/nxffs/Make.defs b/fs/nxffs/Make.defs index 43c636f3627..fd32324b2d2 100644 --- a/fs/nxffs/Make.defs +++ b/fs/nxffs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/nxffs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs.h b/fs/nxffs/nxffs.h index f6c8bcc4d8d..e6394776c32 100644 --- a/fs/nxffs/nxffs.h +++ b/fs/nxffs/nxffs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_block.c b/fs/nxffs/nxffs_block.c index 5205e338278..1288798353c 100644 --- a/fs/nxffs/nxffs_block.c +++ b/fs/nxffs/nxffs_block.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_block.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_blockstats.c b/fs/nxffs/nxffs_blockstats.c index 9b0557b822d..5b33fe9d84e 100644 --- a/fs/nxffs/nxffs_blockstats.c +++ b/fs/nxffs/nxffs_blockstats.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_blockstats.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -120,7 +122,7 @@ int nxffs_blockstats(FAR struct nxffs_volume_s *volume, { /* The block is marked as good */ - stats-> ngood++; + stats->ngood++; } else { @@ -197,7 +199,7 @@ int nxffs_blockstats(FAR struct nxffs_volume_s *volume, { /* The block is marked as good */ - stats-> ngood++; + stats->ngood++; } else { diff --git a/fs/nxffs/nxffs_cache.c b/fs/nxffs/nxffs_cache.c index a307e444fcf..87a867f25de 100644 --- a/fs/nxffs/nxffs_cache.c +++ b/fs/nxffs/nxffs_cache.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_cache.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_dirent.c b/fs/nxffs/nxffs_dirent.c index 46ef7ad706a..83291f7074c 100644 --- a/fs/nxffs/nxffs_dirent.c +++ b/fs/nxffs/nxffs_dirent.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_dirent.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_dump.c b/fs/nxffs/nxffs_dump.c index db074f4d5b5..f4117e17e85 100644 --- a/fs/nxffs/nxffs_dump.c +++ b/fs/nxffs/nxffs_dump.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_dump.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_initialize.c b/fs/nxffs/nxffs_initialize.c index 3e093c2f65b..3878326c7a5 100644 --- a/fs/nxffs/nxffs_initialize.c +++ b/fs/nxffs/nxffs_initialize.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_initialize.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -62,6 +64,8 @@ const struct mountpt_operations g_nxffs_operations = NULL, /* truncate */ #endif NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ NULL, /* sync -- No buffered data */ nxffs_dup, /* dup */ diff --git a/fs/nxffs/nxffs_inode.c b/fs/nxffs/nxffs_inode.c index b7e9c5e0bb5..04a6c147e8d 100644 --- a/fs/nxffs/nxffs_inode.c +++ b/fs/nxffs/nxffs_inode.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_inode.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_ioctl.c b/fs/nxffs/nxffs_ioctl.c index c2cbff73ab0..5d1e70b65a0 100644 --- a/fs/nxffs/nxffs_ioctl.c +++ b/fs/nxffs/nxffs_ioctl.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_ioctl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_open.c b/fs/nxffs/nxffs_open.c index 5e01ed2696f..833cd7ebe18 100644 --- a/fs/nxffs/nxffs_open.c +++ b/fs/nxffs/nxffs_open.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_open.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_pack.c b/fs/nxffs/nxffs_pack.c index 4e8d952139f..1ff34ad73b5 100644 --- a/fs/nxffs/nxffs_pack.c +++ b/fs/nxffs/nxffs_pack.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_pack.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_read.c b/fs/nxffs/nxffs_read.c index 31e33fe7090..b898aa53a59 100644 --- a/fs/nxffs/nxffs_read.c +++ b/fs/nxffs/nxffs_read.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_read.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_reformat.c b/fs/nxffs/nxffs_reformat.c index 4a732901d61..a9afdb9e4b8 100644 --- a/fs/nxffs/nxffs_reformat.c +++ b/fs/nxffs/nxffs_reformat.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_reformat.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_stat.c b/fs/nxffs/nxffs_stat.c index b0df7dbc661..d34adaa1cea 100644 --- a/fs/nxffs/nxffs_stat.c +++ b/fs/nxffs/nxffs_stat.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_stat.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_truncate.c b/fs/nxffs/nxffs_truncate.c index ff6056e63c3..fead6a33efb 100644 --- a/fs/nxffs/nxffs_truncate.c +++ b/fs/nxffs/nxffs_truncate.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_truncate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_unlink.c b/fs/nxffs/nxffs_unlink.c index b2041554c99..4d626cdd81a 100644 --- a/fs/nxffs/nxffs_unlink.c +++ b/fs/nxffs/nxffs_unlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_unlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_util.c b/fs/nxffs/nxffs_util.c index 929731d48cd..794690d1cd1 100644 --- a/fs/nxffs/nxffs_util.c +++ b/fs/nxffs/nxffs_util.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_util.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/nxffs/nxffs_write.c b/fs/nxffs/nxffs_write.c index 64d5d5bbc65..79cbc1a4d80 100644 --- a/fs/nxffs/nxffs_write.c +++ b/fs/nxffs/nxffs_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/nxffs/nxffs_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/partition/CMakeLists.txt b/fs/partition/CMakeLists.txt index a7323a21c7f..44c28e02af6 100644 --- a/fs/partition/CMakeLists.txt +++ b/fs/partition/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/partition/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/partition/Make.defs b/fs/partition/Make.defs index 7bd0a98184c..57c9eb886a2 100644 --- a/fs/partition/Make.defs +++ b/fs/partition/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/partition/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/partition/fs_gpt.c b/fs/partition/fs_gpt.c index 549bcc98da7..3aaefaa47f2 100644 --- a/fs/partition/fs_gpt.c +++ b/fs/partition/fs_gpt.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/partition/fs_gpt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/partition/fs_mbr.c b/fs/partition/fs_mbr.c index 3728961b658..e9c13a47abb 100644 --- a/fs/partition/fs_mbr.c +++ b/fs/partition/fs_mbr.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/partition/fs_mbr.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/partition/fs_partition.c b/fs/partition/fs_partition.c index e73a4f4dd6c..9bb6fab7356 100644 --- a/fs/partition/fs_partition.c +++ b/fs/partition/fs_partition.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/partition/fs_partition.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/partition/fs_ptable.c b/fs/partition/fs_ptable.c index 9010a482581..29708d551ea 100644 --- a/fs/partition/fs_ptable.c +++ b/fs/partition/fs_ptable.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/partition/fs_ptable.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/partition/fs_txtable.c b/fs/partition/fs_txtable.c index 696024e4fed..2e0dabcecd5 100644 --- a/fs/partition/fs_txtable.c +++ b/fs/partition/fs_txtable.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/partition/fs_txtable.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/partition/partition.h b/fs/partition/partition.h index 4958501078a..1e488a92d50 100644 --- a/fs/partition/partition.h +++ b/fs/partition/partition.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/partition/partition.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/CMakeLists.txt b/fs/procfs/CMakeLists.txt index bb30fb67311..8cd17b80a40 100644 --- a/fs/procfs/CMakeLists.txt +++ b/fs/procfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/procfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/procfs/Make.defs b/fs/procfs/Make.defs index 594b7e004d1..f4e1a996c2c 100644 --- a/fs/procfs/Make.defs +++ b/fs/procfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/procfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfs.c b/fs/procfs/fs_procfs.c index 0cd742c8fc8..2b6042639ec 100644 --- a/fs/procfs/fs_procfs.c +++ b/fs/procfs/fs_procfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -292,6 +294,8 @@ const struct mountpt_operations g_procfs_operations = NULL, /* mmap */ NULL, /* truncate */ procfs_poll, /* poll */ + NULL, /* readv */ + NULL, /* writev */ NULL, /* sync */ procfs_dup, /* dup */ @@ -788,9 +792,24 @@ static int procfs_opendir(FAR struct inode *mountpt, FAR const char *relpath, static int procfs_closedir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir) { + FAR struct procfs_dir_priv_s *dirpriv; + int ret = OK; + DEBUGASSERT(mountpt && dir); - fs_heap_free(dir); - return OK; + + dirpriv = (FAR struct procfs_dir_priv_s *)dir; + + if (dirpriv->procfsentry != NULL && + dirpriv->procfsentry->ops->closedir != NULL) + { + ret = dirpriv->procfsentry->ops->closedir(dir); + } + else + { + fs_heap_free(dir); + } + + return ret; } /**************************************************************************** diff --git a/fs/procfs/fs_procfscpuinfo.c b/fs/procfs/fs_procfscpuinfo.c index 6e49328dd55..516ad8e4f3c 100644 --- a/fs/procfs/fs_procfscpuinfo.c +++ b/fs/procfs/fs_procfscpuinfo.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfscpuinfo.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfscpuload.c b/fs/procfs/fs_procfscpuload.c index 1fb769422c8..9fdd4849d5b 100644 --- a/fs/procfs/fs_procfscpuload.c +++ b/fs/procfs/fs_procfscpuload.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfscpuload.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfscritmon.c b/fs/procfs/fs_procfscritmon.c index 741706797dd..90444425b92 100644 --- a/fs/procfs/fs_procfscritmon.c +++ b/fs/procfs/fs_procfscritmon.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfscritmon.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfsfdt.c b/fs/procfs/fs_procfsfdt.c index 89a5d7e6503..6efc919a049 100644 --- a/fs/procfs/fs_procfsfdt.c +++ b/fs/procfs/fs_procfsfdt.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfsfdt.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfsiobinfo.c b/fs/procfs/fs_procfsiobinfo.c index 5d071f8ba5f..66238067515 100644 --- a/fs/procfs/fs_procfsiobinfo.c +++ b/fs/procfs/fs_procfsiobinfo.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfsiobinfo.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfsmeminfo.c b/fs/procfs/fs_procfsmeminfo.c index d474486dbf0..f2a07cb8276 100644 --- a/fs/procfs/fs_procfsmeminfo.c +++ b/fs/procfs/fs_procfsmeminfo.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfsmeminfo.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfspressure.c b/fs/procfs/fs_procfspressure.c index 4a3cad1f595..056cb028064 100644 --- a/fs/procfs/fs_procfspressure.c +++ b/fs/procfs/fs_procfspressure.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfspressure.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfsproc.c b/fs/procfs/fs_procfsproc.c index 73ea8f9e68d..47ddab09cfc 100644 --- a/fs/procfs/fs_procfsproc.c +++ b/fs/procfs/fs_procfsproc.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfsproc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfstcbinfo.c b/fs/procfs/fs_procfstcbinfo.c index e3253582733..1a89af74db9 100644 --- a/fs/procfs/fs_procfstcbinfo.c +++ b/fs/procfs/fs_procfstcbinfo.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfstcbinfo.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -179,17 +181,17 @@ static int tcbinfo_close(FAR struct file *filep) } /**************************************************************************** - * Name: tcbinfo_current_regs + * Name: tcbinfo_running_regs * * Description: - * A special version of up_current_regs() that is non-optimized. + * A special version of running_regs() that is non-optimized. * ****************************************************************************/ nooptimiziation_function -FAR static void *tcbinfo_current_regs(void) +FAR static void *tcbinfo_running_regs(void) { - return up_current_regs(); + return running_regs(); } /**************************************************************************** @@ -215,8 +217,8 @@ static ssize_t tcbinfo_read(FAR struct file *filep, FAR char *buffer, { linesize = procfs_snprintf(attr->line, TCBINFO_LINELEN, "pointer %p size %zu current regs %p\n", - &g_tcbinfo, sizeof(struct tcbinfo_s), - tcbinfo_current_regs()); + &g_tcbinfo, sizeof(struct tcbinfo_s), + tcbinfo_running_regs()); /* Save the linesize in case we are re-entered with f_pos > 0 */ diff --git a/fs/procfs/fs_procfsuptime.c b/fs/procfs/fs_procfsuptime.c index 544ae0da2db..21e2230cc0c 100644 --- a/fs/procfs/fs_procfsuptime.c +++ b/fs/procfs/fs_procfsuptime.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfsuptime.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfsutil.c b/fs/procfs/fs_procfsutil.c index 206724ba1a8..f498005d35c 100644 --- a/fs/procfs/fs_procfsutil.c +++ b/fs/procfs/fs_procfsutil.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfsutil.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/procfs/fs_procfsversion.c b/fs/procfs/fs_procfsversion.c index 69f7ec68cf3..5895381d2a1 100644 --- a/fs/procfs/fs_procfsversion.c +++ b/fs/procfs/fs_procfsversion.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_procfsversion.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -46,7 +48,7 @@ #include "fs_heap.h" #if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_PROCFS) -#ifndef CONFIG_FS_PROCFS_EXCLUDE_PROCESS +#ifndef CONFIG_FS_PROCFS_EXCLUDE_VERSION /**************************************************************************** * Pre-processor Definitions diff --git a/fs/procfs/fs_skeleton.c b/fs/procfs/fs_skeleton.c index c9dd61e2cba..0d785fba588 100644 --- a/fs/procfs/fs_skeleton.c +++ b/fs/procfs/fs_skeleton.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/procfs/fs_skeleton.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/romfs/CMakeLists.txt b/fs/romfs/CMakeLists.txt index eb326f508ff..ba5793e3c2f 100644 --- a/fs/romfs/CMakeLists.txt +++ b/fs/romfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/romfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/romfs/Make.defs b/fs/romfs/Make.defs index 3392b9756fc..2be8411646b 100644 --- a/fs/romfs/Make.defs +++ b/fs/romfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/romfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c index fedf6416dec..9ee971b3da2 100644 --- a/fs/romfs/fs_romfs.c +++ b/fs/romfs/fs_romfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/romfs/fs_romfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -125,6 +127,8 @@ const struct mountpt_operations g_romfs_operations = romfs_mmap, /* mmap */ NULL, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ NULL, /* sync */ romfs_dup, /* dup */ diff --git a/fs/romfs/fs_romfs.h b/fs/romfs/fs_romfs.h index 71dd3f71660..c7773522cce 100644 --- a/fs/romfs/fs_romfs.h +++ b/fs/romfs/fs_romfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/romfs/fs_romfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/romfs/fs_romfsutil.c b/fs/romfs/fs_romfsutil.c index 8c1f2ad09d7..58f1a664283 100644 --- a/fs/romfs/fs_romfsutil.c +++ b/fs/romfs/fs_romfsutil.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/romfs/fs_romfsutil.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/rpmsgfs/CMakeLists.txt b/fs/rpmsgfs/CMakeLists.txt index 8af86bcdcb5..2f4dbfd4c2f 100644 --- a/fs/rpmsgfs/CMakeLists.txt +++ b/fs/rpmsgfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/rpmsgfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/rpmsgfs/Make.defs b/fs/rpmsgfs/Make.defs index fb0a7c6e1ae..bce794b9eb0 100644 --- a/fs/rpmsgfs/Make.defs +++ b/fs/rpmsgfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/rpmsgfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/rpmsgfs/rpmsgfs.c b/fs/rpmsgfs/rpmsgfs.c index f4ff92329db..e3674dcb07f 100644 --- a/fs/rpmsgfs/rpmsgfs.c +++ b/fs/rpmsgfs/rpmsgfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/rpmsgfs/rpmsgfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -165,6 +167,8 @@ const struct mountpt_operations g_rpmsgfs_operations = NULL, /* mmap */ rpmsgfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ rpmsgfs_sync, /* sync */ rpmsgfs_dup, /* dup */ diff --git a/fs/rpmsgfs/rpmsgfs.h b/fs/rpmsgfs/rpmsgfs.h index 24bcaeb1e5d..5495986c714 100644 --- a/fs/rpmsgfs/rpmsgfs.h +++ b/fs/rpmsgfs/rpmsgfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/rpmsgfs/rpmsgfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/rpmsgfs/rpmsgfs_client.c b/fs/rpmsgfs/rpmsgfs_client.c index 2d425f0a771..70888844338 100644 --- a/fs/rpmsgfs/rpmsgfs_client.c +++ b/fs/rpmsgfs/rpmsgfs_client.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/rpmsgfs/rpmsgfs_client.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/rpmsgfs/rpmsgfs_server.c b/fs/rpmsgfs/rpmsgfs_server.c index 8e3e065ed62..6573056353c 100644 --- a/fs/rpmsgfs/rpmsgfs_server.c +++ b/fs/rpmsgfs/rpmsgfs_server.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/rpmsgfs/rpmsgfs_server.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/semaphore/CMakeLists.txt b/fs/semaphore/CMakeLists.txt index b7e5d945bb9..1ad6ca8af75 100644 --- a/fs/semaphore/CMakeLists.txt +++ b/fs/semaphore/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/semaphore/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/semaphore/Make.defs b/fs/semaphore/Make.defs index b59bf2175eb..15bb837de79 100644 --- a/fs/semaphore/Make.defs +++ b/fs/semaphore/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/semaphore/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/semaphore/sem_close.c b/fs/semaphore/sem_close.c index ae8bd126520..09bb257d00f 100644 --- a/fs/semaphore/sem_close.c +++ b/fs/semaphore/sem_close.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/semaphore/sem_close.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/semaphore/sem_open.c b/fs/semaphore/sem_open.c index 40bd2218572..cacccb2fc21 100644 --- a/fs/semaphore/sem_open.c +++ b/fs/semaphore/sem_open.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/semaphore/sem_open.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/semaphore/sem_unlink.c b/fs/semaphore/sem_unlink.c index ff92a1a9c92..e00fabab095 100644 --- a/fs/semaphore/sem_unlink.c +++ b/fs/semaphore/sem_unlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/semaphore/sem_unlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/semaphore/semaphore.h b/fs/semaphore/semaphore.h index 911fa9ec82c..06303477e9c 100644 --- a/fs/semaphore/semaphore.h +++ b/fs/semaphore/semaphore.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/semaphore/semaphore.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/shm/CMakeLists.txt b/fs/shm/CMakeLists.txt index d6770ea4f13..fb4a64a84af 100644 --- a/fs/shm/CMakeLists.txt +++ b/fs/shm/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/shm/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/shm/Make.defs b/fs/shm/Make.defs index f686789c6a6..f632fdc304c 100644 --- a/fs/shm/Make.defs +++ b/fs/shm/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/shm/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/shm/shm_open.c b/fs/shm/shm_open.c index 50dacd52016..1230585ee6b 100644 --- a/fs/shm/shm_open.c +++ b/fs/shm/shm_open.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/shm/shm_open.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/shm/shm_unlink.c b/fs/shm/shm_unlink.c index 84ac6a9bc79..25f6297dd93 100644 --- a/fs/shm/shm_unlink.c +++ b/fs/shm/shm_unlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/shm/shm_unlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/shm/shmfs.c b/fs/shm/shmfs.c index 81a89166c20..752e2d5dacd 100644 --- a/fs/shm/shmfs.c +++ b/fs/shm/shmfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/shm/shmfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -71,6 +73,8 @@ const struct file_operations g_shmfs_operations = shmfs_mmap, /* mmap */ shmfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS shmfs_unlink /* unlink */ #endif diff --git a/fs/shm/shmfs.h b/fs/shm/shmfs.h index 5a4e7d3fe66..ce4f0820dca 100644 --- a/fs/shm/shmfs.h +++ b/fs/shm/shmfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/shm/shmfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/shm/shmfs_alloc.c b/fs/shm/shmfs_alloc.c index 7db6757cc71..4764c901e68 100644 --- a/fs/shm/shmfs_alloc.c +++ b/fs/shm/shmfs_alloc.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/shm/shmfs_alloc.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/smartfs/CMakeLists.txt b/fs/smartfs/CMakeLists.txt index 84cd379d3b2..8455afa1b5e 100644 --- a/fs/smartfs/CMakeLists.txt +++ b/fs/smartfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/smartfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/smartfs/Make.defs b/fs/smartfs/Make.defs index e3d1b389005..ff9ec58bb43 100644 --- a/fs/smartfs/Make.defs +++ b/fs/smartfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/smartfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/smartfs/smartfs.h b/fs/smartfs/smartfs.h index 4e0ac9a152d..6fe214ba629 100644 --- a/fs/smartfs/smartfs.h +++ b/fs/smartfs/smartfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/smartfs/smartfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/smartfs/smartfs_procfs.c b/fs/smartfs/smartfs_procfs.c index 16746dafaf7..f55b0c21659 100644 --- a/fs/smartfs/smartfs_procfs.c +++ b/fs/smartfs/smartfs_procfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/smartfs/smartfs_procfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/smartfs/smartfs_smart.c b/fs/smartfs/smartfs_smart.c index bc4e6477cdf..2317f967cd5 100644 --- a/fs/smartfs/smartfs_smart.c +++ b/fs/smartfs/smartfs_smart.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/smartfs/smartfs_smart.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -145,6 +147,8 @@ const struct mountpt_operations g_smartfs_operations = NULL, /* mmap */ smartfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ smartfs_sync, /* sync */ smartfs_dup, /* dup */ diff --git a/fs/smartfs/smartfs_utils.c b/fs/smartfs/smartfs_utils.c index 11932f2c324..df209c31b36 100644 --- a/fs/smartfs/smartfs_utils.c +++ b/fs/smartfs/smartfs_utils.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/smartfs/smartfs_utils.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/socket/CMakeLists.txt b/fs/socket/CMakeLists.txt index 0e905a5efec..1df0486f3c8 100644 --- a/fs/socket/CMakeLists.txt +++ b/fs/socket/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/socket/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/socket/Make.defs b/fs/socket/Make.defs index 4a300e338c1..b307fa6f608 100644 --- a/fs/socket/Make.defs +++ b/fs/socket/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/socket/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/socket/accept.c b/fs/socket/accept.c index f69f2339304..110de3957b9 100644 --- a/fs/socket/accept.c +++ b/fs/socket/accept.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/socket/accept.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/socket/socket.c b/fs/socket/socket.c index 6501e27f08c..e3875f7bed2 100644 --- a/fs/socket/socket.c +++ b/fs/socket/socket.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/socket/socket.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/socket/socketpair.c b/fs/socket/socketpair.c index c50bea31585..0ffe89d959b 100644 --- a/fs/socket/socketpair.c +++ b/fs/socket/socketpair.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/socket/socketpair.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/spiffs/CMakeLists.txt b/fs/spiffs/CMakeLists.txt index 8320f097327..aea0d59383d 100644 --- a/fs/spiffs/CMakeLists.txt +++ b/fs/spiffs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/spiffs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/spiffs/Make.defs b/fs/spiffs/Make.defs index 77a22238f72..8ab2a337569 100644 --- a/fs/spiffs/Make.defs +++ b/fs/spiffs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/spiffs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/spiffs/src/CMakeLists.txt b/fs/spiffs/src/CMakeLists.txt index e5d8086880c..82966f40059 100644 --- a/fs/spiffs/src/CMakeLists.txt +++ b/fs/spiffs/src/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/spiffs/src/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/spiffs/src/spiffs.h b/fs/spiffs/src/spiffs.h index d02e0dd0512..d564f102ce5 100644 --- a/fs/spiffs/src/spiffs.h +++ b/fs/spiffs/src/spiffs.h @@ -1,8 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs.h * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * This is a port of version 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license but is here re- diff --git a/fs/spiffs/src/spiffs_cache.c b/fs/spiffs/src/spiffs_cache.c index 2ec00b2481e..8825cc869c4 100644 --- a/fs/spiffs/src/spiffs_cache.c +++ b/fs/spiffs/src/spiffs_cache.c @@ -1,8 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_cache.c * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * This is a port of version 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license but is here re- diff --git a/fs/spiffs/src/spiffs_cache.h b/fs/spiffs/src/spiffs_cache.h index d4fb6f3785e..087619018b3 100644 --- a/fs/spiffs/src/spiffs_cache.h +++ b/fs/spiffs/src/spiffs_cache.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_cache.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/spiffs/src/spiffs_check.c b/fs/spiffs/src/spiffs_check.c index dd46e81e15e..cf2e9d54d8c 100644 --- a/fs/spiffs/src/spiffs_check.c +++ b/fs/spiffs/src/spiffs_check.c @@ -1,8 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_check.c * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * This is a port of version 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license but is here re- diff --git a/fs/spiffs/src/spiffs_check.h b/fs/spiffs/src/spiffs_check.h index 92bf6a5feaf..527af83a7dd 100644 --- a/fs/spiffs/src/spiffs_check.h +++ b/fs/spiffs/src/spiffs_check.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_check.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/spiffs/src/spiffs_core.c b/fs/spiffs/src/spiffs_core.c index 9e445d5f58e..c40757c87b5 100644 --- a/fs/spiffs/src/spiffs_core.c +++ b/fs/spiffs/src/spiffs_core.c @@ -1,8 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_core.c * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * This is a port of version 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license but is here re- diff --git a/fs/spiffs/src/spiffs_core.h b/fs/spiffs/src/spiffs_core.h index 74c8e4f336e..a83705a9b65 100644 --- a/fs/spiffs/src/spiffs_core.h +++ b/fs/spiffs/src/spiffs_core.h @@ -1,8 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_core.h * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * This is a port of version 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license but is here re- diff --git a/fs/spiffs/src/spiffs_gc.c b/fs/spiffs/src/spiffs_gc.c index 7ff0bc3a5f7..ec8a429be8b 100644 --- a/fs/spiffs/src/spiffs_gc.c +++ b/fs/spiffs/src/spiffs_gc.c @@ -1,8 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_gc.c * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * This is a port of version 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license but is here re- diff --git a/fs/spiffs/src/spiffs_gc.h b/fs/spiffs/src/spiffs_gc.h index afa39d1c266..90b126beb37 100644 --- a/fs/spiffs/src/spiffs_gc.h +++ b/fs/spiffs/src/spiffs_gc.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_gc.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/spiffs/src/spiffs_mtd.c b/fs/spiffs/src/spiffs_mtd.c index a41b230105c..d362767d8d9 100644 --- a/fs/spiffs/src/spiffs_mtd.c +++ b/fs/spiffs/src/spiffs_mtd.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_mtd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/spiffs/src/spiffs_mtd.h b/fs/spiffs/src/spiffs_mtd.h index e8e271e8a38..d467d5b0571 100644 --- a/fs/spiffs/src/spiffs_mtd.h +++ b/fs/spiffs/src/spiffs_mtd.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_mtd.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/spiffs/src/spiffs_vfs.c b/fs/spiffs/src/spiffs_vfs.c index 2160a3b63be..240533cecab 100644 --- a/fs/spiffs/src/spiffs_vfs.c +++ b/fs/spiffs/src/spiffs_vfs.c @@ -1,9 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_vfs.c - * Interface between SPIFFS and the NuttX VFS * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * Includes logic taken from 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license. @@ -145,6 +144,8 @@ const struct mountpt_operations g_spiffs_operations = NULL, /* mmap */ spiffs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ spiffs_sync, /* sync */ spiffs_dup, /* dup */ diff --git a/fs/spiffs/src/spiffs_volume.c b/fs/spiffs/src/spiffs_volume.c index 2df67565b99..94428385cfa 100644 --- a/fs/spiffs/src/spiffs_volume.c +++ b/fs/spiffs/src/spiffs_volume.c @@ -1,9 +1,8 @@ /**************************************************************************** * fs/spiffs/src/spiffs_volume.c - * SPIFFS Utility Functions for Volume and File Object Support * - * Copyright (C) 2018 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * SPDX-License-Identifier: BSD-3-Clause + * SPDX-FileCopyrightText: 2018 Gregory Nutt * * This is a port of version 0.3.7 of SPIFFS by Peter Andersion. That * version was originally released under the MIT license but is here re- diff --git a/fs/tmpfs/CMakeLists.txt b/fs/tmpfs/CMakeLists.txt index 290ec1fe7cd..3d2ff64fc06 100644 --- a/fs/tmpfs/CMakeLists.txt +++ b/fs/tmpfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/tmpfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/tmpfs/Make.defs b/fs/tmpfs/Make.defs index 5617243a1bd..f091be50a11 100644 --- a/fs/tmpfs/Make.defs +++ b/fs/tmpfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/tmpfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/tmpfs/fs_tmpfs.c b/fs/tmpfs/fs_tmpfs.c index 0bcc8ce89e5..58c39175e0b 100644 --- a/fs/tmpfs/fs_tmpfs.c +++ b/fs/tmpfs/fs_tmpfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/tmpfs/fs_tmpfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -188,6 +190,8 @@ const struct mountpt_operations g_tmpfs_operations = tmpfs_mmap, /* mmap */ tmpfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ tmpfs_sync, /* sync */ tmpfs_dup, /* dup */ diff --git a/fs/tmpfs/fs_tmpfs.h b/fs/tmpfs/fs_tmpfs.h index 0a352dd51c9..56a726adc99 100644 --- a/fs/tmpfs/fs_tmpfs.h +++ b/fs/tmpfs/fs_tmpfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/tmpfs/fs_tmpfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/unionfs/CMakeLists.txt b/fs/unionfs/CMakeLists.txt index 9cfb371b087..427a49f5cf7 100644 --- a/fs/unionfs/CMakeLists.txt +++ b/fs/unionfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/unionfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/unionfs/Make.defs b/fs/unionfs/Make.defs index 70babe4288b..659af879da7 100644 --- a/fs/unionfs/Make.defs +++ b/fs/unionfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/unionfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/unionfs/fs_unionfs.c b/fs/unionfs/fs_unionfs.c index ff29050e462..c920b83b975 100644 --- a/fs/unionfs/fs_unionfs.c +++ b/fs/unionfs/fs_unionfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/unionfs/fs_unionfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -230,7 +232,9 @@ const struct mountpt_operations g_unionfs_operations = unionfs_ioctl, /* ioctl */ NULL, /* mmap */ unionfs_truncate, /* truncate */ - NULL, /* pool */ + NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ unionfs_sync, /* sync */ unionfs_dup, /* dup */ diff --git a/fs/userfs/CMakeLists.txt b/fs/userfs/CMakeLists.txt index 07b7826cf97..f8bcaf9aff1 100644 --- a/fs/userfs/CMakeLists.txt +++ b/fs/userfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/userfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/userfs/Make.defs b/fs/userfs/Make.defs index 69daf85c8ac..bebe2e68537 100644 --- a/fs/userfs/Make.defs +++ b/fs/userfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/userfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/userfs/fs_userfs.c b/fs/userfs/fs_userfs.c index 893855cb5bf..8386cc8b623 100644 --- a/fs/userfs/fs_userfs.c +++ b/fs/userfs/fs_userfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/userfs/fs_userfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -165,6 +167,8 @@ const struct mountpt_operations g_userfs_operations = NULL, /* mmap */ userfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ userfs_sync, /* sync */ userfs_dup, /* dup */ diff --git a/fs/userfs/userfs.h b/fs/userfs/userfs.h index be7fb8a88e8..2c86a4545c7 100644 --- a/fs/userfs/userfs.h +++ b/fs/userfs/userfs.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/userfs/userfs.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/v9fs/CMakeLists.txt b/fs/v9fs/CMakeLists.txt index fa074fe113d..da46982bac6 100644 --- a/fs/v9fs/CMakeLists.txt +++ b/fs/v9fs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/v9fs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/v9fs/Make.defs b/fs/v9fs/Make.defs index a9daa15e4d3..838f4f62b09 100644 --- a/fs/v9fs/Make.defs +++ b/fs/v9fs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/v9fs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/v9fs/client.c b/fs/v9fs/client.c index f1982576ce9..b6823d1b834 100644 --- a/fs/v9fs/client.c +++ b/fs/v9fs/client.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/v9fs/client.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -171,7 +173,7 @@ begin_packed_struct struct v9fs_attach_s { struct v9fs_header_s header; uint32_t fid; - uint16_t afid; + uint32_t afid; uint8_t buffer[2 * (V9FS_BIT16SZ + NAME_MAX) + V9FS_BIT32SZ]; } end_packed_struct; @@ -1096,13 +1098,13 @@ ssize_t v9fs_client_write(FAR struct v9fs_client_s *client, uint32_t fid, while (buflen > 0) { + request.count = buflen > fidp->iounit ? fidp->iounit : buflen; request.header.size = V9FS_HDRSZ + V9FS_BIT32SZ + V9FS_BIT64SZ + V9FS_BIT32SZ + request.count; request.header.type = V9FS_TWRITE; request.header.tag = v9fs_get_tagid(client); request.fid = fid; request.offset = offset; - request.count = buflen > fidp->iounit ? fidp->iounit : buflen; wiov[0].iov_base = &request; wiov[0].iov_len = V9FS_HDRSZ + V9FS_BIT32SZ + V9FS_BIT64SZ + @@ -1463,7 +1465,7 @@ int v9fs_client_walk(FAR struct v9fs_client_s *client, FAR const char *path, struct iovec wiov[2]; struct iovec riov[2]; uint16_t nwname = 0; - uint32_t newfid; + uint32_t newfid = V9FS_NOFID; size_t total_len = 0; size_t offset = 0; size_t name_len; @@ -1524,12 +1526,13 @@ int v9fs_client_walk(FAR struct v9fs_client_s *client, FAR const char *path, return -ENOMEM; } - newfid = v9fs_fid_create(client, path); - if (newfid < 0) + ret = v9fs_fid_create(client, path); + if (ret < 0) { goto err; } + newfid = ret; request.header.size = V9FS_HDRSZ + V9FS_BIT32SZ * 2 + V9FS_BIT16SZ + total_len; request.header.type = V9FS_TWALK; @@ -1584,13 +1587,23 @@ int v9fs_client_walk(FAR struct v9fs_client_s *client, FAR const char *path, if (ret < 0) { v9fs_fid_destroy(client, newfid); - newfid = ret; + goto err; + } + + /* There are differences in different server implementations, so it is + * necessary to check whether the returned nwqid satisfies the requested + * number. + */ + + if (response.nwqid != nwname) + { + ret = -ENOENT; } err: lib_put_pathbuffer(request_payload); lib_put_pathbuffer(response_payload); - return newfid; + return ret == 0 ? newfid : ret; } /**************************************************************************** diff --git a/fs/v9fs/client.h b/fs/v9fs/client.h index 99a24e723a6..7cd81d2d85a 100644 --- a/fs/v9fs/client.h +++ b/fs/v9fs/client.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/v9fs/client.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/v9fs/transport.c b/fs/v9fs/transport.c index e9b48b28c82..339b1fe6de3 100644 --- a/fs/v9fs/transport.c +++ b/fs/v9fs/transport.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/v9fs/transport.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/v9fs/v9fs.c b/fs/v9fs/v9fs.c index 0d1c1f4d833..1b877a4cca1 100644 --- a/fs/v9fs/v9fs.c +++ b/fs/v9fs/v9fs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/v9fs/v9fs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -126,6 +128,8 @@ const struct mountpt_operations g_v9fs_operations = NULL, /* mmap */ v9fs_vfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ v9fs_vfs_sync, /* sync */ v9fs_vfs_dup, /* dup */ diff --git a/fs/v9fs/virtio_9p.c b/fs/v9fs/virtio_9p.c index 67e470d2cd3..8e7cc8fb8d3 100644 --- a/fs/v9fs/virtio_9p.c +++ b/fs/v9fs/virtio_9p.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/v9fs/virtio_9p.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/CMakeLists.txt b/fs/vfs/CMakeLists.txt index 36a790a3ee6..c81e615b7ce 100644 --- a/fs/vfs/CMakeLists.txt +++ b/fs/vfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/vfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this @@ -42,6 +44,7 @@ set(SRCS fs_stat.c fs_sendfile.c fs_statfs.c + fs_uio.c fs_unlink.c fs_write.c fs_dir.c diff --git a/fs/vfs/Make.defs b/fs/vfs/Make.defs index 1e8c5b8d471..30292d787fa 100644 --- a/fs/vfs/Make.defs +++ b/fs/vfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/vfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The @@ -24,7 +26,7 @@ CSRCS += fs_chstat.c fs_close.c fs_dup.c fs_dup2.c fs_fcntl.c fs_epoll.c CSRCS += fs_fchstat.c fs_fstat.c fs_fstatfs.c fs_ioctl.c fs_lseek.c CSRCS += fs_mkdir.c fs_open.c fs_poll.c fs_pread.c fs_pwrite.c fs_read.c CSRCS += fs_rename.c fs_rmdir.c fs_select.c fs_sendfile.c fs_stat.c -CSRCS += fs_statfs.c fs_unlink.c fs_write.c fs_dir.c fs_fsync.c +CSRCS += fs_statfs.c fs_uio.c fs_unlink.c fs_write.c fs_dir.c fs_fsync.c CSRCS += fs_syncfs.c fs_truncate.c # Certain interfaces are not available if there is no mountpoint support diff --git a/fs/vfs/fs_chstat.c b/fs/vfs/fs_chstat.c index 594e46da2d5..9b0c50c3933 100644 --- a/fs/vfs/fs_chstat.c +++ b/fs/vfs/fs_chstat.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_chstat.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_close.c b/fs/vfs/fs_close.c index 514a8bf71a6..7b460e68ed3 100644 --- a/fs/vfs/fs_close.c +++ b/fs/vfs/fs_close.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_close.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_dir.c b/fs/vfs/fs_dir.c index 89630382f28..585df77e14d 100644 --- a/fs/vfs/fs_dir.c +++ b/fs/vfs/fs_dir.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_dir.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_dup.c b/fs/vfs/fs_dup.c index 86024afd671..3b2492ba4a8 100644 --- a/fs/vfs/fs_dup.c +++ b/fs/vfs/fs_dup.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_dup.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_dup2.c b/fs/vfs/fs_dup2.c index 7d70166b246..39b5494f280 100644 --- a/fs/vfs/fs_dup2.c +++ b/fs/vfs/fs_dup2.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_dup2.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c index 529a0924857..1b24b73f97d 100644 --- a/fs/vfs/fs_epoll.c +++ b/fs/vfs/fs_epoll.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_epoll.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_eventfd.c b/fs/vfs/fs_eventfd.c index 2953a5e85db..f5f614a7e5f 100644 --- a/fs/vfs/fs_eventfd.c +++ b/fs/vfs/fs_eventfd.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_eventfd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_fchstat.c b/fs/vfs/fs_fchstat.c index a4952017879..bedf562019e 100644 --- a/fs/vfs/fs_fchstat.c +++ b/fs/vfs/fs_fchstat.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_fchstat.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_fcntl.c b/fs/vfs/fs_fcntl.c index e2c9fe63769..3df81715599 100644 --- a/fs/vfs/fs_fcntl.c +++ b/fs/vfs/fs_fcntl.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_fcntl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_fstat.c b/fs/vfs/fs_fstat.c index 09d8ed425d7..c4585a79ac1 100644 --- a/fs/vfs/fs_fstat.c +++ b/fs/vfs/fs_fstat.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_fstat.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -110,12 +112,12 @@ static int proxy_fstat(FAR struct file *filep, FAR struct inode *inode, { memset(buf, 0, sizeof(struct stat)); buf->st_mode = S_IFBLK; - if (inode->u.i_ops->read) + if (inode->u.i_ops->readv || inode->u.i_ops->read) { buf->st_mode |= S_IROTH | S_IRGRP | S_IRUSR; } - if (inode->u.i_ops->write) + if (inode->u.i_ops->writev || inode->u.i_ops->read) { buf->st_mode |= S_IWOTH | S_IWGRP | S_IWUSR; } diff --git a/fs/vfs/fs_fstatfs.c b/fs/vfs/fs_fstatfs.c index 4ecec4df115..94acd047992 100644 --- a/fs/vfs/fs_fstatfs.c +++ b/fs/vfs/fs_fstatfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_fstatfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_fsync.c b/fs/vfs/fs_fsync.c index 44a47fcb5ad..8a1915c6541 100644 --- a/fs/vfs/fs_fsync.c +++ b/fs/vfs/fs_fsync.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_fsync.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_ioctl.c b/fs/vfs/fs_ioctl.c index 2f9488c4c20..7bab9a39bac 100644 --- a/fs/vfs/fs_ioctl.c +++ b/fs/vfs/fs_ioctl.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_ioctl.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_link.c b/fs/vfs/fs_link.c index 864b0a94663..ffdb193706f 100644 --- a/fs/vfs/fs_link.c +++ b/fs/vfs/fs_link.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_link.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_lock.c b/fs/vfs/fs_lock.c index a2193d13c7f..cf806da1ff9 100644 --- a/fs/vfs/fs_lock.c +++ b/fs/vfs/fs_lock.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_lock.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_lseek.c b/fs/vfs/fs_lseek.c index 847ae9140f7..5cf85868b77 100644 --- a/fs/vfs/fs_lseek.c +++ b/fs/vfs/fs_lseek.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_lseek.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_mkdir.c b/fs/vfs/fs_mkdir.c index db8e1a42799..5878ef33074 100644 --- a/fs/vfs/fs_mkdir.c +++ b/fs/vfs/fs_mkdir.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_mkdir.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_open.c b/fs/vfs/fs_open.c index c76d3f4c99f..83f1eb279b4 100644 --- a/fs/vfs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_open.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -79,8 +81,8 @@ static int inode_checkflags(FAR struct inode *inode, int oflags) return -ENXIO; } - if (((oflags & O_RDOK) != 0 && !ops->read && !ops->ioctl) || - ((oflags & O_WROK) != 0 && !ops->write && !ops->ioctl)) + if (((oflags & O_RDOK) != 0 && !ops->readv && !ops->read && !ops->ioctl) || + ((oflags & O_WROK) != 0 && !ops->writev && !ops->write && !ops->ioctl)) { return -EACCES; } diff --git a/fs/vfs/fs_poll.c b/fs/vfs/fs_poll.c index 4f626103eb4..aa82b226ce6 100644 --- a/fs/vfs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_poll.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_pread.c b/fs/vfs/fs_pread.c index 5333b7f325f..05209285e75 100644 --- a/fs/vfs/fs_pread.c +++ b/fs/vfs/fs_pread.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_pread.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_pseudofile.c b/fs/vfs/fs_pseudofile.c index 1cfe0a9cf47..314c79eed8b 100644 --- a/fs/vfs/fs_pseudofile.c +++ b/fs/vfs/fs_pseudofile.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_pseudofile.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -93,6 +95,8 @@ static const struct file_operations g_pseudofile_ops = pseudofile_mmap, /* mmap */ pseudofile_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS pseudofile_unlink, /* unlink */ #endif diff --git a/fs/vfs/fs_pwrite.c b/fs/vfs/fs_pwrite.c index cd75b5f79e7..1d2cee7163c 100644 --- a/fs/vfs/fs_pwrite.c +++ b/fs/vfs/fs_pwrite.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_pwrite.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_read.c b/fs/vfs/fs_read.c index 08acce27dec..3e60d1337f8 100644 --- a/fs/vfs/fs_read.c +++ b/fs/vfs/fs_read.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_read.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -36,16 +38,83 @@ #include "notify/notify.h" #include "inode/inode.h" +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: file_readv_compat + * + * Description: + * Emulate readv using file_operation::read. + * + ****************************************************************************/ + +static ssize_t file_readv_compat(FAR struct file *filep, + FAR const struct uio *uio) +{ + FAR const struct iovec *iov = uio->uio_iov; + int iovcnt = uio->uio_iovcnt; + FAR struct inode *inode = filep->f_inode; + ssize_t ntotal; + ssize_t nread; + size_t remaining; + FAR uint8_t *buffer; + int i; + + DEBUGASSERT(inode->u.i_ops->read != NULL); + + /* Process each entry in the struct iovec array */ + + for (i = 0, ntotal = 0; i < iovcnt; i++) + { + /* Ignore zero-length reads */ + + if (iov[i].iov_len == 0) + { + continue; + } + + buffer = iov[i].iov_base; + remaining = iov[i].iov_len; + + nread = inode->u.i_ops->read(filep, (void *)buffer, remaining); + + /* Check for a read error */ + + if (nread < 0) + { + return ntotal ? ntotal : nread; + } + + ntotal += nread; + + /* Check for a parital success condition, including an end-of-file */ + + if (nread < remaining) + { + return ntotal; + } + + /* Update the pointer */ + + buffer += nread; + remaining -= nread; + } + + return ntotal; +} + /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: file_read + * Name: file_readv * * Description: - * file_read() is an internal OS interface. It is functionally similar to - * the standard read() interface except: + * file_readv() is an internal OS interface. It is functionally similar to + * the standard readv() interface except: * * - It does not modify the errno variable, * - It is not a cancellation point, @@ -53,8 +122,7 @@ * * Input Parameters: * filep - File structure instance - * buf - User-provided to save the data - * nbytes - The maximum size of the user-provided buffer + * uio - User buffer information * * Returned Value: * The positive non-zero number of bytes read on success, 0 on if an @@ -62,7 +130,7 @@ * ****************************************************************************/ -ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes) +ssize_t file_readv(FAR struct file *filep, FAR const struct uio *uio) { FAR struct inode *inode; ssize_t ret = -EBADF; @@ -81,18 +149,21 @@ ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes) /* Is a driver or mountpoint registered? If so, does it support the read * method? + * If yes, then let it perform the read. NOTE that for the case of the + * mountpoint, we depend on the read methods being identical in + * signature and position in the operations vtable. */ - else if (inode != NULL && inode->u.i_ops && inode->u.i_ops->read) + else if (inode != NULL && inode->u.i_ops) { - /* Yes.. then let it perform the read. NOTE that for the case of the - * mountpoint, we depend on the read methods being identical in - * signature and position in the operations vtable. - */ - - ret = inode->u.i_ops->read(filep, - (FAR char *)buf, - (size_t)nbytes); + if (inode->u.i_ops->readv) + { + ret = inode->u.i_ops->readv(filep, uio); + } + else if (inode->u.i_ops->read) + { + ret = file_readv_compat(filep, uio); + } } /* Return the number of bytes read (or possibly an error code) */ @@ -108,19 +179,53 @@ ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes) } /**************************************************************************** - * Name: nx_read + * Name: file_read * * Description: - * nx_read() is an internal OS interface. It is functionally similar to + * file_read() is an internal OS interface. It is functionally similar to * the standard read() interface except: * + * - It does not modify the errno variable, + * - It is not a cancellation point, + * - It accepts a file structure instance instead of file descriptor. + * + * Input Parameters: + * filep - File structure instance + * buf - User-provided to save the data + * nbytes - The maximum size of the user-provided buffer + * + * Returned Value: + * The positive non-zero number of bytes read on success, 0 on if an + * end-of-file condition, or a negated errno value on any failure. + * + ****************************************************************************/ + +ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes) +{ + struct iovec iov; + struct uio uio; + + iov.iov_base = buf; + iov.iov_len = nbytes; + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + return file_readv(filep, &uio); +} + +/**************************************************************************** + * Name: nx_readv + * + * Description: + * nx_readv() is an internal OS interface. It is functionally similar to + * the standard readv() interface except: + * * - It does not modify the errno variable, and * - It is not a cancellation point. * * Input Parameters: * fd - File descriptor to read from - * buf - User-provided to save the data - * nbytes - The maximum size of the user-provided buffer + * iov - User-provided iovec to save the data + * iovcnt - The number of iovec * * Returned Value: * The positive non-zero number of bytes read on success, 0 on if an @@ -128,8 +233,9 @@ ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes) * ****************************************************************************/ -ssize_t nx_read(int fd, FAR void *buf, size_t nbytes) +ssize_t nx_readv(int fd, FAR const struct iovec *iov, int iovcnt) { + struct uio uio; FAR struct file *filep; ssize_t ret; @@ -145,16 +251,22 @@ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes) /* Then let file_read do all of the work. */ - ret = file_read(filep, buf, nbytes); + uio.uio_iov = iov; + uio.uio_iovcnt = iovcnt; + ret = file_readv(filep, &uio); fs_putfilep(filep); return ret; } /**************************************************************************** - * Name: read + * Name: nx_read * * Description: - * The standard, POSIX read interface. + * nx_read() is an internal OS interface. It is functionally similar to + * the standard read() interface except: + * + * - It does not modify the errno variable, and + * - It is not a cancellation point. * * Input Parameters: * fd - File descriptor to read from @@ -163,21 +275,47 @@ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes) * * Returned Value: * The positive non-zero number of bytes read on success, 0 on if an + * end-of-file condition, or a negated errno value on any failure. + * + ****************************************************************************/ + +ssize_t nx_read(int fd, FAR void *buf, size_t nbytes) +{ + struct iovec iov; + + iov.iov_base = buf; + iov.iov_len = nbytes; + return nx_readv(fd, &iov, 1); +} + +/**************************************************************************** + * Name: readv + * + * Description: + * The standard, POSIX read interface. + * + * Input Parameters: + * fd - File descriptor to read from + * iov - User-provided iovec to save the data + * iovcnt - The number of iovec + * + * Returned Value: + * The positive non-zero number of bytes read on success, 0 on if an * end-of-file condition, or -1 on failure with errno set appropriately. * ****************************************************************************/ -ssize_t read(int fd, FAR void *buf, size_t nbytes) +ssize_t readv(int fd, FAR const struct iovec *iov, int iovcnt) { ssize_t ret; - /* read() is a cancellation point */ + /* readv() is a cancellation point */ enter_cancellation_point(); - /* Let nx_read() do the real work */ + /* Let nx_readv() do the real work */ - ret = nx_read(fd, buf, nbytes); + ret = nx_readv(fd, iov, iovcnt); if (ret < 0) { set_errno(-ret); @@ -187,3 +325,29 @@ ssize_t read(int fd, FAR void *buf, size_t nbytes) leave_cancellation_point(); return ret; } + +/**************************************************************************** + * Name: read + * + * Description: + * The standard, POSIX read interface. + * + * Input Parameters: + * fd - File descriptor to read from + * buf - User-provided to save the data + * nbytes - The maximum size of the user-provided buffer + * + * Returned Value: + * The positive non-zero number of bytes read on success, 0 on if an + * end-of-file condition, or -1 on failure with errno set appropriately. + * + ****************************************************************************/ + +ssize_t read(int fd, FAR void *buf, size_t nbytes) +{ + struct iovec iov; + + iov.iov_base = buf; + iov.iov_len = nbytes; + return readv(fd, &iov, 1); +} diff --git a/fs/vfs/fs_readlink.c b/fs/vfs/fs_readlink.c index 569502e50d0..6cdf067d434 100644 --- a/fs/vfs/fs_readlink.c +++ b/fs/vfs/fs_readlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_readlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_rename.c b/fs/vfs/fs_rename.c index 1bcaa7a7df2..7cd8319796a 100644 --- a/fs/vfs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_rename.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_rmdir.c b/fs/vfs/fs_rmdir.c index 4a8d1eb5773..ddfc8e72d3b 100644 --- a/fs/vfs/fs_rmdir.c +++ b/fs/vfs/fs_rmdir.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_rmdir.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_select.c b/fs/vfs/fs_select.c index 2fce209ee7b..d8393a8cb2c 100644 --- a/fs/vfs/fs_select.c +++ b/fs/vfs/fs_select.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_select.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_sendfile.c b/fs/vfs/fs_sendfile.c index 75eb1fe6666..28825c82551 100644 --- a/fs/vfs/fs_sendfile.c +++ b/fs/vfs/fs_sendfile.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_sendfile.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_signalfd.c b/fs/vfs/fs_signalfd.c index 6c62b91d417..4ebffc58f11 100644 --- a/fs/vfs/fs_signalfd.c +++ b/fs/vfs/fs_signalfd.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_signalfd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_stat.c b/fs/vfs/fs_stat.c index b647b30b717..e956fd1f9eb 100644 --- a/fs/vfs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_stat.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -379,12 +381,12 @@ int inode_stat(FAR struct inode *inode, FAR struct stat *buf, int resolve) * and write methods. */ - if (inode->u.i_ops->read) + if (inode->u.i_ops->readv || inode->u.i_ops->read) { buf->st_mode = S_IROTH | S_IRGRP | S_IRUSR; } - if (inode->u.i_ops->write) + if (inode->u.i_ops->writev || inode->u.i_ops->write) { buf->st_mode |= S_IWOTH | S_IWGRP | S_IWUSR; } diff --git a/fs/vfs/fs_statfs.c b/fs/vfs/fs_statfs.c index ae08d1a2aea..842780d35ad 100644 --- a/fs/vfs/fs_statfs.c +++ b/fs/vfs/fs_statfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_statfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_symlink.c b/fs/vfs/fs_symlink.c index e7f8bb7c420..d868b177497 100644 --- a/fs/vfs/fs_symlink.c +++ b/fs/vfs/fs_symlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_symlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_syncfs.c b/fs/vfs/fs_syncfs.c index 24032289864..33284b9177a 100644 --- a/fs/vfs/fs_syncfs.c +++ b/fs/vfs/fs_syncfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_syncfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_timerfd.c b/fs/vfs/fs_timerfd.c index f5252caf19a..5b67fdfc132 100644 --- a/fs/vfs/fs_timerfd.c +++ b/fs/vfs/fs_timerfd.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_timerfd.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_truncate.c b/fs/vfs/fs_truncate.c index d6dc7dfb6a4..d27d30e02a3 100644 --- a/fs/vfs/fs_truncate.c +++ b/fs/vfs/fs_truncate.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_truncate.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -82,7 +84,7 @@ int file_truncate(FAR struct file *filep, off_t length) * possible not the only indicator -- sufficient, but not necessary") */ - if (inode->u.i_ops->write == NULL) + if (inode->u.i_ops->writev == NULL && inode->u.i_ops->write == NULL) { fwarn("WARNING: File system is read-only\n"); return -EROFS; diff --git a/arch/xtensa/src/common/xtensa_switchcontext.c b/fs/vfs/fs_uio.c similarity index 57% rename from arch/xtensa/src/common/xtensa_switchcontext.c rename to fs/vfs/fs_uio.c index a98e3e1069c..5c6e260d559 100644 --- a/arch/xtensa/src/common/xtensa_switchcontext.c +++ b/fs/vfs/fs_uio.c @@ -1,5 +1,7 @@ /**************************************************************************** - * arch/xtensa/src/common/xtensa_switchcontext.c + * fs/vfs/fs_uio.c + * + * SPDX-License-Identifier: Apache-2.0 * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -24,53 +26,43 @@ #include -#include -#include -#include +#include +#include -#include -#include -#include +#include -#include "sched/sched.h" -#include "group/group.h" -#include "clock/clock.h" -#include "xtensa.h" +#include +#include /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: up_switch_context + * Name: uio_total_len * * Description: - * A task is currently in the ready-to-run list but has been prepped - * to execute. Restore its context, and start execution. - * - * Input Parameters: - * tcb: Refers to the head task of the ready-to-run list - * which will be executed. - * rtcb: Refers to the running task which will be blocked. + * Return the total length of data in bytes. + * Or -EOVERFLOW. * ****************************************************************************/ -void up_switch_context(struct tcb_s *tcb, struct tcb_s *rtcb) +ssize_t uio_total_len(FAR const struct uio *uio) { - /* Are we in an interrupt handler? */ + const struct iovec *iov = uio->uio_iov; + int iovcnt = uio->uio_iovcnt; + size_t len = 0; + int i; - if (!up_current_regs()) + for (i = 0; i < iovcnt; i++) { - /* Switch context to the context of the task at the head of the - * ready to run list. - */ - - xtensa_switchcontext(&rtcb->xcp.regs, tcb->xcp.regs); + if (SSIZE_MAX - len < iov[i].iov_len) + { + return -EOVERFLOW; + } - /* xtensa_switchcontext forces a context switch to the task at the - * head of the ready-to-run list. It does not 'return' in the - * normal sense. When it does return, it is because the blocked - * task is again ready to run and has execution priority. - */ + len += iov[i].iov_len; } + + return len; } diff --git a/fs/vfs/fs_unlink.c b/fs/vfs/fs_unlink.c index 998ab708316..8d33d70033c 100644 --- a/fs/vfs/fs_unlink.c +++ b/fs/vfs/fs_unlink.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_unlink.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/vfs/fs_write.c b/fs/vfs/fs_write.c index 6849763a676..534bf02d9b6 100644 --- a/fs/vfs/fs_write.c +++ b/fs/vfs/fs_write.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/fs_write.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -36,17 +38,89 @@ #include "notify/notify.h" #include "inode/inode.h" +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: file_writev_compat + * + * Description: + * Emulate writev using file_operation::write. + * + ****************************************************************************/ + +static ssize_t file_writev_compat(FAR struct file *filep, + FAR const struct uio *uio) +{ + FAR const struct iovec *iov = uio->uio_iov; + int iovcnt = uio->uio_iovcnt; + FAR struct inode *inode = filep->f_inode; + ssize_t ntotal; + ssize_t nwritten; + size_t remaining; + FAR uint8_t *buffer; + int i; + + DEBUGASSERT(inode->u.i_ops->write != NULL); + + /* Process each entry in the struct iovec array */ + + for (i = 0, ntotal = 0; i < iovcnt; i++) + { + /* Ignore zero-length writes */ + + if (iov[i].iov_len == 0) + { + continue; + } + + if (iov[i].iov_base == NULL) + { + return -EINVAL; + } + + buffer = iov[i].iov_base; + remaining = iov[i].iov_len; + + nwritten = inode->u.i_ops->write(filep, (void *)buffer, remaining); + + /* Check for a write error */ + + if (nwritten < 0) + { + return ntotal ? ntotal : nwritten; + } + + ntotal += nwritten; + + /* Check for a parital success condition */ + + if (nwritten < remaining) + { + return ntotal; + } + + /* Update the pointer */ + + buffer += nwritten; + remaining -= nwritten; + } + + return ntotal; +} + /**************************************************************************** * Public Functions ****************************************************************************/ /**************************************************************************** - * Name: file_write + * Name: file_writev * * Description: - * Equivalent to the standard write() function except that is accepts a + * Equivalent to the standard writev() function except that is accepts a * struct file instance instead of a file descriptor. It is functionally - * equivalent to write() except that in addition to the differences in + * equivalent to writev() except that in addition to the differences in * input parameters: * * - It does not modify the errno variable, @@ -54,8 +128,7 @@ * * Input Parameters: * filep - Instance of struct file to use with the write - * buf - Data to write - * nbytes - Length of data to write + * uio - User buffer information * * Returned Value: * On success, the number of bytes written are returned (zero indicates @@ -65,11 +138,10 @@ * ****************************************************************************/ -ssize_t file_write(FAR struct file *filep, FAR const void *buf, - size_t nbytes) +ssize_t file_writev(FAR struct file *filep, FAR const struct uio *uio) { FAR struct inode *inode; - ssize_t ret; + ssize_t ret = -EBADF; /* Was this file opened for write access? */ @@ -78,17 +150,23 @@ ssize_t file_write(FAR struct file *filep, FAR const void *buf, return -EACCES; } - /* Is a driver registered? Does it support the write method? */ + /* Is a driver registered? Does it support the write method? + * If yes, then let the driver perform the write. + */ inode = filep->f_inode; - if (!inode || !inode->u.i_ops || !inode->u.i_ops->write) + if (inode != NULL && inode->u.i_ops) { - return -EBADF; + if (inode->u.i_ops->writev) + { + ret = inode->u.i_ops->writev(filep, uio); + } + else if (inode->u.i_ops->write) + { + ret = file_writev_compat(filep, uio); + } } - /* Yes, then let the driver perform the write */ - - ret = inode->u.i_ops->write(filep, buf, nbytes); #ifdef CONFIG_FS_NOTIFY if (ret > 0) { @@ -100,12 +178,50 @@ ssize_t file_write(FAR struct file *filep, FAR const void *buf, } /**************************************************************************** - * Name: nx_write + * Name: file_write * * Description: - * nx_write() writes up to nytes bytes to the file referenced by the file - * descriptor fd from the buffer starting at buf. nx_write() is an - * internal OS function. It is functionally equivalent to write() except + * Equivalent to the standard write() function except that is accepts a + * struct file instance instead of a file descriptor. It is functionally + * equivalent to write() except that in addition to the differences in + * input parameters: + * + * - It does not modify the errno variable, + * - It is not a cancellation point, and + * + * Input Parameters: + * filep - Instance of struct file to use with the write + * buf - Data to write + * nbytes - Length of data to write + * + * Returned Value: + * On success, the number of bytes written are returned (zero indicates + * nothing was written). On any failure, a negated errno value is returned + * (see comments withwrite() for a description of the appropriate errno + * values). + * + ****************************************************************************/ + +ssize_t file_write(FAR struct file *filep, FAR const void *buf, + size_t nbytes) +{ + struct iovec iov; + struct uio uio; + + iov.iov_base = (FAR void *)buf; + iov.iov_len = nbytes; + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + return file_writev(filep, &uio); +} + +/**************************************************************************** + * Name: nx_writev + * + * Description: + * nx_writev() writes up to nytes bytes to the file referenced by the file + * descriptor fd from the buffer starting at buf. nx_writev() is an + * internal OS function. It is functionally equivalent to writev() except * that: * * - It does not modify the errno variable, and @@ -113,8 +229,8 @@ ssize_t file_write(FAR struct file *filep, FAR const void *buf, * * Input Parameters: * fd - file descriptor to write to - * buf - Data to write - * nbytes - Length of data to write + * iov - Data to write + * iovcnt - The number of vectors * * Returned Value: * On success, the number of bytes written are returned (zero indicates @@ -124,16 +240,12 @@ ssize_t file_write(FAR struct file *filep, FAR const void *buf, * ****************************************************************************/ -ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes) +ssize_t nx_writev(int fd, FAR const struct iovec *iov, int iovcnt) { + struct uio uio; FAR struct file *filep; ssize_t ret; - if (buf == NULL) - { - return -EINVAL; - } - /* First, get the file structure. * Note that fs_getfilep() will return the errno on failure. */ @@ -145,7 +257,9 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes) * index. Note that file_write() will return the errno on failure. */ - ret = file_write(filep, buf, nbytes); + uio.uio_iov = iov; + uio.uio_iovcnt = iovcnt; + ret = file_writev(filep, &uio); fs_putfilep(filep); } @@ -153,11 +267,16 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes) } /**************************************************************************** - * Name: write + * Name: nx_write * * Description: - * write() writes up to nytes bytes to the file referenced by the file - * descriptor fd from the buffer starting at buf. + * nx_write() writes up to nytes bytes to the file referenced by the file + * descriptor fd from the buffer starting at buf. nx_write() is an + * internal OS function. It is functionally equivalent to write() except + * that: + * + * - It does not modify the errno variable, and + * - It is not a cancellation point. * * Input Parameters: * fd - file descriptor to write to @@ -166,6 +285,35 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes) * * Returned Value: * On success, the number of bytes written are returned (zero indicates + * nothing was written). On any failure, a negated errno value is returned + * (see comments withwrite() for a description of the appropriate errno + * values). + * + ****************************************************************************/ + +ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes) +{ + struct iovec iov; + + iov.iov_base = (void *)buf; + iov.iov_len = nbytes; + return nx_writev(fd, &iov, 1); +} + +/**************************************************************************** + * Name: writev + * + * Description: + * writev() writes up to nytes bytes to the file referenced by the file + * descriptor fd from the buffer starting at buf. + * + * Input Parameters: + * fd - file descriptor to write to + * iov - Data to write + * iovcnt - The number of vectors + * + * Returned Value: + * On success, the number of bytes written are returned (zero indicates * nothing was written). On error, -1 is returned, and errno is set appro- * priately: * @@ -200,7 +348,7 @@ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes) * ****************************************************************************/ -ssize_t write(int fd, FAR const void *buf, size_t nbytes) +ssize_t writev(int fd, FAR const struct iovec *iov, int iovcnt) { ssize_t ret; @@ -210,7 +358,7 @@ ssize_t write(int fd, FAR const void *buf, size_t nbytes) /* Let nx_write() do all of the work */ - ret = nx_write(fd, buf, nbytes); + ret = nx_writev(fd, iov, iovcnt); if (ret < 0) { set_errno(-ret); @@ -220,3 +368,60 @@ ssize_t write(int fd, FAR const void *buf, size_t nbytes) leave_cancellation_point(); return ret; } + +/**************************************************************************** + * Name: write + * + * Description: + * write() writes up to nytes bytes to the file referenced by the file + * descriptor fd from the buffer starting at buf. + * + * Input Parameters: + * fd - file descriptor to write to + * buf - Data to write + * nbytes - Length of data to write + * + * Returned Value: + * On success, the number of bytes written are returned (zero indicates + * nothing was written). On error, -1 is returned, and errno is set appro- + * priately: + * + * EAGAIN + * Non-blocking I/O has been selected using O_NONBLOCK and the write + * would block. + * EBADF + * fd is not a valid file descriptor or is not open for writing. + * EFAULT + * buf is outside your accessible address space. + * EFBIG + * An attempt was made to write a file that exceeds the implementation + * defined maximum file size or the process's file size limit, or + * to write at a position past the maximum allowed offset. + * EINTR + * The call was interrupted by a signal before any data was written. + * EINVAL + * fd is attached to an object which is unsuitable for writing; or + * the file was opened with the O_DIRECT flag, and either the address + * specified in buf, the value specified in count, or the current + * file offset is not suitably aligned. + * EIO + * A low-level I/O error occurred while modifying the inode. + * ENOSPC + * The device containing the file referred to by fd has no room for + * the data. + * EPIPE + * fd is connected to a pipe or socket whose reading end is closed. + * When this happens the writing process will also receive a SIGPIPE + * signal. (Thus, the write return value is seen only if the program + * catches, blocks or ignores this signal.) + * + ****************************************************************************/ + +ssize_t write(int fd, FAR const void *buf, size_t nbytes) +{ + struct iovec iov; + + iov.iov_base = (void *)buf; + iov.iov_len = nbytes; + return writev(fd, &iov, 1); +} diff --git a/fs/vfs/lock.h b/fs/vfs/lock.h index c1f888d22dd..2a51c9a1444 100644 --- a/fs/vfs/lock.h +++ b/fs/vfs/lock.h @@ -1,6 +1,8 @@ /**************************************************************************** * fs/vfs/lock.h * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The diff --git a/fs/yaffs/yaffs_vfs.c b/fs/yaffs/yaffs_vfs.c index 021252311b2..bca5a788da9 100644 --- a/fs/yaffs/yaffs_vfs.c +++ b/fs/yaffs/yaffs_vfs.c @@ -167,6 +167,8 @@ const struct mountpt_operations g_yaffs_operations = NULL, /* mmap */ yaffs_vfs_truncate, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ yaffs_vfs_sync, /* sync */ yaffs_vfs_dup, /* dup */ @@ -1114,7 +1116,7 @@ static int yaffs_vfs_bind(FAR struct inode *driver, FAR const void *data, dev->driver_context = mtd; p = &dev->param; - p->name = strdup(mtd->name); + p->name = fs_heap_strdup(mtd->name); if (p->name == NULL) { ret = -ENOMEM; @@ -1195,7 +1197,7 @@ static int yaffs_vfs_bind(FAR struct inode *driver, FAR const void *data, return OK; errout_with_name: - lib_free((FAR void *)(p->name)); + fs_heap_free((FAR void *)(p->name)); yaffs_remove_device(dev); errout_with_dev: fs_heap_free(dev); @@ -1232,7 +1234,7 @@ static int yaffs_vfs_unbind(FAR void *handle, FAR struct inode **driver, /* Remove and release dev */ yaffs_remove_device(dev); - lib_free((FAR void *)(dev->param.name)); + fs_heap_free((FAR void *)(dev->param.name)); fs_heap_free(dev); /* We hold a reference to the driver but should not but diff --git a/fs/zipfs/CMakeLists.txt b/fs/zipfs/CMakeLists.txt index e9f00e56be6..401d84d04b8 100644 --- a/fs/zipfs/CMakeLists.txt +++ b/fs/zipfs/CMakeLists.txt @@ -1,6 +1,8 @@ # ############################################################################## # fs/zipfs/CMakeLists.txt # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for # additional information regarding copyright ownership. The ASF licenses this diff --git a/fs/zipfs/Make.defs b/fs/zipfs/Make.defs index e03aaaa9413..8b4d60ba834 100644 --- a/fs/zipfs/Make.defs +++ b/fs/zipfs/Make.defs @@ -1,6 +1,8 @@ ############################################################################ # fs/zipfs/Make.defs # +# SPDX-License-Identifier: Apache-2.0 +# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. The diff --git a/fs/zipfs/zip_vfs.c b/fs/zipfs/zip_vfs.c index 50897820e47..30ca7f5e387 100644 --- a/fs/zipfs/zip_vfs.c +++ b/fs/zipfs/zip_vfs.c @@ -1,6 +1,8 @@ /**************************************************************************** * fs/zipfs/zip_vfs.c * + * SPDX-License-Identifier: Apache-2.0 + * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. The @@ -137,6 +139,8 @@ const struct mountpt_operations g_zipfs_operations = NULL, /* mmap */ NULL, /* truncate */ NULL, /* poll */ + NULL, /* readv */ + NULL, /* writev */ NULL, /* sync */ zipfs_dup, /* dup */ diff --git a/graphics/nxterm/nxterm_driver.c b/graphics/nxterm/nxterm_driver.c index 4f350139371..24c1bc2f8b0 100644 --- a/graphics/nxterm/nxterm_driver.c +++ b/graphics/nxterm/nxterm_driver.c @@ -70,7 +70,9 @@ const struct file_operations g_nxterm_drvrops = nxterm_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - nxterm_poll /* poll */ + nxterm_poll, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , nxterm_unlink /* unlink */ #endif @@ -88,7 +90,9 @@ const struct file_operations g_nxterm_drvrops = nxterm_ioctl, /* ioctl */ NULL, /* mmap */ NULL, /* truncate */ - NULL /* poll */ + NULL, /* poll */ + NULL, /* readv */ + NULL /* writev */ #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS , nxterm_unlink /* unlink */ #endif diff --git a/include/fnmatch.h b/include/fnmatch.h index 1dc3246bb71..42b4498cf5e 100644 --- a/include/fnmatch.h +++ b/include/fnmatch.h @@ -37,6 +37,7 @@ #define FNM_PATHNAME 0x01 #define FNM_PERIOD 0x02 #define FNM_NOESCAPE 0x04 +#define FNM_CASEFOLD 0x10 #define FNM_NOMATCH 1 #define FNM_NOSYS -1 diff --git a/include/limits.h b/include/limits.h index e46f30898d0..bf613006481 100644 --- a/include/limits.h +++ b/include/limits.h @@ -130,6 +130,7 @@ #define _POSIX_PIPE_BUF 512 #define _POSIX_STREAM_MAX 16 #define _POSIX_TZNAME_MAX 3 +#define _POSIX2_LINE_MAX 80 #ifdef CONFIG_SMALL_MEMORY @@ -202,6 +203,7 @@ #define ARG_MAX _POSIX_ARG_MAX #define CHILD_MAX _POSIX_CHILD_MAX +#define LINE_MAX _POSIX2_LINE_MAX #define LINK_MAX _POSIX_LINK_MAX #define MAX_CANON _POSIX_MAX_CANON #define MAX_INPUT _POSIX_MAX_INPUT diff --git a/include/nuttx/addrenv.h b/include/nuttx/addrenv.h index e9388815b14..11dad06410a 100644 --- a/include/nuttx/addrenv.h +++ b/include/nuttx/addrenv.h @@ -193,7 +193,9 @@ # define CONFIG_ARCH_SHM_NPAGES 1 # endif -# define ARCH_SHM_SIZE (CONFIG_ARCH_SHM_NPAGES * CONFIG_MM_PGSIZE) +# define ARCH_SHM_MAXPAGES (CONFIG_ARCH_SHM_NPAGES * CONFIG_ARCH_SHM_MAXREGIONS) +# define ARCH_SHM_REGIONSIZE (CONFIG_ARCH_SHM_NPAGES * CONFIG_MM_PGSIZE) +# define ARCH_SHM_SIZE (CONFIG_ARCH_SHM_MAXREGIONS * ARCH_SHM_REGIONSIZE) # define ARCH_SHM_VEND (CONFIG_ARCH_SHM_VBASE + ARCH_SHM_SIZE - 1) # define ARCH_SCRATCH_VBASE ARCH_SHM_VEND diff --git a/include/nuttx/board.h b/include/nuttx/board.h index 33053a2f93c..d3430d2b3cb 100644 --- a/include/nuttx/board.h +++ b/include/nuttx/board.h @@ -820,7 +820,7 @@ int board_button_irq(int id, xcpt_t irqhandler, FAR void *arg); * ****************************************************************************/ -#ifdef CONFIG_BOARD_CRASHDUMP +#ifdef CONFIG_BOARD_CRASHDUMP_CUSTOM struct tcb_s; void board_crashdump(uintptr_t sp, FAR struct tcb_s *tcb, FAR const char *filename, int lineno, diff --git a/include/nuttx/circbuf.h b/include/nuttx/circbuf.h index 3295c175cf9..0b2ba990cea 100644 --- a/include/nuttx/circbuf.h +++ b/include/nuttx/circbuf.h @@ -37,6 +37,12 @@ #include #include +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define CIRCBUF_INITIALIZER(base, size) { base, size, 0, 0, true } + /**************************************************************************** * Public Types ****************************************************************************/ diff --git a/include/nuttx/clock.h b/include/nuttx/clock.h index 74b55d2ad5f..5afc8ed605e 100644 --- a/include/nuttx/clock.h +++ b/include/nuttx/clock.h @@ -391,7 +391,7 @@ EXTERN volatile clock_t g_system_ticks; * * Input Parameters: * ts1 and ts2: The two timespecs to be added - * t23: The location to return the result (may be ts1 or ts2) + * ts3: The location to return the result (may be ts1 or ts2) * * Returned Value: * None @@ -422,7 +422,7 @@ EXTERN volatile clock_t g_system_ticks; * * Input Parameters: * ts1 and ts2: The two timespecs to be subtracted (ts1 - ts2) - * t23: The location to return the result (may be ts1 or ts2) + * ts3: The location to return the result (may be ts1 or ts2) * * Returned Value: * None diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index c09d2ccec81..ed78a6e5739 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -113,10 +113,6 @@ # warning requires compiling with optimization (-O2 or higher) # endif # if CONFIG_FORTIFY_SOURCE == 3 -# if __GNUC__ < 12 || (defined(__clang__) && __clang_major__ < 12) -# error compiler version less than 12 does not support dynamic object size -# endif - # define fortify_size(__o, type) __builtin_dynamic_object_size(__o, type) # else # define fortify_size(__o, type) __builtin_object_size(__o, type) @@ -131,7 +127,9 @@ } \ while (0) -# define fortify_va_arg_pack __builtin_va_arg_pack +# if !defined(__clang__) +# define fortify_va_arg_pack __builtin_va_arg_pack +# endif # define fortify_real(fn) __typeof__(fn) __real_##fn __asm__(#fn) # define fortify_function(fn) fortify_real(fn); \ extern __inline__ no_builtin(#fn) \ @@ -244,7 +242,7 @@ # define naked_function __attribute__((naked,no_instrument_function)) # else # define naked_function -#endif +# endif /* The always_inline_function attribute informs GCC that the function should * always be inlined, regardless of the level of optimization. The diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index cc9591fd054..22b88409e75 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -28,9 +28,13 @@ ****************************************************************************/ #include + #include +#include +#include #include + #include #include #include @@ -183,6 +187,7 @@ struct statfs; struct pollfd; struct mtd_dev_s; struct tcb_s; +struct uio; /* The internal representation of type DIR is just a container for an inode * reference, and the path of directory. @@ -233,6 +238,8 @@ struct file_operations CODE int (*poll)(FAR struct file *filep, FAR struct pollfd *fds, bool setup); + CODE ssize_t (*readv)(FAR struct file *filep, FAR const struct uio *uio); + CODE ssize_t (*writev)(FAR struct file *filep, FAR const struct uio *uio); /* The two structures need not be common after this point */ @@ -329,6 +336,9 @@ struct mountpt_operations CODE int (*truncate)(FAR struct file *filep, off_t length); CODE int (*poll)(FAR struct file *filep, FAR struct pollfd *fds, bool setup); + CODE ssize_t (*readv)(FAR struct file *filep, FAR const struct uio *uio); + CODE ssize_t (*writev)(FAR struct file *filep, FAR const struct uio *uio); + /* The two structures need not be common after this point. The following * are extended methods needed to deal with the unique needs of mounted * file systems. @@ -510,15 +520,6 @@ struct filelist uint8_t fl_rows; /* The number of rows of fl_files array */ uint8_t fl_crefs; /* The references to filelist */ FAR struct file **fl_files; /* The pointer of two layer file descriptors array */ - - /* Pre-allocated files to avoid allocator access during thread creation - * phase, For functional safety requirements, increase - * CONFIG_NFILE_DESCRIPTORS_PER_BLOCK could also avoid allocator access - * caused by the file descriptor exceeding the limit. - */ - - FAR struct file *fl_prefile; - struct file fl_prefiles[CONFIG_NFILE_DESCRIPTORS_PER_BLOCK]; }; /* The following structure defines the list of files used for standard C I/O. @@ -1416,6 +1417,7 @@ int close_mtddriver(FAR struct inode *pinode); ****************************************************************************/ ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes); +ssize_t file_readv(FAR struct file *filep, FAR const struct uio *uio); /**************************************************************************** * Name: nx_read @@ -1439,6 +1441,7 @@ ssize_t file_read(FAR struct file *filep, FAR void *buf, size_t nbytes); ****************************************************************************/ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes); +ssize_t nx_readv(int fd, FAR const struct iovec *iov, int iovcnt); /**************************************************************************** * Name: file_write @@ -1468,6 +1471,7 @@ ssize_t nx_read(int fd, FAR void *buf, size_t nbytes); ssize_t file_write(FAR struct file *filep, FAR const void *buf, size_t nbytes); +ssize_t file_writev(FAR struct file *filep, FAR const struct uio *uio); /**************************************************************************** * Name: nx_write @@ -1495,6 +1499,7 @@ ssize_t file_write(FAR struct file *filep, FAR const void *buf, ****************************************************************************/ ssize_t nx_write(int fd, FAR const void *buf, size_t nbytes); +ssize_t nx_writev(int fd, FAR const struct iovec *iov, int iovcnt); /**************************************************************************** * Name: file_pread diff --git a/include/nuttx/fs/uio.h b/include/nuttx/fs/uio.h new file mode 100644 index 00000000000..e864745a18c --- /dev/null +++ b/include/nuttx/fs/uio.h @@ -0,0 +1,65 @@ +/**************************************************************************** + * include/nuttx/fs/uio.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_FS_UIO_H +#define __INCLUDE_NUTTX_FS_UIO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/* The structure to describe an user I/O operation. + * + * At this point, this is a bare minimum for readv/writev. + * In the future, we might extend this for other things like + * the file offset for pread/pwrite. + * + * This structure was inspired by BSDs. + * (Thus it doesn't have the NuttX-style "_s" suffix.) + */ + +struct uio +{ + FAR const struct iovec *uio_iov; + int uio_iovcnt; +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: uio_total_len + * + * Description: + * Return the total length of data in bytes. + * Or -EOVERFLOW. + * + ****************************************************************************/ + +ssize_t uio_total_len(FAR const struct uio *uio); + +#endif /* __INCLUDE_NUTTX_FS_UIO_H */ diff --git a/include/nuttx/mtd/mtd.h b/include/nuttx/mtd/mtd.h index 9b8622b837c..c528db4e8e9 100644 --- a/include/nuttx/mtd/mtd.h +++ b/include/nuttx/mtd/mtd.h @@ -490,6 +490,19 @@ FAR struct mtd_dev_s *mx35_initialize(FAR struct spi_dev_s *dev); FAR struct mtd_dev_s *rammtd_initialize(FAR uint8_t *start, size_t size); +/**************************************************************************** + * Name: rammtd_uninitialize + * + * Description: + * Free the resources associated with a RAM MTD device instance. + * + * Input Parameters: + * dev - Pointer to the MTD device instance to be uninitialized. + * + ****************************************************************************/ + +void rammtd_uninitialize(FAR struct mtd_dev_s *dev); + /**************************************************************************** * Name: ramtron_initialize * diff --git a/include/nuttx/net/netconfig.h b/include/nuttx/net/netconfig.h index 806703971d6..0a34801ab27 100644 --- a/include/nuttx/net/netconfig.h +++ b/include/nuttx/net/netconfig.h @@ -88,12 +88,14 @@ # define HAVE_INET_SOCKETS # if (defined(CONFIG_NET_IPv4) && (defined(NET_UDP_HAVE_STACK) || \ - defined(NET_TCP_HAVE_STACK))) || defined(CONFIG_NET_ICMP_SOCKET) + defined(NET_TCP_HAVE_STACK) || defined(CONFIG_NET_USRSOCK))) || \ + defined(CONFIG_NET_ICMP_SOCKET) # define HAVE_PFINET_SOCKETS # endif # if (defined(CONFIG_NET_IPv6) && (defined(NET_UDP_HAVE_STACK) || \ - defined(NET_TCP_HAVE_STACK))) || defined(CONFIG_NET_ICMPv6_SOCKET) + defined(NET_TCP_HAVE_STACK) || defined(CONFIG_NET_USRSOCK))) || \ + defined(CONFIG_NET_ICMPv6_SOCKET) # define HAVE_PFINET6_SOCKETS # endif #endif diff --git a/include/nuttx/notifier.h b/include/nuttx/notifier.h index 235cb6c758e..87ebdb78abc 100644 --- a/include/nuttx/notifier.h +++ b/include/nuttx/notifier.h @@ -179,9 +179,9 @@ extern "C" { \ FAR struct atomic_notifier_head *nh = (nhead); \ irqstate_t flags; \ - flags = spin_lock_irqsave(NULL); \ + flags = enter_critical_section(); \ notifier_chain_register(nh->head, (nb), false); \ - spin_unlock_irqrestore(NULL, flags); \ + leave_critical_section(flags); \ } \ while(0) @@ -190,9 +190,9 @@ extern "C" { \ FAR struct atomic_notifier_head *nh = (nhead); \ irqstate_t flags; \ - flags = spin_lock_irqsave(NULL); \ + flags = enter_critical_section(); \ notifier_chain_register(nh->head, (nb), true); \ - spin_unlock_irqrestore(NULL, flags); \ + leave_critical_section(flags); \ } \ while(0) @@ -201,9 +201,9 @@ extern "C" { \ FAR struct atomic_notifier_head *nh = (nhead); \ irqstate_t flags; \ - flags = spin_lock_irqsave(NULL); \ + flags = enter_critical_section(); \ notifier_chain_unregister(nh->head, (nb)); \ - spin_unlock_irqrestore(NULL, flags); \ + leave_critical_section(flags); \ } \ while(0) diff --git a/include/nuttx/sched.h b/include/nuttx/sched.h index 960847b5b46..21cd765819a 100644 --- a/include/nuttx/sched.h +++ b/include/nuttx/sched.h @@ -244,6 +244,8 @@ # define this_cpu() (0) #endif +#define running_regs() ((void *)(g_running_tasks[this_cpu()]->xcp.regs)) + /**************************************************************************** * Public Type Definitions ****************************************************************************/ @@ -872,6 +874,12 @@ EXTERN clock_t g_premp_max[CONFIG_SMP_NCPUS]; EXTERN clock_t g_crit_max[CONFIG_SMP_NCPUS]; #endif /* CONFIG_SCHED_CRITMONITOR_MAXTIME_CSECTION >= 0 */ +/* g_running_tasks[] holds a references to the running task for each CPU. + * It is valid only when up_interrupt_context() returns true. + */ + +EXTERN FAR struct tcb_s *g_running_tasks[CONFIG_SMP_NCPUS]; + EXTERN const struct tcbinfo_s g_tcbinfo; /**************************************************************************** diff --git a/include/nuttx/spinlock.h b/include/nuttx/spinlock.h index bd15818d6a7..ea9593b7e63 100644 --- a/include/nuttx/spinlock.h +++ b/include/nuttx/spinlock.h @@ -929,11 +929,15 @@ static inline_function void read_unlock(FAR volatile rwlock_t *lock) static inline_function void write_lock(FAR volatile rwlock_t *lock) { - int zero = RW_SP_UNLOCKED; - - while (!atomic_compare_exchange_strong((FAR atomic_int *)lock, - &zero, RW_SP_WRITE_LOCKED)) + while (true) { + int zero = RW_SP_UNLOCKED; + if (atomic_compare_exchange_strong((FAR atomic_int *)lock, + &zero, RW_SP_WRITE_LOCKED)) + { + break; + } + SP_DSB(); SP_WFE(); } diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h index dcf832566eb..701dd1a66ea 100644 --- a/include/nuttx/streams.h +++ b/include/nuttx/streams.h @@ -50,6 +50,7 @@ #define lib_stream_puts(stream, buf, len) \ ((FAR struct lib_outstream_s *)(stream))->puts( \ (FAR struct lib_outstream_s *)(stream), buf, len) +#define lib_stream_eof(c) ((c) <= 0) #define lib_stream_getc(stream) \ ((FAR struct lib_instream_s *)(stream))->getc( \ (FAR struct lib_instream_s *)(stream)) @@ -74,19 +75,19 @@ /* These are the generic representations of a streams used by the NuttX */ struct lib_instream_s; -typedef CODE int (*lib_getc_t)(FAR struct lib_instream_s *self); -typedef CODE int (*lib_gets_t)(FAR struct lib_instream_s *self, - FAR void *buf, int len); +typedef CODE int (*lib_getc_t)(FAR struct lib_instream_s *self); +typedef CODE ssize_t (*lib_gets_t)(FAR struct lib_instream_s *self, + FAR void *buf, size_t len); struct lib_outstream_s; -typedef CODE void (*lib_putc_t)(FAR struct lib_outstream_s *self, int ch); -typedef CODE int (*lib_puts_t)(FAR struct lib_outstream_s *self, - FAR const void *buf, int len); -typedef CODE int (*lib_flush_t)(FAR struct lib_outstream_s *self); +typedef CODE void (*lib_putc_t)(FAR struct lib_outstream_s *self, int ch); +typedef CODE ssize_t (*lib_puts_t)(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len); +typedef CODE int (*lib_flush_t)(FAR struct lib_outstream_s *self); struct lib_instream_s { - int nget; /* Total number of characters gotten. Written + off_t nget; /* Total number of characters gotten. Written * by get method, readable by user */ lib_getc_t getc; /* Get one character from the instream */ lib_gets_t gets; /* Get the string from the instream */ @@ -94,7 +95,7 @@ struct lib_instream_s struct lib_outstream_s { - int nput; /* Total number of characters put. Written + off_t nput; /* Total number of characters put. Written * by put method, readable by user */ lib_putc_t putc; /* Put one character to the outstream */ lib_puts_t puts; /* Writes the string to the outstream */ @@ -104,23 +105,24 @@ struct lib_outstream_s /* Seek-able streams */ struct lib_sistream_s; -typedef CODE int (*lib_sigetc_t)(FAR struct lib_sistream_s *self); -typedef CODE int (*lib_sigets_t)(FAR struct lib_sistream_s *self, - FAR void *buf, int len); -typedef CODE off_t (*lib_siseek_t)(FAR struct lib_sistream_s *self, - off_t offset, int whence); +typedef CODE int (*lib_sigetc_t)(FAR struct lib_sistream_s *self); +typedef CODE ssize_t (*lib_sigets_t)(FAR struct lib_sistream_s *self, + FAR void *buf, size_t len); +typedef CODE off_t (*lib_siseek_t)(FAR struct lib_sistream_s *self, + off_t offset, int whence); struct lib_sostream_s; -typedef CODE void (*lib_soputc_t)(FAR struct lib_sostream_s *self, int ch); -typedef CODE int (*lib_soputs_t)(FAR struct lib_sostream_s *self, - FAR const void *buf, int len); -typedef CODE int (*lib_soflush_t)(FAR struct lib_sostream_s *self); -typedef CODE off_t (*lib_soseek_t)(FAR struct lib_sostream_s *self, - off_t offset, int whence); +typedef CODE void (*lib_soputc_t)(FAR struct lib_sostream_s *self, + int ch); +typedef CODE ssize_t (*lib_soputs_t)(FAR struct lib_sostream_s *self, + FAR const void *buf, size_t len); +typedef CODE int (*lib_soflush_t)(FAR struct lib_sostream_s *self); +typedef CODE off_t (*lib_soseek_t)(FAR struct lib_sostream_s *self, + off_t offset, int whence); struct lib_sistream_s { - int nget; /* Total number of characters gotten. Written + off_t nget; /* Total number of characters gotten. Written * by get method, readable by user */ lib_sigetc_t getc; /* Get one character from the instream */ lib_gets_t gets; /* Get the string from the instream */ @@ -129,7 +131,7 @@ struct lib_sistream_s struct lib_sostream_s { - int nput; /* Total number of characters put. Written + off_t nput; /* Total number of characters put. Written * by put method, readable by user */ lib_soputc_t putc; /* Put one character to the outstream */ lib_soputs_t puts; /* Writes the string to the outstream */ @@ -157,7 +159,7 @@ struct lib_memsistream_s { struct lib_sistream_s common; FAR const char *buffer; /* Address of first byte in the buffer */ - size_t offset; /* Current buffer offset in bytes */ + off_t offset; /* Current buffer offset in bytes */ size_t buflen; /* Size of the buffer in bytes */ }; @@ -165,7 +167,7 @@ struct lib_memsostream_s { struct lib_sostream_s common; FAR char *buffer; /* Address of first byte in the buffer */ - size_t offset; /* Current buffer offset in bytes */ + off_t offset; /* Current buffer offset in bytes */ size_t buflen; /* Size of the buffer in bytes */ }; @@ -231,7 +233,7 @@ struct lib_bufferedoutstream_s { struct lib_outstream_s common; FAR struct lib_outstream_s *backend; - int pending; + size_t pending; char buffer[CONFIG_STREAM_OUT_BUFFER_SIZE]; }; @@ -239,7 +241,7 @@ struct lib_hexdumpstream_s { struct lib_outstream_s common; FAR struct lib_outstream_s *backend; - int pending; + size_t pending; char buffer[CONFIG_STREAM_HEXDUMP_BUFFER_SIZE + 1]; }; @@ -247,9 +249,9 @@ struct lib_base64outstream_s { struct lib_outstream_s common; FAR struct lib_outstream_s *backend; - int pending; + size_t pending; unsigned char bytes[3]; - int nbytes; + size_t nbytes; char buffer[CONFIG_STREAM_BASE64_BUFFER_SIZE + 1]; }; @@ -269,7 +271,7 @@ struct lib_syslograwstream_s struct lib_outstream_s common; #ifdef CONFIG_SYSLOG_BUFFER char buffer[CONFIG_SYSLOG_BUFSIZE]; - int offset; + off_t offset; #endif int last_ch; }; @@ -282,7 +284,7 @@ struct lib_lzfoutstream_s struct lib_outstream_s common; FAR struct lib_outstream_s *backend; lzf_state_t state; - size_t offset; + off_t offset; char in[LZF_STREAM_BLOCKSIZE]; char out[LZF_MAX_HDR_SIZE + LZF_STREAM_BLOCKSIZE]; }; @@ -291,7 +293,7 @@ struct lib_lzfoutstream_s #ifndef CONFIG_DISABLE_MOUNTPOINT struct lib_blkoutstream_s { - struct lib_outstream_s common; + struct lib_sostream_s common; FAR struct inode *inode; struct geometry geo; FAR unsigned char *cache; @@ -301,7 +303,7 @@ struct lib_blkoutstream_s #if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_MTD) struct lib_mtdoutstream_s { - struct lib_outstream_s common; + struct lib_sostream_s common; FAR struct inode *inode; struct mtd_geometry_s geo; FAR unsigned char *cache; @@ -354,13 +356,13 @@ extern struct lib_outstream_s g_lowoutstream; ****************************************************************************/ void lib_meminstream(FAR struct lib_meminstream_s *stream, - FAR const char *bufstart, int buflen); + FAR const char *bufstart, size_t buflen); void lib_memoutstream(FAR struct lib_memoutstream_s *stream, - FAR char *bufstart, int buflen); + FAR char *bufstart, size_t buflen); void lib_memsistream(FAR struct lib_memsistream_s *stream, - FAR const char *bufstart, int buflen); + FAR const char *bufstart, size_t buflen); void lib_memsostream(FAR struct lib_memsostream_s *stream, - FAR char *bufstart, int buflen); + FAR char *bufstart, size_t buflen); /**************************************************************************** * Name: lib_stdinstream, lib_stdoutstream diff --git a/include/nuttx/wdog.h b/include/nuttx/wdog.h index 84f7f6a3ad9..04b1e3415b4 100644 --- a/include/nuttx/wdog.h +++ b/include/nuttx/wdog.h @@ -31,6 +31,7 @@ #include #include +#include #include /**************************************************************************** diff --git a/include/nuttx/wqueue.h b/include/nuttx/wqueue.h index bdb7e60b500..a5b52085b99 100644 --- a/include/nuttx/wqueue.h +++ b/include/nuttx/wqueue.h @@ -349,6 +349,7 @@ int work_usrstart(void); * Input Parameters: * name - Name of the new task * priority - Priority of the new task + * stack_addr - Stack buffer of the new task * stack_size - size (in bytes) of the stack needed * nthreads - Number of work thread should be created * @@ -359,6 +360,7 @@ int work_usrstart(void); FAR struct kwork_wqueue_s *work_queue_create(FAR const char *name, int priority, + FAR void *stack_addr, int stack_size, int nthreads); /**************************************************************************** diff --git a/include/pthread.h b/include/pthread.h index 0418dfacd07..e0866c8462d 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -269,6 +269,7 @@ struct pthread_cond_s { sem_t sem; clockid_t clockid; + uint16_t wait_count; }; #ifndef __PTHREAD_COND_T_DEFINED @@ -367,6 +368,8 @@ struct pthread_barrier_s { sem_t sem; unsigned int count; + unsigned int wait_count; + mutex_t mutex; }; #ifndef __PTHREAD_BARRIER_T_DEFINED diff --git a/include/signal.h b/include/signal.h index 865819ee7b3..b63d77aa999 100644 --- a/include/signal.h +++ b/include/signal.h @@ -172,6 +172,8 @@ #define SIGSYS 31 +#define SIGIOT SIGABRT + /* sigprocmask() "how" definitions. * Only one of the following can be specified: */ @@ -199,6 +201,10 @@ * is delivered */ #define SA_KERNELHAND (1 << 7) /* Invoke the handler in kernel space directly */ +/* SA_NOMASK is a nonstandard synonym of SA_NODEFER */ + +#define SA_NOMASK SA_NODEFER + /* These are the possible values of the siginfo si_code field */ #define SI_USER 0 /* Signal sent from kill, raise, or abort */ @@ -410,7 +416,11 @@ struct sigaction } sa_u; sigset_t sa_mask; int sa_flags; - FAR void *sa_user; /* Passed to siginfo.si_user (non-standard) */ + union + { + CODE void (*sa_restorer)(void); + FAR void *sa_user; /* Passed to siginfo.si_user (non-standard) */ + }; }; /* Definitions that adjust the non-standard naming */ @@ -427,6 +437,8 @@ typedef struct size_t ss_size; } stack_t; +typedef CODE void (*sig_t)(int); + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/include/stdio.h b/include/stdio.h index a7d3115d433..65b11586964 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -318,6 +318,7 @@ fortify_function(vsprintf) int vsprintf(FAR char *dest, return ret; } +#ifdef fortify_va_arg_pack fortify_function(snprintf) int snprintf(FAR char *buf, size_t size, FAR const IPTR char *format, ...) { @@ -336,6 +337,7 @@ fortify_function(sprintf) int sprintf(FAR char *buf, return ret; } #endif +#endif #undef EXTERN #if defined(__cplusplus) diff --git a/include/sys/fcntl.h b/include/sys/fcntl.h new file mode 100644 index 00000000000..6196702b73e --- /dev/null +++ b/include/sys/fcntl.h @@ -0,0 +1,44 @@ +/**************************************************************************** + * include/sys/fcntl.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_SYS_FCNTL_H +#define __INCLUDE_SYS_FCNTL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __INCLUDE_SYS_FCNTL_H */ diff --git a/include/sys/mount.h b/include/sys/mount.h index 9adbff6ec8a..9a1bb82874d 100644 --- a/include/sys/mount.h +++ b/include/sys/mount.h @@ -39,7 +39,16 @@ /* Mount flags */ -#define MS_RDONLY 1 /* Mount file system read-only */ +#define MS_RDONLY 1 /* Mount file system read-only */ +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ +#define MS_NODEV 4 /* Disallow access to device special files */ +#define MS_NOEXEC 8 /* Disallow program execution */ +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ +#define MS_NOSYMFOLLOW 256 /* Do not follow symlinks */ +#define MS_NOATIME 1024 /* Do not update access times. */ /* Un-mount flags * diff --git a/include/sys/prctl.h b/include/sys/prctl.h index d9f75f7ca89..aea419244f2 100644 --- a/include/sys/prctl.h +++ b/include/sys/prctl.h @@ -76,6 +76,9 @@ #define PR_SET_NAME_EXT 3 #define PR_GET_NAME_EXT 4 +#define PR_SET_DUMPABLE 5 +#define PR_GET_DUMPABLE 6 + /**************************************************************************** * Public Type Definitions ****************************************************************************/ diff --git a/include/sys/resource.h b/include/sys/resource.h index 9cda4a407f8..6bb4cf00f78 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -60,6 +60,7 @@ #define RLIMIT_STACK 6 /* Limit on stack size */ #define RLIMIT_AS 7 /* Limit on address space size */ #define RLIMIT_MEMLOCK 8 /* Limit on memory use */ +#define RLIMIT_NICE 10 /* Limit on nice level */ /* Below are not implemented yet: */ diff --git a/include/sys/sem.h b/include/sys/sem.h new file mode 100644 index 00000000000..8e6ba775279 --- /dev/null +++ b/include/sys/sem.h @@ -0,0 +1,44 @@ +/**************************************************************************** + * include/sys/sem.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_SYS_SEM_H +#define __INCLUDE_SYS_SEM_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __INCLUDE_SYS_SEM_H */ diff --git a/include/sys/signal.h b/include/sys/signal.h new file mode 100644 index 00000000000..dcd0a643ade --- /dev/null +++ b/include/sys/signal.h @@ -0,0 +1,44 @@ +/**************************************************************************** + * include/sys/signal.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_SYS_SIGNAL_H +#define __INCLUDE_SYS_SIGNAL_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __INCLUDE_SYS_VFS_H */ diff --git a/include/sys/socket.h b/include/sys/socket.h index fc604bde209..d3d8c760832 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -242,6 +242,8 @@ #define SOL_SCO 17 /* See options in include/netpacket/bluetooth.h */ #define SOL_RFCOMM 18 /* See options in include/netpacket/bluetooth.h */ +#define SOL_PACKET 19 + /* Protocol-level socket options may begin with this value */ #define __SO_PROTOCOL 16 diff --git a/include/sys/statfs.h b/include/sys/statfs.h index a3b1f3b75b1..7d298c6e0f2 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -101,6 +101,8 @@ #define RPMSGFS_MAGIC 0x54534f47 #define ZIPFS_MAGIC 0x504b #define V9FS_MAGIC 0x01021997 +#define LROFS_MAGIC 0x7276 +#define ARCHIVEFS_MAGIC 0x504c #if defined(CONFIG_FS_LARGEFILE) # define statfs64 statfs diff --git a/include/sys/syscall_lookup.h b/include/sys/syscall_lookup.h index 8e27edae007..5bef5e5d1ca 100644 --- a/include/sys/syscall_lookup.h +++ b/include/sys/syscall_lookup.h @@ -200,6 +200,8 @@ SYSCALL_LOOKUP(close, 1) SYSCALL_LOOKUP(ioctl, 3) SYSCALL_LOOKUP(read, 3) SYSCALL_LOOKUP(write, 3) +SYSCALL_LOOKUP(readv, 3) +SYSCALL_LOOKUP(writev, 3) SYSCALL_LOOKUP(pread, 4) SYSCALL_LOOKUP(pwrite, 4) #ifdef CONFIG_FS_AIO diff --git a/include/sys/types.h b/include/sys/types.h index 32328ac30f0..276caeb07cc 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -232,6 +232,8 @@ typedef int32_t off_t; typedef int32_t fpos_t; #endif +typedef off_t loff_t; + /* blksize_t is a signed integer value used for file block sizes */ typedef int16_t blksize_t; diff --git a/include/unistd.h b/include/unistd.h index 7557655fd76..a0a04253dc5 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -389,6 +389,7 @@ unsigned int alarm(unsigned int seconds); int chdir(FAR const char *path); int fchdir(int fd); FAR char *getcwd(FAR char *buf, size_t size); +FAR char *get_current_dir_name(void); /* File path operations */ diff --git a/include/wait.h b/include/wait.h new file mode 100644 index 00000000000..050c9834f90 --- /dev/null +++ b/include/wait.h @@ -0,0 +1,44 @@ +/**************************************************************************** + * include/wait.h + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_WAIT_H +#define __INCLUDE_WAIT_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __INCLUDE_WAIT_H */ diff --git a/libs/libbuiltin/Kconfig b/libs/libbuiltin/Kconfig index 3db48a0c516..4d8c581ce4f 100644 --- a/libs/libbuiltin/Kconfig +++ b/libs/libbuiltin/Kconfig @@ -5,36 +5,119 @@ comment "Toolchain Library Support" +config LIB_BUILTIN + bool + +config LIB_COMPILER_RT + bool + choice prompt "Builtin toolchain support" default BUILTIN_TOOLCHAIN ---help--- - Choose to compile libraries related to toolchain into the OS + Select the builtin library config BUILTIN_COMPILER_RT - bool "Builtin LLVM Compiler-rt" + bool "Builtin LLVM libclang_rt.builtins" + depends on ARCH_TOOLCHAIN_GNU + select LIB_BUILTIN + select LIB_COMPILER_RT ---help--- Compile the LLVM Compiler-rt library into the OS. config BUILTIN_TOOLCHAIN - bool "Link the toolchain library" + bool "Link toolchain builtin library to the OS" + +endchoice + +choice + prompt "Code coverage analysis support" + default COVERAGE_NONE + ---help--- + Select the code coverage analysis library + +config COVERAGE_COMPILER_RT + bool "Builtin libclang_rt.profile" + depends on ARCH_TOOLCHAIN_CLANG + select LIB_BUILTIN + select LIB_COMPILER_RT ---help--- - Use the toolchain library that comes with the compiler + Compile the LLVM Compiler-rt library into the OS. + Support adding native rich compilation options "-fprofile-xxx" + +config COVERAGE_MINI + bool "Builtin code coverage analysis mini library" + select LIB_BUILTIN + ---help--- + This is a mini version of the library, which is + used for code coverage analysis. If the toolchain + is clang, only support the compilation option + "-fprofile-instr-generate -fcoverage-mapping" + +config COVERAGE_TOOLCHAIN + bool "Link toolchain gcov library to the OS" + depends on ARCH_TOOLCHAIN_GCC + ---help--- + Link the toolchain coverage library to the OS. + +config COVERAGE_NONE + bool "Disable coverage function" endchoice -if BUILTIN_COMPILER_RT +choice + prompt "Builtin profile support" + default PROFILE_NONE + ---help--- + Select the profile library -config COMPILER_RT_VERSION - string "Select LLVM Compiler-rt version" - default "17.0.1" +config PROFILE_MINI + bool "Enable mini gprof profiling" + select LIB_BUILTIN + ---help--- + Enable gprof profiling support. This will cause the compiler to + generate additional code to support profiling. This will also + cause the linker to include the gmon.out file in the final + executable. + Add the "-pg" parameter to the Makefile when compiling to obtain + the function call graph of the specified module. If you do this, + please enable "CONFIG_FRAME_POINTER" -config COMPILER_RT_HAS_BFLOAT16 - bool "Enable support for bfloat16 in Compiler-rt" +config PROFILE_NONE + bool "None profile support" + +endchoice + +config COVERAGE_ALL + bool "Enable code coverage for all module" + depends on !COVERAGE_NONE default n + ---help--- + Enable code coverage for all code, it will instrument + all code, which will cause a large performance penalty for the code. + If use GCC, it will add the '-fprofile-generate + -ftest-coverage' parameter to all module. + If use Clang, it will add the '-fprofile-instr-generate + -fcoverage-mapping' parameter to all module. + The data can then be printed nsh run "gcov dump -d /xxx/xxx" -config COMPILER_RT_PROFILE - bool "Enable profiling support in Compiler-rt" + +config PROFILE_ALL + bool "Enable gprof call graph for all modules" + depends on FRAME_POINTER && !PROFILE_NONE default n + ---help--- + Enable gprof profiling for all code, it will instrument + all code, which will cause a large performance penalty for the code. + You can add the '-pg' parameter to the specified module in the + makefile to only analyze the content of the module. -endif # BUILTIN_COMPILER_RT +config LIB_COMPILER_RT_VERSION + string "Select LLVM Compiler-rt version" + depends on LIB_COMPILER_RT + default "17.0.1" + +config LIB_COMPILER_RT_HAS_BFLOAT16 + bool "Enable support for bfloat16 in Compiler-rt" + depends on LIB_COMPILER_RT + default n diff --git a/libs/libbuiltin/Makefile b/libs/libbuiltin/Makefile index d003471bc4e..2728539da4c 100644 --- a/libs/libbuiltin/Makefile +++ b/libs/libbuiltin/Makefile @@ -20,16 +20,15 @@ include $(TOPDIR)/Make.defs -ifeq ($(CONFIG_BUILTIN_COMPILER_RT),y) -include compiler-rt/Make.defs -endif - BIN ?= libbuiltin$(LIBEXT) BINDIR ?= bin KBIN = libkbuiltin$(LIBEXT) KBINDIR = kbin +include compiler-rt/Make.defs +include libgcc/Make.defs + AOBJS = $(addprefix $(BINDIR)$(DELIM), $(ASRCS:.S=$(OBJEXT))) COBJS = $(addprefix $(BINDIR)$(DELIM), $(CSRCS:.c=$(OBJEXT))) CXXOBJS = $(addprefix $(BINDIR)$(DELIM), $(CXXSRCS:.cxx=$(OBJEXT))) @@ -38,12 +37,8 @@ CPPOBJS = $(addprefix $(BINDIR)$(DELIM), $(CPPSRCS:.cpp=$(OBJEXT))) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(CPPSRCS) OBJS = $(AOBJS) $(COBJS) $(CXXOBJS) $(CPPOBJS) -BUILTIN_CLEANDIR = $(foreach dir,$(LIBBUILTIN),$(dir)/$(dir)) - -all: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - -.PHONY: depend clean distclean context $(LIBBUILTIN) +all: $(BIN) +.PHONY: depend clean distclean context $(AOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -57,15 +52,21 @@ $(CXXOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cxx $(CPPOBJS): $(BINDIR)$(DELIM)%$(OBJEXT): %.cpp $(call COMPILEXX, $<, $@) -context:: +bin: + $(Q) mkdir $@ + +kbin: + $(Q) mkdir $@ -.depend: $(LIBBUILTIN) +context:: bin kbin + +.depend: Makefile $(SRCS) $(TOPDIR)$(DELIM).config $(Q) touch $@ -depend: .depend +depend:: .depend -$(BIN): depend - $(Q) $(MAKE) all EXTRAFLAGS="$(EXTRAFLAGS)" +$(BIN): $(OBJS) + $(call ARCHIVE, $@, $(OBJS)) # C library for the kernel phase of the two-pass kernel build @@ -75,12 +76,11 @@ $(KBIN): $(OBJS) endif clean: + $(call CLEAN) $(call DELFILE, $(BIN)) - $(Q) $(MAKE) -C bin clean - $(Q) $(MAKE) -C kbin clean - -distclean: clean - $(Q) $(MAKE) -C bin distclean - $(Q) $(MAKE) -C kbin distclean - $(call DELFILE, .depend) - $(call DELDIR, $(BUILTIN_CLEANDIR)) \ No newline at end of file + $(call DELFILE, $(KBIN)) + +distclean:: clean + $(call DELDIR, bin) + $(call DELDIR, kbin) + $(call DELDIR, .depend) diff --git a/libs/libbuiltin/bin/Makefile b/libs/libbuiltin/bin/Makefile deleted file mode 100644 index d60aef150e9..00000000000 --- a/libs/libbuiltin/bin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# libs/libbuiltin/bin/Makefile -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call DELFILE, *.o) - -# Deep clean -- removes all traces of the configuration - -distclean: clean - $(call DELFILE, *.dep) - $(call DELFILE, .depend) diff --git a/libs/libbuiltin/compiler-rt/CMakeLists.txt b/libs/libbuiltin/compiler-rt/CMakeLists.txt index 58fef0ae45f..96731c6c82b 100644 --- a/libs/libbuiltin/compiler-rt/CMakeLists.txt +++ b/libs/libbuiltin/compiler-rt/CMakeLists.txt @@ -18,11 +18,11 @@ # # ############################################################################## -if(CONFIG_BUILTIN_COMPILER_RT) +if(CONFIG_LIB_COMPILER_RT) if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/compiler-rt) - set(COMPILER_RT_VERSION ${CONFIG_COMPILER_RT_VERSION}) + set(COMPILER_RT_VERSION ${CONFIG_LIB_COMPILER_RT_VERSION}) FetchContent_Declare( compiler-rt @@ -52,427 +52,109 @@ if(CONFIG_BUILTIN_COMPILER_RT) endif() - nuttx_add_system_library(compiler-rt) + if(CONFIG_ARCH_ARM) + set(ARCH arm) + elseif(CONFIG_ARCH_RISCV) + set(ARCH riscv) + elseif(CONFIG_ARCH_X86_64) + set(ARCH x86_64) + elseif(CONFIG_ARCH_ARM64) + set(ARCH aarch64) + endif() list(APPEND INCDIR ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/include) - list(APPEND INCDIR ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins) - - # Arithmetic operations - set(RT_BUILTIN_SRCS - absvdi2.c - absvsi2.c - absvti2.c - adddf3.c - addtf3.c - addvdi3.c - addvsi3.c - addvti3.c - muldc3.c - muldf3.c - muldi3.c - mulodi4.c - mulosi4.c - muloti4.c - mulsc3.c - mulsf3.c - multc3.c - multf3.c - multi3.c - mulvdi3.c - mulvsi3.c - mulvti3.c - mulxc3.c - negdf2.c - negdi2.c - negsf2.c - negti2.c - negvdi2.c - negvsi2.c - negvti2.c - subdf3.c - subsf3.c - subtf3.c - subvdi3.c - subvsi3.c - subvti3.c) - - # Floating point operations - list( - APPEND - RT_BUILTIN_SRCS - floatdidf.c - floatdisf.c - floatditf.c - floatdixf.c - floatsidf.c - floatsisf.c - floatsitf.c - floattidf.c - floattisf.c - floattitf.c - floattixf.c - floatundidf.c - floatundisf.c - floatunditf.c - floatundixf.c - floatunsidf.c - floatunsisf.c - floatunsitf.c - floatuntidf.c - floatuntisf.c - floatuntitf.c - floatuntixf.c) - - # Conversion and expansion operations - list( - APPEND - RT_BUILTIN_SRCS - fixtfdi.c - fixtfsi.c - fixtfti.c - fixunsdfdi.c - fixunsdfsi.c - fixunsdfti.c - fixunssfdi.c - fixunssfsi.c - fixunssfti.c - fixunstfdi.c - fixunstfsi.c - fixunstfti.c - fixunsxfdi.c - fixunsxfsi.c - fixunsxfti.c - fixxfdi.c - fixxfti.c - extenddftf2.c - extendhfsf2.c - extendhftf2.c - extendsfdf2.c - extendsftf2.c - truncdfhf2.c - truncdfsf2.c - truncsfhf2.c - trunctfdf2.c - trunctfhf2.c - trunctfsf2.c) - - # Bit manipulation operations - list( - APPEND - RT_BUILTIN_SRCS - ashldi3.c - ashlti3.c - ashrdi3.c - ashrti3.c - clzti2.c - ctzdi2.c - ctzsi2.c - ctzti2.c - lshrdi3.c - lshrti3.c - popcountdi2.c - popcountsi2.c - popcountti2.c - paritydi2.c - paritysi2.c - parityti2.c) - - # Division and modulo operations - list( - APPEND - RT_BUILTIN_SRCS - divdc3.c - divdf3.c - divdi3.c - divmoddi4.c - divmodti4.c - divsc3.c - divsf3.c - divtc3.c - divtf3.c - divti3.c - divxc3.c - moddi3.c - modti3.c - udivdi3.c - udivmoddi4.c - udivmodti4.c - udivti3.c - umoddi3.c - umodti3.c) - - # Atomic operations - list( - APPEND - RT_BUILTIN_SRCS - atomic.c - atomic_flag_clear.c - atomic_flag_clear_explicit.c - atomic_flag_test_and_set.c - atomic_flag_test_and_set_explicit.c - atomic_signal_fence.c - atomic_thread_fence.c) - - # Other function related files - list( - APPEND - RT_BUILTIN_SRCS - apple_versioning.c - clear_cache.c - cmpdi2.c - cmpti2.c - comparedf2.c - comparetf2.c - cpu_model.c - emutls.c - enable_execute_stack.c - eprintf.c - fp_mode.c - gcc_personality_v0.c - int_util.c - os_version_check.c - trampoline_setup.c - ucmpdi2.c - ucmpti2.c - powidf2.c - powisf2.c - powitf2.c - powixf2.c) - - set(RT_BUILTIN_ARCH_SRCS) - # ARM-specific assembly files - if(CONFIG_ARCH_ARM) - set(RT_BUILTIN_ARCH arm) - list( - APPEND - RT_BUILTIN_ARCH_SRCS - adddf3vfp.S - addsf3.S - addsf3vfp.S - divmodsi4.S - divsi3.S - modsi3.S - subdf3vfp.S - subsf3vfp.S - muldf3vfp.S - mulsf3vfp.S - negdf2vfp.S - negsf2vfp.S) - - # Floating-Point Operations - list( - APPEND - RT_BUILTIN_ARCH_SRCS - comparesf2.S - eqdf2vfp.S - eqsf2vfp.S - extendsfdf2vfp.S - fixdfsivfp.S - fixsfsivfp.S - fixunsdfsivfp.S - fixunssfsivfp.S - floatsidfvfp.S - floatsisfvfp.S - floatunssidfvfp.S - floatunssisfvfp.S - gedf2vfp.S - gesf2vfp.S - gtdf2vfp.S - gtsf2vfp.S - ledf2vfp.S - lesf2vfp.S - ltdf2vfp.S - ltsf2vfp.S - nedf2vfp.S - nesf2vfp.S - truncdfsf2vfp.S - unorddf2vfp.S - unordsf2vfp.S) - - # Synchronization operations - list( - APPEND - RT_BUILTIN_ARCH_SRCS - sync_fetch_and_add_4.S - sync_fetch_and_add_8.S - sync_fetch_and_and_4.S - sync_fetch_and_and_8.S - sync_fetch_and_max_4.S - sync_fetch_and_max_8.S - sync_fetch_and_min_4.S - sync_fetch_and_min_8.S - sync_fetch_and_nand_4.S - sync_fetch_and_nand_8.S - sync_fetch_and_or_4.S - sync_fetch_and_or_8.S - sync_fetch_and_sub_4.S - sync_fetch_and_sub_8.S - sync_fetch_and_umax_4.S - sync_fetch_and_umax_8.S - sync_fetch_and_umin_4.S - sync_fetch_and_umin_8.S - sync_fetch_and_xor_4.S - sync_fetch_and_xor_8.S - sync_synchronize.S) - - # Memory operations - list( - APPEND - RT_BUILTIN_ARCH_SRCS - aeabi_memcmp.S - aeabi_memcpy.S - aeabi_memmove.S - aeabi_memset.S - restore_vfp_d8_d15_regs.S - save_vfp_d8_d15_regs.S) - - # Division and Modulus Operations - list( - APPEND - RT_BUILTIN_ARCH_SRCS - aeabi_idivmod.S - aeabi_ldivmod.S - aeabi_uidivmod.S - aeabi_uldivmod.S - udivmodsi4.S - udivsi3.S - umodsi3.S) - - # Bitwise and Other Operations - list( - APPEND - RT_BUILTIN_ARCH_SRCS - bswapdi2.S - bswapsi2.S - chkstk.S - clzdi2.S - clzsi2.S) - - # Branch and Control Flow - list(APPEND RT_BUILTIN_ARCH_SRCS switch16.S switch32.S switch8.S switchu8.S) - - else() - - # Other architectures - list( - APPEND - RT_BUILTIN_SRCS - addsf3.c - divsi3.c - modsi3.c - bswapdi2.c - bswapsi2.c - clzdi2.c - clzsi2.c - divmodsi4.c - udivmodsi4.c - udivsi3.c - umodsi3.c - comparesf2.c) - endif() + if(CONFIG_BUILTIN_COMPILER_RT) - if(CONFIG_ARCH_ARM64) - set(ARCH "aarch64") - list(APPEND RT_BUILTIN_ARCH_SRCS chkstk.S lse.S fp_mode.c) - elseif(CONFIG_ARCH_RISCV) - set(ARCH "riscv") - list( - APPEND - RT_BUILTIN_ARCH_SRCS - muldi3.S - mulsi3.S - restore.S - save.S - fp_mode.c) - else() - list(APPEND RT_BUILTIN_SRCS muldi3.c) - endif() + nuttx_add_system_library(rt.buitlins) + + target_include_directories( + rt.buitlins PRIVATE ${INCDIR} + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins) + + target_compile_options(rt.buitlins PRIVATE -Wno-undef -Wno-macro-redefined) + + set(SRCSTMP) + set(RT_BUILTINS_SRCS) + file(GLOB RT_BUILTINS_SRCS + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/*.c) + + file(GLOB SRCSTMP + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/${ARCH}/*.S) + list(APPEND RT_BUILTINS_SRCS ${SRCSTMP}) + + file(GLOB SRCSTMP + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/${ARCH}/*.c) + list(APPEND RT_BUILTINS_SRCS ${SRCSTMP}) + + if(NOT CONFIG_LIB_COMPILER_RT_HAS_BFLOAT16) + set(RT_BUILTINS_BFLOAT16_SRCS + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/truncdfbf2.c + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/truncsfbf2.c) + list(REMOVE_ITEM RT_BUILTINS_SRCS ${RT_BUILTINS_BFLOAT16_SRCS}) + endif() + + target_sources(rt.buitlins PRIVATE ${RT_BUILTINS_SRCS}) - if(CONFIG_ARCH_X86_64) - set(ARCH "x86_64") - list( - APPEND - RT_BUILTIN_ARCH_SRCS - chkstk2.S - chkstk.S - floatundidf.S - floatundisf.S - floatundixf.S - floatdidf.c - floatdisf.c - floatdixf.c) - else() - list(APPEND RT_BUILTIN_SRCS floatundidf.c floatundisf.c floatundixf.c) endif() - if(CONFIG_COMPILER_RT_PROFILE) + if(CONFIG_COVERAGE_COMPILER_RT) + + nuttx_add_system_library(rt.profile) target_include_directories( - compiler-rt PRIVATE ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile) + rt.profile PRIVATE ${INCDIR} + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile) target_compile_options( - compiler-rt - PRIVATE -DCOMPILER_RT_HAS_UNAME - -Wno-cleardeprecated-pragma - -Wno-deprecated-pragma - -Wno-incompatible-pointer-types - -Wno-shadow - -Wno-strict-prototypes - -Wno-undef - -Wno-unknown-warning-option) - - set(RT_PROFILE_SRCS - GCDAProfiling.c - InstrProfiling.c - InstrProfilingBuffer.c - InstrProfilingFile.c - InstrProfilingInternal.c - InstrProfilingMerge.c - InstrProfilingMergeFile.c - InstrProfilingNameVar.c - InstrProfilingUtil.c - InstrProfilingValue.c - InstrProfilingVersionVar.c - InstrProfilingWriter.c - InstrProfilingRuntime.cpp) - - foreach(src ${RT_PROFILE_SRCS}) - string(PREPEND src ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile/) - list(APPEND COMPILER_RT_SRCS ${src}) - endforeach() - - list(APPEND COMPILER_RT_SRCS InstrProfilingPlatform.c) + rt.profile PRIVATE -DCOMPILER_RT_HAS_UNAME -Wno-undef + -Wno-strict-prototypes -Wno-shadow) + + set(SRCSTMP) + set(RT_PROFILE_SRCS InstrProfilingPlatform.c) + + file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile/*.c) + list(APPEND RT_PROFILE_SRCS ${SRCSTMP}) + + file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile/*.cpp) + list(APPEND RT_PROFILE_SRCS ${SRCSTMP}) + + target_sources(rt.profile PRIVATE ${RT_PROFILE_SRCS}) endif() - list(APPEND INCDIR - ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/${RT_BUILTIN_ARCH}) - - foreach(src ${RT_BUILTIN_SRCS}) - string(PREPEND src ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/) - list(APPEND COMPILER_RT_SRCS ${src}) - endforeach() - - foreach(src ${RT_BUILTIN_ARCH_SRCS}) - string( - PREPEND src - ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/builtins/${RT_BUILTIN_ARCH}/) - list(APPEND COMPILER_RT_SRCS ${src}) - endforeach() - - # Add the sources to the target - target_sources(compiler-rt PRIVATE ${COMPILER_RT_SRCS}) - - target_compile_options( - compiler-rt - PRIVATE -Wno-shift-count-negative - -Wno-constant-conversion - -Wshift-count-overflow - -Wno-undef - -Wno-incompatible-pointer-types - -Wno-visibility - -Wno-macro-redefined) - - target_include_directories(compiler-rt PRIVATE ${INCDIR}) +endif() + +if(CONFIG_COVERAGE_COMPILER_RT) + + nuttx_add_system_library(rt.profile) + + target_include_directories( + rt.profile PRIVATE ${INCDIR} + ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile) + + target_compile_options(rt.profile -fno-profile-instr-generate + -fno-coverage-mapping) + + target_compile_options(rt.profile PRIVATE -DCOMPILER_RT_HAS_UNAME -Wno-undef + -Wno-strict-prototypes -Wno-shadow) + + set(SRCSTMP) + set(RT_PROFILE_SRCS InstrProfilingPlatform.c) + + file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile/*.c) + list(APPEND RT_PROFILE_SRCS ${SRCSTMP}) + + file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/compiler-rt/lib/profile/*.cpp) + list(APPEND RT_PROFILE_SRCS ${SRCSTMP}) + + target_sources(rt.profile PRIVATE ${RT_PROFILE_SRCS}) + +elseif(CONFIG_COVERAGE_MINI) + nuttx_add_system_library(rt.miniprofile) + + target_compile_options(rt.miniprofile -fno-profile-instr-generate + -fno-coverage-mapping) + + target_sources(rt.profile PRIVATE ${CMAKE_CURRENT_LIST_DIR}/coverage.c) endif() diff --git a/libs/libbuiltin/compiler-rt/InstrProfilingPlatform.c b/libs/libbuiltin/compiler-rt/InstrProfilingPlatform.c index 8e466d600d7..3de393c1bf2 100644 --- a/libs/libbuiltin/compiler-rt/InstrProfilingPlatform.c +++ b/libs/libbuiltin/compiler-rt/InstrProfilingPlatform.c @@ -60,37 +60,37 @@ void __llvm_profile_register_names_function(void *NamesStart, COMPILER_RT_VISIBILITY const __llvm_profile_data *__llvm_profile_begin_data(void) { - return &__start__llvm_prf_data; + return (const __llvm_profile_data *)__start__llvm_prf_data; } COMPILER_RT_VISIBILITY const __llvm_profile_data *__llvm_profile_end_data(void) { - return &__end__llvm_prf_data; + return (const __llvm_profile_data *)__end__llvm_prf_data; } COMPILER_RT_VISIBILITY const char *__llvm_profile_begin_names(void) { - return &__start__llvm_prf_names; + return (const char *)__start__llvm_prf_names; } COMPILER_RT_VISIBILITY const char *__llvm_profile_end_names(void) { - return &__end__llvm_prf_names; + return (const char *)__end__llvm_prf_names; } COMPILER_RT_VISIBILITY char *__llvm_profile_begin_counters(void) { - return &__start__llvm_prf_cnts; + return (char *)__start__llvm_prf_cnts; } COMPILER_RT_VISIBILITY char *__llvm_profile_end_counters(void) { - return &__end__llvm_prf_cnts; + return (char *)__end__llvm_prf_cnts; } COMPILER_RT_VISIBILITY diff --git a/libs/libbuiltin/compiler-rt/Make.defs b/libs/libbuiltin/compiler-rt/Make.defs index bce8321c266..93faaf892b1 100644 --- a/libs/libbuiltin/compiler-rt/Make.defs +++ b/libs/libbuiltin/compiler-rt/Make.defs @@ -20,11 +20,30 @@ include $(TOPDIR)/Make.defs -LIBBUILTIN += compiler-rt +COMPILER_RT_VERSION=$(CONFIG_LIB_COMPILER_RT_VERSION) -COMPILER_RT_VERSION=$(CONFIG_COMPILER_RT_VERSION) +ifeq ($(CONFIG_ARCH_ARM),y) + ARCH = arm +else ifeq ($(CONFIG_ARCH_RISCV),y) + ARCH = riscv +else ifeq ($(CONFIG_ARCH_X86_64),y) + ARCH = x86_64 +else ifeq ($(CONFIG_ARCH_ARM64),y) + ARCH = aarch64 +endif + +COMPILER_RT_OBJDIR = compiler-rt \ + compiler-rt/compiler-rt \ + compiler-rt/compiler-rt/lib \ + compiler-rt/compiler-rt/lib/builtins \ + compiler-rt/compiler-rt/lib/builtins/$(ARCH) \ + compiler-rt/compiler-rt/lib/profile + +BIN_OBJDIR = $(addprefix $(BINDIR)$(DELIM),$(COMPILER_RT_OBJDIR)) +KBIN_OBJDIR = $(addprefix $(KBINDIR)$(DELIM),$(COMPILER_RT_OBJDIR)) ifeq ($(wildcard compiler-rt/compiler-rt/lib),) + compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz: $(call DOWNLOAD,https://github.com/llvm/llvm-project/releases/download/llvmorg-$(COMPILER_RT_VERSION),$@) @@ -32,164 +51,72 @@ compiler-rt/compiler-rt: compiler-rt-$(COMPILER_RT_VERSION).src.tar.xz $(Q) tar -xf $< $(Q) mv compiler-rt-$(COMPILER_RT_VERSION).src $@ $(call DELDIR, $<) + $(Q) mkdir $(BIN_OBJDIR) $(KBIN_OBJDIR) compiler-rt: compiler-rt/compiler-rt + endif -FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/include -FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins -FLAGS += -Wno-shift-count-negative -Wno-constant-conversion -Wshift-count-overflow -FLAGS += -Wno-undef -Wno-incompatible-pointer-types -Wno-visibility -Wno-macro-redefined +ifeq ($(CONFIG_LIB_COMPILER_RT),y) -################# Builtin Library ################# +.PHONY: compiler-rt +depend:: compiler-rt + +distclean:: + $(call DELDIR, $(BIN_OBJDIR)) + $(call DELDIR, $(KBIN_OBJDIR)) + $(call DELDIR, compiler-rt/compiler-rt) + +FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/include -# Files related to arithmetic operations -CSRCS += absvdi2.c absvsi2.c absvti2.c adddf3.c addtf3.c addvdi3.c addvsi3.c addvti3.c \ - muldc3.c muldf3.c mulodi4.c mulosi4.c muloti4.c mulsc3.c mulsf3.c multc3.c multf3.c \ - multi3.c mulvdi3.c mulvsi3.c mulvti3.c mulxc3.c negdf2.c negdi2.c negsf2.c negti2.c \ - negvdi2.c negvsi2.c negvti2.c subdf3.c subsf3.c subtf3.c subvdi3.c subvsi3.c subvti3.c - -# Floating point processing related files -CSRCS += floatdidf.c floatdisf.c floatditf.c floatdixf.c floatsidf.c floatsisf.c floatsitf.c \ - floattidf.c floattisf.c floattitf.c floattixf.c floatunditf.c \ - floatunsidf.c floatunsisf.c floatunsitf.c floatuntidf.c floatuntisf.c \ - floatuntitf.c floatuntixf.c - -# Convert and expand related files -CSRCS += fixtfdi.c fixtfsi.c fixtfti.c fixunsdfdi.c fixunsdfsi.c fixunsdfti.c fixunssfdi.c \ - fixunssfsi.c fixunssfti.c fixunstfdi.c fixunstfsi.c fixunstfti.c fixunsxfdi.c fixunsxfsi.c \ - fixunsxfti.c fixxfdi.c fixxfti.c extenddftf2.c extendhfsf2.c extendhftf2.c extendsfdf2.c \ - extendsftf2.c truncdfhf2.c truncdfsf2.c truncsfhf2.c \ - trunctfdf2.c trunctfhf2.c trunctfsf2.c - -ifeq ($(CONFIG_COMPILER_RT_HAS_BFLOAT16),y) - CSRCS += truncdfbf2.c truncsfbf2.c endif -# Bit manipulation related files -CSRCS += ashldi3.c ashlti3.c ashrdi3.c ashrti3.c \ - clzti2.c ctzdi2.c ctzsi2.c ctzti2.c lshrdi3.c lshrti3.c popcountdi2.c popcountsi2.c \ - popcountti2.c paritydi2.c paritysi2.c parityti2.c +################# Builtin Library ################# -# Files related to division and modulo operations -CSRCS += divdc3.c divdf3.c divdi3.c divmoddi4.c divmodti4.c divsc3.c divsf3.c \ - divtc3.c divtf3.c divti3.c divxc3.c moddi3.c modti3.c udivdi3.c udivmoddi4.c \ - udivmodti4.c udivti3.c umoddi3.c umodti3.c +ifeq ($(CONFIG_BUILTIN_COMPILER_RT),y) -# Files related to atomic operations -CSRCS += atomic.c atomic_flag_clear.c atomic_flag_clear_explicit.c atomic_flag_test_and_set.c \ - atomic_flag_test_and_set_explicit.c atomic_signal_fence.c atomic_thread_fence.c +FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins +FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins/${ARCH} -# Other function related files -CSRCS += apple_versioning.c clear_cache.c cmpdi2.c cmpti2.c comparedf2.c comparetf2.c \ - cpu_model.c emutls.c enable_execute_stack.c eprintf.c fp_mode.c gcc_personality_v0.c \ - int_util.c os_version_check.c trampoline_setup.c ucmpdi2.c ucmpti2.c powidf2.c powisf2.c \ - powitf2.c powixf2.c +FLAGS += -Wno-undef -Wno-macro-redefined -# Bit manipulation related arch -ifeq ($(CONFIG_ARCH_ARM),y) - ARCH = arm - # Arithmetic Operations - ASRCS += adddf3vfp.S addsf3.S addsf3vfp.S divmodsi4.S divsi3.S modsi3.S subdf3vfp.S subsf3vfp.S \ - muldf3vfp.S mulsf3vfp.S negdf2vfp.S negsf2vfp.S - - # Floating-Point Operations - ASRCS += comparesf2.S eqdf2vfp.S eqsf2vfp.S extendsfdf2vfp.S fixdfsivfp.S fixsfsivfp.S \ - fixunsdfsivfp.S fixunssfsivfp.S floatsidfvfp.S floatsisfvfp.S floatunssidfvfp.S \ - floatunssisfvfp.S gedf2vfp.S gesf2vfp.S gtdf2vfp.S gtsf2vfp.S ledf2vfp.S lesf2vfp.S \ - ltdf2vfp.S ltsf2vfp.S nedf2vfp.S nesf2vfp.S truncdfsf2vfp.S unorddf2vfp.S unordsf2vfp.S - - # Synchronization Operations - ASRCS += sync_fetch_and_add_4.S sync_fetch_and_add_8.S sync_fetch_and_and_4.S sync_fetch_and_and_8.S \ - sync_fetch_and_max_4.S sync_fetch_and_max_8.S sync_fetch_and_min_4.S sync_fetch_and_min_8.S \ - sync_fetch_and_nand_4.S sync_fetch_and_nand_8.S sync_fetch_and_or_4.S sync_fetch_and_or_8.S \ - sync_fetch_and_sub_4.S sync_fetch_and_sub_8.S sync_fetch_and_umax_4.S sync_fetch_and_umax_8.S \ - sync_fetch_and_umin_4.S sync_fetch_and_umin_8.S sync_fetch_and_xor_4.S sync_fetch_and_xor_8.S \ - sync_synchronize.S - # Memory Operations - ASRCS += aeabi_memcmp.S aeabi_memcpy.S aeabi_memmove.S aeabi_memset.S restore_vfp_d8_d15_regs.S \ - save_vfp_d8_d15_regs.S - - # Division and Modulus Operations - ASRCS += aeabi_idivmod.S aeabi_ldivmod.S aeabi_uidivmod.S aeabi_uldivmod.S udivmodsi4.S udivsi3.S umodsi3.S - - # Bitwise and Other Operations - ASRCS += bswapdi2.S bswapsi2.S chkstk.S clzdi2.S clzsi2.S - - # Branch and Control Flow - ASRCS += switch16.S switch32.S switch8.S switchu8.S - - CSRCS += aeabi_cdcmpeq_check_nan.c aeabi_cfcmpeq_check_nan.c aeabi_div0.c aeabi_drsub.c aeabi_frsub.c -else - CSRCS += addsf3.c divsi3.c modsi3.c - CSRCS += bswapdi2.c bswapsi2.c clzdi2.c clzsi2.c - CSRCS += divmodsi4.c udivmodsi4.c udivsi3.c umodsi3.c - CSRCS += comparesf2.c -endif +CSRCS += $(wildcard compiler-rt/compiler-rt/lib/builtins/*.c) +ASRCS += $(wildcard compiler-rt/compiler-rt/lib/builtins/$(ARCH)/*.S) +CSRCS += $(wildcard compiler-rt/compiler-rt/lib/builtins/$(ARCH)/*.c) -ifeq ($(CONFIG_ARCH_ARM64),y) - ARCH = aarch64 - ASRCS += chkstk.S lse.S - CSRCS += fp_mode.c +ifeq ($(CONFIG_LIB_COMPILER_RT_HAS_BFLOAT16),) + BFLOAT16_SRCS := compiler-rt/compiler-rt/lib/builtins/truncdfbf2.c + BFLOAT16_SRCS += compiler-rt/compiler-rt/lib/builtins/truncsfbf2.c + CSRCS := $(filter-out $(BFLOAT16_SRCS), $(CSRCS)) endif -ifeq ($(CONFIG_ARCH_RISCV),y) - ARCH = riscv - ASRCS += muldi3.S mulsi3.S restore.S save.S - CSRCS += fp_mode.c -else - CSRCS += muldi3.c endif -ifeq ($(CONFIG_ARCH_X86_64),y) - ARCH = x86_64 - ASRCS += chkstk2.S chkstk.S floatundidf.S floatundisf.S floatundixf.S - CSRCS += floatdidf.c floatdisf.c floatdixf.c -else - CSRCS += floatundidf.c floatundisf.c floatundixf.c -endif +################# Profile Library ################# -ifeq ($(CONFIG_COMPILER_RT_PROFILE),y) +ifeq ($(CONFIG_COVERAGE_COMPILER_RT),y) -# Include paths FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/profile -# Suppress specific warnings -FLAGS += -Wno-cleardeprecated-pragma -Wno-deprecated-pragma -Wno-incompatible-pointer-types -FLAGS += -Wno-shadow -Wno-strict-prototypes -Wno-undef -Wno-unknown-warning-option - -# Define compiler-specific macros +FLAGS += -fno-profile-instr-generate -fno-coverage-mapping +FLAGS += -Wno-undef -Wno-strict-prototypes -Wno-shadow FLAGS += -DCOMPILER_RT_HAS_UNAME -# Disable code coverage analysis for the library -FLAGS += -fno-profile-generate +CSRCS += $(wildcard compiler-rt/compiler-rt/lib/profile/*.c) +CPPSRCS += $(wildcard compiler-rt/compiler-rt/lib/profile/*.cpp) +CSRCS += InstrProfilingPlatform.c -# Profile support source files -CSRCS += GCDAProfiling.c InstrProfilingBuffer.c InstrProfiling.c InstrProfilingFile.c InstrProfilingInternal.c -CSRCS += InstrProfilingMerge.c InstrProfilingMergeFile.c InstrProfilingNameVar.c -CSRCS += InstrProfilingUtil.c InstrProfilingValue.c InstrProfilingVersionVar.c InstrProfilingWriter.c -CPPSRCS += InstrProfilingRuntime.cpp +else ifeq ($(CONFIG_COVERAGE_MINI),y) -# Profile platform support -CSRCS += InstrProfilingPlatform.c +FLAGS += -fno-profile-instr-generate -fno-coverage-mapping -# Dependency and search paths -DEPPATH += --dep-path compiler-rt/compiler-rt/lib/profile -VPATH += :compiler-rt/compiler-rt/lib/profile +CSRCS += coverage.c endif -FLAGS += ${INCDIR_PREFIX}$(CURDIR)/compiler-rt/compiler-rt/lib/builtins/${ARCH} - AFLAGS += $(FLAGS) CFLAGS += $(FLAGS) CXXFLAGS += $(FLAGS) -DEPPATH += --dep-path compiler-rt/compiler-rt/lib/builtins/${ARCH} -VPATH += :compiler-rt/compiler-rt/lib/builtins/${ARCH} - -DEPPATH += --dep-path compiler-rt/compiler-rt/lib/builtins -VPATH += :compiler-rt/compiler-rt/lib/builtins - DEPPATH += --dep-path compiler-rt VPATH += :compiler-rt diff --git a/libs/libbuiltin/compiler-rt/coverage.c b/libs/libbuiltin/compiler-rt/coverage.c new file mode 100644 index 00000000000..df85b49a0ed --- /dev/null +++ b/libs/libbuiltin/compiler-rt/coverage.c @@ -0,0 +1,326 @@ +/**************************************************************************** + * libs/libbuiltin/compiler-rt/coverage.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define INSTR_PROF_RAW_VERSION 8 +#define INSTR_PROF_RAW_VERSION_VAR __llvm_profile_raw_version +#define INSTR_PROF_PROFILE_RUNTIME_VAR __llvm_profile_runtime + +/* Magic number to detect file format and endianness. + * Use 255 at one end, since no UTF-8 file can use that character. Avoid 0, + * so that utilities, like strings, don't grab it as a string. 129 is also + * invalid UTF-8, and high enough to be interesting. + * Use "lprofr" in the centre to stand for "LLVM Profile Raw", or "lprofR" + * for 32-bit platforms. + */ + +#define INSTR_PROF_RAW_MAGIC_64 \ + (uint64_t)255 << 56 | (uint64_t)'l' << 48 | (uint64_t)'p' << 40 | \ + (uint64_t)'r' << 32 | (uint64_t)'o' << 24 | (uint64_t)'f' << 16 | \ + (uint64_t)'r' << 8 | (uint64_t)129 + +#define INSTR_PROF_RAW_MAGIC_32 \ + (uint64_t)255 << 56 | (uint64_t)'l' << 48 | (uint64_t)'p' << 40 | \ + (uint64_t)'r' << 32 | (uint64_t)'o' << 24 | (uint64_t)'f' << 16 | \ + (uint64_t)'R' << 8 | (uint64_t)129 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +enum value_kind +{ + IPVK_INDIRECT_CALL_TARGET = 0, + IPVK_MEM_OP_SIZE = 1, + IPVK_FIRST = IPVK_INDIRECT_CALL_TARGET, + IPVK_LAST = IPVK_MEM_OP_SIZE, +}; + +typedef struct aligned_data(8) __llvm_profile_data +{ + const uint64_t name_ref; + const uint64_t func_hash; + const intptr_t counter_ptr; + const intptr_t func_ptr; + intptr_t values; + const uint32_t num_counters; + const uint16_t num_value_sites[IPVK_LAST + 1]; +}__llvm_profile_data; + +typedef struct __llvm_profile_header +{ + uint64_t magic; + uint64_t version; + uint64_t binary_ids_size; + uint64_t data_size; + uint64_t padding_bytes_before_counters; + uint64_t counters_size; + uint64_t padding_bytes_after_counters; + uint64_t names_size; + uint64_t counters_delta; + uint64_t names_delta; + enum value_kind value_kind_last; +}__llvm_profile_header; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static uint64_t INSTR_PROF_RAW_VERSION_VAR = INSTR_PROF_RAW_VERSION; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/* Record where the data is in memory. Within each of the types of data, + * it's stored consecutively. + */ + +extern char __start__llvm_prf_names[]; +extern char __end__llvm_prf_names[]; +extern char __start__llvm_prf_data[]; +extern char __end__llvm_prf_data[]; +extern char __start__llvm_prf_cnts[]; +extern char __end__llvm_prf_cnts[]; + +int INSTR_PROF_PROFILE_RUNTIME_VAR; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static size_t __llvm_profile_counter_entry_size(void) +{ + return sizeof(uint64_t); +} + +static uint64_t __llvm_profile_get_magic(void) +{ + return sizeof(void *) == sizeof(uint64_t) ? (INSTR_PROF_RAW_MAGIC_64) + : (INSTR_PROF_RAW_MAGIC_32); +} + +static uint64_t __llvm_profile_get_version(void) +{ + return __llvm_profile_raw_version; +} + +static uint64_t __llvm_profile_get_num_counters(const char *begin, + const char *end) +{ + return (((intptr_t)end + __llvm_profile_counter_entry_size() - 1) - + (intptr_t)begin) / __llvm_profile_counter_entry_size(); +} + +static int __llvm_write_binary_ids(void) +{ + return 0; +} + +static const __llvm_profile_data *__llvm_profile_begin_data(void) +{ + return (const __llvm_profile_data *)__start__llvm_prf_data; +} + +static const __llvm_profile_data *__llvm_profile_end_data(void) +{ + return (const __llvm_profile_data *)__end__llvm_prf_data; +} + +static const char *__llvm_profile_begin_names(void) +{ + return (const char *)__start__llvm_prf_names; +} + +static const char *__llvm_profile_end_names(void) +{ + return (const char *)__end__llvm_prf_names; +} + +static char *__llvm_profile_begin_counters(void) +{ + return (char *)__start__llvm_prf_cnts; +} + +static char *__llvm_profile_end_counters(void) +{ + return (char *)__end__llvm_prf_cnts; +} + +static uint64_t __llvm_profile_get_num_padding_bytes(uint64_t size) +{ + return 7 & (sizeof(uint64_t) - size % sizeof(uint64_t)); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +uint64_t __llvm_profile_get_num_data(const __llvm_profile_data *begin, + const __llvm_profile_data *end) +{ + return (((intptr_t)end + sizeof(__llvm_profile_data) - 1) - + (intptr_t)begin) / sizeof(__llvm_profile_data); +} + +/* Given a pointer to the __llvm_profile_data for the function, record the + * bounds of the profile data and profile count sections. + * This function is called several time by the __llvm_profile_init function + * at program start. + * + * If this function is called we register __llvm_profile_dump() with + * atexit to write out the profile information to file. + */ + +void __llvm_profile_register_function(void *data_) +{ + (void)data_; +} + +void __llvm_profile_register_names_function(void *names_start, + uint64_t names_size) +{ + (void)names_start; + (void)names_size; +} + +/* Called by an atexit handler. Writes a file called default.profraw + * containing the profile data. This needs to be merged by + * llvm-prof. See the clang profiling documentation for details. + */ + +void __llvm_profile_dump(const char *path) +{ + int fd; + int ret; + + /* Header: __llvm_profile_header from InstrProfData.inc */ + + const char *filename = path; + + /* Calculate size of sections. */ + + const __llvm_profile_data *data_begin = __llvm_profile_begin_data(); + const __llvm_profile_data *data_end = __llvm_profile_end_data(); + const uint64_t num_data = + __llvm_profile_get_num_data(data_begin, data_end); + + const char *counters_begin = __llvm_profile_begin_counters(); + const char *counters_end = __llvm_profile_end_counters(); + const uint64_t num_counters = + __llvm_profile_get_num_counters(counters_begin, counters_end); + + const char *names_begin = __llvm_profile_begin_names(); + const char *names_end = __llvm_profile_end_names(); + const uint64_t names_size = (names_end - names_begin) * sizeof(char); + + uint64_t padding_bytes_after_names = + __llvm_profile_get_num_padding_bytes(names_size); + + __llvm_profile_header hdr; + hdr.magic = __llvm_profile_get_magic(); + hdr.version = __llvm_profile_get_version(); + hdr.binary_ids_size = __llvm_write_binary_ids(); + hdr.data_size = num_data; + hdr.padding_bytes_before_counters = 0; + hdr.counters_size = num_counters; + hdr.padding_bytes_after_counters = 0; + hdr.names_size = names_size; + hdr.counters_delta = (uintptr_t)counters_begin - (uintptr_t)data_begin; + hdr.names_delta = (uintptr_t)names_begin; + hdr.value_kind_last = IPVK_LAST; + + fd = _NX_OPEN(filename, O_WRONLY | O_CREAT); + if (fd < 0) + { + _NX_SETERRNO(fd); + return; + } + + /* Header */ + + ret = _NX_WRITE(fd, &hdr, sizeof(hdr)); + if (ret != sizeof(hdr)) + { + _NX_SETERRNO(ret); + goto exit; + } + + /* Data */ + + ret = _NX_WRITE(fd, data_begin, sizeof(__llvm_profile_data) * num_data); + if (ret != sizeof(__llvm_profile_data) * num_data) + { + _NX_SETERRNO(ret); + goto exit; + } + + /* Counters */ + + ret = _NX_WRITE(fd, counters_begin, sizeof(uint64_t) * num_counters); + if (ret != sizeof(uint64_t) * num_counters) + { + _NX_SETERRNO(ret); + goto exit; + } + + /* Names */ + + ret = _NX_WRITE(fd, names_begin, names_size); + if (ret != names_size) + { + _NX_SETERRNO(ret); + goto exit; + } + + /* Padding */ + + for (; padding_bytes_after_names != 0; --padding_bytes_after_names) + { + ret = _NX_WRITE(fd, "\0", 1); + if (ret != 1) + { + _NX_SETERRNO(ret); + break; + } + } + +exit: + _NX_CLOSE(fd); +} diff --git a/libs/libbuiltin/kbin/Makefile b/libs/libbuiltin/kbin/Makefile deleted file mode 100644 index 2703454c79e..00000000000 --- a/libs/libbuiltin/kbin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# libs/libbuiltin/kbin/Makefile -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call DELFILE, *.o) - -# Deep clean -- removes all traces of the configuration - -distclean: clean - $(call DELFILE, *.dep) - $(call DELFILE, .depend) diff --git a/libs/libnx/bin/CMakeLists.txt b/libs/libbuiltin/libgcc/CMakeLists.txt similarity index 86% rename from libs/libnx/bin/CMakeLists.txt rename to libs/libbuiltin/libgcc/CMakeLists.txt index 7fafff5924f..ad5624c4f4b 100644 --- a/libs/libnx/bin/CMakeLists.txt +++ b/libs/libbuiltin/libgcc/CMakeLists.txt @@ -1,7 +1,5 @@ # ############################################################################## -# libs/libnx/bin/CMakeLists.txt -# -# SPDX-License-Identifier: Apache-2.0 +# libs/libbuiltin/libgcc/CMakeLists.txt # # Licensed to the Apache Software Foundation (ASF) under one or more contributor # license agreements. See the NOTICE file distributed with this work for @@ -20,3 +18,7 @@ # # ############################################################################## +if(CONFIG_PROFILE_MINI) + nuttx_add_system_library(libgprof) + target_sources(libgprof PRIVATE profile.c) +endif() diff --git a/mm/kbin/CMakeLists.txt b/libs/libbuiltin/libgcc/Make.defs similarity index 85% rename from mm/kbin/CMakeLists.txt rename to libs/libbuiltin/libgcc/Make.defs index 7cec6898a67..6d1a9260831 100644 --- a/mm/kbin/CMakeLists.txt +++ b/libs/libbuiltin/libgcc/Make.defs @@ -1,7 +1,5 @@ ############################################################################ -# mm/kbin/CMakeLists.txt -# -# SPDX-License-Identifier: Apache-2.0 +# libs/libbuiltin/libgcc/Make.defs # # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with @@ -18,5 +16,13 @@ # License for the specific language governing permissions and limitations # under the License. # -########################################################################### +############################################################################ + +ifeq ($(CONFIG_PROFILE_MINI),y) + +CSRCS += profile.c + +DEPPATH += --dep-path libgcc +VPATH += :libgcc +endif diff --git a/sched/instrument/profile_monitor.c b/libs/libbuiltin/libgcc/profile.c similarity index 99% rename from sched/instrument/profile_monitor.c rename to libs/libbuiltin/libgcc/profile.c index 2c98c6b81c7..5d2e82750cc 100644 --- a/sched/instrument/profile_monitor.c +++ b/libs/libbuiltin/libgcc/profile.c @@ -1,5 +1,5 @@ /**************************************************************************** - * sched/instrument/profile_monitor.c + * libs/libbuiltin/libgcc/profile.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/libs/libc/Makefile b/libs/libc/Makefile index e07442cbb04..fb0f2d79f12 100644 --- a/libs/libc/Makefile +++ b/libs/libc/Makefile @@ -173,7 +173,13 @@ endif # Context -context:: +bin: + $(Q) mkdir $@ + +kbin: + $(Q) mkdir $@ + +context:: bin kbin ifeq ($(CONFIG_LIBC_ZONEINFO_ROMFS),y) $(Q) $(MAKE) -C zoneinfo context BIN=$(BIN) endif @@ -203,8 +209,6 @@ depend:: .depend # Clean most derived files, retaining the configuration clean:: - $(Q) $(MAKE) -C bin clean - $(Q) $(MAKE) -C kbin clean $(Q) $(MAKE) -C zoneinfo clean BIN=$(BIN) $(call DELFILE, $(BIN)) $(call DELFILE, $(KBIN)) @@ -213,13 +217,11 @@ clean:: # Deep clean -- removes all traces of the configuration distclean:: clean - $(Q) $(MAKE) -C bin distclean - $(Q) $(MAKE) -C kbin distclean $(Q) $(MAKE) -C zoneinfo distclean BIN=$(BIN) $(call DELFILE, exec_symtab.c) - $(call DELFILE, bin$(DELIM)Make.dep) - $(call DELFILE, kbin$(DELIM)Make.dep) $(call DELFILE, .depend) + $(call DELDIR, bin) + $(call DELDIR, kbin) -include bin$(DELIM)Make.dep -include kbin$(DELIM)Make.dep diff --git a/libs/libc/gdbstub/lib_gdbstub.c b/libs/libc/gdbstub/lib_gdbstub.c index 45660591f5c..ace13079380 100644 --- a/libs/libc/gdbstub/lib_gdbstub.c +++ b/libs/libc/gdbstub/lib_gdbstub.c @@ -1039,7 +1039,7 @@ static void gdb_get_registers(FAR struct gdb_state_s *state) { if (up_interrupt_context()) { - reg = (FAR uint8_t *)up_current_regs(); + reg = (FAR uint8_t *)running_regs(); } else { @@ -1897,7 +1897,7 @@ int gdb_debugpoint_remove(int type, FAR void *addr, size_t size) point.addr = addr; point.size = size; - retrun nxsched_smp_call((1 << CONFIG_SMP_NCPUS) - 1, + return nxsched_smp_call((1 << CONFIG_SMP_NCPUS) - 1, gdb_smp_debugpoint_remove, &point); #else return up_debugpoint_remove(type, addr, size); diff --git a/libs/libc/gnssutils/Kconfig b/libs/libc/gnssutils/Kconfig index 5dde471e758..2b825c2108a 100644 --- a/libs/libc/gnssutils/Kconfig +++ b/libs/libc/gnssutils/Kconfig @@ -12,3 +12,15 @@ config GNSSUTILS_MINMEA_LIB NOTE: This library depends on having some version of math.h at include/nuttx. There are some different ways to accomplish this. See the discussion in the top-level nuttx/README.txt file. + +if GNSSUTILS_MINMEA_LIB + +config GNSSUTILS_MINMEA_VERSION_4_10 + bool "MINMEAD NMEA version 4.10" + default n + ---help--- + Enable support for nmea version 4.10. + NOTE: This library depends on gps gnssutils/minmea. + Open when get nmea data with version 4.10 + +endif diff --git a/libs/libc/hex2bin/lib_hex2bin.c b/libs/libc/hex2bin/lib_hex2bin.c index 1494d18ba8b..1774a741020 100644 --- a/libs/libc/hex2bin/lib_hex2bin.c +++ b/libs/libc/hex2bin/lib_hex2bin.c @@ -250,21 +250,21 @@ static int readstream(FAR struct lib_instream_s *instream, /* Skip until the beginning of line start code is encountered */ ch = lib_stream_getc(instream); - while (ch != RECORD_STARTCODE && ch != EOF) + while (ch != RECORD_STARTCODE && !lib_stream_eof(ch)) { ch = lib_stream_getc(instream); } /* Skip over the startcode */ - if (ch != EOF) + if (!lib_stream_eof(ch)) { ch = lib_stream_getc(instream); } /* Then read, verify, and buffer until the end of line is encountered */ - while (ch != EOF && nbytes < (MAXRECORD_ASCSIZE - 1)) + while (!lib_stream_eof(ch) && nbytes < (MAXRECORD_ASCSIZE - 1)) { if (ch == '\n' || ch == '\r') { diff --git a/libs/libc/kbin/Makefile b/libs/libc/kbin/Makefile deleted file mode 100644 index 90cb1895b9d..00000000000 --- a/libs/libc/kbin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# libs/libc/kbin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean diff --git a/libs/libc/libc.csv b/libs/libc/libc.csv index 49865e8ff15..6142df6037c 100644 --- a/libs/libc/libc.csv +++ b/libs/libc/libc.csv @@ -97,6 +97,7 @@ "getaddrinfo","netdb.h","defined(CONFIG_LIBC_NETDB)","int","FAR const char *","FAR const char *","FAR const struct addrinfo *","FAR struct addrinfo **" "getc","stdio.h","","int","FAR FILE *" "getcwd","unistd.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char *","FAR char *","size_t" +"get_current_dir_name","unistd.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char *","void" "getegid","unistd.h","","gid_t" "geteuid","unistd.h","","uid_t" "gethostbyname","netdb.h","defined(CONFIG_LIBC_NETDB)","FAR struct hostent *","FAR const char *" diff --git a/libs/libc/machine/CMakeLists.txt b/libs/libc/machine/CMakeLists.txt index 1518564e766..5f4869dc7d6 100644 --- a/libs/libc/machine/CMakeLists.txt +++ b/libs/libc/machine/CMakeLists.txt @@ -22,9 +22,7 @@ add_subdirectory(${CONFIG_ARCH}) -if(CONFIG_LIBC_ARCH_ATOMIC) - target_sources(c PRIVATE arch_atomic.c) -endif() +target_sources(c PRIVATE arch_atomic.c) if(CONFIG_MM_KASAN) target_sources(c PRIVATE arch_libc.c) diff --git a/libs/libc/machine/arm/CMakeLists.txt b/libs/libc/machine/arm/CMakeLists.txt index 387be1d42c6..560c77d4c96 100644 --- a/libs/libc/machine/arm/CMakeLists.txt +++ b/libs/libc/machine/arm/CMakeLists.txt @@ -62,7 +62,7 @@ if(CONFIG_ARCH_SETJMP_H) endif() endif() -if(CONFIG_SCHED_GPROF) +if(CONFIG_PROFILE_MINI) list(APPEND SRCS gnu/mcount.S) endif() diff --git a/libs/libc/machine/arm/Make.defs b/libs/libc/machine/arm/Make.defs index 63a319eb4a3..c17428d1c23 100644 --- a/libs/libc/machine/arm/Make.defs +++ b/libs/libc/machine/arm/Make.defs @@ -60,7 +60,7 @@ ASRCS += arch_setjmp.S endif endif -ifeq ($(CONFIG_SCHED_GPROF),y) +ifeq ($(CONFIG_PROFILE_MINI),y) ASRCS += mcount.S endif diff --git a/libs/libc/misc/lib_kbddecode.c b/libs/libc/misc/lib_kbddecode.c index b743a55f1aa..8830fc1d18a 100644 --- a/libs/libc/misc/lib_kbddecode.c +++ b/libs/libc/misc/lib_kbddecode.c @@ -142,7 +142,7 @@ int kbd_decode(FAR struct lib_instream_s *stream, /* No, ungotten characters. Check for the beginning of an ESC sequence. */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream */ @@ -166,7 +166,7 @@ int kbd_decode(FAR struct lib_instream_s *stream, /* Check for ESC-[ */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream. Return the escape character now. We will * return the EOF indication next time. @@ -192,7 +192,7 @@ int kbd_decode(FAR struct lib_instream_s *stream, /* Get and verify the special keyboard data to decode */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream. Unget everything and return the ESC character. */ @@ -219,7 +219,7 @@ int kbd_decode(FAR struct lib_instream_s *stream, /* Check for the final semicolon */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream. Unget everything and return the ESC character. */ diff --git a/libs/libc/misc/lib_pathbuffer.c b/libs/libc/misc/lib_pathbuffer.c index 834b48901f7..3928130dc8b 100644 --- a/libs/libc/misc/lib_pathbuffer.c +++ b/libs/libc/misc/lib_pathbuffer.c @@ -25,7 +25,7 @@ ****************************************************************************/ #include -#include +#include #include #include @@ -41,8 +41,8 @@ struct pathbuffer_s { - mutex_t lock; /* Lock for the buffer */ - unsigned int free_bitmap; /* Bitmap of free buffer */ + spinlock_t lock; /* Lock for the buffer */ + unsigned long free_bitmap; /* Bitmap of free buffer */ char buffer[CONFIG_LIBC_MAX_PATHBUFFER][PATH_MAX]; }; @@ -52,7 +52,7 @@ struct pathbuffer_s static struct pathbuffer_s g_pathbuffer = { - NXMUTEX_INITIALIZER, + SP_UNLOCKED, (1u << CONFIG_LIBC_MAX_PATHBUFFER) - 1, }; @@ -82,20 +82,21 @@ static struct pathbuffer_s g_pathbuffer = FAR char *lib_get_pathbuffer(void) { + irqstate_t flags; int index; /* Try to find a free buffer */ - nxmutex_lock(&g_pathbuffer.lock); - index = ffs(g_pathbuffer.free_bitmap) - 1; + flags = spin_lock_irqsave(&g_pathbuffer.lock); + index = ffsl(g_pathbuffer.free_bitmap) - 1; if (index >= 0 && index < CONFIG_LIBC_MAX_PATHBUFFER) { g_pathbuffer.free_bitmap &= ~(1u << index); - nxmutex_unlock(&g_pathbuffer.lock); + spin_unlock_irqrestore(&g_pathbuffer.lock, flags); return g_pathbuffer.buffer[index]; } - nxmutex_unlock(&g_pathbuffer.lock); + spin_unlock_irqrestore(&g_pathbuffer.lock, flags); /* If no free buffer is found, allocate a new one if * CONFIG_LIBC_PATHBUFFER_MALLOC is enabled @@ -124,22 +125,20 @@ FAR char *lib_get_pathbuffer(void) void lib_put_pathbuffer(FAR char *buffer) { + irqstate_t flags; int index; - nxmutex_lock(&g_pathbuffer.lock); index = (buffer - &g_pathbuffer.buffer[0][0]) / PATH_MAX; - if (index >= 0 && index < CONFIG_LIBC_MAX_PATHBUFFER) { /* Mark the corresponding bit as free */ + flags = spin_lock_irqsave(&g_pathbuffer.lock); g_pathbuffer.free_bitmap |= 1u << index; - nxmutex_unlock(&g_pathbuffer.lock); + spin_unlock_irqrestore(&g_pathbuffer.lock, flags); return; } - nxmutex_unlock(&g_pathbuffer.lock); - /* Free the buffer if it was dynamically allocated */ #ifdef CONFIG_LIBC_PATHBUFFER_MALLOC diff --git a/libs/libc/misc/lib_slcddecode.c b/libs/libc/misc/lib_slcddecode.c index 9d29ee438ac..3e93850955c 100644 --- a/libs/libc/misc/lib_slcddecode.c +++ b/libs/libc/misc/lib_slcddecode.c @@ -180,7 +180,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream, /* No, ungotten characters. Get the next character from the buffer. */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream (or perhaps an I/O error) */ @@ -204,7 +204,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream, /* Get the next character from the buffer */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream. Return the escape character now. We will * return the EOF indication next time. @@ -233,7 +233,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream, /* Get the next character from the buffer */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream. Return the ESC now; return the following * characters later. @@ -281,7 +281,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream, /* Get the next character from the buffer */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream. Return the ESC now; return the following * characters later. @@ -314,7 +314,7 @@ enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream, /* Get the next character from the buffer */ ch = lib_stream_getc(stream); - if (ch == EOF) + if (lib_stream_eof(ch)) { /* End of file/stream. Return the ESC now; return the following * characters later. diff --git a/libs/libc/modlib/gnu-elf.ld b/libs/libc/modlib/gnu-elf.ld index 357d7356f18..bd5733f335a 100644 --- a/libs/libc/modlib/gnu-elf.ld +++ b/libs/libc/modlib/gnu-elf.ld @@ -36,13 +36,16 @@ SECTIONS .init_array : { _sinit = .; - *(.init_array) + KEEP(*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) + KEEP(*(.init_array .ctors)) _einit = .; } .fini_array : { - *(.fini_array) + KEEP (*(.dtors)) + KEEP (*(.fini_array)) + KEEP (*(SORT(.fini_array.*))) } .rodata : diff --git a/libs/libc/netdb/lib_dnsaddserver.c b/libs/libc/netdb/lib_dnsaddserver.c index b32d17ad4d4..4827ac0aa03 100644 --- a/libs/libc/netdb/lib_dnsaddserver.c +++ b/libs/libc/netdb/lib_dnsaddserver.c @@ -227,7 +227,9 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen) ret = OK; } - goto errout; + dns_unlock(); + fclose(stream); + return ret; } #if CONFIG_NETDB_DNSSERVER_NAMESERVERS > 1 diff --git a/libs/libc/obstack/lib_obstack_vprintf.c b/libs/libc/obstack/lib_obstack_vprintf.c index bedc3051d1b..9dec3c673a5 100644 --- a/libs/libc/obstack/lib_obstack_vprintf.c +++ b/libs/libc/obstack/lib_obstack_vprintf.c @@ -42,8 +42,8 @@ struct obstack_stream * Private Functions ****************************************************************************/ -static int obstack_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t obstack_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct obstack_stream *stream = (FAR struct obstack_stream *)self; diff --git a/libs/libc/pthread/pthread_barrierinit.c b/libs/libc/pthread/pthread_barrierinit.c index 5ff90ed72ec..739ccc6cb1c 100644 --- a/libs/libc/pthread/pthread_barrierinit.c +++ b/libs/libc/pthread/pthread_barrierinit.c @@ -87,6 +87,8 @@ int pthread_barrier_init(FAR pthread_barrier_t *barrier, { sem_init(&barrier->sem, 0, 0); barrier->count = count; + barrier->wait_count = 0; + nxmutex_init(&barrier->mutex); } return ret; diff --git a/libs/libc/pthread/pthread_condinit.c b/libs/libc/pthread/pthread_condinit.c index d4f133b948d..c174f98bb6e 100644 --- a/libs/libc/pthread/pthread_condinit.c +++ b/libs/libc/pthread/pthread_condinit.c @@ -74,6 +74,7 @@ int pthread_cond_init(FAR pthread_cond_t *cond, else { cond->clockid = attr ? attr->clockid : CLOCK_REALTIME; + cond->wait_count = 0; } sinfo("Returning %d\n", ret); diff --git a/libs/libc/stdio/lib_libvscanf.c b/libs/libc/stdio/lib_libvscanf.c index f232ab042de..8acbaa13f81 100644 --- a/libs/libc/stdio/lib_libvscanf.c +++ b/libs/libc/stdio/lib_libvscanf.c @@ -1149,7 +1149,7 @@ static int vscanf_internal(FAR struct lib_instream_s *stream, FAR int *lastc, { size_t nchars = (size_t) (stream->nget - ngetstart); - if (c != EOF) + if (!lib_stream_eof(c)) { /* One more character already read */ diff --git a/libs/libc/stdio/lib_vsscanf.c b/libs/libc/stdio/lib_vsscanf.c index 8a35242fc4a..516c5db2da8 100644 --- a/libs/libc/stdio/lib_vsscanf.c +++ b/libs/libc/stdio/lib_vsscanf.c @@ -41,7 +41,7 @@ int vsscanf(FAR const char *buf, FAR const IPTR char *fmt, va_list ap) /* Initialize a memory stream to freadm from the buffer */ - lib_meminstream(&meminstream, buf, INT_MAX); + lib_meminstream(&meminstream, buf, strlen(buf)); /* Then let lib_vscanf do the real work */ diff --git a/libs/libc/stream/lib_base64outstream.c b/libs/libc/stream/lib_base64outstream.c index a273195024d..27c4461e5f4 100644 --- a/libs/libc/stream/lib_base64outstream.c +++ b/libs/libc/stream/lib_base64outstream.c @@ -82,18 +82,18 @@ static void base64stream_putc(FAR struct lib_outstream_s *self, int ch) * Name: base64stream_puts ****************************************************************************/ -static int base64stream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t base64stream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_base64outstream_s *stream = (FAR void *)self; FAR const unsigned char *input = (FAR const unsigned char *)buf; - int remaining = len; + size_t remaining = len; if (stream->nbytes) { /* Flush the first three bytes */ - int n = 3 - stream->nbytes; + size_t n = 3 - stream->nbytes; if (n > remaining) { n = remaining; @@ -118,8 +118,9 @@ static int base64stream_puts(FAR struct lib_outstream_s *self, while (remaining >= 3) { - int outlen; - int n = (STREAM_BASE64_BUFFER_SIZE - stream->pending) / 4 * 3; + size_t outlen; + size_t n = (STREAM_BASE64_BUFFER_SIZE - stream->pending) / 4 * 3; + if (n > remaining) { n = remaining / 3 * 3; diff --git a/libs/libc/stream/lib_blkoutstream.c b/libs/libc/stream/lib_blkoutstream.c index 14be9be081c..7ee0e793f1a 100644 --- a/libs/libc/stream/lib_blkoutstream.c +++ b/libs/libc/stream/lib_blkoutstream.c @@ -45,7 +45,7 @@ * Name: blkoutstream_flush ****************************************************************************/ -static int blkoutstream_flush(FAR struct lib_outstream_s *self) +static int blkoutstream_flush(FAR struct lib_sostream_s *self) { FAR struct lib_blkoutstream_s *stream = (FAR struct lib_blkoutstream_s *)self; @@ -61,12 +61,82 @@ static int blkoutstream_flush(FAR struct lib_outstream_s *self) return ret; } +/**************************************************************************** + * Name: blkoutstream_seek + ****************************************************************************/ + +static off_t blkoutstream_seek(FAR struct lib_sostream_s *self, + off_t offset, int whence) +{ + FAR struct lib_blkoutstream_s *stream = + (FAR struct lib_blkoutstream_s *)self; + size_t sectorsize = stream->geo.geo_sectorsize; + off_t streamsize = sectorsize * stream->geo.geo_nsectors; + FAR struct inode *inode = stream->inode; + off_t sector; + off_t ret; + + switch (whence) + { + case SEEK_SET: + break; + case SEEK_END: + offset += streamsize; + break; + case SEEK_CUR: + offset += self->nput; + break; + default: + return -ENOTSUP; + } + + /* Seek to negative value or value larger than maximum size shall fail. */ + + if (offset < 0 || offset > streamsize) + { + return -EINVAL; + } + + if (self->nput % sectorsize) + { + sector = self->nput / sectorsize; + if (offset >= sector * sectorsize && + offset < (sector + 1) * sectorsize) + { + /* Inside same sector */ + + goto out; + } + + ret = inode->u.i_bops->write(stream->inode, stream->cache, + sector, 1); + if (ret < 0) + { + return ret; + } + } + + if (offset % sectorsize) + { + ret = inode->u.i_bops->read(inode, stream->cache, + offset / sectorsize, 1); + if (ret < 0) + { + return ret; + } + } + +out: + self->nput = offset; + return offset; +} + /**************************************************************************** * Name: blkoutstream_puts ****************************************************************************/ -static int blkoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t blkoutstream_puts(FAR struct lib_sostream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_blkoutstream_s *stream = (FAR struct lib_blkoutstream_s *)self; @@ -74,12 +144,12 @@ static int blkoutstream_puts(FAR struct lib_outstream_s *self, FAR struct inode *inode = stream->inode; FAR const unsigned char *ptr = buf; size_t remain = len; - int ret; + ssize_t ret; while (remain > 0) { - size_t sblock = self->nput / sectorsize; - size_t offset = self->nput % sectorsize; + off_t sector = self->nput / sectorsize; + off_t offset = self->nput % sectorsize; if (offset > 0) { @@ -93,28 +163,35 @@ static int blkoutstream_puts(FAR struct lib_outstream_s *self, self->nput += copyin; remain -= copyin; - if (offset == stream->geo.geo_sectorsize) + if (offset == sectorsize) { - ret = inode->u.i_bops->write(inode, stream->cache, sblock, 1); + ret = inode->u.i_bops->write(inode, stream->cache, sector, 1); if (ret < 0) { return ret; } } } - else if (remain < stream->geo.geo_sectorsize) + else if (remain < sectorsize) { + /* Read sector back to keep as more as possible old data */ + + ret = inode->u.i_bops->read(inode, stream->cache, sector, 1); + if (ret < 0) + { + return ret; + } + memcpy(stream->cache, ptr, remain); self->nput += remain; remain = 0; } - else if (remain >= stream->geo.geo_sectorsize) + else { - size_t copyin = (remain / stream->geo.geo_sectorsize) * - stream->geo.geo_sectorsize; + size_t nsector = remain / sectorsize; + size_t copyin = nsector * sectorsize; - ret = inode->u.i_bops->write(inode, ptr, sblock, - remain / stream->geo.geo_sectorsize); + ret = inode->u.i_bops->write(inode, ptr, sector, nsector); if (ret < 0) { return ret; @@ -133,7 +210,7 @@ static int blkoutstream_puts(FAR struct lib_outstream_s *self, * Name: blkoutstream_putc ****************************************************************************/ -static void blkoutstream_putc(FAR struct lib_outstream_s *self, int ch) +static void blkoutstream_putc(FAR struct lib_sostream_s *self, int ch) { char tmp = ch; blkoutstream_puts(self, &tmp, 1); @@ -170,6 +247,7 @@ void lib_blkoutstream_close(FAR struct lib_blkoutstream_s *stream) if (stream->cache != NULL) { + blkoutstream_flush(&stream->common); lib_free(stream->cache); stream->cache = NULL; } @@ -232,6 +310,7 @@ int lib_blkoutstream_open(FAR struct lib_blkoutstream_s *stream, stream->common.putc = blkoutstream_putc; stream->common.puts = blkoutstream_puts; stream->common.flush = blkoutstream_flush; + stream->common.seek = blkoutstream_seek; return OK; } diff --git a/libs/libc/stream/lib_bufferedoutstream.c b/libs/libc/stream/lib_bufferedoutstream.c index ae9c9f5443e..25b54908415 100644 --- a/libs/libc/stream/lib_bufferedoutstream.c +++ b/libs/libc/stream/lib_bufferedoutstream.c @@ -63,12 +63,12 @@ static int bufferedoutstream_flush(FAR struct lib_outstream_s *self) * Name: bufferedoutstream_puts ****************************************************************************/ -static int bufferedoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t bufferedoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_bufferedoutstream_s *stream = (FAR struct lib_bufferedoutstream_s *)self; - int ret = len; + size_t ret = len; if (stream->pending + len <= CONFIG_STREAM_OUT_BUFFER_SIZE) { diff --git a/libs/libc/stream/lib_fileoutstream.c b/libs/libc/stream/lib_fileoutstream.c index d3ffe6a300b..21ffe4e460a 100644 --- a/libs/libc/stream/lib_fileoutstream.c +++ b/libs/libc/stream/lib_fileoutstream.c @@ -42,12 +42,12 @@ * Name: rawoutstream_puts ****************************************************************************/ -static int fileoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t fileoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_fileoutstream_s *stream = (FAR struct lib_fileoutstream_s *)self; - int nwritten; + ssize_t nwritten; do { diff --git a/libs/libc/stream/lib_hexdumpstream.c b/libs/libc/stream/lib_hexdumpstream.c index 3e42c91f880..4e7231d67c2 100644 --- a/libs/libc/stream/lib_hexdumpstream.c +++ b/libs/libc/stream/lib_hexdumpstream.c @@ -100,7 +100,7 @@ static int hexdumpstream_flush(FAR struct lib_outstream_s *self) static void hexdumpstream_putc(FAR struct lib_outstream_s *self, int ch) { FAR struct lib_hexdumpstream_s *stream = (FAR void *)self; - int outlen = CONFIG_STREAM_HEXDUMP_BUFFER_SIZE; + size_t outlen = CONFIG_STREAM_HEXDUMP_BUFFER_SIZE; const uint8_t byte = ch; bin2hex(&byte, 1, stream->buffer + stream->pending, @@ -120,15 +120,15 @@ static void hexdumpstream_putc(FAR struct lib_outstream_s *self, int ch) * Name: hexdumpstream_puts ****************************************************************************/ -static int hexdumpstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t hexdumpstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_hexdumpstream_s *stream = (FAR void *)self; const unsigned char *p = buf; - int outlen = CONFIG_STREAM_HEXDUMP_BUFFER_SIZE; - int line = outlen / 2; - int remain = len; - int ret; + size_t outlen = CONFIG_STREAM_HEXDUMP_BUFFER_SIZE; + size_t line = outlen / 2; + size_t remain = len; + ssize_t ret; while (remain > 0) { diff --git a/libs/libc/stream/lib_lowoutstream.c b/libs/libc/stream/lib_lowoutstream.c index 4a778c75b43..82d67734f6a 100644 --- a/libs/libc/stream/lib_lowoutstream.c +++ b/libs/libc/stream/lib_lowoutstream.c @@ -40,8 +40,8 @@ ****************************************************************************/ static void lowoutstream_putc(FAR struct lib_outstream_s *self, int ch); -static int lowoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len); +static ssize_t lowoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len); /**************************************************************************** * Public Data @@ -79,8 +79,8 @@ static void lowoutstream_putc(FAR struct lib_outstream_s *self, int ch) * Name: lowoutstream_puts ****************************************************************************/ -static int lowoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t lowoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { DEBUGASSERT(self); diff --git a/libs/libc/stream/lib_lzfcompress.c b/libs/libc/stream/lib_lzfcompress.c index a26bfa1b278..ad64dc8e4ea 100644 --- a/libs/libc/stream/lib_lzfcompress.c +++ b/libs/libc/stream/lib_lzfcompress.c @@ -64,8 +64,8 @@ static int lzfoutstream_flush(FAR struct lib_outstream_s *self) * Name: lzfoutstream_puts ****************************************************************************/ -static int lzfoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t lzfoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_lzfoutstream_s *stream = (FAR struct lib_lzfoutstream_s *)self; @@ -74,7 +74,7 @@ static int lzfoutstream_puts(FAR struct lib_outstream_s *self, size_t total = len; size_t copyin; size_t outlen; - int ret; + ssize_t ret; while (total > 0) { diff --git a/libs/libc/stream/lib_meminstream.c b/libs/libc/stream/lib_meminstream.c index c4b05767ed0..6a9f6c4968a 100644 --- a/libs/libc/stream/lib_meminstream.c +++ b/libs/libc/stream/lib_meminstream.c @@ -25,6 +25,7 @@ ****************************************************************************/ #include +#include #include #include "libc.h" @@ -41,7 +42,7 @@ static int meminstream_getc(FAR struct lib_instream_s *self) { FAR struct lib_meminstream_s *stream = (FAR struct lib_meminstream_s *)self; - int ret; + int ret = -EINVAL; DEBUGASSERT(self); @@ -52,10 +53,6 @@ static int meminstream_getc(FAR struct lib_instream_s *self) ret = stream->buffer[self->nget]; self->nget++; } - else - { - ret = EOF; - } return ret; } @@ -64,12 +61,12 @@ static int meminstream_getc(FAR struct lib_instream_s *self) * Name: meminstream_gets ****************************************************************************/ -static int meminstream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t meminstream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { FAR struct lib_meminstream_s *stream = (FAR struct lib_meminstream_s *)self; - int ret; + ssize_t ret = -EINVAL; DEBUGASSERT(self); @@ -82,10 +79,6 @@ static int meminstream_gets(FAR struct lib_instream_s *self, self->nget += ret; memcpy(buffer, stream->buffer, ret); } - else - { - ret = EOF; - } return ret; } @@ -112,7 +105,7 @@ static int meminstream_gets(FAR struct lib_instream_s *self, ****************************************************************************/ void lib_meminstream(FAR struct lib_meminstream_s *stream, - FAR const char *bufstart, int buflen) + FAR const char *bufstart, size_t buflen) { stream->common.getc = meminstream_getc; stream->common.gets = meminstream_gets; diff --git a/libs/libc/stream/lib_memoutstream.c b/libs/libc/stream/lib_memoutstream.c index 17b3bf2945d..2db0f6bd087 100644 --- a/libs/libc/stream/lib_memoutstream.c +++ b/libs/libc/stream/lib_memoutstream.c @@ -36,12 +36,12 @@ * Name: memoutstream_puts ****************************************************************************/ -static int memoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t memoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_memoutstream_s *stream = (FAR struct lib_memoutstream_s *)self; - int ncopy; + size_t ncopy; DEBUGASSERT(self); @@ -94,7 +94,7 @@ static void memoutstream_putc(FAR struct lib_outstream_s *self, int ch) ****************************************************************************/ void lib_memoutstream(FAR struct lib_memoutstream_s *outstream, - FAR char *bufstart, int buflen) + FAR char *bufstart, size_t buflen) { outstream->common.putc = memoutstream_putc; outstream->common.puts = memoutstream_puts; diff --git a/libs/libc/stream/lib_memsistream.c b/libs/libc/stream/lib_memsistream.c index 08e62352caa..0b063133002 100644 --- a/libs/libc/stream/lib_memsistream.c +++ b/libs/libc/stream/lib_memsistream.c @@ -25,6 +25,7 @@ ****************************************************************************/ #include +#include #include "libc.h" @@ -40,7 +41,7 @@ static int memsistream_getc(FAR struct lib_sistream_s *self) { FAR struct lib_memsistream_s *stream = (FAR struct lib_memsistream_s *)self; - int ret; + int ret = -EINVAL; DEBUGASSERT(self); @@ -52,10 +53,6 @@ static int memsistream_getc(FAR struct lib_sistream_s *self) stream->offset++; self->nget++; } - else - { - ret = EOF; - } return ret; } @@ -64,12 +61,12 @@ static int memsistream_getc(FAR struct lib_sistream_s *self) * Name: meminstream_gets ****************************************************************************/ -static int memsistream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t memsistream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { FAR struct lib_memsistream_s *stream = (FAR struct lib_memsistream_s *)self; - int ret; + ssize_t ret = -EINVAL; DEBUGASSERT(self); @@ -82,10 +79,6 @@ static int memsistream_gets(FAR struct lib_instream_s *self, self->nget += ret; memcpy(buffer, stream->buffer, ret); } - else - { - ret = EOF; - } return ret; } @@ -106,7 +99,7 @@ static off_t memsistream_seek(FAR struct lib_sistream_s *self, off_t offset, switch (whence) { case SEEK_CUR: - newpos = (off_t)stream->offset + offset; + newpos = stream->offset + offset; break; case SEEK_SET: @@ -114,23 +107,23 @@ static off_t memsistream_seek(FAR struct lib_sistream_s *self, off_t offset, break; case SEEK_END: - newpos = (off_t)stream->buflen + offset; + newpos = stream->buflen + offset; break; default: - return (off_t)ERROR; + return -EINVAL; } /* Make sure that the new position is within range */ - if (newpos < 0 || newpos >= (off_t)stream->buflen) + if (newpos < 0 || newpos >= stream->buflen) { - return (off_t)ERROR; + return -EINVAL; } /* Return the new position */ - stream->offset = (size_t)newpos; + stream->offset = newpos; return newpos; } @@ -156,7 +149,7 @@ static off_t memsistream_seek(FAR struct lib_sistream_s *self, off_t offset, ****************************************************************************/ void lib_memsistream(FAR struct lib_memsistream_s *instream, - FAR const char *bufstart, int buflen) + FAR const char *bufstart, size_t buflen) { instream->common.getc = memsistream_getc; instream->common.gets = memsistream_gets; diff --git a/libs/libc/stream/lib_memsostream.c b/libs/libc/stream/lib_memsostream.c index 2187c5e42cc..fb2eddb7eb0 100644 --- a/libs/libc/stream/lib_memsostream.c +++ b/libs/libc/stream/lib_memsostream.c @@ -25,6 +25,7 @@ ****************************************************************************/ #include +#include #include "libc.h" @@ -61,10 +62,10 @@ static void memsostream_putc(FAR struct lib_sostream_s *self, int ch) * Name: memoutstream_puts ****************************************************************************/ -static int memsostream_puts(FAR struct lib_sostream_s *self, - FAR const void *buf, int len) +static ssize_t memsostream_puts(FAR struct lib_sostream_s *self, + FAR const void *buf, size_t len) { - int ncopy; + ssize_t ncopy; FAR struct lib_memsostream_s *stream = (FAR struct lib_memsostream_s *)self; @@ -99,7 +100,7 @@ static off_t memsostream_seek(FAR struct lib_sostream_s *self, off_t offset, switch (whence) { case SEEK_CUR: - newpos = (off_t)stream->offset + offset; + newpos = stream->offset + offset; break; case SEEK_SET: @@ -107,23 +108,23 @@ static off_t memsostream_seek(FAR struct lib_sostream_s *self, off_t offset, break; case SEEK_END: - newpos = (off_t)stream->buflen + offset; + newpos = stream->buflen + offset; break; default: - return (off_t)ERROR; + return -EINVAL; } /* Make sure that the new position is within range */ - if (newpos < 0 || newpos >= (off_t)stream->buflen) + if (newpos < 0 || newpos >= stream->buflen) { - return (off_t)ERROR; + return -EINVAL; } /* Return the new position */ - stream->offset = (size_t)newpos; + stream->offset = newpos; return newpos; } @@ -149,7 +150,7 @@ static off_t memsostream_seek(FAR struct lib_sostream_s *self, off_t offset, ****************************************************************************/ void lib_memsostream(FAR struct lib_memsostream_s *outstream, - FAR char *bufstart, int buflen) + FAR char *bufstart, size_t buflen) { outstream->common.putc = memsostream_putc; outstream->common.puts = memsostream_puts; diff --git a/libs/libc/stream/lib_mtdoutstream.c b/libs/libc/stream/lib_mtdoutstream.c index 229a78d8dc1..eebd15f3c5e 100644 --- a/libs/libc/stream/lib_mtdoutstream.c +++ b/libs/libc/stream/lib_mtdoutstream.c @@ -47,32 +47,27 @@ * Name: mtdoutstream_flush ****************************************************************************/ -static int mtdoutstream_flush(FAR struct lib_outstream_s *self) +static int mtdoutstream_flush(FAR struct lib_sostream_s *self) { FAR struct lib_mtdoutstream_s *stream = (FAR struct lib_mtdoutstream_s *)self; + FAR struct mtd_dev_s *i_mtd = stream->inode->u.i_mtd; size_t erasesize = stream->geo.erasesize; size_t nblkpererase = erasesize / stream->geo.blocksize; int ret = OK; if (self->nput % erasesize > 0) { -#ifdef CONFIG_MTD_BYTE_WRITE - /* if byte write, flush won't be needed */ + size_t sblock = self->nput / erasesize; - if (stream->inode->u.i_mtd->write == NULL) -#endif + ret = MTD_ERASE(i_mtd, sblock, 1); + if (ret < 0) { - ret = MTD_ERASE(stream->inode->u.i_mtd, self->nput / erasesize, 1); - if (ret < 0) - { - return ret; - } - - ret = MTD_BWRITE(stream->inode->u.i_mtd, - self->nput / erasesize * nblkpererase, - nblkpererase, stream->cache); + return ret; } + + ret = MTD_BWRITE(i_mtd, sblock * nblkpererase, + nblkpererase, stream->cache); } return ret; @@ -82,114 +77,90 @@ static int mtdoutstream_flush(FAR struct lib_outstream_s *self) * Name: mtdoutstream_puts ****************************************************************************/ -static int mtdoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t mtdoutstream_puts(FAR struct lib_sostream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_mtdoutstream_s *stream = (FAR struct lib_mtdoutstream_s *)self; + FAR struct mtd_dev_s *i_mtd = stream->inode->u.i_mtd; size_t erasesize = stream->geo.erasesize; size_t nblkpererase = erasesize / stream->geo.blocksize; - FAR struct inode *inode = stream->inode; FAR const unsigned char *ptr = buf; size_t remain = len; - int ret; + ssize_t ret; if (self->nput + len > erasesize * stream->geo.neraseblocks) { return -ENOSPC; } -#ifdef CONFIG_MTD_BYTE_WRITE - if (stream->inode->u.i_mtd->write != NULL) + while (remain > 0) { - if (self->nput % stream->geo.erasesize == 0) - { - ret = MTD_ERASE(inode->u.i_mtd, - self->nput / stream->geo.erasesize, 1); - if (ret < 0) - { - return ret; - } - } - - ret = MTD_WRITE(inode->u.i_mtd, self->nput, len, buf); - if (ret < 0) - { - return ret; - } + off_t sblock = self->nput / erasesize; + off_t offset = self->nput % erasesize; - self->nput += len; - } - else -#endif - { - while (remain > 0) + if (offset > 0) { - size_t sblock = self->nput / erasesize; - size_t offset = self->nput % erasesize; - - if (offset > 0) - { - size_t copyin = offset + remain > erasesize ? - erasesize - offset : remain; + size_t copyin = offset + remain > erasesize ? + erasesize - offset : remain; - memcpy(stream->cache + offset, ptr, copyin); + memcpy(stream->cache + offset, ptr, copyin); - ptr += copyin; - offset += copyin; - self->nput += copyin; - remain -= copyin; + ptr += copyin; + offset += copyin; + self->nput += copyin; + remain -= copyin; - if (offset == erasesize) - { - ret = MTD_ERASE(inode->u.i_mtd, sblock, 1); - if (ret < 0) - { - return ret; - } - - ret = MTD_BWRITE(inode->u.i_mtd, sblock * nblkpererase, - nblkpererase, stream->cache); - if (ret < 0) - { - return ret; - } - } - } - else if (remain < erasesize) + if (offset == erasesize) { - /* erase content to all 0 before caching, - * so no random content will be flushed - */ - - memset(stream->cache, 0, stream->geo.erasesize); - memcpy(stream->cache, ptr, remain); - self->nput += remain; - remain = 0; - } - else if (remain >= erasesize) - { - size_t copyin = (remain / erasesize) * erasesize; - - ret = MTD_ERASE(inode->u.i_mtd, sblock, - remain / erasesize); + ret = MTD_ERASE(i_mtd, sblock, 1); if (ret < 0) { return ret; } - ret = MTD_BWRITE(inode->u.i_mtd, sblock * nblkpererase, - remain / erasesize * nblkpererase, - ptr); + ret = MTD_BWRITE(i_mtd, sblock * nblkpererase, + nblkpererase, stream->cache); if (ret < 0) { return ret; } + } + } + else if (remain < erasesize) + { + ret = MTD_BREAD(i_mtd, sblock * nblkpererase, + nblkpererase, stream->cache); + if (ret < 0) + { + return ret; + } + + memcpy(stream->cache, ptr, remain); + self->nput += remain; + remain = 0; + } + else + { + size_t nblock = remain / erasesize; + size_t copyin = nblock * erasesize; - ptr += copyin; - self->nput += copyin; - remain -= copyin; + ret = MTD_ERASE(i_mtd, sblock, nblock); + if (ret < 0) + { + return ret; + } + + ret = MTD_BWRITE(i_mtd, sblock * nblkpererase, + nblock * nblkpererase, ptr); + if (ret < 0) + { + return ret; } + + ptr += copyin; + self->nput += copyin; + remain -= copyin; } } @@ -200,12 +171,91 @@ static int mtdoutstream_puts(FAR struct lib_outstream_s *self, * Name: mtdoutstream_putc ****************************************************************************/ -static void mtdoutstream_putc(FAR struct lib_outstream_s *self, int ch) +static void mtdoutstream_putc(FAR struct lib_sostream_s *self, int ch) { char tmp = ch; mtdoutstream_puts(self, &tmp, 1); } +/**************************************************************************** + * Name: mtdoutstream_seek + ****************************************************************************/ + +static off_t mtdoutstream_seek(FAR struct lib_sostream_s *self, + off_t offset, int whence) +{ + FAR struct lib_mtdoutstream_s *stream = + (FAR struct lib_mtdoutstream_s *)self; + FAR struct mtd_dev_s *i_mtd = stream->inode->u.i_mtd; + size_t erasesize = stream->geo.erasesize; + off_t streamsize = erasesize * stream->geo.neraseblocks; + size_t nblkpererase = erasesize / stream->geo.blocksize; + size_t block; + off_t ret; + + switch (whence) + { + case SEEK_SET: + break; + case SEEK_END: + offset += streamsize; + break; + case SEEK_CUR: + offset += self->nput; + break; + default: + return -ENOTSUP; + } + + /* Seek to negative value or value larger than maximum size shall fail */ + + if (offset < 0 || offset > streamsize) + { + return -EINVAL; + } + + if (self->nput % erasesize) + { + block = self->nput / erasesize; + if (offset >= block * erasesize && + offset < (block + 1) * erasesize) + { + /* Inside same erase block */ + + goto out; + } + + ret = MTD_ERASE(i_mtd, block, 1); + if (ret < 0) + { + return ret; + } + + ret = MTD_BWRITE(i_mtd, block * nblkpererase, + nblkpererase, stream->cache); + if (ret < 0) + { + return ret; + } + } + + if (offset % erasesize) + { + block = offset / erasesize; + + ret = MTD_BREAD(i_mtd, block * nblkpererase, + nblkpererase, stream->cache); + if (ret < 0) + { + return ret; + } + } + +out: + self->nput = offset; + return offset; +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -237,6 +287,7 @@ void lib_mtdoutstream_close(FAR struct lib_mtdoutstream_s *stream) if (stream->cache != NULL) { + mtdoutstream_flush(&stream->common); lib_free(stream->cache); stream->cache = NULL; } @@ -291,22 +342,18 @@ int lib_mtdoutstream_open(FAR struct lib_mtdoutstream_s *stream, return -EINVAL; } -#ifdef CONFIG_MTD_BYTE_WRITE - if (node->u.i_mtd->write == NULL) -#endif + stream->cache = lib_malloc(stream->geo.erasesize); + if (stream->cache == NULL) { - stream->cache = lib_zalloc(stream->geo.erasesize); - if (stream->cache == NULL) - { - close_mtddriver(node); - return -ENOMEM; - } + close_mtddriver(node); + return -ENOMEM; } stream->inode = node; stream->common.putc = mtdoutstream_putc; stream->common.puts = mtdoutstream_puts; stream->common.flush = mtdoutstream_flush; + stream->common.seek = mtdoutstream_seek; return OK; } diff --git a/libs/libc/stream/lib_nullinstream.c b/libs/libc/stream/lib_nullinstream.c index effdd1e6bb7..bc0d460ad0e 100644 --- a/libs/libc/stream/lib_nullinstream.c +++ b/libs/libc/stream/lib_nullinstream.c @@ -36,15 +36,15 @@ static int nullinstream_getc(FAR struct lib_instream_s *self) { UNUSED(self); - return EOF; + return -EINVAL; } -static int nullinstream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t nullinstream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { UNUSED(buffer); UNUSED(len); - return EOF; + return -EINVAL; } /**************************************************************************** diff --git a/libs/libc/stream/lib_nulloutstream.c b/libs/libc/stream/lib_nulloutstream.c index c3f57399eec..c6c439a41af 100644 --- a/libs/libc/stream/lib_nulloutstream.c +++ b/libs/libc/stream/lib_nulloutstream.c @@ -41,8 +41,8 @@ static void nulloutstream_putc(FAR struct lib_outstream_s *self, int ch) self->nput++; } -static int nulloutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buffer, int len) +static ssize_t nulloutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buffer, size_t len) { UNUSED(buffer); UNUSED(len); diff --git a/libs/libc/stream/lib_rawinstream.c b/libs/libc/stream/lib_rawinstream.c index 02d4e0181d9..620c55a69b7 100644 --- a/libs/libc/stream/lib_rawinstream.c +++ b/libs/libc/stream/lib_rawinstream.c @@ -59,26 +59,22 @@ static int rawinstream_getc(FAR struct lib_instream_s *self) self->nget++; return ch; } - - /* Return EOF on any failure to read from the incoming byte stream. The - * only expected error is EINTR meaning that the read was interrupted - * by a signal. A Zero return value would indicate an end-of-file - * condition. - */ - - return EOF; + else + { + return _NX_GETERRVAL(nread); + } } /**************************************************************************** * Name: rawinstream_getc ****************************************************************************/ -static int rawinstream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t rawinstream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { FAR struct lib_rawinstream_s *stream = (FAR struct lib_rawinstream_s *)self; - int nread; + ssize_t nread; DEBUGASSERT(self && stream->fd >= 0); diff --git a/libs/libc/stream/lib_rawoutstream.c b/libs/libc/stream/lib_rawoutstream.c index 5eb798caf7d..98b7cf895d4 100644 --- a/libs/libc/stream/lib_rawoutstream.c +++ b/libs/libc/stream/lib_rawoutstream.c @@ -42,12 +42,12 @@ * Name: rawoutstream_puts ****************************************************************************/ -static int rawoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buf, int len) +static ssize_t rawoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buf, size_t len) { FAR struct lib_rawoutstream_s *stream = (FAR struct lib_rawoutstream_s *)self; - int nwritten = 0; + ssize_t nwritten = 0; do { diff --git a/libs/libc/stream/lib_rawsistream.c b/libs/libc/stream/lib_rawsistream.c index 72d77550c4b..af20a335d06 100644 --- a/libs/libc/stream/lib_rawsistream.c +++ b/libs/libc/stream/lib_rawsistream.c @@ -59,26 +59,22 @@ static int rawsistream_getc(FAR struct lib_sistream_s *self) self->nget++; return ch; } - - /* Return EOF on any failure to read from the incoming byte stream. The - * only expected error is EINTR meaning that the read was interrupted - * by a signal. A Zero return value would indicated an end-of-file - * confition. - */ - - return EOF; + else + { + return _NX_GETERRVAL(nread); + } } /**************************************************************************** * Name: rawsistream_gets ****************************************************************************/ -static int rawsistream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t rawsistream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { FAR struct lib_rawsistream_s *stream = (FAR struct lib_rawsistream_s *)self; - int nread; + ssize_t nread; DEBUGASSERT(self && stream->fd >= 0); @@ -108,7 +104,13 @@ static off_t rawsistream_seek(FAR struct lib_sistream_s *self, off_t offset, (FAR struct lib_rawsistream_s *)self; DEBUGASSERT(self); - return _NX_SEEK(stream->fd, offset, whence); + offset = _NX_SEEK(stream->fd, offset, whence); + if (offset < 0) + { + offset = _NX_GETERRVAL(offset); + } + + return offset; } /**************************************************************************** diff --git a/libs/libc/stream/lib_rawsostream.c b/libs/libc/stream/lib_rawsostream.c index a81efa2a379..f741e856458 100644 --- a/libs/libc/stream/lib_rawsostream.c +++ b/libs/libc/stream/lib_rawsostream.c @@ -47,7 +47,7 @@ static void rawsostream_putc(FAR struct lib_sostream_s *self, int ch) FAR struct lib_rawsostream_s *stream = (FAR struct lib_rawsostream_s *)self; char buffer = ch; - int nwritten; + ssize_t nwritten; DEBUGASSERT(self && stream->fd >= 0); @@ -79,12 +79,12 @@ static void rawsostream_putc(FAR struct lib_sostream_s *self, int ch) * Name: rawsostream_puts ****************************************************************************/ -static int rawsostream_puts(FAR struct lib_sostream_s *self, - FAR const void *buffer, int len) +static ssize_t rawsostream_puts(FAR struct lib_sostream_s *self, + FAR const void *buffer, size_t len) { FAR struct lib_rawsostream_s *stream = (FAR struct lib_rawsostream_s *)self; - int nwritten; + ssize_t nwritten; DEBUGASSERT(self && stream->fd >= 0); @@ -125,7 +125,13 @@ static off_t rawsostream_seek(FAR struct lib_sostream_s *self, off_t offset, (FAR struct lib_rawsostream_s *)self; DEBUGASSERT(self); - return _NX_SEEK(stream->fd, offset, whence); + offset = _NX_SEEK(stream->fd, offset, whence); + if (offset < 0) + { + offset = _NX_GETERRVAL(offset); + } + + return offset; } /**************************************************************************** diff --git a/libs/libc/stream/lib_stdinstream.c b/libs/libc/stream/lib_stdinstream.c index ae7094ec2bf..96558f8c443 100644 --- a/libs/libc/stream/lib_stdinstream.c +++ b/libs/libc/stream/lib_stdinstream.c @@ -52,6 +52,10 @@ static int stdinstream_getc(FAR struct lib_instream_s *self) { self->nget++; } + else + { + ret = _NX_GETERRVAL(ret); + } return ret; } @@ -60,12 +64,12 @@ static int stdinstream_getc(FAR struct lib_instream_s *self) * Name: stdinstream_gets ****************************************************************************/ -static int stdinstream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t stdinstream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { FAR struct lib_stdinstream_s *stream = (FAR struct lib_stdinstream_s *)self; - int nread = 0; + ssize_t nread = 0; DEBUGASSERT(self); diff --git a/libs/libc/stream/lib_stdoutstream.c b/libs/libc/stream/lib_stdoutstream.c index 711aeb01959..8bb19c2446a 100644 --- a/libs/libc/stream/lib_stdoutstream.c +++ b/libs/libc/stream/lib_stdoutstream.c @@ -71,12 +71,12 @@ static void stdoutstream_putc(FAR struct lib_outstream_s *self, int ch) * Name: stdoutstream_puts ****************************************************************************/ -static int stdoutstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buffer, int len) +static ssize_t stdoutstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buffer, size_t len) { FAR struct lib_stdoutstream_s *stream = (FAR struct lib_stdoutstream_s *)self; - int result; + ssize_t result; DEBUGASSERT(self && stream->handle); diff --git a/libs/libc/stream/lib_stdsistream.c b/libs/libc/stream/lib_stdsistream.c index a86dab9e430..c453ab3a66e 100644 --- a/libs/libc/stream/lib_stdsistream.c +++ b/libs/libc/stream/lib_stdsistream.c @@ -51,6 +51,10 @@ static int stdsistream_getc(FAR struct lib_sistream_s *self) { self->nget++; } + else + { + ret = _NX_GETERRVAL(ret); + } return ret; } @@ -59,12 +63,12 @@ static int stdsistream_getc(FAR struct lib_sistream_s *self) * Name: stdsistream_gets ****************************************************************************/ -static int stdsistream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t stdsistream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { FAR struct lib_stdsistream_s *stream = (FAR struct lib_stdsistream_s *)self; - int nread = 0; + ssize_t nread = 0; DEBUGASSERT(self); @@ -94,7 +98,13 @@ static off_t stdsistream_seek(FAR struct lib_sistream_s *self, off_t offset, (FAR struct lib_stdsistream_s *)self; DEBUGASSERT(self); - return fseek(stream->handle, offset, whence); + offset = fseek(stream->handle, offset, whence); + if (offset < 0) + { + offset = _NX_GETERRVAL(offset); + } + + return offset; } /**************************************************************************** diff --git a/libs/libc/stream/lib_stdsostream.c b/libs/libc/stream/lib_stdsostream.c index c3a23314702..6343b0b6181 100644 --- a/libs/libc/stream/lib_stdsostream.c +++ b/libs/libc/stream/lib_stdsostream.c @@ -70,12 +70,12 @@ static void stdsostream_putc(FAR struct lib_sostream_s *self, int ch) * Name: stdsostream_puts ****************************************************************************/ -static int stdsostream_puts(FAR struct lib_sostream_s *self, - FAR const void *buffer, int len) +static ssize_t stdsostream_puts(FAR struct lib_sostream_s *self, + FAR const void *buffer, size_t len) { FAR struct lib_stdsostream_s *stream = (FAR struct lib_stdsostream_s *)self; - int result; + ssize_t result; DEBUGASSERT(self && stream->handle); @@ -129,7 +129,13 @@ static off_t stdsostream_seek(FAR struct lib_sostream_s *self, off_t offset, (FAR struct lib_stdsostream_s *)self; DEBUGASSERT(stream != NULL && stream->handle != NULL); - return fseek(stream->handle, offset, whence); + offset = fseek(stream->handle, offset, whence); + if (offset < 0) + { + offset = _NX_GETERRVAL(offset); + } + + return offset; } /**************************************************************************** diff --git a/libs/libc/stream/lib_syslograwstream.c b/libs/libc/stream/lib_syslograwstream.c index 23354004cdf..427b365e1a5 100644 --- a/libs/libc/stream/lib_syslograwstream.c +++ b/libs/libc/stream/lib_syslograwstream.c @@ -102,15 +102,15 @@ static void syslograwstream_addchar(FAR struct lib_syslograwstream_s *stream, * Name: syslograwstream_addstring ****************************************************************************/ -static int +static ssize_t syslograwstream_addstring(FAR struct lib_syslograwstream_s *stream, - FAR const char *buff, int len) + FAR const char *buff, size_t len) { - int ret = 0; + ssize_t ret = 0; do { - int remain = CONFIG_SYSLOG_BUFSIZE - stream->offset; + size_t remain = CONFIG_SYSLOG_BUFSIZE - stream->offset; remain = remain > len - ret ? len - ret : remain; memcpy(stream->buffer + stream->offset, buff + ret, remain); stream->offset += remain; @@ -183,8 +183,8 @@ static void syslograwstream_putc(FAR struct lib_outstream_s *self, int ch) } } -static int syslograwstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buff, int len) +static ssize_t syslograwstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buff, size_t len) { FAR struct lib_syslograwstream_s *stream = (FAR void *)self; @@ -202,7 +202,7 @@ static int syslograwstream_puts(FAR struct lib_outstream_s *self, return syslograwstream_addstring(stream, buff, len); #else - int ret; + ssize_t ret; /* Try writing until the write was successful or until an * irrecoverable error occurs. diff --git a/libs/libc/stream/lib_syslogstream.c b/libs/libc/stream/lib_syslogstream.c index 495a7ba99cf..ff31365304d 100644 --- a/libs/libc/stream/lib_syslogstream.c +++ b/libs/libc/stream/lib_syslogstream.c @@ -49,8 +49,8 @@ static void syslogstream_putc(FAR struct lib_outstream_s *self, int ch) stream->common.nput++; } -static int syslogstream_puts(FAR struct lib_outstream_s *self, - FAR const void *buff, int len) +static ssize_t syslogstream_puts(FAR struct lib_outstream_s *self, + FAR const void *buff, size_t len) { FAR struct lib_syslogstream_s *stream = (FAR struct lib_syslogstream_s *)self; @@ -61,7 +61,7 @@ static int syslogstream_puts(FAR struct lib_outstream_s *self, return 0; } - syslog(stream->priority, "%.*s", len, (FAR const char *)buff); + syslog(stream->priority, "%.*s", (int)len, (FAR const char *)buff); return len; } diff --git a/libs/libc/stream/lib_zeroinstream.c b/libs/libc/stream/lib_zeroinstream.c index 051e15c2229..da1928bac11 100644 --- a/libs/libc/stream/lib_zeroinstream.c +++ b/libs/libc/stream/lib_zeroinstream.c @@ -38,8 +38,8 @@ static int zeroinstream_getc(FAR struct lib_instream_s *self) return 0; } -static int zeroinstream_gets(FAR struct lib_instream_s *self, - FAR void *buffer, int len) +static ssize_t zeroinstream_gets(FAR struct lib_instream_s *self, + FAR void *buffer, size_t len) { self->nget += len; memset(buffer, 0, len); diff --git a/libs/libc/uio/CMakeLists.txt b/libs/libc/uio/CMakeLists.txt index 1074488fec1..9dbcbf0dce0 100644 --- a/libs/libc/uio/CMakeLists.txt +++ b/libs/libc/uio/CMakeLists.txt @@ -20,4 +20,4 @@ # # ############################################################################## -target_sources(c PRIVATE lib_readv.c lib_writev.c lib_preadv.c lib_pwritev.c) +target_sources(c PRIVATE lib_preadv.c lib_pwritev.c) diff --git a/libs/libc/uio/Make.defs b/libs/libc/uio/Make.defs index 04620764ddf..59bfb7d6640 100644 --- a/libs/libc/uio/Make.defs +++ b/libs/libc/uio/Make.defs @@ -22,7 +22,6 @@ # Add the uio.h C files to the build -CSRCS += lib_readv.c lib_writev.c CSRCS += lib_preadv.c lib_pwritev.c # Add the uio.h directory to the build diff --git a/libs/libc/uio/lib_readv.c b/libs/libc/uio/lib_readv.c deleted file mode 100644 index c16d0a673bd..00000000000 --- a/libs/libc/uio/lib_readv.c +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** - * libs/libc/uio/lib_readv.c - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: readv() - * - * Description: - * The readv() function is equivalent to read(), except as described below. - * The readv() function places the input data into the 'iovcnt' buffers - * specified by the members of the 'iov' array: iov[0], iov[1], ..., - * iov['iovcnt'-1]. The 'iovcnt' argument is valid if greater than 0 and - * less than or equal to IOV_MAX as defined in limits.h. - * - * Each iovec entry specifies the base address and length of an area in - * memory where data should be placed. The readv() function will always - * fill an area completely before proceeding to the next. - * - * TODO: pon successful completion, readv() will mark for update the - * st_atime field of the file. - * - * Input Parameters: - * filedes - The open file descriptor for the file to be read - * iov - Array of read buffer descriptors - * iovcnt - Number of elements in iov[] - * - * Returned Value: - * Upon successful completion, readv() will return a non-negative integer - * indicating the number of bytes actually read. Otherwise, the functions - * will return -1 and set errno to indicate the error. See read() for the - * list of returned errno values. In addition, the readv() function will - * fail if: - * - * EINVAL. - * The sum of the iov_len values in the iov array overflowed an ssize_t - * or The 'iovcnt' argument was less than or equal to 0, or greater than - * IOV_MAX (Not implemented). - * - ****************************************************************************/ - -ssize_t readv(int fildes, FAR const struct iovec *iov, int iovcnt) -{ - ssize_t ntotal; - ssize_t nread; - size_t remaining; - FAR uint8_t *buffer; - int i; - - /* Process each entry in the struct iovec array */ - - for (i = 0, ntotal = 0; i < iovcnt; i++) - { - /* Ignore zero-length reads */ - - if (iov[i].iov_len > 0) - { - buffer = iov[i].iov_base; - remaining = iov[i].iov_len; - - /* Read repeatedly as necessary to fill buffer */ - - do - { - /* NOTE: read() is a cancellation point */ - - nread = read(fildes, buffer, remaining); - - /* Check for a read error */ - - if (nread < 0) - { - return nread; - } - - /* Check for an end-of-file condition */ - - else if (nread == 0) - { - return ntotal; - } - - /* Update pointers and counts in order to handle partial - * buffer reads. - */ - - buffer += nread; - remaining -= nread; - ntotal += nread; - } - while (remaining > 0); - } - } - - return ntotal; -} diff --git a/libs/libc/uio/lib_writev.c b/libs/libc/uio/lib_writev.c deleted file mode 100644 index 79623e64b64..00000000000 --- a/libs/libc/uio/lib_writev.c +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************** - * libs/libc/uio/lib_writev.c - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. The - * ASF licenses this file to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance with the - * License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#include -#include -#include - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: writev() - * - * Description: - * The writev() function is equivalent to write(), except as described - * below. The writev() function will gather output data from the 'iovcnt' - * buffers specified by the members of the 'iov' array: - * iov[0], iov[1], ..., iov[iovcnt-1]. - * The 'iovcnt' argument is valid if greater than 0 and less than or equal - * to IOV_MAX, as defined in limits.h. - * - * Each iovec entry specifies the base address and length of an area in - * memory from which data should be written. The writev() function always - * writes a complete area before proceeding to the next. - * - * If 'filedes' refers to a regular file and all of the iov_len members in - * the array pointed to by iov are 0, writev() will return 0 and have no - * other effect. For other file types, the behavior is unspecified. - * - * TODO: If the sum of the iov_len values is greater than SSIZE_MAX, the - * operation will fail and no data will be transferred. - * - * Input Parameters: - * filedes - The open file descriptor for the file to be write - * iov - Array of write buffer descriptors - * iovcnt - Number of elements in iov[] - * - * Returned Value: - * Upon successful completion, writev() shall return the number of bytes - * actually written. Otherwise, it shall return a value of -1, the file- - * pointer shall remain unchanged, and errno shall be set to indicate an - * error. See write for the list of returned errno values. In addition, - * the writev() function will fail if: - * - * EINVAL. - * The sum of the iov_len values in the iov array overflowed an ssize_t - * or The 'iovcnt' argument was less than or equal to 0, or greater than - * IOV_MAX (Not implemented). - * - ****************************************************************************/ - -ssize_t writev(int fildes, FAR const struct iovec *iov, int iovcnt) -{ - ssize_t ntotal; - ssize_t nwritten; - size_t remaining; - FAR uint8_t *buffer; - int i; - - /* Process each entry in the struct iovec array */ - - for (i = 0, ntotal = 0; i < iovcnt; i++) - { - /* Ignore zero-length writes */ - - if (iov[i].iov_len > 0) - { - buffer = iov[i].iov_base; - remaining = iov[i].iov_len; - - /* Write repeatedly as necessary to write the entire buffer */ - - do - { - /* NOTE: write() is a cancellation point */ - - nwritten = write(fildes, buffer, remaining); - - /* Check for a write error */ - - if (nwritten < 0) - { - return ntotal ? ntotal : ERROR; - } - - /* Update pointers and counts in order to handle partial - * buffer writes. - */ - - buffer += nwritten; - remaining -= nwritten; - ntotal += nwritten; - } - while (remaining > 0); - } - } - - return ntotal; -} diff --git a/libs/libc/unistd/lib_getcwd.c b/libs/libc/unistd/lib_getcwd.c index 41091fd1a1f..8c6ce20651b 100644 --- a/libs/libc/unistd/lib_getcwd.c +++ b/libs/libc/unistd/lib_getcwd.c @@ -127,3 +127,28 @@ FAR char *getcwd(FAR char *buf, size_t size) strlcpy(buf, pwd, size); return buf; } + +/**************************************************************************** + * Name: get_current_dir_name + * + * Description: + * get_current_dir_name() will allocate an buffer to hold the current + * working directory info, and this buffer will be returned to user. + * the user will be responsible to free the buffer. + * + * Input Parameters: + * None + * + * Returned Value: + * On success, get_current_dir_name() returns a pointer to a string + * containing the pathname of the current working directory. + * Otherwise, get_current_dir_name() returns a null pointer and + * sets errno to indicate the error. + * the errno can refer to: getcwd() function's comments. + * + ****************************************************************************/ + +FAR char *get_current_dir_name(void) +{ + return getcwd(NULL, 0); +} diff --git a/libs/libm/Makefile b/libs/libm/Makefile index f3dd77d6fed..841f53d544e 100644 --- a/libs/libm/Makefile +++ b/libs/libm/Makefile @@ -84,11 +84,17 @@ endif depend: .depend +bin: + $(Q) mkdir $@ + +kbin: + $(Q) mkdir $@ + +context: bin kbin + # Clean most derived files, retaining the configuration clean: - $(Q) $(MAKE) -C bin clean - $(Q) $(MAKE) -C kbin clean $(call DELFILE, $(BIN)) $(call DELFILE, $(KBIN)) $(call CLEAN) @@ -96,10 +102,8 @@ clean: # Deep clean -- removes all traces of the configuration distclean:: clean - $(Q) $(MAKE) -C bin distclean - $(Q) $(MAKE) -C kbin distclean - $(call DELFILE, bin$(DELIM)Make.dep) - $(call DELFILE, kbin$(DELIM)Make.dep) + $(call DELDIR, bin) + $(call DELDIR, kbin) $(call DELFILE, .depend) -include bin$(DELIM)Make.dep diff --git a/libs/libm/bin/Makefile b/libs/libm/bin/Makefile deleted file mode 100644 index db15a994aa7..00000000000 --- a/libs/libm/bin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# libs/libm/bin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean diff --git a/libs/libm/kbin/Makefile b/libs/libm/kbin/Makefile deleted file mode 100644 index ce9d1532ee8..00000000000 --- a/libs/libm/kbin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# libs/libm/kbin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean diff --git a/libs/libm/libmcs/0001-fix-build-error-remove-unused-file-fenv.h.patch b/libs/libm/libmcs/0001-fix-build-error-remove-unused-file-fenv.h.patch index 9b79a9d32fa..9b48e60edfb 100644 --- a/libs/libm/libmcs/0001-fix-build-error-remove-unused-file-fenv.h.patch +++ b/libs/libm/libmcs/0001-fix-build-error-remove-unused-file-fenv.h.patch @@ -3,14 +3,11 @@ From: yanghuatao Date: Thu, 23 Mar 2023 09:43:19 +0800 Subject: [PATCH 1/3] fix build error: remove unused file fenv.h -VELAPLATFO-6159 - fenv.h is unused, remove it or will have conflict with quickjs.c`s fenv.h (1)open menuconfig (2)close math.h:build setup->Customize Header Files->math.h (2) select libmcs:Library Rountines->Select math library->Math Library fram LibmCS (3)build Signed-off-by: yanghuatao -Change-Id: I70496ce82ff2f9de9016f5c829daf9982fa32d45 --- libmcs/libmcs/libm/include/fenv.h | 41 ----------------------------------------- 1 file changed, 41 deletions(-) diff --git a/libs/libm/libmcs/0002-fix-build-error-do-not-include-config.h.patch b/libs/libm/libmcs/0002-fix-build-error-do-not-include-config.h.patch index 03f355b8ba6..eb969f183e5 100644 --- a/libs/libm/libmcs/0002-fix-build-error-do-not-include-config.h.patch +++ b/libs/libm/libmcs/0002-fix-build-error-do-not-include-config.h.patch @@ -3,14 +3,11 @@ From: yanghuatao Date: Thu, 23 Mar 2023 09:47:17 +0800 Subject: [PATCH 2/3] fix build error: do not include config.h -VELAPLATFO-6159 - config.h is generated by confugure, we do not need it (1)open menuconfig (2)close math.h:build setup->Customize Header Files->math.h (2) select libmcs:Library Rountines->Select math library->Math Library fram LibmCS (3)build Signed-off-by: yanghuatao -Change-Id: I2d6efed47a8addee7624cbb972fb2ca914c1684c --- libmcs/libmcs/libm/include/complex.h | 1 - libmcs/libmcs/libm/include/math.h | 1 - diff --git a/libs/libm/libmcs/0003-fix-build-error-INFINITY-error-in-quickjs.c.patch b/libs/libm/libmcs/0003-fix-build-error-INFINITY-error-in-quickjs.c.patch index d8c411b290f..ca82aa7659b 100644 --- a/libs/libm/libmcs/0003-fix-build-error-INFINITY-error-in-quickjs.c.patch +++ b/libs/libm/libmcs/0003-fix-build-error-INFINITY-error-in-quickjs.c.patch @@ -3,14 +3,11 @@ From: yanghuatao Date: Thu, 23 Mar 2023 09:54:59 +0800 Subject: [PATCH 3/3] fix build error: INFINITY error in quickjs.c -VELAPLATFO-6159 - quickjs/quickjs.c:40035:45: error: initializer element is not constant 40035 | JS_PROP_DOUBLE_DEF("POSITIVE_INFINITY", INFINITY, 0 ) (1)open menuconfig (2)close math.h:build setup->Customize Header Files->math.h (2) select libmcs:Library Rountines->Select math library->Math Library fram LibmCS (3)build Signed-off-by: yanghuatao -Change-Id: I6d70b7152e047b893429f49abc3c6c0e191735a4 --- libmcs/libmcs/Makefile.in | 1 - .../2000_misc_internal.rst | 1 - diff --git a/libs/libm/libmcs/0004-Fix-warning-function-declaration-isn-t-a-prototype-W.patch b/libs/libm/libmcs/0004-Fix-warning-function-declaration-isn-t-a-prototype-W.patch index f47ce0bb44a..7e53974dc3d 100644 --- a/libs/libm/libmcs/0004-Fix-warning-function-declaration-isn-t-a-prototype-W.patch +++ b/libs/libm/libmcs/0004-Fix-warning-function-declaration-isn-t-a-prototype-W.patch @@ -8,7 +8,6 @@ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Xiang Xiao -Change-Id: Ie8f405c14d6bae5a5d25caa82e7190c4bcb4504f --- libm/common/tools.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/libm/libmcs/0005-libm-libmcs-Fix-clang-build-libmcs-warning.patch b/libs/libm/libmcs/0005-libm-libmcs-Fix-clang-build-libmcs-warning.patch index b620f8d5bf2..d69de68f2bd 100644 --- a/libs/libm/libmcs/0005-libm-libmcs-Fix-clang-build-libmcs-warning.patch +++ b/libs/libm/libmcs/0005-libm-libmcs-Fix-clang-build-libmcs-warning.patch @@ -3,13 +3,10 @@ From: yanghuatao Date: Mon, 4 Sep 2023 21:29:55 +0800 Subject: [PATCH 2/2] libm/libmcs: Fix clang build libmcs warning -VELAPLATFO-15795 - Fix warnings: libmcs/libmcs/libm/common/fenv.c libmcs/libmcs/libm/common/fenv.c:26:15: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] int fegetround() -Change-Id: I91e956a46b0ea0bbf187c1790a1f236da8ee6b01 Signed-off-by: yanghuatao --- libmcs/libmcs/libm/common/fenv.c | 2 +- diff --git a/libs/libm/newlib/0001-newlib-libm-fix-__RCSID-build-error.patch b/libs/libm/newlib/0001-newlib-libm-fix-__RCSID-build-error.patch index 93983ad6751..a3f805fd084 100644 --- a/libs/libm/newlib/0001-newlib-libm-fix-__RCSID-build-error.patch +++ b/libs/libm/newlib/0001-newlib-libm-fix-__RCSID-build-error.patch @@ -3,12 +3,9 @@ From: yanghuatao Date: Sun, 26 Mar 2023 01:16:23 +0800 Subject: [PATCH 1/2] newlib libm fix __RCSID build error -VELAPLATFO-6159 - remove code __RCSID in newlib/libm Signed-off-by: yanghuatao -Change-Id: I7eec03396b911ead48183fc80936475a9136f3ee --- newlib/libm/complex/conjl.c | 3 --- newlib/libm/complex/cprojl.c | 3 --- diff --git a/libs/libm/newlib/0002-newlib-libm-remove-include-reent.h.patch b/libs/libm/newlib/0002-newlib-libm-remove-include-reent.h.patch index 3ce5df259b6..3baa0d0b218 100644 --- a/libs/libm/newlib/0002-newlib-libm-remove-include-reent.h.patch +++ b/libs/libm/newlib/0002-newlib-libm-remove-include-reent.h.patch @@ -3,12 +3,9 @@ From: yanghuatao Date: Sun, 26 Mar 2023 09:31:15 +0800 Subject: [PATCH 2/2] newlib libm remove include reent.h -VELAPLATFO-6159 - remove include reent.h Signed-off-by: yanghuatao -Change-Id: I8265baa3bfc9df9035fb45f02676047ea8adacbd --- newlib/libm/math/w_gamma.c | 1 - newlib/libm/math/w_lgamma.c | 1 - diff --git a/libs/libm/newlib/0003-newlib-fix-compilation-for-x86.patch b/libs/libm/newlib/0003-newlib-fix-compilation-for-x86.patch index eea5de8e5c1..d5d058962e1 100644 --- a/libs/libm/newlib/0003-newlib-fix-compilation-for-x86.patch +++ b/libs/libm/newlib/0003-newlib-fix-compilation-for-x86.patch @@ -3,7 +3,6 @@ From: p-szafonimateusz Date: Thu, 22 Feb 2024 15:05:36 +0100 Subject: [PATCH] newlib: fix compilation for x86 -Change-Id: I5286ef72e358010ea7b4805e6087b06f67e42d44 Signed-off-by: p-szafonimateusz --- newlib/libc/machine/shared_x86/sys/fenv.h | 1 + diff --git a/libs/libm/newlib/0004-newlib-disable-optmisation-for-sincos.patch b/libs/libm/newlib/0004-newlib-disable-optmisation-for-sincos.patch index 958386ba4c1..ccda128da70 100644 --- a/libs/libm/newlib/0004-newlib-disable-optmisation-for-sincos.patch +++ b/libs/libm/newlib/0004-newlib-disable-optmisation-for-sincos.patch @@ -3,7 +3,6 @@ From: p-szafonimateusz Date: Fri, 24 May 2024 09:19:03 +0200 Subject: [PATCH] newlib: disable optmisation for sincos -Change-Id: Ie571e357485384655f67cdc9af2be1c60cacfeee Signed-off-by: p-szafonimateusz --- newlib/libm/math/w_sincos.c | 9 +++++++++ diff --git a/libs/libm/openlibm/0001-fix-build-float_t-error-float_t-has-not-been-declare.patch b/libs/libm/openlibm/0001-fix-build-float_t-error-float_t-has-not-been-declare.patch index 324cd2f362e..a64b368ea44 100644 --- a/libs/libm/openlibm/0001-fix-build-float_t-error-float_t-has-not-been-declare.patch +++ b/libs/libm/openlibm/0001-fix-build-float_t-error-float_t-has-not-been-declare.patch @@ -6,14 +6,11 @@ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -VELAPLATFO-6159 - libcxx/cmath:335:9: error: ‘::float_t’ has not been declared (1)open menuconfig (2)close math.h:build setup->Customize Header Files->math.h (2) select openlibm:Library Rountines->Select math library->Math Library fram openlibm (3)build Signed-off-by: yanghuatao -Change-Id: Iec6dbcebbe4ef15a96bcebb038f0c64ab39c5af7 --- include/openlibm_math.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/libm/openlibm/0002-add-math.h-and-complex.h-to-openlibm.patch b/libs/libm/openlibm/0002-add-math.h-and-complex.h-to-openlibm.patch index 1f549862f6c..e982e58b57a 100644 --- a/libs/libm/openlibm/0002-add-math.h-and-complex.h-to-openlibm.patch +++ b/libs/libm/openlibm/0002-add-math.h-and-complex.h-to-openlibm.patch @@ -3,14 +3,11 @@ From: yanghuatao Date: Sat, 25 Mar 2023 11:05:58 +0800 Subject: [PATCH 2/2] add math.h and complex.h to openlibm -VELAPLATFO-6159 - openlibm do not have math.h and complex.h, so we add them to openlibm (1)open menuconfig (2)close math.h:build setup->Customize Header Files->math.h (2) select openlibm:Library Rountines->Select math library->Math Library fram openlibm (3)build Signed-off-by: yanghuatao -Change-Id: I0bebef549c3ce7226a190d6a16a347f47014ad0b --- include/complex.h | 6 ++++++ include/math.h | 6 ++++++ diff --git a/libs/libm/openlibm/0003-nuttx-openlibm-Fix-openlibm-M_PI-undeclared-error.patch b/libs/libm/openlibm/0003-nuttx-openlibm-Fix-openlibm-M_PI-undeclared-error.patch index b4b73c804f7..555cbf03980 100644 --- a/libs/libm/openlibm/0003-nuttx-openlibm-Fix-openlibm-M_PI-undeclared-error.patch +++ b/libs/libm/openlibm/0003-nuttx-openlibm-Fix-openlibm-M_PI-undeclared-error.patch @@ -6,8 +6,6 @@ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -VELAPLATFO-28707 - CC: socket/net_timeo.c sensors/wtgahrs2_uorb.c: In function ‘wtgahrs2_gyro_data’: sensors/wtgahrs2_uorb.c:229:58: error: ‘M_PI’ undeclared (first use in this function) 229 | gyro.x = (short)(buffer[1] << 8 | buffer[0]) * (2000 * M_PI / 180 / 32768); @@ -17,7 +15,6 @@ make[1]: *** [Makefile:105: wtgahrs2_uorb.o] Error 1 make: *** [tools/LibTargets.mk:101: drivers/libdrivers.a] Error 2 make: *** Waiting for unfinished jobs.... -Change-Id: I01072f562fa6306db864cf4fa7c260c09751e0d1 Signed-off-by: yanghuatao --- include/openlibm_math.h | 4 ++++ diff --git a/libs/libnx/Makefile b/libs/libnx/Makefile index ba77144d62e..f9ab938f47e 100644 --- a/libs/libnx/Makefile +++ b/libs/libnx/Makefile @@ -241,13 +241,17 @@ depend: .depend # Generate configuration context -context: gensources +bin: + $(Q) mkdir $@ + +kbin: + $(Q) mkdir $@ + +context:: gensources bin kbin # Clean most derived files, retaining the configuration clean: - $(Q) $(MAKE) -C bin clean - $(Q) $(MAKE) -C kbin clean $(Q) $(MAKE) -C nxfonts -f Makefile.sources clean EXTRAFLAGS="$(EXTRAFLAGS)" $(call DELFILE, $(BIN)) $(call DELFILE, $(KBIN)) @@ -256,12 +260,10 @@ clean: # Deep clean -- removes all traces of the configuration distclean: clean - $(Q) $(MAKE) -C bin distclean - $(Q) $(MAKE) -C kbin distclean - $(Q) $(MAKE) -C nxfonts -f Makefile.sources distclean EXTRAFLAGS="$(EXTRAFLAGS)" - $(call DELFILE, bin/Make.dep) - $(call DELFILE, kbin/Make.dep) + $(call DELDIR, bin) + $(call DELDIR, kbin) $(call DELFILE, .depend) + $(Q) $(MAKE) -C nxfonts -f Makefile.sources distclean EXTRAFLAGS="$(EXTRAFLAGS)" -include bin/Make.dep -include kbin/Make.dep diff --git a/libs/libnx/bin/Makefile b/libs/libnx/bin/Makefile deleted file mode 100644 index f4d6b0eafb6..00000000000 --- a/libs/libnx/bin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# libs/libnx/bin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean diff --git a/libs/libnx/kbin/Makefile b/libs/libnx/kbin/Makefile deleted file mode 100644 index ee4d64c7a04..00000000000 --- a/libs/libnx/kbin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# libs/libnx/kbin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean diff --git a/libs/libxx/0001-Fix-build-error-about-__GLIBC__.patch b/libs/libxx/0001-Fix-build-error-about-__GLIBC__.patch new file mode 100644 index 00000000000..95d6ee09dff --- /dev/null +++ b/libs/libxx/0001-Fix-build-error-about-__GLIBC__.patch @@ -0,0 +1,17 @@ +diff --git libcxx/src/locale.cpp libcxx/src/locale.cpp +--- libcxx/src/locale.cpp ++++ libcxx/src/locale.cpp +@@ -41,6 +41,10 @@ + #include "include/atomic_support.h" + #include "include/sso_allocator.h" + ++#if defined(__NuttX__) && defined(__GLIBC__) ++# undef __GLIBC__ ++#endif ++ + // On Linux, wint_t and wchar_t have different signed-ness, and this causes + // lots of noise in the build log, but no bugs that I know of. + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wsign-conversion") +-- +2.34.1 + diff --git a/libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch b/libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch index 679dd8dbfe7..f07e83d8c93 100644 --- a/libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch +++ b/libs/libxx/0001-libcxxabi-Fix-build-warnings-generated-by-CMake-comp.patch @@ -7,8 +7,6 @@ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -VELAPLATFO-32782 - nuttx/libs/libxx/libcxxabi/src/cxa_personality.cpp: In function ‘void __cxxabiv1::__cxa_call_unexpected(void*)’: nuttx/libs/libxx/libcxxabi/src/cxa_personality.cpp:1250:46: warning: ‘ttypeIndex’ may be used uninitialized [-Wmaybe-uninitialized] 1250 | if (!exception_spec_can_catch(ttypeIndex, classInfo, ttypeEncoding, @@ -17,7 +15,6 @@ nuttx/libs/libxx/libcxxabi/src/cxa_personality.cpp:1250:46: warning: ‘ttypeInd | ~~~~~~~~~~~~~~~~~~~~~~ 1252 | unwind_exception, base)) -Change-Id: Ic114508ecdad7cc84e7ad997a9379e50b2efd2a5 Signed-off-by: cuiziwei --- src/cxa_personality.cpp | 2 +- diff --git a/libs/libxx/0001-uClibcxx-basic_definitions-fix-GCC-specific-definiti.patch b/libs/libxx/0001-uClibcxx-basic_definitions-fix-GCC-specific-definiti.patch index 5ca8181e811..88765a3d1d2 100644 --- a/libs/libxx/0001-uClibcxx-basic_definitions-fix-GCC-specific-definiti.patch +++ b/libs/libxx/0001-uClibcxx-basic_definitions-fix-GCC-specific-definiti.patch @@ -5,7 +5,6 @@ Subject: [PATCH 1/2] uClibcxx:basic_definitions: fix GCC-specific definitions gcc use __GNUC__ instead off __GCC__ -Change-Id: I63aeb2118f45a981653553c8a3721a9d9c7ccaaa --- include/basic_definitions | 4 ++-- include/cstddef | 2 +- diff --git a/libs/libxx/0001-uclibxx-use-overload-constructor-of-filebuf-ostream.patch b/libs/libxx/0001-uclibxx-use-overload-constructor-of-filebuf-ostream.patch index 1b98d13acbe..16da202c5eb 100644 --- a/libs/libxx/0001-uclibxx-use-overload-constructor-of-filebuf-ostream.patch +++ b/libs/libxx/0001-uclibxx-use-overload-constructor-of-filebuf-ostream.patch @@ -6,7 +6,6 @@ Subject: [PATCH] uclibxx: use overload constructor of filebuf & ostream Instead of set valiable in Init, use overload constructor in filebuf & stream class -Change-Id: I090432b5576eb568f92f3c147b39ad2efd8ba6b0 --- include/fstream | 15 +++++++-- include/ios | 21 +++--------- diff --git a/libs/libxx/0002-libcxxabi-fix-compilation-errors.patch b/libs/libxx/0002-libcxxabi-fix-compilation-errors.patch index 383541331e2..6881e77804c 100644 --- a/libs/libxx/0002-libcxxabi-fix-compilation-errors.patch +++ b/libs/libxx/0002-libcxxabi-fix-compilation-errors.patch @@ -9,7 +9,6 @@ error: invalid conversion from 'int' to '_Unwind_State' [-fpermissive] | | | int -Change-Id: I47827d58438f248e2171d20a44cc29ed8b259fc5 Signed-off-by: yinshengkai --- src/cxa_personality.cpp | 2 +- diff --git a/libs/libxx/Kconfig b/libs/libxx/Kconfig index 62618e15bb6..f2db4087cb1 100644 --- a/libs/libxx/Kconfig +++ b/libs/libxx/Kconfig @@ -136,4 +136,9 @@ config LIBCXX_VERSION depends on LIBCXX default "17.0.6" +config LIBCXX_TEST + bool "LLVM Libcxx Library Test" + depends on LIBCXX && CXX_EXCEPTION + default n + endif diff --git a/libs/libxx/libcxx.cmake b/libs/libxx/libcxx.cmake index 9b4c3fee88d..acdab9dec15 100644 --- a/libs/libxx/libcxx.cmake +++ b/libs/libxx/libcxx.cmake @@ -49,7 +49,9 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxx) ${CMAKE_CURRENT_LIST_DIR}/libcxx < ${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-remove-mach-time-h.patch && patch -p1 -d ${CMAKE_CURRENT_LIST_DIR}/libcxx < - ${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-fix-ld-errors.patch + ${CMAKE_CURRENT_LIST_DIR}/0001-libcxx-fix-ld-errors.patch && patch -p1 -d + ${CMAKE_CURRENT_LIST_DIR}/libcxx < + ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-build-error-about-__GLIBC__.patch DOWNLOAD_NO_PROGRESS true TIMEOUT 30) @@ -70,7 +72,9 @@ configure_file(${CMAKE_CURRENT_LIST_DIR}/__config_site set_property( TARGET nuttx APPEND - PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include/libcxx) + PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include/libcxx + ${CMAKE_CURRENT_LIST_DIR}/libcxx/test/support + ${CMAKE_CURRENT_LIST_DIR}/libcxx/src) add_compile_definitions(_LIBCPP_BUILDING_LIBRARY) if(CONFIG_LIBSUPCXX_TOOLCHAIN) @@ -81,13 +85,6 @@ if(CONFIG_LIBSUPCXX) add_compile_definitions(__GLIBCXX__) endif() -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS ON) - -set(SRCS) -set(SRCSTMP) - file(GLOB SRCS ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/*.cpp) file(GLOB SRCSTMP ${CMAKE_CURRENT_LIST_DIR}/libcxx/src/experimental/*.cpp) list(APPEND SRCS ${SRCSTMP}) @@ -121,3 +118,188 @@ target_sources(libcxx PRIVATE ${SRCS}) target_compile_options(libcxx PRIVATE ${FLAGS}) target_include_directories(libcxx BEFORE PRIVATE ${CMAKE_CURRENT_LIST_DIR}/libcxx/src) + +if(CONFIG_LIBCXX_TEST) + list( + APPEND + FLAGS + -Wno-array-bounds + -Wno-permissive + -Wno-unused-variable + -Wno-unused-but-set-variable + -Wno-psabi + -Wno-unused-local-typedefs + -Wno-unused-result + -Wno-unused-function + -Wno-undef + -Wno-return-type + -Wno-self-move + -Wno-class-memaccess + -Wno-tautological-compare + -Wno-narrowing + -Wno-use-after-free + -Wno-invalid-memory-model + -Wno-mismatched-new-delete) + add_compile_options(-UNDEBUG) + add_compile_definitions( + DISABLE_NEW_COUNT + _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE + _LIBCPP_ENABLE_DEBUG_MODE + _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS + _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR + _LIBCPP_ENABLE_CXX20_REMOVED_ALLOCATOR_MEMBERS + _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS + _LIBCPP_DISABLE_DEPRECATION_WARNINGS) + + set(i 0) + set(TEST_DIR "${CMAKE_CURRENT_LIST_DIR}/libcxx/test") + file(GLOB_RECURSE TESTS "${TEST_DIR}/*.pass.cpp") + file( + GLOB + UNSUPPORTED_TESTS + # error: ‘_wremove’ was not declared in this scope + ${TEST_DIR}/libcxx/input.output/file.streams/fstreams/ifstream.members/open_wchar_pointer.pass.cpp + ${TEST_DIR}/libcxx/input.output/file.streams/fstreams/ofstream.members/open_wchar_pointer.pass.cpp + ${TEST_DIR}/libcxx/input.output/file.streams/fstreams/ofstream.cons/wchar_pointer.pass.cpp + ${TEST_DIR}/libcxx/input.output/file.streams/fstreams/fstream.members/open_wchar_pointer.pass.cpp + ${TEST_DIR}/libcxx/input.output/file.streams/fstreams/fstream.cons/wchar_pointer.pass.cpp + # error: ‘x’ in ‘struct Foo’ does not name a type + ${TEST_DIR}/libcxx/selftest/compile.pass.cpp/compile-error.compile.pass.cpp + ${TEST_DIR}/libcxx/selftest/pass.cpp/compile-error.pass.cpp + ${TEST_DIR}/libcxx/selftest/link.pass.cpp/compile-error.link.pass.cpp + # error: ‘__sanitizer_verify_contiguous_container’ was not declared in this + # scope + ${TEST_DIR}/libcxx/containers/sequences/vector/asan.pass.cpp + # error: attributes are not allowed on a function-definition + ${TEST_DIR}/libcxx/thread/thread.mutex/thread_safety_requires_capability.pass.cpp + # fatal error: Block.h: No such file or directory + ${TEST_DIR}/libcxx/utilities/function.objects/func.blocks.pass.cpp + # link error + ${TEST_DIR}/libcxx/selftest/compile.pass.cpp/link-error.compile.pass.cpp + ${TEST_DIR}/libcxx/selftest/link.pass.cpp/link-error.link.pass.cpp + ${TEST_DIR}/libcxx/selftest/pass.cpp/link-error.pass.cpp + # std::views::join + ${TEST_DIR}/std/ranges/range.adaptors/range.join.view/adaptor.pass.cpp + ${TEST_DIR}/std/library/description/conventions/customization.point.object/cpo.compile.pass.cpp + ${TEST_DIR}/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.segmented.pass.cpp + ${TEST_DIR}/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy_backward.pass.cpp + # no build __partition_chunks + ${TEST_DIR}/libcxx/algorithms/pstl.libdispatch.chunk_partitions.pass.cpp + # REQUIRES: c++98 || c++03 || c++11 || c++14 + ${TEST_DIR}/std/containers/associative/multimap/multimap.value_compare/types.pass.cpp + ${TEST_DIR}/std/containers/associative/map/map.value_compare/types.pass.cpp + # std::result_of + ${TEST_DIR}/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp + ${TEST_DIR}/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp + ${TEST_DIR}/std/utilities/function.objects/func.invoke/invoke.pass.cpp + ${TEST_DIR}/std/utilities/function.objects/func.invoke/invoke_constexpr.pass.cpp + # WINT_MIN undef + ${TEST_DIR}/std/language.support/cstdint/cstdint.syn/cstdint.pass.cpp + ${TEST_DIR}/std/input.output/file.streams/c.files/cinttypes.pass.cpp + # static assertion failed + ${TEST_DIR}/std/language.support/support.runtime/cstdlib.pass.cpp + # error: static assertion failed: Types differ unexpectedly + ${TEST_DIR}/std/strings/c.strings/cstring.pass.cpp + ${TEST_DIR}/std/strings/c.strings/cwchar.pass.cpp + # error: ‘is_literal_type_v’ is not a member of ‘std’ + ${TEST_DIR}/std/utilities/meta/meta.unary/meta.unary.prop/is_literal_type.pass.cpp + ${TEST_DIR}/libcxx/containers/sequences/vector/asan.pass.cpp + # error: static assertion failed + ${TEST_DIR}/libcxx/utilities/utility/pairs/pairs.pair/non_trivial_copy_move_ABI.pass.cpp + # unsport c++20 + ${TEST_DIR}/std/utilities/memory/default.allocator/allocator_types.void.compile.pass.cpp + ${TEST_DIR}/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.const/auto_ptr.pass.cpp + ${TEST_DIR}/std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.assign/auto_ptr_Y.pass.cpp + ${TEST_DIR}/std/utilities/utility/pairs/pairs.pair/assign_pair_cxx03.pass.cpp + ${TEST_DIR}/std/utilities/function.objects/func.require/binary_function.pass.cpp + ${TEST_DIR}/std/utilities/function.objects/func.require/unary_function.pass.cpp + ${TEST_DIR}/std/utilities/function.objects/refwrap/weak_result.pass.cpp + ${TEST_DIR}/std/utilities/function.objects/refwrap/binder_typedefs.compile.pass.cpp + ${TEST_DIR}/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array11.pass.cpp + ${TEST_DIR}/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete11.pass.cpp + # arm build error + ${TEST_DIR}/std/numerics/cfenv/cfenv.syn/cfenv.pass.cpp + ${TEST_DIR}/std/utilities/format/format.formatter/format.formatter.spec/formatter.floating_point.pass.cpp + ${TEST_DIR}/std/localization/locales/locale.convenience/conversions/conversions.buffer/seekoff.pass.cpp + ) + + file( + GLOB_RECURSE + SKIP_TESTS + ${TEST_DIR}/libcxx/containers/views/mdspan/*.pass.cpp + ${TEST_DIR}/libcxx/input.output/iostream.format/print.fun/*.pass.cpp + ${TEST_DIR}/libcxx/ranges/range.factories/range.repeat.view/*.pass.cpp + ${TEST_DIR}/libcxx/utilities/expected/*.pass.cpp + # skip deprecated test + ${TEST_DIR}/libcxx/depr/*.pass.cpp + ${TEST_DIR}/std/depr/*.pass.cpp + ${TEST_DIR}/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/*.pass.cpp + # arm atomic undef + ${TEST_DIR}/std/atomics/atomics.types.operations/atomics.types.operations.req/*.pass.cpp + ${TEST_DIR}/std/atomics/atomics.types.operations/atomics.types.operations.wait/*.pass.cpp + ) + list(REMOVE_ITEM TESTS ${UNSUPPORTED_TESTS} ${SKIP_TESTS}) + foreach(TEST ${TESTS}) + if(EXISTS ${TEST}) + set(GREP_PATTERNS + "UNSUPPORTED: c++03, c++11, c++14, c++17, c++20" + "TEST_LIBCPP_ASSERT_FAILURE" + "static_assert(test" + "UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME" + "UNSUPPORTED: gcc" + "include " + "std::ranges::join_view" + "std::binary_function" + "std::unary_function" + "std::binary_negate" + "std::not1" + "std::not2" + "std::unary_negate" + "std::raw_storage_iterator" + "void operator delete" + "filesystem_test_helper.h" + "asan_testing.h") + + set(SKIP_TEST FALSE) + + foreach(PATTERN IN LISTS GREP_PATTERNS) + execute_process(COMMAND grep -q "${PATTERN}" ${TEST} + RESULT_VARIABLE grep_result) + + if(grep_result EQUAL 0) + set(SKIP_TEST TRUE) + break() + endif() + endforeach() + + if(SKIP_TEST) + continue() + endif() + + execute_process(COMMAND grep -q "int main" ${TEST} + RESULT_VARIABLE grep_result) + if(NOT grep_result EQUAL 0) + continue() + endif() + + get_filename_component(TEST_NAME ${TEST} NAME_WE) + foreach(CHARACTER "+" "-" "=" "[]") + string(REPLACE "${CHARACTER}" "_" TEST_NAME "${TEST_NAME}") + endforeach() + + nuttx_add_application( + NAME + ${TEST_NAME}_${i} + SRCS + ${TEST} + STACKSIZE + 102400 + COMPILE_FLAGS + ${FLAGS}) + set_source_files_properties( + ${TEST_DIR}/libcxx/containers/sequences/vector/exception_safety_exceptions_disabled.pass.cpp + PROPERTIES COMPILE_FLAGS -fno-exceptions) + math(EXPR i "${i}+1") + endif() + endforeach() +endif() diff --git a/libs/libxx/libcxx.defs b/libs/libxx/libcxx.defs index 717af3489e6..192a6734a1e 100644 --- a/libs/libxx/libcxx.defs +++ b/libs/libxx/libcxx.defs @@ -35,6 +35,7 @@ libcxx: libcxx-$(LIBCXX_VERSION).src.tar.xz $(Q) patch -p2 < mbstate_t.patch $(Q) patch -p0 < 0001-libcxx-remove-mach-time-h.patch $(Q) patch -p0 < 0001-libcxx-fix-ld-errors.patch + $(Q) patch -p0 < 0001-Fix-build-error-about-__GLIBC__.patch $(Q) touch $@ endif diff --git a/libs/libxx/libcxxabi.cmake b/libs/libxx/libcxxabi.cmake index 078d35df9ee..c632a6123c7 100644 --- a/libs/libxx/libcxxabi.cmake +++ b/libs/libxx/libcxxabi.cmake @@ -52,16 +52,16 @@ if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/libcxxabi) endif() endif() +nuttx_create_symlink(${CMAKE_CURRENT_LIST_DIR}/libcxxabi/include + ${CMAKE_BINARY_DIR}/include/libcxxabi) + set_property( TARGET nuttx APPEND - PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES - ${CMAKE_CURRENT_LIST_DIR}/libcxxabi/include) + PROPERTY NUTTX_CXX_INCLUDE_DIRECTORIES ${CMAKE_BINARY_DIR}/include/libcxxabi) nuttx_add_system_library(libcxxabi) -set(SRCS) - # C++ABI files list( APPEND @@ -91,8 +91,6 @@ if(CONFIG_LIBCXXABI) add_compile_definitions(LIBCXX_BUILDING_LIBCXXABI) endif() -set(TARGET_SRCS) - foreach(src ${SRCS}) string(PREPEND src libcxxabi/src/) list(APPEND TARGET_SRCS ${src}) diff --git a/libs/libxx/libcxxmini.cmake b/libs/libxx/libcxxmini.cmake index 91c9b321c0a..030ff377e78 100644 --- a/libs/libxx/libcxxmini.cmake +++ b/libs/libxx/libcxxmini.cmake @@ -35,7 +35,9 @@ target_sources( libcxxmini/libxx_deletea.cxx libcxxmini/libxx_deletea_sized.cxx libcxxmini/libxx_new.cxx - libcxxmini/libxx_newa.cxx) + libcxxmini/libxx_newa.cxx + libxx_dynamic_cast.cxx + libxx_typeinfo.cxx) # Why c++14? * libcxx seems to require c++11. * The compiler defaults varies: # clang/macOS (from xcode): 199711L gcc/ubuntu: 201402L * There is diff --git a/libs/libxx/libcxxmini.defs b/libs/libxx/libcxxmini.defs index a9394695b92..c21441fd2bb 100644 --- a/libs/libxx/libcxxmini.defs +++ b/libs/libxx/libcxxmini.defs @@ -23,6 +23,7 @@ CXXSRCS += libxx_cxa_guard.cxx libxx_cxapurevirtual.cxx CXXSRCS += libxx_delete.cxx libxx_delete_sized.cxx libxx_deletea.cxx CXXSRCS += libxx_deletea_sized.cxx libxx_new.cxx libxx_newa.cxx +CXXSRCS += libxx_dynamic_cast.cxx libxx_typeinfo.cxx ifneq ($(CONFIG_XTENSA_TOOLCHAIN_XCC), y) CXXFLAGS += -Wno-missing-exception-spec diff --git a/libs/libxx/libcxxmini/libxx_dynamic_cast.cxx b/libs/libxx/libcxxmini/libxx_dynamic_cast.cxx new file mode 100644 index 00000000000..046dea07229 --- /dev/null +++ b/libs/libxx/libcxxmini/libxx_dynamic_cast.cxx @@ -0,0 +1,182 @@ +/**************************************************************************** + * libs/libxx/libcxxmini/libxx_dynamic_cast.cxx + * + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "libxx_typeinfo.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +using namespace __cxxabiv1; + +#define ADD_TO_PTR(x, off) \ + reinterpret_cast<__typeof__(x)>(reinterpret_cast(x) + off) + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +struct vtable_header +{ + /* Offset of the leaf object. */ + + ptrdiff_t leaf_offset; + + /* Type of the object. */ + + const __class_type_info *type; +}; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +bool std::type_info::__do_catch(std::type_info const *ex_type, + void **exception_object, + unsigned int outer) const +{ + const type_info *type = this; + + if (type == ex_type) + { + return true; + } + +#ifdef CONFIG_CXX_RTTI + if (const __class_type_info *cti = dynamic_cast(type)) + { + return ex_type->__do_upcast(cti, exception_object); + } +#endif + + return false; +} + +void *__class_type_info::cast_to( + void *obj, const struct __class_type_info *other) const +{ + if (this == other) + { + return obj; + } + return 0; +} + +void *__si_class_type_info::cast_to( + void *obj, const struct __class_type_info *other) const +{ + if (this == other) + { + return obj; + } + return __base_type->cast_to(obj, other); +} + +bool __si_class_type_info::__do_upcast(const __class_type_info *target, + void **thrown_object) const +{ + if (this == target) + { + return true; + } + return __base_type->__do_upcast(target, thrown_object); +} + +void *__vmi_class_type_info::cast_to( + void *obj, const struct __class_type_info *other) const +{ + if (__do_upcast(other, &obj)) + { + return obj; + } + return 0; +} + +bool __vmi_class_type_info::__do_upcast(const __class_type_info *target, + void **thrown_object) const +{ + if (this == target) + { + return true; + } + for (unsigned int i=0 ; i<__base_count ; i++) + { + const __base_class_type_info *info = &__base_info[i]; + ptrdiff_t offset = info->offset(); + + /* If this is a virtual superclass, the offset is stored in the + * object's vtable at the offset requested; 2.9.5.6.c: + * + * 'For a non-virtual base, this is the offset in the object of the + * base subobject. For a virtual base, this is the offset in the + * virtual table of the virtual base offset for the virtual base + * referenced (negative).' + */ + + void *obj = *thrown_object; + if (info->is_virtual()) + { + // Object's vtable + ptrdiff_t *off = *static_cast(obj); + // Offset location in vtable + off = ADD_TO_PTR(off, offset); + offset = *off; + } + void *cast = ADD_TO_PTR(obj, offset); + + if (info->__base_type == target || + (info->__base_type->__do_upcast(target, &cast))) + { + *thrown_object = cast; + return true; + } + } + return 0; +} + +#ifdef CONFIG_CXX_RTTI +extern "C" void* __dynamic_cast(const void *sub, + const __class_type_info *src, + const __class_type_info *dst, + ptrdiff_t src2dst_offset) +{ + const char *vtable_location = *static_cast(sub); + const vtable_header *header = + reinterpret_cast(vtable_location - sizeof(vtable_header)); + void *leaf = ADD_TO_PTR(const_cast(sub), header->leaf_offset); + return header->type->cast_to(leaf, dst); +} +#endif diff --git a/libs/libxx/libcxxmini/libxx_typeinfo.cxx b/libs/libxx/libcxxmini/libxx_typeinfo.cxx new file mode 100644 index 00000000000..662dcad790c --- /dev/null +++ b/libs/libxx/libcxxmini/libxx_typeinfo.cxx @@ -0,0 +1,83 @@ +/**************************************************************************** + * libs/libxx/libcxxmini/libxx_typeinfo.cxx + * + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include "libxx_typeinfo.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +using std::type_info; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +type_info::~type_info() {} + +bool type_info::operator==(const type_info &other) const +{ + return __type_name == other.__type_name; +} + +bool type_info::operator!=(const type_info &other) const +{ + return __type_name != other.__type_name; +} + +bool type_info::before(const type_info &other) const +{ + return __type_name < other.__type_name; +} + +const char* type_info::name() const +{ + return __type_name; +} + +type_info::type_info (const type_info& rhs) +{ + __type_name = rhs.__type_name; +} + +type_info& type_info::operator= (const type_info& rhs) +{ + return *new type_info(rhs); +} + +__cxxabiv1::__class_type_info::~__class_type_info() {} +__cxxabiv1::__si_class_type_info::~__si_class_type_info() {} +__cxxabiv1::__vmi_class_type_info::~__vmi_class_type_info() {} diff --git a/libs/libxx/libcxxmini/libxx_typeinfo.h b/libs/libxx/libcxxmini/libxx_typeinfo.h new file mode 100644 index 00000000000..8feb10ed9fc --- /dev/null +++ b/libs/libxx/libcxxmini/libxx_typeinfo.h @@ -0,0 +1,273 @@ +/**************************************************************************** + * libs/libxx/libcxxmini/libxx_typeinfo.h + * + * Copyright 2010-2011 PathScale, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS + * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef _LIBCPPMINI_TYPEINFO_H +#define _LIBCPPMINI_TYPEINFO_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +namespace __cxxabiv1 +{ + struct __class_type_info; +} + +namespace std +{ + /* Standard type info class. The layout of this class is specified by the + * ABI. The layout of the vtable is not, but is intended to be + * compatible with the GNU ABI. + * + * Unlike the GNU version, the vtable layout is considered semi-private. + */ + + class type_info + { + public: + + /* Virtual destructor. This class must have one virtual function to + * ensure that it has a vtable. + */ + + virtual ~type_info(); + bool operator == (const type_info &rhs) const; + bool operator != (const type_info &rhs) const; + bool before(const type_info &rhs) const; + const char *name() const; + type_info(); + private: + type_info(const type_info &rhs); + type_info &operator = (const type_info &rhs); + const char *__type_name; + + /* The following functions are in this order to match the + * vtable layout of libsupc++. This allows libcxxrt to be used + * with libraries that depend on this. + * + * These functions are in the public headers for libstdc++, so + * we have to assume that someone will probably call them and + * expect them to work. Their names must also match the names used in + * libsupc++, so that code linking against this library can subclass + * type_info and correctly fill in the values in the vtables. + */ + + public: + + /* Returns true if this is some pointer type, false otherwise. */ + + virtual bool __is_pointer_p() const + { + return false; + } + + /* Returns true if this is some function type, false otherwise. */ + + virtual bool __is_function_p() const + { + return false; + } + + /* Catch function. Allows external libraries to implement + * their own basic types. This is used, for example, in the + * GNUstep Objective-C runtime to allow Objective-C types to be + * caught in G++ catch blocks. + * + * The outer parameter indicates the number of outer pointers + * in the high bits. The low bit indicates whether the + * pointers are const qualified. + */ + + virtual bool __do_catch(const type_info *thrown_type, + void **thrown_object, + unsigned outer) const; + + /* Performs an upcast. This is used in exception handling to + * cast from subclasses to superclasses. If the upcast is + * possible, it returns true and adjusts the pointer. If the + * upcast is not possible, it returns false and does not adjust + * the pointer. + */ + + virtual bool __do_upcast( + const __cxxabiv1::__class_type_info *target, + void **thrown_object) const + { + return false; + } + }; +} + +namespace __cxxabiv1 +{ + /* Base class for class type info. Used only for tentative definitions. */ + + struct __class_type_info : public std::type_info + { + virtual ~__class_type_info(); + + /* Function implementing dynamic casts. */ + + virtual void *cast_to( + void *obj, const struct __class_type_info *other) const; + virtual bool __do_upcast(const __class_type_info *target, + void **thrown_object) const + { + return this == target; + } + }; + + /* Single-inheritance class type info. This is used for classes containing + * a single non-virtual base class at offset 0. + */ + + struct __si_class_type_info : public __class_type_info + { + virtual ~__si_class_type_info(); + const __class_type_info *__base_type; + virtual bool __do_upcast( + const __cxxabiv1::__class_type_info *target, + void **thrown_object) const; + virtual void *cast_to( + void *obj, const struct __class_type_info *other) const; + }; + + /* Type info for base classes. Classes with multiple bases store an array + * of these, one for each superclass. + */ + + struct __base_class_type_info + { + const __class_type_info *__base_type; + private: + + /* The high __offset_shift bits of this store the (signed) offset + * of the base class. The low bits store flags from + * __offset_flags_masks. + */ + + long __offset_flags; + + /* Flags used in the low bits of __offset_flags. */ + + enum __offset_flags_masks + { + /* This base class is virtual. */ + + __virtual_mask = 0x1, + + /* This base class is public. */ + + __public_mask = 0x2, + + /* The number of bits reserved for flags. */ + + __offset_shift = 8 + }; + public: + + /* Returns the offset of the base class. */ + + long offset() const + { + return __offset_flags >> __offset_shift; + } + + /* Returns the flags. */ + + long flags() const + { + return __offset_flags & ((1 << __offset_shift) - 1); + } + + /* Returns whether this is a public base class. */ + + bool is_public() const + { + return flags() & __public_mask; + } + + /* Returns whether this is a virtual base class. */ + + bool is_virtual() const + { + return flags() & __virtual_mask; + } + }; + + /* Type info for classes with virtual bases or multiple superclasses. */ + + struct __vmi_class_type_info : public __class_type_info + { + virtual ~__vmi_class_type_info(); + + /* Flags describing this class. Contains values from __flags_masks. */ + + unsigned int __flags; + + /* The number of base classes. */ + + unsigned int __base_count; + +/* Array of base classes - this actually has __base_count elements, not + * 1. + */ + + __base_class_type_info __base_info[1]; + + /* Flags used in the __flags field. */ + + enum __flags_masks + { + /* The class has non-diamond repeated inheritance. */ + + __non_diamond_repeat_mask = 0x1, + + /* The class is diamond shaped. */ + + __diamond_shaped_mask = 0x2 + }; + virtual bool __do_upcast( + const __cxxabiv1::__class_type_info *target, + void **thrown_object) const; + virtual void *cast_to( + void *obj, const struct __class_type_info *other) const; + }; +} + +#endif /* _LIBCPPMINI_TYPEINFO_H */ diff --git a/mm/Makefile b/mm/Makefile index 4b03bf6a96d..53eb8bd72d2 100644 --- a/mm/Makefile +++ b/mm/Makefile @@ -91,7 +91,13 @@ endif # Dependencies -context:: +bin: + $(Q) mkdir $@ + +kbin: + $(Q) mkdir $@ + +context:: bin kbin makedepfile: $(CSRCS:.c=.ddc) $(ASRCS:.S=.dds) $(call CATFILE, bin/Make.dep, $^) @@ -113,8 +119,6 @@ depend: .depend # Clean most derived files, retaining the configuration clean: - $(Q) $(MAKE) -C bin clean - $(Q) $(MAKE) -C kbin clean $(call DELFILE, $(BIN)) $(call DELFILE, $(KBIN)) $(call CLEAN) @@ -122,10 +126,8 @@ clean: # Deep clean -- removes all traces of the configuration distclean:: clean - $(Q) $(MAKE) -C bin distclean - $(Q) $(MAKE) -C kbin distclean - $(call DELFILE, bin$(DELIM)Make.dep) - $(call DELFILE, kbin$(DELIM)Make.dep) + $(call DELDIR, bin) + $(call DELDIR, kbin) $(call DELFILE, .depend) -include bin$(DELIM)Make.dep diff --git a/mm/bin/Makefile b/mm/bin/Makefile deleted file mode 100644 index c391c25f1ce..00000000000 --- a/mm/bin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# mm/bin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean diff --git a/mm/iob/iob.h b/mm/iob/iob.h index d5fe93dc919..e63dc081554 100644 --- a/mm/iob/iob.h +++ b/mm/iob/iob.h @@ -33,6 +33,7 @@ #include #include +#include #ifdef CONFIG_MM_IOB @@ -76,14 +77,29 @@ extern FAR struct iob_qentry_s *g_iob_qcommitted; /* Counting semaphores that tracks the number of free IOBs/qentries */ -extern sem_t g_iob_sem; /* Counts free I/O buffers */ +extern sem_t g_iob_sem; + +/* Counts free I/O buffers */ + +extern volatile int16_t g_iob_count; + #if CONFIG_IOB_THROTTLE > 0 -extern sem_t g_throttle_sem; /* Counts available I/O buffers when throttled */ +extern sem_t g_throttle_sem; + +/* Counts available I/O buffers when throttled */ + +extern volatile int16_t g_throttle_count; #endif #if CONFIG_IOB_NCHAINS > 0 -extern sem_t g_qentry_sem; /* Counts free I/O buffer queue containers */ +extern sem_t g_qentry_sem; + +/* Counts free I/O buffer queue containers */ + +extern volatile int16_t g_qentry_count; #endif +extern volatile spinlock_t g_iob_lock; + /**************************************************************************** * Public Function Prototypes ****************************************************************************/ diff --git a/mm/iob/iob_add_queue.c b/mm/iob/iob_add_queue.c index 38a641d0232..7d0d1538650 100644 --- a/mm/iob/iob_add_queue.c +++ b/mm/iob/iob_add_queue.c @@ -63,7 +63,6 @@ static int iob_add_queue_internal(FAR struct iob_s *iob, qentry->qe_flink = NULL; - irqstate_t flags = enter_critical_section(); if (!iobq->qh_head) { iobq->qh_head = qentry; @@ -76,8 +75,6 @@ static int iob_add_queue_internal(FAR struct iob_s *iob, iobq->qh_tail = qentry; } - leave_critical_section(flags); - return 0; } diff --git a/mm/iob/iob_alloc.c b/mm/iob/iob_alloc.c index 42cafee97cd..d3768173d00 100644 --- a/mm/iob/iob_alloc.c +++ b/mm/iob/iob_alloc.c @@ -78,7 +78,7 @@ static FAR struct iob_s *iob_alloc_committed(void) * to protect the committed list: We disable interrupts very briefly. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_iob_lock); /* Take the I/O buffer from the head of the committed list */ @@ -97,10 +97,82 @@ static FAR struct iob_s *iob_alloc_committed(void) iob->io_pktlen = 0; /* Total length of the packet */ } - leave_critical_section(flags); + spin_unlock_irqrestore(&g_iob_lock, flags); return iob; } +static FAR struct iob_s *iob_tryalloc_internal(bool throttled) +{ + FAR struct iob_s *iob; +#if CONFIG_IOB_THROTTLE > 0 + int16_t count; +#endif + +#if CONFIG_IOB_THROTTLE > 0 + /* Select the count to check. */ + + count = (throttled ? g_throttle_count : g_iob_count); +#endif + + /* We don't know what context we are called from so we use extreme measures + * to protect the free list: We disable interrupts very briefly. + */ + +#if CONFIG_IOB_THROTTLE > 0 + /* If there are free I/O buffers for this allocation */ + + if (count > 0) +#endif + { + /* Take the I/O buffer from the head of the free list */ + + iob = g_iob_freelist; + if (iob != NULL) + { + /* Remove the I/O buffer from the free list and decrement the + * counting semaphore(s) that tracks the number of available + * IOBs. + */ + + g_iob_freelist = iob->io_flink; + + /* Take a semaphore count. Note that we cannot do this in + * in the orthodox way by calling nxsem_wait() or nxsem_trywait() + * because this function may be called from an interrupt + * handler. Fortunately we know at at least one free buffer + * so a simple decrement is all that is needed. + */ + + g_iob_count--; + DEBUGASSERT(g_iob_count >= 0); + +#if CONFIG_IOB_THROTTLE > 0 + /* The throttle semaphore is used to throttle the number of + * free buffers that are available. It is used to prevent + * the overrunning of the free buffer list. Please note that + * it can only be decremented to zero, which indicates no + * throttled buffers are available. + */ + + if (g_throttle_count > 0) + { + g_throttle_count--; + } +#endif + + /* Put the I/O buffer in a known state */ + + iob->io_flink = NULL; /* Not in a chain */ + iob->io_len = 0; /* Length of the data in the entry */ + iob->io_offset = 0; /* Offset to the beginning of data */ + iob->io_pktlen = 0; /* Total length of the packet */ + return iob; + } + } + + return NULL; +} + /**************************************************************************** * Name: iob_allocwait * @@ -113,6 +185,7 @@ static FAR struct iob_s *iob_alloc_committed(void) static FAR struct iob_s *iob_allocwait(bool throttled, unsigned int timeout) { FAR struct iob_s *iob; + FAR volatile int16_t *count; irqstate_t flags; FAR sem_t *sem; clock_t start; @@ -121,8 +194,10 @@ static FAR struct iob_s *iob_allocwait(bool throttled, unsigned int timeout) #if CONFIG_IOB_THROTTLE > 0 /* Select the semaphore count to check. */ + count = (throttled ? &g_throttle_count : &g_iob_count); sem = (throttled ? &g_throttle_sem : &g_iob_sem); #else + count = &g_iob_count; sem = &g_iob_sem; #endif @@ -132,15 +207,14 @@ static FAR struct iob_s *iob_allocwait(bool throttled, unsigned int timeout) * we are waiting for I/O buffers to become free. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_iob_lock); /* Try to get an I/O buffer. If successful, the semaphore count will be * decremented atomically. */ - start = clock_systime_ticks(); - iob = iob_tryalloc(throttled); - while (ret == OK && iob == NULL) + iob = iob_tryalloc_internal(throttled); + if (iob == NULL) { /* If not successful, then the semaphore count was less than or equal * to zero (meaning that there are no free buffers). We need to wait @@ -148,12 +222,17 @@ static FAR struct iob_s *iob_allocwait(bool throttled, unsigned int timeout) * list. */ + (*count)--; + + spin_unlock_irqrestore(&g_iob_lock, flags); + if (timeout == UINT_MAX) { ret = nxsem_wait_uninterruptible(sem); } else { + start = clock_systime_ticks(); ret = nxsem_tickwait_uninterruptible(sem, iob_allocwait_gettimeout(start, timeout)); } @@ -165,10 +244,13 @@ static FAR struct iob_s *iob_allocwait(bool throttled, unsigned int timeout) */ iob = iob_alloc_committed(); + DEBUGASSERT(iob != NULL); } + + return iob; } - leave_critical_section(flags); + spin_unlock_irqrestore(&g_iob_lock, flags); return iob; } @@ -250,78 +332,15 @@ FAR struct iob_s *iob_tryalloc(bool throttled) { FAR struct iob_s *iob; irqstate_t flags; -#if CONFIG_IOB_THROTTLE > 0 - FAR sem_t *sem; -#endif - -#if CONFIG_IOB_THROTTLE > 0 - /* Select the semaphore count to check. */ - - sem = (throttled ? &g_throttle_sem : &g_iob_sem); -#endif /* We don't know what context we are called from so we use extreme measures * to protect the free list: We disable interrupts very briefly. */ - flags = enter_critical_section(); - -#if CONFIG_IOB_THROTTLE > 0 - /* If there are free I/O buffers for this allocation */ - - if (sem->semcount > 0) -#endif - { - /* Take the I/O buffer from the head of the free list */ - - iob = g_iob_freelist; - if (iob != NULL) - { - /* Remove the I/O buffer from the free list and decrement the - * counting semaphore(s) that tracks the number of available - * IOBs. - */ - - g_iob_freelist = iob->io_flink; - - /* Take a semaphore count. Note that we cannot do this in - * in the orthodox way by calling nxsem_wait() or nxsem_trywait() - * because this function may be called from an interrupt - * handler. Fortunately we know at at least one free buffer - * so a simple decrement is all that is needed. - */ - - g_iob_sem.semcount--; - DEBUGASSERT(g_iob_sem.semcount >= 0); - -#if CONFIG_IOB_THROTTLE > 0 - /* The throttle semaphore is used to throttle the number of - * free buffers that are available. It is used to prevent - * the overrunning of the free buffer list. Please note that - * it can only be decremented to zero, which indicates no - * throttled buffers are available. - */ - - if (g_throttle_sem.semcount > 0) - { - g_throttle_sem.semcount--; - } -#endif - - leave_critical_section(flags); - - /* Put the I/O buffer in a known state */ - - iob->io_flink = NULL; /* Not in a chain */ - iob->io_len = 0; /* Length of the data in the entry */ - iob->io_offset = 0; /* Offset to the beginning of data */ - iob->io_pktlen = 0; /* Total length of the packet */ - return iob; - } - } - - leave_critical_section(flags); - return NULL; + flags = spin_lock_irqsave(&g_iob_lock); + iob = iob_tryalloc_internal(throttled); + spin_unlock_irqrestore(&g_iob_lock, flags); + return iob; } #ifdef CONFIG_IOB_ALLOC diff --git a/mm/iob/iob_alloc_qentry.c b/mm/iob/iob_alloc_qentry.c index 82c8393c446..b2f682ddd37 100644 --- a/mm/iob/iob_alloc_qentry.c +++ b/mm/iob/iob_alloc_qentry.c @@ -59,7 +59,7 @@ static FAR struct iob_qentry_s *iob_alloc_qcommitted(void) * to protect the committed list: We disable interrupts very briefly. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_iob_lock); /* Take the I/O buffer from the head of the committed list */ @@ -75,7 +75,43 @@ static FAR struct iob_qentry_s *iob_alloc_qcommitted(void) iobq->qe_head = NULL; /* Nothing is contained */ } - leave_critical_section(flags); + spin_unlock_irqrestore(&g_iob_lock, flags); + return iobq; +} + +static FAR struct iob_qentry_s *iob_tryalloc_qentry_internal(void) +{ + FAR struct iob_qentry_s *iobq; + + /* We don't know what context we are called from so we use extreme measures + * to protect the free list: We disable interrupts very briefly. + */ + + iobq = g_iob_freeqlist; + if (iobq) + { + /* Remove the I/O buffer chain container from the free list and + * decrement the counting semaphore that tracks the number of free + * containers. + */ + + g_iob_freeqlist = iobq->qe_flink; + + /* Take a semaphore count. Note that we cannot do this in + * in the orthodox way by calling nxsem_wait() or nxsem_trywait() + * because this function may be called from an interrupt + * handler. Fortunately we know at at least one free buffer + * so a simple decrement is all that is needed. + */ + + g_qentry_count--; + DEBUGASSERT(g_qentry_count >= 0); + + /* Put the I/O buffer in a known state */ + + iobq->qe_head = NULL; /* Nothing is contained */ + } + return iobq; } @@ -101,14 +137,14 @@ static FAR struct iob_qentry_s *iob_allocwait_qentry(void) * re-enabled while we are waiting for I/O buffers to become free. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_iob_lock); /* Try to get an I/O buffer chain container. If successful, the semaphore * count will bedecremented atomically. */ - qentry = iob_tryalloc_qentry(); - while (ret == OK && qentry == NULL) + qentry = iob_tryalloc_qentry_internal(); + if (qentry == NULL) { /* If not successful, then the semaphore count was less than or equal * to zero (meaning that there are no free buffers). We need to wait @@ -116,6 +152,8 @@ static FAR struct iob_qentry_s *iob_allocwait_qentry(void) * semaphore count will be incremented. */ + g_qentry_count--; + spin_unlock_irqrestore(&g_iob_lock, flags); ret = nxsem_wait_uninterruptible(&g_qentry_sem); if (ret >= 0) { @@ -127,26 +165,13 @@ static FAR struct iob_qentry_s *iob_allocwait_qentry(void) qentry = iob_alloc_qcommitted(); DEBUGASSERT(qentry != NULL); - - if (qentry == NULL) - { - /* This should not fail, but we allow for that possibility to - * handle any potential, non-obvious race condition. Perhaps - * the free IOB ended up in the g_iob_free list? - * - * We need release our count so that it is available to - * iob_tryalloc(), perhaps allowing another thread to take our - * count. In that event, iob_tryalloc() will fail above and - * we will have to wait again. - */ - - nxsem_post(&g_qentry_sem); - qentry = iob_tryalloc_qentry(); - } } + + return qentry; } - leave_critical_section(flags); + spin_unlock_irqrestore(&g_iob_lock, flags); + return qentry; } @@ -201,33 +226,9 @@ FAR struct iob_qentry_s *iob_tryalloc_qentry(void) * to protect the free list: We disable interrupts very briefly. */ - flags = enter_critical_section(); - iobq = g_iob_freeqlist; - if (iobq) - { - /* Remove the I/O buffer chain container from the free list and - * decrement the counting semaphore that tracks the number of free - * containers. - */ - - g_iob_freeqlist = iobq->qe_flink; - - /* Take a semaphore count. Note that we cannot do this in - * in the orthodox way by calling nxsem_wait() or nxsem_trywait() - * because this function may be called from an interrupt - * handler. Fortunately we know at at least one free buffer - * so a simple decrement is all that is needed. - */ - - g_qentry_sem.semcount--; - DEBUGASSERT(g_qentry_sem.semcount >= 0); - - /* Put the I/O buffer in a known state */ - - iobq->qe_head = NULL; /* Nothing is contained */ - } - - leave_critical_section(flags); + flags = spin_lock_irqsave(&g_iob_lock); + iobq = iob_tryalloc_qentry_internal(); + spin_unlock_irqrestore(&g_iob_lock, flags); return iobq; } diff --git a/mm/iob/iob_free.c b/mm/iob/iob_free.c index cec01c82954..bf506c1d0ba 100644 --- a/mm/iob/iob_free.c +++ b/mm/iob/iob_free.c @@ -83,9 +83,6 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob) #ifdef CONFIG_IOB_NOTIFIER int16_t navail; #endif -#if CONFIG_IOB_THROTTLE > 0 - bool committed_thottled = false; -#endif iobinfo("iob=%p io_pktlen=%u io_len=%u next=%p\n", iob, iob->io_pktlen, iob->io_len, next); @@ -135,7 +132,7 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob) * interrupts very briefly. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_iob_lock); /* Which list? If there is a task waiting for an IOB, then put * the IOB on either the free list or on the committed list where @@ -145,80 +142,58 @@ FAR struct iob_s *iob_free(FAR struct iob_s *iob) */ #if CONFIG_IOB_THROTTLE > 0 - if ((g_iob_sem.semcount < 0) || - ((g_iob_sem.semcount >= CONFIG_IOB_THROTTLE) && - (g_throttle_sem.semcount < 0))) + if ((g_iob_count < 0) || + ((g_iob_count >= CONFIG_IOB_THROTTLE) && + (g_throttle_count < 0))) #else - if (g_iob_sem.semcount < 0) + if (g_iob_count < 0) #endif { + FAR sem_t *sem; + iob->io_flink = g_iob_committed; g_iob_committed = iob; + #if CONFIG_IOB_THROTTLE > 0 - if ((g_iob_sem.semcount >= CONFIG_IOB_THROTTLE) && - (g_throttle_sem.semcount < 0)) + if (g_iob_count < 0) { - committed_thottled = true; + g_iob_count++; + sem = &g_iob_sem; } + else + { + g_throttle_count++; + sem = &g_throttle_sem; + } +#else + g_iob_count++; + sem = &g_iob_sem; #endif + spin_unlock_irqrestore(&g_iob_lock, flags); + nxsem_post(sem); } else { + g_iob_count++; +#if CONFIG_IOB_THROTTLE > 0 + if (g_iob_count > CONFIG_IOB_THROTTLE) + { + g_throttle_count++; + } +#endif + iob->io_flink = g_iob_freelist; g_iob_freelist = iob; + spin_unlock_irqrestore(&g_iob_lock, flags); } - leave_critical_section(flags); - - /* Signal that an IOB is available. This is done with schedule locked - * to make sure that both g_iob_sem and g_throttle_sem are incremented - * together (if applicable). After the schedule is unlocked, if there - * is a thread blocked, waiting for an IOB, this will wake up exactly - * one thread. The semaphore count will correctly indicate that the - * awakened task owns an IOB and should find it in the committed list. - */ - - sched_lock(); - - nxsem_post(&g_iob_sem); - DEBUGASSERT(g_iob_sem.semcount <= CONFIG_IOB_NBUFFERS); + DEBUGASSERT(g_iob_count <= CONFIG_IOB_NBUFFERS); #if CONFIG_IOB_THROTTLE > 0 - flags = enter_critical_section(); - - if (g_iob_sem.semcount > CONFIG_IOB_THROTTLE) - { - /* If posting to the the throttled semaphore is going to awake a - * waiting task, then the g_iob_sem count should be decremented - * because an I/O buffer (from the head of the g_iob_committed list) - * will be allocated to this waiting task. - * Decrementing the g_throttled_sem (when posting to the g_iob_sem) - * is not necessary because this condition can only occur when the - * g_throttled_sem is less or equal to zero. On the other hand, if - * the g_iob_sem is greater than the CONFIG_IOB_THROTTLE and there - * is a waiting thread, then the I/O buffer just freed will be - * committed to a waiting task and is not available for general use. - */ - - if (committed_thottled) - { - g_iob_sem.semcount--; - } - - leave_critical_section(flags); - - nxsem_post(&g_throttle_sem); - DEBUGASSERT(g_throttle_sem.semcount <= + DEBUGASSERT(g_throttle_count <= (CONFIG_IOB_NBUFFERS - CONFIG_IOB_THROTTLE)); - } - else - { - leave_critical_section(flags); - } #endif - sched_unlock(); - #ifdef CONFIG_IOB_NOTIFIER /* Check if the IOB was claimed by a thread that is blocked waiting * for an IOB. diff --git a/mm/iob/iob_free_qentry.c b/mm/iob/iob_free_qentry.c index f40e35d8b31..05e375574b1 100644 --- a/mm/iob/iob_free_qentry.c +++ b/mm/iob/iob_free_qentry.c @@ -60,7 +60,7 @@ FAR struct iob_qentry_s *iob_free_qentry(FAR struct iob_qentry_s *iobq) * interrupts very briefly. */ - flags = enter_critical_section(); + flags = spin_lock_irqsave(&g_iob_lock); /* Which list? If there is a task waiting for an IOB chain, then put * the IOB chain on either the free list or on the committed list where @@ -68,27 +68,22 @@ FAR struct iob_qentry_s *iob_free_qentry(FAR struct iob_qentry_s *iobq) * iob_tryalloc_qentry()). */ - if (g_qentry_sem.semcount < 0) + if (g_qentry_count < 0) { iobq->qe_flink = g_iob_qcommitted; g_iob_qcommitted = iobq; + g_qentry_count++; + spin_unlock_irqrestore(&g_iob_lock, flags); + nxsem_post(&g_qentry_sem); } else { + g_qentry_count++; iobq->qe_flink = g_iob_freeqlist; g_iob_freeqlist = iobq; + spin_unlock_irqrestore(&g_iob_lock, flags); } - /* Signal that an I/O buffer chain container is available. If there - * is a thread waiting for an I/O buffer chain container, this will - * wake up exactly one thread. The semaphore count will correctly - * indicated that the awakened task owns an I/O buffer chain container - * and should find it in the committed list. - */ - - nxsem_post(&g_qentry_sem); - leave_critical_section(flags); - /* And return the I/O buffer chain container after the one that was freed */ return nextq; diff --git a/mm/iob/iob_free_queue_qentry.c b/mm/iob/iob_free_queue_qentry.c index 315b23b116a..511355f048e 100644 --- a/mm/iob/iob_free_queue_qentry.c +++ b/mm/iob/iob_free_queue_qentry.c @@ -53,7 +53,6 @@ void iob_free_queue_qentry(FAR struct iob_s *iob, FAR struct iob_qentry_s *prev = NULL; FAR struct iob_qentry_s *qentry; - irqstate_t flags = enter_critical_section(); for (qentry = iobq->qh_head; qentry != NULL; prev = qentry, qentry = qentry->qe_flink) { @@ -86,8 +85,6 @@ void iob_free_queue_qentry(FAR struct iob_s *iob, break; } } - - leave_critical_section(flags); } #endif /* CONFIG_IOB_NCHAINS > 0 */ diff --git a/mm/iob/iob_initialize.c b/mm/iob/iob_initialize.c index b37aef98c51..7e35d7427b4 100644 --- a/mm/iob/iob_initialize.c +++ b/mm/iob/iob_initialize.c @@ -91,23 +91,32 @@ FAR struct iob_qentry_s *g_iob_freeqlist; FAR struct iob_qentry_s *g_iob_qcommitted; #endif +sem_t g_iob_sem = SEM_INITIALIZER(0); + /* Counting semaphores that tracks the number of free IOBs/qentries */ -sem_t g_iob_sem = SEM_INITIALIZER(CONFIG_IOB_NBUFFERS); +volatile int16_t g_iob_count = CONFIG_IOB_NBUFFERS; #if CONFIG_IOB_THROTTLE > 0 + +sem_t g_throttle_sem = SEM_INITIALIZER(0); + /* Counts available I/O buffers when throttled */ -sem_t g_throttle_sem = SEM_INITIALIZER(CONFIG_IOB_NBUFFERS - - CONFIG_IOB_THROTTLE); +volatile int16_t g_throttle_count = CONFIG_IOB_NBUFFERS - + CONFIG_IOB_THROTTLE; #endif #if CONFIG_IOB_NCHAINS > 0 +sem_t g_qentry_sem = SEM_INITIALIZER(0); + /* Counts free I/O buffer queue containers */ -sem_t g_qentry_sem = SEM_INITIALIZER(CONFIG_IOB_NCHAINS); +volatile int16_t g_qentry_count = CONFIG_IOB_NCHAINS; #endif +volatile spinlock_t g_iob_lock = SP_UNLOCKED; + /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/mm/iob/iob_navail.c b/mm/iob/iob_navail.c index b387d35003f..68ee073717a 100644 --- a/mm/iob/iob_navail.c +++ b/mm/iob/iob_navail.c @@ -46,34 +46,27 @@ int iob_navail(bool throttled) { - int navail = 0; int ret; #if CONFIG_IOB_NBUFFERS > 0 - /* Get the value of the IOB counting semaphores */ - - ret = nxsem_get_value(&g_iob_sem, &navail); - if (ret >= 0) - { - ret = navail; + ret = g_iob_count; #if CONFIG_IOB_THROTTLE > 0 - /* Subtract the throttle value is so requested */ + /* Subtract the throttle value is so requested */ - if (throttled) - { - ret -= CONFIG_IOB_THROTTLE; - } + if (throttled) + { + ret -= CONFIG_IOB_THROTTLE; + } #endif - if (ret < 0) - { - ret = 0; - } + if (ret < 0) + { + ret = 0; } #else - ret = navail; + ret = 0; #endif return ret; @@ -89,24 +82,18 @@ int iob_navail(bool throttled) int iob_qentry_navail(void) { - int navail = 0; int ret; #if CONFIG_IOB_NCHAINS > 0 /* Get the value of the IOB chain qentry counting semaphores */ - ret = nxsem_get_value(&g_qentry_sem, &navail); - if (ret >= 0) + ret = g_qentry_count; + if (ret < 0) { - ret = navail; - if (ret < 0) - { - ret = 0; - } + ret = 0; } - #else - ret = navail; + ret = 0; #endif return ret; diff --git a/mm/iob/iob_remove_queue.c b/mm/iob/iob_remove_queue.c index 25a8679cbf6..fe09f4bc3f8 100644 --- a/mm/iob/iob_remove_queue.c +++ b/mm/iob/iob_remove_queue.c @@ -58,7 +58,6 @@ FAR struct iob_s *iob_remove_queue(FAR struct iob_queue_s *iobq) /* Remove the I/O buffer chain from the head of the queue */ - irqstate_t flags = enter_critical_section(); qentry = iobq->qh_head; if (qentry) { @@ -76,7 +75,6 @@ FAR struct iob_s *iob_remove_queue(FAR struct iob_queue_s *iobq) iob_free_qentry(qentry); } - leave_critical_section(flags); return iob; } diff --git a/mm/iob/iob_statistics.c b/mm/iob/iob_statistics.c index f08535eb389..16fae3cc7f6 100644 --- a/mm/iob/iob_statistics.c +++ b/mm/iob/iob_statistics.c @@ -56,7 +56,7 @@ void iob_getstats(FAR struct iob_stats_s *stats) { stats->ntotal = CONFIG_IOB_NBUFFERS; - nxsem_get_value(&g_iob_sem, &stats->nfree); + stats->nfree = g_iob_count; if (stats->nfree < 0) { stats->nwait = -stats->nfree; @@ -68,7 +68,7 @@ void iob_getstats(FAR struct iob_stats_s *stats) } #if CONFIG_IOB_THROTTLE > 0 - nxsem_get_value(&g_throttle_sem, &stats->nthrottle); + stats->nthrottle = g_throttle_count; if (stats->nthrottle < 0) { stats->nthrottle = -stats->nthrottle; diff --git a/mm/kbin/Makefile b/mm/kbin/Makefile deleted file mode 100644 index ff2d943c516..00000000000 --- a/mm/kbin/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -############################################################################ -# mm/kbin/Makefile -# -# SPDX-License-Identifier: Apache-2.0 -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. The -# ASF licenses this file to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -########################################################################### - -include $(TOPDIR)/Make.defs - -all: -.PHONY: clean distclean - -# Clean Targets: - -clean: - $(call CLEAN) - -# Deep clean -- removes all traces of the configuration - -distclean: clean diff --git a/mm/mempool/mempool.c b/mm/mempool/mempool.c index 32e268791a6..4ea7a9e7833 100644 --- a/mm/mempool/mempool.c +++ b/mm/mempool/mempool.c @@ -404,6 +404,7 @@ FAR void *mempool_allocate(FAR struct mempool_s *pool) mempool_add_backtrace(pool, (FAR struct mempool_backtrace_s *) ((FAR char *)blk + pool->blocksize)); #endif + return blk; } diff --git a/net/bluetooth/bluetooth.h b/net/bluetooth/bluetooth.h index c625d675789..aeac3269a31 100644 --- a/net/bluetooth/bluetooth.h +++ b/net/bluetooth/bluetooth.h @@ -143,20 +143,6 @@ struct sockaddr; /* Forward reference */ void bluetooth_initialize(void); -/**************************************************************************** - * Name: bluetooth_conn_initialize - * - * Description: - * Initialize the Bluetooth connection structure allocator. Called - * once and only from bluetooth_initialize(). - * - * Assumptions: - * Called early in the initialization sequence - * - ****************************************************************************/ - -void bluetooth_conn_initialize(void); - /**************************************************************************** * Name: bluetooth_conn_alloc() * diff --git a/net/bluetooth/bluetooth_conn.c b/net/bluetooth/bluetooth_conn.c index f649943bd46..9deb36247ce 100644 --- a/net/bluetooth/bluetooth_conn.c +++ b/net/bluetooth/bluetooth_conn.c @@ -42,10 +42,19 @@ #include #include "devif/devif.h" +#include "utils/utils.h" #include "bluetooth/bluetooth.h" #ifdef CONFIG_NET_BLUETOOTH +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_NET_BLUETOOTH_MAX_CONNS +# define CONFIG_NET_BLUETOOTH_MAX_CONNS 0 +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -54,14 +63,10 @@ * network lock. */ -#if CONFIG_NET_BLUETOOTH_PREALLOC_CONNS > 0 -static struct bluetooth_conn_s - g_bluetooth_connections[CONFIG_NET_BLUETOOTH_PREALLOC_CONNS]; -#endif - -/* A list of all free packet socket connections */ - -static dq_queue_t g_free_bluetooth_connections; +NET_BUFPOOL_DECLARE(g_bluetooth_connections, sizeof(struct bluetooth_conn_s), + CONFIG_NET_BLUETOOTH_PREALLOC_CONNS, + CONFIG_NET_BLUETOOTH_ALLOC_CONNS, + CONFIG_NET_BLUETOOTH_MAX_CONNS); /* A list of all allocated packet socket connections */ @@ -76,33 +81,6 @@ static const bt_addr_t g_any_addr = * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: bluetooth_conn_initialize - * - * Description: - * Initialize the Bluetooth connection structure allocator. Called - * once and only from bluetooth_initialize(). - * - * Assumptions: - * Called early in the initialization sequence - * - ****************************************************************************/ - -void bluetooth_conn_initialize(void) -{ -#if CONFIG_NET_BLUETOOTH_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NET_BLUETOOTH_PREALLOC_CONNS; i++) - { - /* Link each pre-allocated connection structure into the free list. */ - - dq_addlast(&g_bluetooth_connections[i].bc_conn.node, - &g_free_bluetooth_connections); - } -#endif -} - /**************************************************************************** * Name: bluetooth_conn_alloc() * @@ -115,39 +93,12 @@ void bluetooth_conn_initialize(void) FAR struct bluetooth_conn_s *bluetooth_conn_alloc(void) { FAR struct bluetooth_conn_s *conn; -#if CONFIG_NET_BLUETOOTH_ALLOC_CONNS > 0 - int i; -#endif /* The free list is protected by the network lock */ net_lock(); -#if CONFIG_NET_BLUETOOTH_ALLOC_CONNS > 0 - if (dq_peek(&g_active_bluetooth_connections) == NULL) - { -#if CONFIG_NET_BLUETOOTH_MAX_CONNS > 0 - if (dq_count(&g_active_bluetooth_connections) + - CONFIG_NET_BLUETOOTH_ALLOC_CONNS > CONFIG_NET_BLUETOOTH_MAX_CONNS) - { - net_unlock(); - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(*conn) * CONFIG_NET_BLUETOOTH_ALLOC_CONNS); - if (conn != NULL) - { - for (i = 0; i < CONFIG_NET_BLUETOOTH_ALLOC_CONNS; i++) - { - dq_addlast(&conn[i].bc_conn.node, - &g_active_bluetooth_connections); - } - } - } -#endif - conn = (FAR struct bluetooth_conn_s *) - dq_remfirst(&g_free_bluetooth_connections); + conn = NET_BUFPOOL_TRYALLOC(g_bluetooth_connections); if (conn) { /* Mark as unbound */ @@ -207,22 +158,9 @@ void bluetooth_conn_free(FAR struct bluetooth_conn_s *conn) bluetooth_container_free(container); } - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection structure */ -#if CONFIG_NET_BLUETOOTH_ALLOC_CONNS == 1 - if (conn < g_bluetooth_connections || conn >= (g_bluetooth_connections + - CONFIG_NET_BLUETOOTH_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->bc_conn.node, &g_free_bluetooth_connections); - } + NET_BUFPOOL_FREE(g_bluetooth_connections, conn); net_unlock(); } diff --git a/net/bluetooth/bluetooth_initialize.c b/net/bluetooth/bluetooth_initialize.c index 92e71719c6c..0ab1a14fbe6 100644 --- a/net/bluetooth/bluetooth_initialize.c +++ b/net/bluetooth/bluetooth_initialize.c @@ -48,10 +48,6 @@ void bluetooth_initialize(void) { - /* Initialize connection structions */ - - bluetooth_conn_initialize(); - /* Initialize the container allocator */ bluetooth_container_initialize(); diff --git a/net/can/can_conn.c b/net/can/can_conn.c index 89be629af56..30f38992423 100644 --- a/net/can/can_conn.c +++ b/net/can/can_conn.c @@ -46,18 +46,22 @@ #ifdef CONFIG_NET_CAN /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* The array containing all NetLink connections. */ - -#if CONFIG_CAN_PREALLOC_CONNS > 0 -static struct can_conn_s g_can_connections[CONFIG_CAN_PREALLOC_CONNS]; +#ifndef CONFIG_CAN_MAX_CONNS +# define CONFIG_CAN_MAX_CONNS 0 #endif -/* A list of all free NetLink connections */ +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* The array containing all NetLink connections. */ -static dq_queue_t g_free_can_connections; +NET_BUFPOOL_DECLARE(g_can_connections, sizeof(struct can_conn_s), + CONFIG_CAN_PREALLOC_CONNS, CONFIG_CAN_ALLOC_CONNS, + CONFIG_CAN_MAX_CONNS); static mutex_t g_free_lock = NXMUTEX_INITIALIZER; /* A list of all allocated NetLink connections */ @@ -79,16 +83,6 @@ static dq_queue_t g_active_can_connections; void can_initialize(void) { -#if CONFIG_CAN_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_CAN_PREALLOC_CONNS; i++) - { - /* Mark the connection closed and move it to the free list */ - - dq_addlast(&g_can_connections[i].sconn.node, &g_free_can_connections); - } -#endif } /**************************************************************************** @@ -103,37 +97,12 @@ void can_initialize(void) FAR struct can_conn_s *can_alloc(void) { FAR struct can_conn_s *conn; -#if CONFIG_CAN_ALLOC_CONNS > 0 - int i; -#endif /* The free list is protected by a a mutex. */ nxmutex_lock(&g_free_lock); -#if CONFIG_CAN_ALLOC_CONNS > 0 - if (dq_peek(&g_free_can_connections) == NULL) - { -#if CONFIG_CAN_MAX_CONNS > 0 - if (dq_count(&g_active_can_connections) + - CONFIG_CAN_ALLOC_CONNS > CONFIG_CAN_MAX_CONNS) - { - nxmutex_unlock(&g_free_lock); - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(*conn) * CONFIG_CAN_ALLOC_CONNS); - if (conn != NULL) - { - for (i = 0; i < CONFIG_CAN_ALLOC_CONNS; i++) - { - dq_addlast(&conn[i].sconn.node, &g_free_can_connections); - } - } - } -#endif - conn = (FAR struct can_conn_s *)dq_remfirst(&g_free_can_connections); + conn = NET_BUFPOOL_TRYALLOC(g_can_connections); if (conn != NULL) { /* FIXME SocketCAN default behavior enables loopback */ @@ -184,22 +153,9 @@ void can_free(FAR struct can_conn_s *conn) dq_rem(&conn->sconn.node, &g_active_can_connections); - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection. */ -#if CONFIG_CAN_ALLOC_CONNS == 1 - if (conn < g_can_connections || conn >= (g_can_connections + - CONFIG_CAN_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_can_connections); - } + NET_BUFPOOL_FREE(g_can_connections, conn); nxmutex_unlock(&g_free_lock); } diff --git a/net/devif/devif.h b/net/devif/devif.h index 5b3bdaea119..875e21f1508 100644 --- a/net/devif/devif.h +++ b/net/devif/devif.h @@ -310,19 +310,6 @@ extern "C" void devif_initialize(void); -/**************************************************************************** - * Name: devif_callback_init - * - * Description: - * Configure the pre-allocated callback structures into a free list. - * - * Assumptions: - * This function must be called with the network locked. - * - ****************************************************************************/ - -void devif_callback_init(void); - /**************************************************************************** * Name: devif_callback_alloc * diff --git a/net/devif/devif_callback.c b/net/devif/devif_callback.c index ecd82836677..ce633c3229c 100644 --- a/net/devif/devif_callback.c +++ b/net/devif/devif_callback.c @@ -39,6 +39,7 @@ #include #include "netdev/netdev.h" +#include "utils/utils.h" #include "devif/devif.h" /**************************************************************************** @@ -52,11 +53,9 @@ * Private Data ****************************************************************************/ -#if CONFIG_NET_PREALLOC_DEVIF_CALLBACKS > 0 -static struct devif_callback_s - g_cbprealloc[CONFIG_NET_PREALLOC_DEVIF_CALLBACKS]; -#endif -static FAR struct devif_callback_s *g_cbfreelist = NULL; +NET_BUFPOOL_DECLARE(g_cbprealloc, sizeof(struct devif_callback_s), + CONFIG_NET_PREALLOC_DEVIF_CALLBACKS, + CONFIG_NET_ALLOC_DEVIF_CALLBACKS, 0); /**************************************************************************** * Private Functions @@ -88,7 +87,7 @@ static void devif_callback_free(FAR struct net_driver_s *dev, #ifdef CONFIG_DEBUG_FEATURES /* Check for double freed callbacks */ - curr = g_cbfreelist; + curr = (FAR struct devif_callback_s *)g_cbprealloc.freebuffers.head; while (curr != NULL) { @@ -187,23 +186,9 @@ static void devif_callback_free(FAR struct net_driver_s *dev, } } - /* If this is a preallocated or a batch allocated callback store it in - * the free callbacks list. Else free it. - */ + /* Free the callback structure */ -#if CONFIG_NET_ALLOC_DEVIF_CALLBACKS == 1 - if (cb < g_cbprealloc || cb >= (g_cbprealloc + - CONFIG_NET_PREALLOC_DEVIF_CALLBACKS)) - { - kmm_free(cb); - } - else -#endif - { - cb->nxtconn = g_cbfreelist; - cb->nxtdev = NULL; - g_cbfreelist = cb; - } + NET_BUFPOOL_FREE(g_cbprealloc, cb); net_unlock(); } @@ -252,31 +237,6 @@ static bool devif_event_trigger(uint16_t events, uint16_t triggers) * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: devif_callback_init - * - * Description: - * Configure the pre-allocated callback structures into a free list. - * - * Assumptions: - * Called early in the initialization sequence so that no special - * protection is required. - * - ****************************************************************************/ - -void devif_callback_init(void) -{ -#if CONFIG_NET_PREALLOC_DEVIF_CALLBACKS > 0 - int i; - - for (i = 0; i < CONFIG_NET_PREALLOC_DEVIF_CALLBACKS; i++) - { - g_cbprealloc[i].nxtconn = g_cbfreelist; - g_cbfreelist = &g_cbprealloc[i]; - } -#endif -} - /**************************************************************************** * Name: devif_callback_alloc * @@ -299,9 +259,6 @@ FAR struct devif_callback_s * FAR struct devif_callback_s **list_tail) { FAR struct devif_callback_s *ret; -#if CONFIG_NET_ALLOC_DEVIF_CALLBACKS > 0 - int i; -#endif net_lock(); @@ -324,34 +281,11 @@ FAR struct devif_callback_s * return NULL; } - /* Allocate the callback entry from heap */ + /* Get a callback structure */ -#if CONFIG_NET_ALLOC_DEVIF_CALLBACKS > 0 - if (g_cbfreelist == NULL) - { - ret = kmm_zalloc(sizeof(struct devif_callback_s) * - CONFIG_NET_ALLOC_DEVIF_CALLBACKS); - if (ret != NULL) - { - for (i = 0; i < CONFIG_NET_ALLOC_DEVIF_CALLBACKS; i++) - { - ret[i].nxtconn = g_cbfreelist; - g_cbfreelist = &ret[i]; - } - } - } -#endif - - /* Check the head of the free list */ - - ret = g_cbfreelist; + ret = NET_BUFPOOL_TRYALLOC(g_cbprealloc); if (ret) { - /* Remove the next instance from the head of the free list */ - - g_cbfreelist = ret->nxtconn; - memset(ret, 0, sizeof(struct devif_callback_s)); - /* Add the newly allocated instance to the head of the device event * list. */ diff --git a/net/devif/devif_initialize.c b/net/devif/devif_initialize.c index 302c76b4760..03b9e1d6821 100644 --- a/net/devif/devif_initialize.c +++ b/net/devif/devif_initialize.c @@ -88,8 +88,5 @@ struct net_stats_s g_netstats; void devif_initialize(void) { - /* Initialize callback support */ - - devif_callback_init(); } #endif /* CONFIG_NET */ diff --git a/net/icmp/icmp.h b/net/icmp/icmp.h index 57a80fd97d4..9e8f6e00809 100644 --- a/net/icmp/icmp.h +++ b/net/icmp/icmp.h @@ -162,19 +162,6 @@ EXTERN const struct sock_intf_s g_icmp_sockif; void icmp_input(FAR struct net_driver_s *dev); -/**************************************************************************** - * Name: icmp_sock_initialize - * - * Description: - * Initialize the IPPROTO_ICMP socket connection structures. Called once - * and only from the network initialization layer. - * - ****************************************************************************/ - -#ifdef CONFIG_NET_ICMP_SOCKET -void icmp_sock_initialize(void); -#endif - /**************************************************************************** * Name: icmp_alloc * diff --git a/net/icmp/icmp_conn.c b/net/icmp/icmp_conn.c index a4eac7cd3a8..f7e9256b6a1 100644 --- a/net/icmp/icmp_conn.c +++ b/net/icmp/icmp_conn.c @@ -41,22 +41,27 @@ #include "devif/devif.h" #include "icmp/icmp.h" +#include "utils/utils.h" #ifdef CONFIG_NET_ICMP_SOCKET /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* The array containing all IPPROTO_ICMP socket connections */ - -#if CONFIG_NET_ICMP_PREALLOC_CONNS > 0 -static struct icmp_conn_s g_icmp_connections[CONFIG_NET_ICMP_PREALLOC_CONNS]; +#ifndef CONFIG_NET_ICMP_MAX_CONNS +# define CONFIG_NET_ICMP_MAX_CONNS 0 #endif -/* A list of all free IPPROTO_ICMP socket connections */ +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* The array containing all IPPROTO_ICMP socket connections */ -static dq_queue_t g_free_icmp_connections; +NET_BUFPOOL_DECLARE(g_icmp_connections, sizeof(struct icmp_conn_s), + CONFIG_NET_ICMP_PREALLOC_CONNS, + CONFIG_NET_ICMP_ALLOC_CONNS, CONFIG_NET_ICMP_MAX_CONNS); static mutex_t g_free_lock = NXMUTEX_INITIALIZER; /* A list of all allocated IPPROTO_ICMP socket connections */ @@ -67,30 +72,6 @@ static dq_queue_t g_active_icmp_connections; * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: icmp_sock_initialize - * - * Description: - * Initialize the IPPROTO_ICMP socket connection structures. Called once - * and only from the network initialization layer. - * - ****************************************************************************/ - -void icmp_sock_initialize(void) -{ -#if CONFIG_NET_ICMP_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NET_ICMP_PREALLOC_CONNS; i++) - { - /* Move the connection structure to the free list */ - - dq_addlast(&g_icmp_connections[i].sconn.node, - &g_free_icmp_connections); - } -#endif -} - /**************************************************************************** * Name: icmp_alloc * @@ -111,31 +92,7 @@ FAR struct icmp_conn_s *icmp_alloc(void) ret = nxmutex_lock(&g_free_lock); if (ret >= 0) { -#if CONFIG_NET_ICMP_ALLOC_CONNS > 0 - if (dq_peek(&g_free_icmp_connections) == NULL) - { -#if CONFIG_NET_ICMP_MAX_CONNS > 0 - if (dq_count(&g_active_icmp_connections) + - CONFIG_NET_ICMP_ALLOC_CONNS > CONFIG_NET_ICMP_MAX_CONNS) - { - nxmutex_unlock(&g_free_lock); - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(*conn) * CONFIG_NET_ICMP_ALLOC_CONNS); - if (conn != NULL) - { - for (ret = 0; ret < CONFIG_NET_ICMP_ALLOC_CONNS; ret++) - { - dq_addlast(&conn[ret].sconn.node, - &g_free_icmp_connections); - } - } - } -#endif - - conn = (FAR struct icmp_conn_s *)dq_remfirst(&g_free_icmp_connections); + conn = NET_BUFPOOL_TRYALLOC(g_icmp_connections); if (conn != NULL) { /* Enqueue the connection into the active list */ @@ -184,22 +141,9 @@ void icmp_free(FAR struct icmp_conn_s *conn) dq_rem(&conn->sconn.node, &g_active_icmp_connections); - /* If this is a preallocated or a batch allocated connection store it - * in the free connections list. Else free it. - */ + /* Free the connection. */ -#if CONFIG_NET_ICMP_ALLOC_CONNS == 1 - if (conn < g_icmp_connections || conn >= (g_icmp_connections + - CONFIG_NET_ICMP_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_icmp_connections); - } + NET_BUFPOOL_FREE(g_icmp_connections, conn); } nxmutex_unlock(&g_free_lock); diff --git a/net/icmpv6/icmpv6.h b/net/icmpv6/icmpv6.h index 5d4301892c1..6f0c0e58226 100644 --- a/net/icmpv6/icmpv6.h +++ b/net/icmpv6/icmpv6.h @@ -563,19 +563,6 @@ void icmpv6_rnotify(FAR struct net_driver_s *dev, int result); # define icmpv6_rnotify(d,r) (0) #endif -/**************************************************************************** - * Name: icmpv6_sock_initialize - * - * Description: - * Initialize the IPPROTO_ICMP socket connection structures. Called once - * and only from the network initialization layer. - * - ****************************************************************************/ - -#ifdef CONFIG_NET_ICMPv6_SOCKET -void icmpv6_sock_initialize(void); -#endif - /**************************************************************************** * Name: icmpv6_alloc * diff --git a/net/icmpv6/icmpv6_conn.c b/net/icmpv6/icmpv6_conn.c index ac3d65a4dbc..0d49222850c 100644 --- a/net/icmpv6/icmpv6_conn.c +++ b/net/icmpv6/icmpv6_conn.c @@ -41,23 +41,28 @@ #include "devif/devif.h" #include "icmpv6/icmpv6.h" +#include "utils/utils.h" #ifdef CONFIG_NET_ICMPv6_SOCKET /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* The array containing all IPPROTO_ICMP socket connections */ - -#if CONFIG_NET_ICMPv6_PREALLOC_CONNS > 0 -static struct icmpv6_conn_s - g_icmpv6_connections[CONFIG_NET_ICMPv6_PREALLOC_CONNS]; +#ifndef CONFIG_NET_ICMPv6_MAX_CONNS +# define CONFIG_NET_ICMPv6_MAX_CONNS 0 #endif -/* A list of all free IPPROTO_ICMP socket connections */ +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* The array containing all IPPROTO_ICMP socket connections */ -static dq_queue_t g_free_icmpv6_connections; +NET_BUFPOOL_DECLARE(g_icmpv6_connections, sizeof(struct icmpv6_conn_s), + CONFIG_NET_ICMPv6_PREALLOC_CONNS, + CONFIG_NET_ICMPv6_ALLOC_CONNS, + CONFIG_NET_ICMPv6_MAX_CONNS); static mutex_t g_free_lock = NXMUTEX_INITIALIZER; /* A list of all allocated IPPROTO_ICMP socket connections */ @@ -68,30 +73,6 @@ static dq_queue_t g_active_icmpv6_connections; * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: icmpv6_sock_initialize - * - * Description: - * Initialize the IPPROTO_ICMP socket connection structures. Called once - * and only from the network initialization layer. - * - ****************************************************************************/ - -void icmpv6_sock_initialize(void) -{ -#if CONFIG_NET_ICMPv6_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NET_ICMPv6_PREALLOC_CONNS; i++) - { - /* Move the connection structure to the free list */ - - dq_addlast(&g_icmpv6_connections[i].sconn.node, - &g_free_icmpv6_connections); - } -#endif -} - /**************************************************************************** * Name: icmpv6_alloc * @@ -112,32 +93,7 @@ FAR struct icmpv6_conn_s *icmpv6_alloc(void) ret = nxmutex_lock(&g_free_lock); if (ret >= 0) { -#if CONFIG_NET_ICMPv6_ALLOC_CONNS > 0 - if (dq_peek(&g_active_icmpv6_connections) == NULL) - { -#if CONFIG_NET_ICMPv6_MAX_CONNS > 0 - if (dq_count(&g_active_icmpv6_connections) + - CONFIG_NET_ICMPv6_ALLOC_CONNS > CONFIG_NET_ICMPv6_MAX_CONNS) - { - nxmutex_unlock(&g_free_lock); - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(*conn) * CONFIG_NET_ICMPv6_ALLOC_CONNS); - if (conn != NULL) - { - for (ret = 0; ret < CONFIG_NET_ICMPv6_ALLOC_CONNS; ret++) - { - dq_addlast(&conn[ret].sconn.node, - &g_free_icmpv6_connections); - } - } - } -#endif - - conn = (FAR struct icmpv6_conn_s *) - dq_remfirst(&g_free_icmpv6_connections); + conn = NET_BUFPOOL_TRYALLOC(g_icmpv6_connections); if (conn != NULL) { /* Enqueue the connection into the active list */ @@ -174,22 +130,9 @@ void icmpv6_free(FAR struct icmpv6_conn_s *conn) dq_rem(&conn->sconn.node, &g_active_icmpv6_connections); - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection. */ -#if CONFIG_NET_ICMPv6_ALLOC_CONNS == 1 - if (conn < g_icmpv6_connections || conn >= (g_icmpv6_connections + - CONFIG_NET_ICMPv6_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_icmpv6_connections); - } + NET_BUFPOOL_FREE(g_icmpv6_connections, conn); nxmutex_unlock(&g_free_lock); } diff --git a/net/ieee802154/ieee802154.h b/net/ieee802154/ieee802154.h index 721a0f62185..af337d88b45 100644 --- a/net/ieee802154/ieee802154.h +++ b/net/ieee802154/ieee802154.h @@ -157,20 +157,6 @@ struct sockaddr; /* Forward reference */ void ieee802154_initialize(void); -/**************************************************************************** - * Name: ieee802154_conn_initialize - * - * Description: - * Initialize the IEEE 802.15.4 connection structure allocator. Called - * once and only from ieee802154_initialize(). - * - * Assumptions: - * Called early in the initialization sequence - * - ****************************************************************************/ - -void ieee802154_conn_initialize(void); - /**************************************************************************** * Name: ieee802154_conn_alloc() * diff --git a/net/ieee802154/ieee802154_conn.c b/net/ieee802154/ieee802154_conn.c index d30f05c14ba..ce89c02c6b2 100644 --- a/net/ieee802154/ieee802154_conn.c +++ b/net/ieee802154/ieee802154_conn.c @@ -42,9 +42,18 @@ #include "devif/devif.h" #include "ieee802154/ieee802154.h" +#include "utils/utils.h" #ifdef CONFIG_NET_IEEE802154 +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_NET_IEEE802154_MAX_CONNS +# define CONFIG_NET_IEEE802154_MAX_CONNS 0 +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -53,14 +62,11 @@ * network lock. */ -#if CONFIG_NET_IEEE802154_PREALLOC_CONNS > 0 -static struct ieee802154_conn_s - g_ieee802154_connections[CONFIG_NET_IEEE802154_PREALLOC_CONNS]; -#endif - -/* A list of all free packet socket connections */ - -static dq_queue_t g_free_ieee802154_connections; +NET_BUFPOOL_DECLARE(g_ieee802154_connections, + sizeof(struct ieee802154_conn_s), + CONFIG_NET_IEEE802154_PREALLOC_CONNS, + CONFIG_NET_IEEE802154_ALLOC_CONNS, + CONFIG_NET_IEEE802154_MAX_CONNS); /* A list of all allocated packet socket connections */ @@ -70,33 +76,6 @@ static dq_queue_t g_active_ieee802154_connections; * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: ieee802154_conn_initialize - * - * Description: - * Initialize the IEEE 802.15.4 connection structure allocator. Called - * once and only from ieee802154_initialize(). - * - * Assumptions: - * Called early in the initialization sequence - * - ****************************************************************************/ - -void ieee802154_conn_initialize(void) -{ -#if CONFIG_NET_IEEE802154_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NET_IEEE802154_PREALLOC_CONNS; i++) - { - /* Link each pre-allocated connection structure into the free list. */ - - dq_addlast(&g_ieee802154_connections[i].sconn.node, - &g_free_ieee802154_connections); - } -#endif -} - /**************************************************************************** * Name: ieee802154_conn_alloc() * @@ -109,39 +88,12 @@ void ieee802154_conn_initialize(void) FAR struct ieee802154_conn_s *ieee802154_conn_alloc(void) { FAR struct ieee802154_conn_s *conn; -#if CONFIG_NET_IEEE802154_ALLOC_CONNS > 0 - int i; -#endif /* The free list is protected by the network lock. */ net_lock(); -#if CONFIG_NET_IEEE802154_ALLOC_CONNS > 0 - if (dq_peek(&g_free_ieee802154_connections) == NULL) - { -#if CONFIG_NET_IEEE802154_MAX_CONNS > 0 - if (dq_count(&g_active_ieee802154_connections) + - CONFIG_NET_IEEE802154_ALLOC_CONNS > CONFIG_NET_IEEE802154_MAX_CONNS) - { - net_unlock(); - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(*conn) * CONFIG_NET_IEEE802154_ALLOC_CONNS); - if (conn != NULL) - { - for (i = 0; i < CONFIG_NET_IEEE802154_ALLOC_CONNS; i++) - { - dq_addlast(&conn[i].sconn.node, - &g_free_ieee802154_connections); - } - } - } -#endif - conn = (FAR struct ieee802154_conn_s *) - dq_remfirst(&g_free_ieee802154_connections); + conn = NET_BUFPOOL_TRYALLOC(g_ieee802154_connections); if (conn) { dq_addlast(&conn->sconn.node, &g_active_ieee802154_connections); @@ -195,22 +147,9 @@ void ieee802154_conn_free(FAR struct ieee802154_conn_s *conn) ieee802154_container_free(container); } - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection. */ -#if CONFIG_NET_IEEE802154_ALLOC_CONNS == 1 - if (conn < g_ieee802154_connections || conn >= (g_ieee802154_connections + - CONFIG_NET_IEEE802154_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_ieee802154_connections); - } + NET_BUFPOOL_FREE(g_ieee802154_connections, conn); net_unlock(); } diff --git a/net/ieee802154/ieee802154_initialize.c b/net/ieee802154/ieee802154_initialize.c index 56e6352454d..94364f874b4 100644 --- a/net/ieee802154/ieee802154_initialize.c +++ b/net/ieee802154/ieee802154_initialize.c @@ -48,10 +48,6 @@ void ieee802154_initialize(void) { - /* Initialize connection structions */ - - ieee802154_conn_initialize(); - /* Initialize the container allocator */ ieee802154_container_initialize(); diff --git a/net/ipforward/Kconfig b/net/ipforward/Kconfig index 3be48eac759..2e4990d3898 100644 --- a/net/ipforward/Kconfig +++ b/net/ipforward/Kconfig @@ -40,3 +40,21 @@ config NET_IPFORWARD_NSTRUCT WARNING: DO NOT set this setting to a value greater than or equal to CONFIG_IOB_NBUFFERS, otherwise it may consume all the IOB and let netdev fail to work. + +config NET_IPFORWARD_ALLOC_STRUCT + int "Dynamic forwarding structures allocation" + default 1 + ---help--- + When set to 0 all dynamic allocations are disabled + + When set to 1 a new forwarding structure will be allocated every + time, and it will be free'd when no longer needed. + + Setting this to 2 or more will allocate the forwarding structures + in batches (with batch size equal to this config). When a I/O buffer + chain head is no longer needed, it will be returned to the free + forwarding structures pool, and it will never be deallocated! + + Note: maximum number of allocated forwarding structures is limited + to CONFIG_IOB_NBUFFERS - CONFIG_IOB_THROTTLE to avoid consuming all + the IOBs. diff --git a/net/ipforward/ipfwd_alloc.c b/net/ipforward/ipfwd_alloc.c index b0b5536dea8..2d993ce452c 100644 --- a/net/ipforward/ipfwd_alloc.c +++ b/net/ipforward/ipfwd_alloc.c @@ -37,6 +37,7 @@ #include #include "ipforward/ipforward.h" +#include "utils/utils.h" #ifdef CONFIG_NET_IPFORWARD @@ -66,13 +67,12 @@ * Private Data ****************************************************************************/ -/* This is an array of pre-allocating forwarding structures */ +/* This is the state of the global forwarding structures */ -static struct forward_s g_fwdpool[CONFIG_NET_IPFORWARD_NSTRUCT]; - -/* This is a list of free forwarding structures */ - -static FAR struct forward_s *g_fwdfree; +NET_BUFPOOL_DECLARE(g_fwdpool, sizeof(struct forward_s), + CONFIG_NET_IPFORWARD_NSTRUCT, + CONFIG_NET_IPFORWARD_ALLOC_STRUCT, + CONFIG_IOB_NBUFFERS - CONFIG_IOB_THROTTLE); /**************************************************************************** * Public Functions @@ -91,25 +91,11 @@ static FAR struct forward_s *g_fwdfree; void ipfwd_initialize(void) { - FAR struct forward_s *fwd; - int i; - /* The IOB size must be such that the maximum L2 and L3 headers fit into * the contiguous memory of the first IOB in the IOB chain. */ DEBUGASSERT(MAX_HDRLEN <= CONFIG_IOB_BUFSIZE); - - /* Add all pre-allocated forwarding structures to the free list */ - - g_fwdfree = NULL; - - for (i = 0; i < CONFIG_NET_IPFORWARD_NSTRUCT; i++) - { - fwd = &g_fwdpool[i]; - fwd->f_flink = g_fwdfree; - g_fwdfree = fwd; - } } /**************************************************************************** @@ -127,16 +113,7 @@ void ipfwd_initialize(void) FAR struct forward_s *ipfwd_alloc(void) { - FAR struct forward_s *fwd; - - fwd = g_fwdfree; - if (fwd != NULL) - { - g_fwdfree = fwd->f_flink; - memset (fwd, 0, sizeof(struct forward_s)); - } - - return fwd; + return NET_BUFPOOL_TRYALLOC(g_fwdpool); } /**************************************************************************** @@ -153,8 +130,7 @@ FAR struct forward_s *ipfwd_alloc(void) void ipfwd_free(FAR struct forward_s *fwd) { - fwd->f_flink = g_fwdfree; - g_fwdfree = fwd; + NET_BUFPOOL_FREE(g_fwdpool, fwd); } #endif /* CONFIG_NET_IPFORWARD */ diff --git a/net/net_initialize.c b/net/net_initialize.c index d97f238d45d..25d69c5a1ee 100644 --- a/net/net_initialize.c +++ b/net/net_initialize.c @@ -131,38 +131,16 @@ void net_initialize(void) ipfwd_initialize(); #endif -#ifdef CONFIG_NET_ICMP_SOCKET - /* Initialize IPPPROTO_ICMP socket support */ - - icmp_sock_initialize(); -#endif - -#ifdef CONFIG_NET_ICMPv6_SOCKET - /* Initialize IPPPROTO_ICMP6 socket support */ - - icmpv6_sock_initialize(); -#endif - #ifdef NET_TCP_HAVE_STACK /* Initialize the TCP/IP connection structures */ tcp_initialize(); - - /* Initialize the TCP/IP write buffering */ - -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS - tcp_wrbuffer_initialize(); -#endif #endif /* CONFIG_NET_TCP */ #ifdef NET_UDP_HAVE_STACK /* Initialize the UDP connection structures */ udp_initialize(); - -#ifdef CONFIG_NET_UDP_WRITE_BUFFERS - udp_wrbuffer_initialize(); -#endif #endif #ifdef CONFIG_NET_USRSOCK diff --git a/net/netlink/netlink_conn.c b/net/netlink/netlink_conn.c index 0a1b5f71da3..fa960a0cffa 100644 --- a/net/netlink/netlink_conn.c +++ b/net/netlink/netlink_conn.c @@ -49,19 +49,22 @@ #ifdef CONFIG_NET_NETLINK /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* The array containing all NetLink connections. */ - -#if CONFIG_NETLINK_PREALLOC_CONNS > 0 -static struct netlink_conn_s -g_netlink_connections[CONFIG_NETLINK_PREALLOC_CONNS]; +#ifndef CONFIG_NETLINK_MAX_CONNS +# define CONFIG_NETLINK_MAX_CONNS 0 #endif -/* A list of all free NetLink connections */ +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* The array containing all NetLink connections. */ -static dq_queue_t g_free_netlink_connections; +NET_BUFPOOL_DECLARE(g_netlink_connections, sizeof(struct netlink_conn_s), + CONFIG_NETLINK_PREALLOC_CONNS, + CONFIG_NETLINK_ALLOC_CONNS, CONFIG_NETLINK_MAX_CONNS); static mutex_t g_free_lock = NXMUTEX_INITIALIZER; /* A list of all allocated NetLink connections */ @@ -147,17 +150,6 @@ netlink_get_terminator(FAR const struct nlmsghdr *req) void netlink_initialize(void) { -#if CONFIG_NETLINK_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NETLINK_PREALLOC_CONNS; i++) - { - /* Mark the connection closed and move it to the free list */ - - dq_addlast(&g_netlink_connections[i].sconn.node, - &g_free_netlink_connections); - } -#endif } /**************************************************************************** @@ -172,38 +164,12 @@ void netlink_initialize(void) FAR struct netlink_conn_s *netlink_alloc(void) { FAR struct netlink_conn_s *conn; -#if CONFIG_NETLINK_ALLOC_CONNS > 0 - int i; -#endif /* The free list is protected by a mutex. */ nxmutex_lock(&g_free_lock); -#if CONFIG_NETLINK_ALLOC_CONNS > 0 - if (dq_peek(&g_free_netlink_connections) == NULL) - { -#if CONFIG_NETLINK_MAX_CONNS > 0 - if (dq_count(&g_active_netlink_connections) + - CONFIG_NETLINK_ALLOC_CONNS > CONFIG_NETLINK_MAX_CONNS) - { - nxmutex_unlock(&g_free_lock); - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(*conn) * CONFIG_NETLINK_ALLOC_CONNS); - if (conn != NULL) - { - for (i = 0; i < CONFIG_NETLINK_ALLOC_CONNS; i++) - { - dq_addlast(&conn[i].sconn.node, &g_free_netlink_connections); - } - } - } -#endif - conn = (FAR struct netlink_conn_s *) - dq_remfirst(&g_free_netlink_connections); + conn = NET_BUFPOOL_TRYALLOC(g_netlink_connections); if (conn != NULL) { /* Enqueue the connection into the active list */ @@ -245,22 +211,9 @@ void netlink_free(FAR struct netlink_conn_s *conn) kmm_free(resp); } - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection */ -#if CONFIG_NETLINK_ALLOC_CONNS == 1 - if (conn < g_netlink_connections || conn >= (g_netlink_connections + - CONFIG_NETLINK_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_netlink_connections); - } + NET_BUFPOOL_FREE(g_netlink_connections, conn); nxmutex_unlock(&g_free_lock); } diff --git a/net/pkt/pkt_conn.c b/net/pkt/pkt_conn.c index 601dff89f39..8482d68de3a 100644 --- a/net/pkt/pkt_conn.c +++ b/net/pkt/pkt_conn.c @@ -42,6 +42,7 @@ #include "devif/devif.h" #include "pkt/pkt.h" +#include "utils/utils.h" /**************************************************************************** * Pre-processor Definitions @@ -52,19 +53,19 @@ (addr1[2] == addr2[2]) && (addr1[3] == addr2[3]) && \ (addr1[4] == addr2[4]) && (addr1[5] == addr2[5])) +#ifndef CONFIG_NET_PKT_MAX_CONNS +# define CONFIG_NET_PKT_MAX_CONNS 0 +#endif + /**************************************************************************** * Private Data ****************************************************************************/ /* The array containing all packet socket connections */ -#if CONFIG_NET_PKT_PREALLOC_CONNS > 0 -static struct pkt_conn_s g_pkt_connections[CONFIG_NET_PKT_PREALLOC_CONNS]; -#endif - -/* A list of all free packet socket connections */ - -static dq_queue_t g_free_pkt_connections; +NET_BUFPOOL_DECLARE(g_pkt_connections, sizeof(struct pkt_conn_s), + CONFIG_NET_PKT_PREALLOC_CONNS, + CONFIG_NET_PKT_ALLOC_CONNS, CONFIG_NET_PKT_MAX_CONNS); static mutex_t g_free_lock = NXMUTEX_INITIALIZER; /* A list of all allocated packet socket connections */ @@ -86,14 +87,6 @@ static dq_queue_t g_active_pkt_connections; void pkt_initialize(void) { -#if CONFIG_NET_PKT_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NET_PKT_PREALLOC_CONNS; i++) - { - dq_addlast(&g_pkt_connections[i].sconn.node, &g_free_pkt_connections); - } -#endif } /**************************************************************************** @@ -108,37 +101,12 @@ void pkt_initialize(void) FAR struct pkt_conn_s *pkt_alloc(void) { FAR struct pkt_conn_s *conn; -#if CONFIG_NET_PKT_ALLOC_CONNS > 0 - int i; -#endif /* The free list is protected by a mutex. */ nxmutex_lock(&g_free_lock); -#if CONFIG_NET_PKT_ALLOC_CONNS > 0 - if (dq_peek(&g_free_pkt_connections) == NULL) - { -#if CONFIG_NET_PKT_MAX_CONNS > 0 - if (dq_count(&g_active_pkt_connections) + - CONFIG_NET_PKT_ALLOC_CONNS > CONFIG_NET_PKT_MAX_CONNS) - { - nxmutex_unlock(&g_free_lock); - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(*conn) * CONFIG_NET_PKT_ALLOC_CONNS); - if (conn != NULL) - { - for (i = 0; i < CONFIG_NET_PKT_ALLOC_CONNS; i++) - { - dq_addlast(&conn[i].sconn.node, &g_free_pkt_connections); - } - } - } -#endif - conn = (FAR struct pkt_conn_s *)dq_remfirst(&g_free_pkt_connections); + conn = NET_BUFPOOL_TRYALLOC(g_pkt_connections); if (conn) { /* Enqueue the connection into the active list */ @@ -171,22 +139,9 @@ void pkt_free(FAR struct pkt_conn_s *conn) dq_rem(&conn->sconn.node, &g_active_pkt_connections); - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection. */ -#if CONFIG_NET_PKT_ALLOC_CONNS == 1 - if (conn < g_pkt_connections || conn >= (g_pkt_connections + - CONFIG_NET_PKT_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_pkt_connections); - } + NET_BUFPOOL_FREE(g_pkt_connections, conn); nxmutex_unlock(&g_free_lock); } diff --git a/net/tcp/Kconfig b/net/tcp/Kconfig index fd2bcec1211..5574454fe0b 100644 --- a/net/tcp/Kconfig +++ b/net/tcp/Kconfig @@ -259,6 +259,20 @@ config NET_TCP_NWRBCHAINS choice for this value would be the same as the maximum number of TCP connections. +config NET_TCP_ALLOC_WRBCHAINS + int "Dynamic I/O buffer chain heads allocation" + default 1 + ---help--- + When set to 0 all dynamic allocations are disabled + + When set to 1 a new I/O buffer chain head will be allocated every + time, and it will be free'd when no longer needed. + + Setting this to 2 or more will allocate the I/O buffer chain heads + in batches (with batch size equal to this config). When a I/O buffer + chain head is no longer needed, it will be returned to the free + I/O buffer chain heads pool, and it will never be deallocated! + config NET_TCP_WRBUFFER_DEBUG bool "Force write buffer debug" default n diff --git a/net/tcp/tcp.h b/net/tcp/tcp.h index 14dcdeee3a0..10dacf8b5bd 100644 --- a/net/tcp/tcp.h +++ b/net/tcp/tcp.h @@ -1768,21 +1768,6 @@ bool tcp_should_send_recvwindow(FAR struct tcp_conn_s *conn); int psock_tcp_cansend(FAR struct tcp_conn_s *conn); -/**************************************************************************** - * Name: tcp_wrbuffer_initialize - * - * Description: - * Initialize the list of free write buffers - * - * Assumptions: - * Called once early initialization. - * - ****************************************************************************/ - -#ifdef CONFIG_NET_TCP_WRITE_BUFFERS -void tcp_wrbuffer_initialize(void); -#endif /* CONFIG_NET_TCP_WRITE_BUFFERS */ - #ifdef CONFIG_NET_TCP_WRITE_BUFFERS struct tcp_wrbuffer_s; diff --git a/net/tcp/tcp_conn.c b/net/tcp/tcp_conn.c index 2cc05157f5b..19c1fd97cca 100644 --- a/net/tcp/tcp_conn.c +++ b/net/tcp/tcp_conn.c @@ -74,18 +74,22 @@ #include "utils/utils.h" /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* The array containing all TCP connections. */ - -#if CONFIG_NET_TCP_PREALLOC_CONNS > 0 -static struct tcp_conn_s g_tcp_connections[CONFIG_NET_TCP_PREALLOC_CONNS]; +#ifndef CONFIG_NET_TCP_MAX_CONNS +# define CONFIG_NET_TCP_MAX_CONNS 0 #endif -/* A list of all free TCP connections */ +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* The array containing all TCP connections. */ -static dq_queue_t g_free_tcp_connections; +NET_BUFPOOL_DECLARE(g_tcp_connections, sizeof(struct tcp_conn_s), + CONFIG_NET_TCP_PREALLOC_CONNS, + CONFIG_NET_TCP_ALLOC_CONNS, CONFIG_NET_TCP_MAX_CONNS); /* A list of all connected TCP connections */ @@ -497,54 +501,6 @@ static inline int tcp_ipv6_bind(FAR struct tcp_conn_s *conn, } #endif /* CONFIG_NET_IPv6 */ -/**************************************************************************** - * Name: tcp_alloc_conn - * - * Description: - * Find or allocate a free TCP/IP connection structure for use. - * - ****************************************************************************/ - -#if CONFIG_NET_TCP_ALLOC_CONNS > 0 -static FAR struct tcp_conn_s *tcp_alloc_conn(void) -{ - FAR struct tcp_conn_s *conn; - int i; - - /* Return the entry from the head of the free list */ - - if (dq_peek(&g_free_tcp_connections) == NULL) - { -#if CONFIG_NET_TCP_MAX_CONNS > 0 - if (dq_count(&g_active_tcp_connections) + - CONFIG_NET_TCP_ALLOC_CONNS > CONFIG_NET_TCP_MAX_CONNS) - { - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(struct tcp_conn_s) * - CONFIG_NET_TCP_ALLOC_CONNS); - if (conn == NULL) - { - return conn; - } - - /* Now initialize each connection structure */ - - for (i = 0; i < CONFIG_NET_TCP_ALLOC_CONNS; i++) - { - /* Mark the connection closed and move it to the free list */ - - conn[i].tcpstateflags = TCP_CLOSED; - dq_addlast(&conn[i].sconn.node, &g_free_tcp_connections); - } - } - - return (FAR struct tcp_conn_s *)dq_remfirst(&g_free_tcp_connections); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -650,17 +606,6 @@ int tcp_selectport(uint8_t domain, void tcp_initialize(void) { -#if CONFIG_NET_TCP_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NET_TCP_PREALLOC_CONNS; i++) - { - /* Mark the connection closed and move it to the free list */ - - g_tcp_connections[i].tcpstateflags = TCP_CLOSED; - dq_addlast(&g_tcp_connections[i].sconn.node, &g_free_tcp_connections); - } -#endif } /**************************************************************************** @@ -687,7 +632,7 @@ FAR struct tcp_conn_s *tcp_alloc(uint8_t domain) /* Return the entry from the head of the free list */ - conn = (FAR struct tcp_conn_s *)dq_remfirst(&g_free_tcp_connections); + conn = NET_BUFPOOL_TRYALLOC(g_tcp_connections); #ifndef CONFIG_NET_SOLINGER /* Is the free list empty? */ @@ -760,21 +705,11 @@ FAR struct tcp_conn_s *tcp_alloc(uint8_t domain) * a new connection. */ - conn = (FAR struct tcp_conn_s *) - dq_remfirst(&g_free_tcp_connections); + conn = NET_BUFPOOL_TRYALLOC(g_tcp_connections); } } #endif - /* Allocate the connect entry from heap */ - -#if CONFIG_NET_TCP_ALLOC_CONNS > 0 - if (conn == NULL) - { - conn = tcp_alloc_conn(); - } -#endif - net_unlock(); /* Mark the connection allocated */ @@ -972,21 +907,9 @@ void tcp_free(FAR struct tcp_conn_s *conn) conn->tcpstateflags = TCP_CLOSED; - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection structure */ -#if CONFIG_NET_TCP_ALLOC_CONNS == 1 - if (conn < g_tcp_connections || conn >= (g_tcp_connections + - CONFIG_NET_TCP_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - dq_addlast(&conn->sconn.node, &g_free_tcp_connections); - } + NET_BUFPOOL_FREE(g_tcp_connections, conn); net_unlock(); } diff --git a/net/tcp/tcp_netpoll.c b/net/tcp/tcp_netpoll.c index 189e868e22b..f31077bcf55 100644 --- a/net/tcp/tcp_netpoll.c +++ b/net/tcp/tcp_netpoll.c @@ -230,12 +230,6 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds) info = conn->pollinfo; while (info->conn != NULL) { - if ((fds->events & info->fds->events) != 0) - { - nwarn("WARNING: fds->events %" PRIx32 " same event bit\n", - fds->events); - } - if (++info >= &conn->pollinfo[CONFIG_NET_TCP_NPOLLWAITERS]) { DEBUGPANIC(); diff --git a/net/tcp/tcp_wrbuffer.c b/net/tcp/tcp_wrbuffer.c index 4e426736092..2450f2f8322 100644 --- a/net/tcp/tcp_wrbuffer.c +++ b/net/tcp/tcp_wrbuffer.c @@ -48,64 +48,20 @@ #if defined(CONFIG_NET_TCP) && defined(CONFIG_NET_TCP_WRITE_BUFFERS) -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/* Package all globals used by this logic into a structure */ - -struct wrbuffer_s -{ - /* The semaphore to protect the buffers */ - - sem_t sem; - - /* This is the list of available write buffers */ - - sq_queue_t freebuffers; - - /* These are the pre-allocated write buffers */ - - struct tcp_wrbuffer_s buffers[CONFIG_NET_TCP_NWRBCHAINS]; -}; - /**************************************************************************** * Private Data ****************************************************************************/ /* This is the state of the global write buffer resource */ -static struct wrbuffer_s g_wrbuffer; +NET_BUFPOOL_DECLARE(g_wrbuffer, sizeof(struct tcp_wrbuffer_s), + CONFIG_NET_TCP_NWRBCHAINS, + CONFIG_NET_TCP_ALLOC_WRBCHAINS, 0); /**************************************************************************** * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: tcp_wrbuffer_initialize - * - * Description: - * Initialize the list of free write buffers - * - * Assumptions: - * Called once early initialization. - * - ****************************************************************************/ - -void tcp_wrbuffer_initialize(void) -{ - int i; - - sq_init(&g_wrbuffer.freebuffers); - - nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_TCP_NWRBCHAINS); - - for (i = 0; i < CONFIG_NET_TCP_NWRBCHAINS; i++) - { - sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers); - } -} - /**************************************************************************** * Name: tcp_wrbuffer_timedalloc * @@ -127,7 +83,6 @@ void tcp_wrbuffer_initialize(void) FAR struct tcp_wrbuffer_s *tcp_wrbuffer_timedalloc(unsigned int timeout) { FAR struct tcp_wrbuffer_s *wrb; - int ret; /* We need to allocate two things: (1) A write buffer structure and (2) * at least one I/O buffer to start the chain. @@ -137,20 +92,12 @@ FAR struct tcp_wrbuffer_s *tcp_wrbuffer_timedalloc(unsigned int timeout) * buffer */ - ret = net_sem_timedwait_uninterruptible(&g_wrbuffer.sem, timeout); - if (ret != OK) + wrb = NET_BUFPOOL_TIMEDALLOC(g_wrbuffer, timeout); + if (wrb == NULL) { return NULL; } - /* Now, we are guaranteed to have a write buffer structure reserved - * for us in the free list. - */ - - wrb = (FAR struct tcp_wrbuffer_s *)sq_remfirst(&g_wrbuffer.freebuffers); - DEBUGASSERT(wrb); - memset(wrb, 0, sizeof(struct tcp_wrbuffer_s)); - /* Now get the first I/O buffer for the write buffer structure */ wrb->wb_iob = net_iobtimedalloc(true, timeout); @@ -247,8 +194,7 @@ void tcp_wrbuffer_release(FAR struct tcp_wrbuffer_s *wrb) /* Then free the write buffer structure */ - sq_addlast(&wrb->wb_node, &g_wrbuffer.freebuffers); - nxsem_post(&g_wrbuffer.sem); + NET_BUFPOOL_FREE(g_wrbuffer, wrb); } /**************************************************************************** @@ -304,16 +250,7 @@ uint32_t tcp_wrbuffer_inqueue_size(FAR struct tcp_conn_s *conn) int tcp_wrbuffer_test(void) { - int val = 0; - int ret; - - ret = nxsem_get_value(&g_wrbuffer.sem, &val); - if (ret >= 0) - { - ret = val > 0 ? OK : -ENOSPC; - } - - return ret; + return NET_BUFPOOL_TEST(g_wrbuffer); } #endif /* CONFIG_NET_TCP && CONFIG_NET_TCP_WRITE_BUFFERS */ diff --git a/net/udp/Kconfig b/net/udp/Kconfig index e147b7a608a..e3cc5bf546e 100644 --- a/net/udp/Kconfig +++ b/net/udp/Kconfig @@ -103,6 +103,20 @@ config NET_UDP_NWRBCHAINS choice for this value would be the same as the maximum number of UDP connections. +config NET_UDP_ALLOC_WRBCHAINS + int "Dynamic I/O buffer chain heads allocation" + default 1 + ---help--- + When set to 0 all dynamic allocations are disabled. + + When set to 1 a new I/O buffer chain head will be allocated every + time, and it will be free'd when no longer needed. + + Setting this to 2 or more will allocate the I/O buffer chain heads + in batches (with batch size equal to this config). When a I/O buffer + chain head is no longer needed, it will be returned to the free + I/O buffer chain heads pool, and it will never be deallocated! + config NET_UDP_WRBUFFER_DEBUG bool "Force write buffer debug" default n diff --git a/net/udp/udp.h b/net/udp/udp.h index d1e2f466109..47f35b8ccfa 100644 --- a/net/udp/udp.h +++ b/net/udp/udp.h @@ -480,21 +480,6 @@ int udp_setsockopt(FAR struct socket *psock, int option, FAR const void *value, socklen_t value_len); #endif -/**************************************************************************** - * Name: udp_wrbuffer_initialize - * - * Description: - * Initialize the list of free write buffers - * - * Assumptions: - * Called once early initialization. - * - ****************************************************************************/ - -#ifdef CONFIG_NET_UDP_WRITE_BUFFERS -void udp_wrbuffer_initialize(void); -#endif /* CONFIG_NET_UDP_WRITE_BUFFERS */ - /**************************************************************************** * Name: udp_wrbuffer_alloc * diff --git a/net/udp/udp_conn.c b/net/udp/udp_conn.c index 83a13e725ec..553401adee2 100644 --- a/net/udp/udp_conn.c +++ b/net/udp/udp_conn.c @@ -75,18 +75,22 @@ #include "utils/utils.h" /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* The array containing all UDP connections. */ - -#if CONFIG_NET_UDP_PREALLOC_CONNS > 0 -static struct udp_conn_s g_udp_connections[CONFIG_NET_UDP_PREALLOC_CONNS]; +#ifndef CONFIG_NET_UDP_MAX_CONNS +# define CONFIG_NET_UDP_MAX_CONNS 0 #endif -/* A list of all free UDP connections */ +/**************************************************************************** + * Private Data + ****************************************************************************/ -static dq_queue_t g_free_udp_connections; +/* The array containing all UDP connections. */ + +NET_BUFPOOL_DECLARE(g_udp_connections, sizeof(struct udp_conn_s), + CONFIG_NET_UDP_PREALLOC_CONNS, + CONFIG_NET_UDP_ALLOC_CONNS, CONFIG_NET_UDP_MAX_CONNS); static mutex_t g_free_lock = NXMUTEX_INITIALIZER; /* A list of all allocated UDP connections */ @@ -460,54 +464,6 @@ udp_ipv6_active(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn, } #endif /* CONFIG_NET_IPv6 */ -/**************************************************************************** - * Name: udp_alloc_conn - * - * Description: - * Allocate a uninitialized UDP connection structure. - * - ****************************************************************************/ - -#if CONFIG_NET_UDP_ALLOC_CONNS > 0 -static FAR struct udp_conn_s *udp_alloc_conn(void) -{ - FAR struct udp_conn_s *conn; - int i; - - /* Return the entry from the head of the free list */ - - if (dq_peek(&g_free_udp_connections) == NULL) - { -#if CONFIG_NET_UDP_MAX_CONNS > 0 - if (dq_count(&g_active_udp_connections) + - CONFIG_NET_UDP_ALLOC_CONNS > CONFIG_NET_UDP_MAX_CONNS) - { - return NULL; - } -#endif - - conn = kmm_zalloc(sizeof(struct udp_conn_s) * - CONFIG_NET_UDP_ALLOC_CONNS); - if (conn == NULL) - { - return conn; - } - - /* Now initialize each connection structure */ - - for (i = 0; i < CONFIG_NET_UDP_ALLOC_CONNS; i++) - { - /* Mark the connection closed and move it to the free list */ - - conn[i].lport = 0; - dq_addlast(&conn[i].sconn.node, &g_free_udp_connections); - } - } - - return (FAR struct udp_conn_s *)dq_remfirst(&g_free_udp_connections); -} -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -593,17 +549,6 @@ uint16_t udp_select_port(uint8_t domain, FAR union ip_binding_u *u) void udp_initialize(void) { -#if CONFIG_NET_UDP_PREALLOC_CONNS > 0 - int i; - - for (i = 0; i < CONFIG_NET_UDP_PREALLOC_CONNS; i++) - { - /* Mark the connection closed and move it to the free list */ - - g_udp_connections[i].lport = 0; - dq_addlast(&g_udp_connections[i].sconn.node, &g_free_udp_connections); - } -#endif } /**************************************************************************** @@ -623,14 +568,7 @@ FAR struct udp_conn_s *udp_alloc(uint8_t domain) nxmutex_lock(&g_free_lock); - conn = (FAR struct udp_conn_s *)dq_remfirst(&g_free_udp_connections); - -#if CONFIG_NET_UDP_ALLOC_CONNS > 0 - if (conn == NULL) - { - conn = udp_alloc_conn(); - } -#endif + conn = NET_BUFPOOL_TRYALLOC(g_udp_connections); if (conn) { @@ -712,23 +650,9 @@ void udp_free(FAR struct udp_conn_s *conn) #endif - /* Free the connection. - * If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection. */ -#if CONFIG_NET_UDP_ALLOC_CONNS == 1 - if (conn < g_udp_connections || conn >= (g_udp_connections + - CONFIG_NET_UDP_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_udp_connections); - } + NET_BUFPOOL_FREE(g_udp_connections, conn); nxmutex_unlock(&g_free_lock); } diff --git a/net/udp/udp_sendto_buffered.c b/net/udp/udp_sendto_buffered.c index 2a746bbc42f..5aae170076b 100644 --- a/net/udp/udp_sendto_buffered.c +++ b/net/udp/udp_sendto_buffered.c @@ -941,7 +941,11 @@ int psock_udp_cansend(FAR struct udp_conn_s *conn) * many more. */ - if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0) + if (udp_wrbuffer_test() < 0 || iob_navail(false) <= 0 +#if CONFIG_NET_SEND_BUFSIZE > 0 + || udp_wrbuffer_inqueue_size(conn) >= conn->sndbufs +#endif + ) { return -EWOULDBLOCK; } diff --git a/net/udp/udp_wrbuffer.c b/net/udp/udp_wrbuffer.c index 0b9846c77f6..c967d216e93 100644 --- a/net/udp/udp_wrbuffer.c +++ b/net/udp/udp_wrbuffer.c @@ -47,64 +47,20 @@ #include "utils/utils.h" #include "udp/udp.h" -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/* Package all globals used by this logic into a structure */ - -struct wrbuffer_s -{ - /* The semaphore to protect the buffers */ - - sem_t sem; - - /* This is the list of available write buffers */ - - sq_queue_t freebuffers; - - /* These are the pre-allocated write buffers */ - - struct udp_wrbuffer_s buffers[CONFIG_NET_UDP_NWRBCHAINS]; -}; - /**************************************************************************** * Private Data ****************************************************************************/ /* This is the state of the global write buffer resource */ -static struct wrbuffer_s g_wrbuffer; +NET_BUFPOOL_DECLARE(g_wrbuffer, sizeof(struct udp_wrbuffer_s), + CONFIG_NET_UDP_NWRBCHAINS, + CONFIG_NET_UDP_ALLOC_WRBCHAINS, 0); /**************************************************************************** * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: udp_wrbuffer_initialize - * - * Description: - * Initialize the list of free write buffers - * - * Assumptions: - * Called once early initialization. - * - ****************************************************************************/ - -void udp_wrbuffer_initialize(void) -{ - int i; - - sq_init(&g_wrbuffer.freebuffers); - - nxsem_init(&g_wrbuffer.sem, 0, CONFIG_NET_UDP_NWRBCHAINS); - - for (i = 0; i < CONFIG_NET_UDP_NWRBCHAINS; i++) - { - sq_addfirst(&g_wrbuffer.buffers[i].wb_node, &g_wrbuffer.freebuffers); - } -} - /**************************************************************************** * Name: udp_wrbuffer_alloc * @@ -133,15 +89,8 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_alloc(void) * buffer */ - net_sem_wait_uninterruptible(&g_wrbuffer.sem); - - /* Now, we are guaranteed to have a write buffer structure reserved - * for us in the free list. - */ - - wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&g_wrbuffer.freebuffers); + wrb = NET_BUFPOOL_ALLOC(g_wrbuffer); DEBUGASSERT(wrb); - memset(wrb, 0, sizeof(struct udp_wrbuffer_s)); /* Now get the first I/O buffer for the write buffer structure */ @@ -177,7 +126,6 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_alloc(void) FAR struct udp_wrbuffer_s *udp_wrbuffer_timedalloc(unsigned int timeout) { FAR struct udp_wrbuffer_s *wrb; - int ret; /* We need to allocate two things: (1) A write buffer structure and (2) * at least one I/O buffer to start the chain. @@ -187,20 +135,12 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_timedalloc(unsigned int timeout) * buffer */ - ret = net_sem_timedwait_uninterruptible(&g_wrbuffer.sem, timeout); - if (ret != OK) + wrb = NET_BUFPOOL_TIMEDALLOC(g_wrbuffer, timeout); + if (wrb == NULL) { return NULL; } - /* Now, we are guaranteed to have a write buffer structure reserved - * for us in the free list. - */ - - wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&g_wrbuffer.freebuffers); - DEBUGASSERT(wrb); - memset(wrb, 0, sizeof(struct udp_wrbuffer_s)); - /* Now get the first I/O buffer for the write buffer structure */ wrb->wb_iob = net_iobtimedalloc(true, timeout); @@ -253,19 +193,12 @@ FAR struct udp_wrbuffer_s *udp_wrbuffer_tryalloc(void) * buffer */ - if (nxsem_trywait(&g_wrbuffer.sem) != OK) + wrb = NET_BUFPOOL_TRYALLOC(g_wrbuffer); + if (wrb == NULL) { return NULL; } - /* Now, we are guaranteed to have a write buffer structure reserved - * for us in the free list. - */ - - wrb = (FAR struct udp_wrbuffer_s *)sq_remfirst(&g_wrbuffer.freebuffers); - DEBUGASSERT(wrb); - memset(wrb, 0, sizeof(struct udp_wrbuffer_s)); - /* Now get the first I/O buffer for the write buffer structure */ wrb->wb_iob = @@ -312,8 +245,7 @@ void udp_wrbuffer_release(FAR struct udp_wrbuffer_s *wrb) /* Then free the write buffer structure */ - sq_addlast(&wrb->wb_node, &g_wrbuffer.freebuffers); - nxsem_post(&g_wrbuffer.sem); + NET_BUFPOOL_FREE(g_wrbuffer, wrb); } /**************************************************************************** @@ -363,9 +295,7 @@ uint32_t udp_wrbuffer_inqueue_size(FAR struct udp_conn_s *conn) int udp_wrbuffer_test(void) { - int val = 0; - nxsem_get_value(&g_wrbuffer.sem, &val); - return val > 0 ? OK : -ENOSPC; + return NET_BUFPOOL_TEST(g_wrbuffer); } #endif /* CONFIG_NET && CONFIG_NET_UDP && CONFIG_NET_UDP_WRITE_BUFFERS */ diff --git a/net/usrsock/usrsock_conn.c b/net/usrsock/usrsock_conn.c index c87703d915a..528b79ca283 100644 --- a/net/usrsock/usrsock_conn.c +++ b/net/usrsock/usrsock_conn.c @@ -43,21 +43,26 @@ #include #include "usrsock/usrsock.h" +#include "utils/utils.h" /**************************************************************************** - * Private Data + * Pre-processor Definitions ****************************************************************************/ -/* The array containing all usrsock connections. */ - -#if CONFIG_NET_USRSOCK_PREALLOC_CONNS > 0 -static struct usrsock_conn_s - g_usrsock_connections[CONFIG_NET_USRSOCK_PREALLOC_CONNS]; +#ifndef CONFIG_NET_USRSOCK_MAX_CONNS +# define CONFIG_NET_USRSOCK_MAX_CONNS 0 #endif -/* A list of all free usrsock connections */ +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* The array containing all usrsock connections. */ -static dq_queue_t g_free_usrsock_connections; +NET_BUFPOOL_DECLARE(g_usrsock_connections, sizeof(struct usrsock_conn_s), + CONFIG_NET_USRSOCK_PREALLOC_CONNS, + CONFIG_NET_USRSOCK_ALLOC_CONNS, + CONFIG_NET_USRSOCK_MAX_CONNS); static mutex_t g_free_lock = NXMUTEX_INITIALIZER; /* A list of all allocated usrsock connections */ @@ -80,38 +85,12 @@ static dq_queue_t g_active_usrsock_connections; FAR struct usrsock_conn_s *usrsock_alloc(void) { FAR struct usrsock_conn_s *conn; -#if CONFIG_NET_USRSOCK_ALLOC_CONNS > 0 - int i; -#endif /* The free list is protected by a a mutex. */ nxmutex_lock(&g_free_lock); -#if CONFIG_NET_USRSOCK_ALLOC_CONNS > 0 - if (dq_peek(&g_free_usrsock_connections) == NULL) - { -#if CONFIG_NET_USRSOCK_MAX_CONNS > 0 - if (dq_count(&g_active_usrsock_connections) + - CONFIG_NET_USRSOCK_ALLOC_CONNS > CONFIG_NET_USRSOCK_MAX_CONNS) - { - nxmutex_unlock(&g_free_lock); - return NULL; - } -#endif - conn = kmm_zalloc(sizeof(*conn) * CONFIG_NET_USRSOCK_ALLOC_CONNS); - if (conn != NULL) - { - for (i = 0; i < CONFIG_NET_USRSOCK_ALLOC_CONNS; i++) - { - dq_addlast(&conn[i].sconn.node, &g_free_usrsock_connections); - } - } - } -#endif - - conn = (FAR struct usrsock_conn_s *) - dq_remfirst(&g_free_usrsock_connections); + conn = NET_BUFPOOL_TRYALLOC(g_usrsock_connections); if (conn) { /* Make sure that the connection is marked as uninitialized */ @@ -154,22 +133,9 @@ void usrsock_free(FAR struct usrsock_conn_s *conn) nxsem_destroy(&conn->resp.sem); - /* If this is a preallocated or a batch allocated connection store it in - * the free connections list. Else free it. - */ + /* Free the connection. */ -#if CONFIG_NET_USRSOCK_ALLOC_CONNS == 1 - if (conn < g_usrsock_connections || conn >= (g_usrsock_connections + - CONFIG_NET_USRSOCK_PREALLOC_CONNS)) - { - kmm_free(conn); - } - else -#endif - { - memset(conn, 0, sizeof(*conn)); - dq_addlast(&conn->sconn.node, &g_free_usrsock_connections); - } + NET_BUFPOOL_FREE(g_usrsock_connections, conn); nxmutex_unlock(&g_free_lock); } @@ -334,22 +300,6 @@ void usrsock_setup_datain(FAR struct usrsock_conn_s *conn, void usrsock_initialize(void) { -#if CONFIG_NET_USRSOCK_PREALLOC_CONNS > 0 - FAR struct usrsock_conn_s *conn; - int i; - - for (i = 0; i < CONFIG_NET_USRSOCK_PREALLOC_CONNS; i++) - { - conn = &g_usrsock_connections[i]; - - /* Mark the connection closed and move it to the free list */ - - conn->usockid = USRSOCK_USOCKID_INVALID; - conn->state = USRSOCK_CONN_STATE_UNINITIALIZED; - dq_addlast(&conn->sconn.node, &g_free_usrsock_connections); - } -#endif - /* Register /dev/usrsock character device. */ usrsock_register(); diff --git a/net/utils/CMakeLists.txt b/net/utils/CMakeLists.txt index 8803381a3dc..a960501fdbd 100644 --- a/net/utils/CMakeLists.txt +++ b/net/utils/CMakeLists.txt @@ -33,7 +33,8 @@ set(SRCS net_snoop.c net_cmsg.c net_iob_concat.c - net_mask2pref.c) + net_mask2pref.c + net_bufpool.c) # IPv6 utilities diff --git a/net/utils/Make.defs b/net/utils/Make.defs index de2d96a28a8..a279cd22151 100644 --- a/net/utils/Make.defs +++ b/net/utils/Make.defs @@ -25,6 +25,7 @@ NET_CSRCS += net_dsec2tick.c net_dsec2timeval.c net_timeval2dsec.c NET_CSRCS += net_chksum.c net_ipchksum.c net_incr32.c net_lock.c NET_CSRCS += net_snoop.c net_cmsg.c net_iob_concat.c net_mask2pref.c +NET_CSRCS += net_bufpool.c # IPv6 utilities diff --git a/net/utils/net_bufpool.c b/net/utils/net_bufpool.c new file mode 100644 index 00000000000..70f0fba2094 --- /dev/null +++ b/net/utils/net_bufpool.c @@ -0,0 +1,199 @@ +/**************************************************************************** + * net/utils/net_bufpool.c + * + * SPDX-License-Identifier: Apache-2.0 + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "utils/utils.h" + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/* The node to store in the pool */ + +struct net_bufnode_s +{ + sq_entry_t node; +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: net_bufpool_init + * + * Description: + * Initialize a network buffer pool. + * + * Input Parameters: + * pool - The pool to be initialized + * + ****************************************************************************/ + +static void net_bufpool_init(FAR struct net_bufpool_s *pool) +{ + int i; + + DEBUGASSERT(pool->nodesize < 0); + pool->nodesize = -pool->nodesize; + + for (i = 0; i < pool->prealloc; i++) + { + FAR struct net_bufnode_s *node = (FAR struct net_bufnode_s *) + (pool->pool + i * pool->nodesize); + sq_addlast(&node->node, &pool->freebuffers); + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: net_bufpool_timedalloc + * + * Description: + * Allocate a buffer from the pool. If no buffer is available, then wait + * for the specified timeout. + * + * Input Parameters: + * pool - The pool from which to allocate the buffer + * timeout - The maximum time to wait for a buffer to become available. + * + * Returned Value: + * A reference to the allocated buffer, which is guaranteed to be zeroed. + * NULL is returned on a timeout. + * + ****************************************************************************/ + +FAR void *net_bufpool_timedalloc(FAR struct net_bufpool_s *pool, + unsigned int timeout) +{ + FAR struct net_bufnode_s *node; + int ret; + int i; + + if (pool->nodesize < 0) + { + net_bufpool_init(pool); + DEBUGASSERT(pool->nodesize > 0); + } + + ret = net_sem_timedwait_uninterruptible(&pool->sem, timeout); + if (ret != OK) + { + return NULL; + } + + /* If we get here, then we didn't exceed maxalloc. */ + + if (pool->dynalloc > 0 && sq_peek(&pool->freebuffers) == NULL) + { + node = kmm_zalloc(pool->nodesize * pool->dynalloc); + if (node == NULL) + { + return NULL; + } + + /* Now initialize each connection structure */ + + for (i = 0; i < pool->dynalloc; i++) + { + sq_addlast(&node->node, &pool->freebuffers); + node = (FAR struct net_bufnode_s *) + ((FAR char *)node + pool->nodesize); + } + } + + return sq_remfirst(&pool->freebuffers); +} + +/**************************************************************************** + * Name: net_bufpool_free + * + * Description: + * Free a buffer from the pool. + * + * Input Parameters: + * pool - The pool from which to allocate the buffer + * node - The buffer to be freed + * + ****************************************************************************/ + +void net_bufpool_free(FAR struct net_bufpool_s *pool, FAR void *node) +{ + DEBUGASSERT(pool->nodesize > 0); + + if (pool->dynalloc == 1 && + ((FAR char *)node < pool->pool || + (FAR char *)node >= pool->pool + pool->prealloc * pool->nodesize)) + { + kmm_free(node); + } + else + { + FAR struct net_bufnode_s *net_bufnode = node; + + /* Set the buffer to zero, to make sure all nodes in the free buffer + * pool are zeroed. + */ + + memset(net_bufnode, 0, pool->nodesize); + sq_addlast(&net_bufnode->node, &pool->freebuffers); + } + + nxsem_post(&pool->sem); +} + +/**************************************************************************** + * Name: net_bufpool_test + * + * Description: + * Check if there is room in the buffer pool. Does not reserve any space. + * + * Assumptions: + * None. + * + ****************************************************************************/ + +int net_bufpool_test(FAR struct net_bufpool_s *pool) +{ + int val = 0; + int ret; + + ret = nxsem_get_value(&pool->sem, &val); + if (ret >= 0) + { + ret = val > 0 ? OK : -ENOSPC; + } + + return ret; +} diff --git a/net/utils/utils.h b/net/utils/utils.h index d5355d03d8d..729c5faa157 100644 --- a/net/utils/utils.h +++ b/net/utils/utils.h @@ -76,6 +76,35 @@ (nport) = HTONS(hport); \ } while (0) +/* Network buffer pool related macros, in which: + * pool: The name of the buffer pool + * nodesize: The size of each node in the pool + * prealloc: The number of pre-allocated buffers + * dynalloc: The number per dynamic allocations + * maxalloc: The number of max allocations, 0 means no limit + */ + +#define NET_BUFPOOL_MAX(prealloc, dynalloc, maxalloc) \ + (dynalloc) <= 0 ? (prealloc) : ((maxalloc) > 0 ? (maxalloc) : INT16_MAX) + +#define NET_BUFPOOL_DECLARE(pool, nodesize, prealloc, dynalloc, maxalloc) \ + static char pool##_buffer[prealloc][nodesize]; \ + static struct net_bufpool_s pool = \ + { \ + pool##_buffer[0], \ + prealloc, \ + dynalloc, \ + -nodesize, \ + SEM_INITIALIZER(NET_BUFPOOL_MAX(prealloc, dynalloc, maxalloc)), \ + { NULL, NULL } \ + }; + +#define NET_BUFPOOL_TIMEDALLOC(p,t) net_bufpool_timedalloc(&p, t) +#define NET_BUFPOOL_TRYALLOC(p) net_bufpool_timedalloc(&p, 0) +#define NET_BUFPOOL_ALLOC(p) net_bufpool_timedalloc(&p, UINT_MAX) +#define NET_BUFPOOL_FREE(p,n) net_bufpool_free(&p, n) +#define NET_BUFPOOL_TEST(p) net_bufpool_test(&p) + /**************************************************************************** * Public Types ****************************************************************************/ @@ -89,6 +118,22 @@ enum tv2ds_remainder_e TV2DS_CEIL /* Force to next larger full decisecond */ }; +/* This structure is used to manage a pool of network buffers */ + +struct net_bufpool_s +{ + /* Allocation configuration */ + + FAR char *pool; /* The beginning of the pre-allocated buffer pool */ + int prealloc; /* The number of pre-allocated buffers */ + int dynalloc; /* The number per dynamic allocations */ + int nodesize; /* The size of each node in the pool */ + + sem_t sem; /* The semaphore for waiting for free buffers */ + + sq_queue_t freebuffers; +}; + /**************************************************************************** * Public Data ****************************************************************************/ @@ -322,6 +367,53 @@ FAR void *net_ipv6_payload(FAR struct ipv6_hdr_s *ipv6, FAR uint8_t *proto); uint16_t net_iob_concat(FAR struct iob_s **iob1, FAR struct iob_s **iob2); #endif +/**************************************************************************** + * Name: net_bufpool_timedalloc + * + * Description: + * Allocate a buffer from the pool. If no buffer is available, then wait + * for the specified timeout. + * + * Input Parameters: + * pool - The pool from which to allocate the buffer + * timeout - The maximum time to wait for a buffer to become available. + * + * Returned Value: + * A reference to the allocated buffer, which is guaranteed to be zeroed. + * NULL is returned on a timeout. + * + ****************************************************************************/ + +FAR void *net_bufpool_timedalloc(FAR struct net_bufpool_s *pool, + unsigned int timeout); + +/**************************************************************************** + * Name: net_bufpool_free + * + * Description: + * Free a buffer from the pool. + * + * Input Parameters: + * pool - The pool from which to allocate the buffer + * node - The buffer to be freed + * + ****************************************************************************/ + +void net_bufpool_free(FAR struct net_bufpool_s *pool, FAR void *node); + +/**************************************************************************** + * Name: net_bufpool_test + * + * Description: + * Check if there is room in the buffer pool. Does not reserve any space. + * + * Assumptions: + * None. + * + ****************************************************************************/ + +int net_bufpool_test(FAR struct net_bufpool_s *pool); + /**************************************************************************** * Name: net_chksum_adjust * diff --git a/openamp/0001-lib-errno.h-fix-compile-error.patch b/openamp/0001-lib-errno.h-fix-compile-error.patch index c7388325ac4..48444e474d9 100644 --- a/openamp/0001-lib-errno.h-fix-compile-error.patch +++ b/openamp/0001-lib-errno.h-fix-compile-error.patch @@ -5,7 +5,6 @@ Subject: [PATCH 1/5] lib/errno.h: fix compile error lib/errno.h: delete defined(__arm__) for use GCC compile -Change-Id: I00f93740810c1cb8875fc2e27bac478aecaf28d5 Signed-off-by: wangyongrong --- lib/errno.h | 2 +- diff --git a/openamp/0001-ns-acknowledge-the-received-creation-message.patch b/openamp/0001-ns-acknowledge-the-received-creation-message.patch index 18caee06d96..a7b1fb87df1 100644 --- a/openamp/0001-ns-acknowledge-the-received-creation-message.patch +++ b/openamp/0001-ns-acknowledge-the-received-creation-message.patch @@ -6,7 +6,6 @@ Subject: [PATCH 01/14] ns: acknowledge the received creation message the two phase handsake make the client could initiate the transfer immediately without the server side send any dummy message first. -Change-Id: I3289120a4e0d2291ba8b39de98d97de9e15880d0 Signed-off-by: Xiang Xiao Signed-off-by: wangyongrong --- diff --git a/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch b/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch index 03b84841c4e..4e2e531b912 100644 --- a/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch +++ b/openamp/0002-Negotiate-individual-buffer-size-dynamically.patch @@ -9,7 +9,6 @@ If slave support VIRTIO_RPMSG_F_BUFSZ(0x04) feature, master determine the buffer size from config space(first 8 bytes), otherwise the default size(512 bytes) will be used. -Change-Id: Ief68ed298495296a9eff38448ce5661f188300c2 Signed-off-by: anchao Signed-off-by: Xiang Xiao Signed-off-by: wangyongrong diff --git a/openamp/0002-libmetal-atomic-enable-64-bit-atomic-by-toolchain-bu.patch b/openamp/0002-libmetal-atomic-enable-64-bit-atomic-by-toolchain-bu.patch index 9e416b8d312..0f8a3db03c4 100644 --- a/openamp/0002-libmetal-atomic-enable-64-bit-atomic-by-toolchain-bu.patch +++ b/openamp/0002-libmetal-atomic-enable-64-bit-atomic-by-toolchain-bu.patch @@ -18,7 +18,6 @@ toolchains have built-in properties to indicate whether support atomic64: | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 | #define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 -Change-Id: Iab9f7df0a9d21e29c8b8d131006cb4817414ebdc Signed-off-by: chao an --- lib/io.h | 3 ++- diff --git a/openamp/0003-atomic.h-fix-compiler-error.patch b/openamp/0003-atomic.h-fix-compiler-error.patch index dee4c958b45..4056a3260d1 100644 --- a/openamp/0003-atomic.h-fix-compiler-error.patch +++ b/openamp/0003-atomic.h-fix-compiler-error.patch @@ -26,7 +26,6 @@ In file included from /home/wyr/work/code/velasim/upgrade/nuttx/include/nuttx/ne /home/wyr/work/code/velasim/upgrade/nuttx/include/metal/compiler/gcc/atomic.h:22:15: error: conflicting type qualifiers for 'atomic_short' 22 | typedef short atomic_short; -Change-Id: Ic4e920c27e0f8a263136eb9ecb5350edd157195d Signed-off-by: Yongrong Wang --- lib/atomic.h | 4 ++-- diff --git a/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch b/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch index 905858dafad..7db9086e559 100644 --- a/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch +++ b/openamp/0003-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch @@ -4,7 +4,6 @@ Date: Tue, 19 Oct 2021 19:45:14 +0800 Subject: [PATCH 03/14] rpmsg: notify the user when the remote address is received -Change-Id: I1085e98aa0bd50746b624ec3fce1e3ca407c17e3 Signed-off-by: ligd Signed-off-by: wangyongrong --- diff --git a/openamp/0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch b/openamp/0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch index 8d8b40ef1b8..fe31a3665a2 100644 --- a/openamp/0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch +++ b/openamp/0004-lib-system-nuttx-fix-unused-parameter-compile-error.patch @@ -18,7 +18,6 @@ error: unused parameter ‘len’ [-Werror=unused-parameter] 25 | static inline void __metal_cache_flush(void *addr, unsigned int len) | ~~~~~~~~~~~~~^~~ -Change-Id: Ic4515da151d90fd1f87d94d5523144967a7ca688 Signed-off-by: Yongrong Wang --- lib/system/nuttx/cache.h | 5 +++++ diff --git a/openamp/0004-openamp-virtio.h-negotiate_features-also-can-be-call.patch b/openamp/0004-openamp-virtio.h-negotiate_features-also-can-be-call.patch index 2f974f94716..36b6027ddef 100644 --- a/openamp/0004-openamp-virtio.h-negotiate_features-also-can-be-call.patch +++ b/openamp/0004-openamp-virtio.h-negotiate_features-also-can-be-call.patch @@ -4,7 +4,6 @@ Date: Tue, 2 Jul 2024 16:33:32 +0800 Subject: [PATCH 04/14] openamp/virtio.h: negotiate_features also can be call when final_features is NULL -Change-Id: I41774d6c8b3c8b7487dc4b640fa60f4061ad3694 Signed-off-by: wangyongrong --- lib/include/openamp/virtio.h | 6 ++++-- diff --git a/openamp/0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch b/openamp/0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch index 4c73ca0fcfe..d4ecbd8a3af 100644 --- a/openamp/0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch +++ b/openamp/0005-libmetal-cmake-set-HAVE_STDATOMIC_H-default-true-in-.patch @@ -4,7 +4,6 @@ Date: Fri, 6 Sep 2024 10:56:49 +0800 Subject: [PATCH 5/5] libmetal(cmake):set HAVE_STDATOMIC_H default true in NuttX platform -Change-Id: I84e6fdd03753a16a9c296e87ab121cb8c16f3c61 Signed-off-by: xuxin19 --- cmake/depends.cmake | 10 ++++++++-- diff --git a/openamp/0005-remoteproc-rpmsg_virtio-change-sched_yeild-to-usleep.patch b/openamp/0005-remoteproc-rpmsg_virtio-change-sched_yeild-to-usleep.patch index 14e8ec85da4..53ac619f0a6 100644 --- a/openamp/0005-remoteproc-rpmsg_virtio-change-sched_yeild-to-usleep.patch +++ b/openamp/0005-remoteproc-rpmsg_virtio-change-sched_yeild-to-usleep.patch @@ -3,7 +3,6 @@ From: wangyongrong Date: Wed, 3 Jul 2024 10:00:34 +0800 Subject: [PATCH 05/14] remoteproc/rpmsg_virtio: change sched_yeild to usleep -Change-Id: I4246185cb1d2f363df170e2aa03a1901b0a296a8 Signed-off-by: wangyongrong --- lib/remoteproc/remoteproc_virtio.c | 3 ++- diff --git a/openamp/0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch b/openamp/0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch index baabca60035..3cfcb0beb9b 100644 --- a/openamp/0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch +++ b/openamp/0006-lib-system-nuttx-io.c-include-stddef.h-in-nuttx-io.c.patch @@ -5,7 +5,6 @@ Subject: [PATCH 6/6] lib/system/nuttx/io.c: include in nuttx/io.c Because nuttx/io.c use NULL and NULL is defined in -Change-Id: I98af56739e6beb6f165ef165e700c3ed8305d1d1 Signed-off-by: Bowen Wang --- lib/system/nuttx/io.c | 1 + diff --git a/openamp/0006-rpmsg-wait-ept-ready-in-rpmsg_send.patch b/openamp/0006-rpmsg-wait-ept-ready-in-rpmsg_send.patch index f82073bae5c..a7252a24628 100644 --- a/openamp/0006-rpmsg-wait-ept-ready-in-rpmsg_send.patch +++ b/openamp/0006-rpmsg-wait-ept-ready-in-rpmsg_send.patch @@ -5,7 +5,6 @@ Subject: [PATCH 06/14] rpmsg: wait ept ready in rpmsg_send since the destination address need time to return from peer -Change-Id: I1a518c15cd375205b07861c7d39670de555eaaed Signed-off-by: ligd Signed-off-by: wangyongrong --- diff --git a/openamp/0007-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch b/openamp/0007-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch index 07b930c700f..23a4a6a4843 100644 --- a/openamp/0007-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch +++ b/openamp/0007-openamp-add-VIRTIO_RING_F_MUST_NOTIFY-event.patch @@ -3,7 +3,6 @@ From: ligd Date: Thu, 23 Jun 2022 00:41:13 +0800 Subject: [PATCH 07/14] openamp: add VIRTIO_RING_F_MUST_NOTIFY event -Change-Id: I455c4a5427fbcc60c6f61707c4304c12aa13ee58 Signed-off-by: ligd --- lib/include/openamp/virtqueue.h | 3 +++ diff --git a/openamp/0008-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch b/openamp/0008-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch index 8eb9b5ed31b..3923d4c5253 100644 --- a/openamp/0008-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch +++ b/openamp/0008-rpmsg_virtio-don-t-need-check-status-when-get_tx_pay.patch @@ -4,7 +4,6 @@ Date: Wed, 3 Jul 2024 10:28:31 +0800 Subject: [PATCH 08/14] rpmsg_virtio: don't need check status when get_tx_payload -Change-Id: I6c0632a6924dafeb0c01ec0b16c9f53d2fbc6810 Signed-off-by: ligd --- lib/rpmsg/rpmsg_virtio.c | 6 ------ diff --git a/openamp/0009-openamp-swap-get_rx_buffer-return_rx_buffer-to-resol.patch b/openamp/0009-openamp-swap-get_rx_buffer-return_rx_buffer-to-resol.patch index e053318bf18..5259d62a3f3 100644 --- a/openamp/0009-openamp-swap-get_rx_buffer-return_rx_buffer-to-resol.patch +++ b/openamp/0009-openamp-swap-get_rx_buffer-return_rx_buffer-to-resol.patch @@ -4,7 +4,6 @@ Date: Fri, 7 Apr 2023 12:42:09 +0800 Subject: [PATCH 09/14] openamp: swap get_rx_buffer & return_rx_buffer to resolve remote low power. -Change-Id: I84e8b3a7a6796b5865da482db0408d5a08c55c2a Signed-off-by: ligd Signed-off-by: wangyongrong --- diff --git a/openamp/0010-rpmsg_virtio.c-virtqueue_kick-after-all-rx-buffer-re.patch b/openamp/0010-rpmsg_virtio.c-virtqueue_kick-after-all-rx-buffer-re.patch index 4c555166910..f8bf9e6c957 100644 --- a/openamp/0010-rpmsg_virtio.c-virtqueue_kick-after-all-rx-buffer-re.patch +++ b/openamp/0010-rpmsg_virtio.c-virtqueue_kick-after-all-rx-buffer-re.patch @@ -7,7 +7,6 @@ Subject: [PATCH 10/14] rpmsg_virtio.c: virtqueue_kick after all rx buffer Only kick once when all the rx buffers has been returned to decrease the interrupt times to improve the performance -Change-Id: I158e3a63063e8eff7b97a02660f2d7a6c812c493 Signed-off-by: Yongrong Wang Signed-off-by: Bowen Wang --- diff --git a/openamp/0011-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch b/openamp/0011-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch index abb7319a649..7b359c3f839 100644 --- a/openamp/0011-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch +++ b/openamp/0011-virtio-change-feature-to-64-bit-in-all-virtio_dispat.patch @@ -6,7 +6,6 @@ Subject: [PATCH 11/14] virtio: change feature to 64 bit in all virtio_dispatch The virtio device feature bit has exceeded 32 bits, so change feautre to 64 bit like linux does to support more features -Change-Id: I42c016e3e9eaac5fdbfdf19549a906bc51eb6939 Signed-off-by: Yongrong Wang --- lib/include/openamp/rpmsg_virtio.h | 2 +- diff --git a/openamp/0012-rpmsg_virtio.c-fix-get_tx_payload_buffer-error.patch b/openamp/0012-rpmsg_virtio.c-fix-get_tx_payload_buffer-error.patch index 2d6aecd846d..2aa6c361300 100644 --- a/openamp/0012-rpmsg_virtio.c-fix-get_tx_payload_buffer-error.patch +++ b/openamp/0012-rpmsg_virtio.c-fix-get_tx_payload_buffer-error.patch @@ -5,7 +5,6 @@ Subject: [PATCH 12/14] rpmsg_virtio.c: fix get_tx_payload_buffer error Always sleep when notify wait return not RPMSG_SUCCESS -Change-Id: I2fa50e649de36114597fec09dfcf96c7d2d35546 Signed-off-by: Yongrong Wang --- lib/rpmsg/rpmsg_virtio.c | 4 +--- diff --git a/openamp/0013-openamp-add-assert-when-get-tx-buffer-failed.patch b/openamp/0013-openamp-add-assert-when-get-tx-buffer-failed.patch index 781b575e008..9633c14c2b0 100644 --- a/openamp/0013-openamp-add-assert-when-get-tx-buffer-failed.patch +++ b/openamp/0013-openamp-add-assert-when-get-tx-buffer-failed.patch @@ -5,7 +5,6 @@ Subject: [PATCH 13/14] openamp: add assert when get tx buffer failed So we can found the error more eaily -Change-Id: Idade291ac8d8224b1ccbe0c0120bc07c036be17a Signed-off-by: dongjiuzhu1 --- lib/rpmsg/rpmsg_virtio.c | 2 ++ diff --git a/openamp/0014-virtio.h-add-memory-operation-for-virtio-device.patch b/openamp/0014-virtio.h-add-memory-operation-for-virtio-device.patch index 47abc6dcca6..7c09c34011d 100644 --- a/openamp/0014-virtio.h-add-memory-operation-for-virtio-device.patch +++ b/openamp/0014-virtio.h-add-memory-operation-for-virtio-device.patch @@ -6,7 +6,6 @@ Subject: [PATCH 14/14] virtio.h: add memory operation for virtio device To make different virtio device/transport can use it's own memory region. -Change-Id: I30adcc2c4215cefa8d0f7d81b6ebffd0f3ad74b5 Signed-off-by: Bowen Wang --- lib/include/openamp/virtio.h | 42 ++++++++++++++++++++++++++++++++++++ diff --git a/sched/Kconfig b/sched/Kconfig index 24f0a14eeab..ac4f703ca68 100644 --- a/sched/Kconfig +++ b/sched/Kconfig @@ -346,6 +346,11 @@ config IRQ_NWORKS ---help--- The max num of active irq wqueue. +config IRQ_WORK_SECTION + string "The section where irq stack is located" + ---help--- + The section where irq stack is located. + config IRQ_WORK_STACKSIZE int "The default stack size for isr wqueue" default DEFAULT_TASK_STACKSIZE @@ -1343,47 +1348,6 @@ config SCHED_STACK_RECORD to disable.Through instrumentation, record the backtrace at the deepest point in the stack. -config SCHED_GCOV - bool "Enable GCOV support" - select HAVE_CXXINITIALIZE - default n - ---help--- - Enable GCOV support for code coverage analysis. - After turning on this option, code coverage can be analyzed. - If this option is enabled, image size and performance will be - significantly reduced. Before use, you need to add the - "-fprofile-generate -ftest-coverage" compilation parameters - to the file to be analyzed. - -config SCHED_GCOV_ALL - bool "Enable gcov call graph for all modules" - depends on SCHED_GCOV - default n - ---help--- - Enable gcov profiling for all code, it will instrument - all code, which will cause a large performance penalty for the code. - -config SCHED_GPROF - bool "Enable gprof profiling" - default n - ---help--- - Enable gprof profiling support. This will cause the compiler to - generate additional code to support profiling. This will also - cause the linker to include the gmon.out file in the final - executable. - Add the "-pg" parameter to the Makefile when compiling to obtain - the function call graph of the specified module. - -config SCHED_GPROF_ALL - bool "Enable gprof call graph for all modules" - depends on SCHED_GPROF - default n - ---help--- - Enable gprof profiling for all code, it will instrument - all code, which will cause a large performance penalty for the code. - You can add the '-pg' parameter to the specified module in the - makefile to only analyze the content of the module. - endmenu menu "Files and I/O" diff --git a/sched/init/nx_bringup.c b/sched/init/nx_bringup.c index 2ea82b920ad..f9dbb69d350 100644 --- a/sched/init/nx_bringup.c +++ b/sched/init/nx_bringup.c @@ -322,8 +322,7 @@ static inline void nx_start_application(void) board_late_initialize(); #endif -#if defined(CONFIG_BOARD_COREDUMP_SYSLOG) || \ - defined(CONFIG_BOARD_COREDUMP_BLKDEV) +#ifndef CONFIG_BOARD_CRASHDUMP_NONE coredump_initialize(); #endif diff --git a/sched/init/nx_start.c b/sched/init/nx_start.c index d45f68bbf15..01ba4df823f 100644 --- a/sched/init/nx_start.c +++ b/sched/init/nx_start.c @@ -129,7 +129,7 @@ dq_queue_t g_assignedtasks[CONFIG_SMP_NCPUS]; FAR struct tcb_s *g_delivertasks[CONFIG_SMP_NCPUS]; #endif -/* g_running_tasks[] holds a references to the running task for each cpu. +/* g_running_tasks[] holds a references to the running task for each CPU. * It is valid only when up_interrupt_context() returns true. */ diff --git a/sched/instrument/CMakeLists.txt b/sched/instrument/CMakeLists.txt index 581008f9073..1782ddae2a1 100644 --- a/sched/instrument/CMakeLists.txt +++ b/sched/instrument/CMakeLists.txt @@ -26,8 +26,4 @@ if(NOT "${CONFIG_SCHED_STACK_RECORD}" STREQUAL "0") list(APPEND SRCS stack_monitor.c) endif() -if(CONFIG_SCHED_GPROF) - list(APPEND SRCS profile_monitor.c) -endif() - target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/instrument/Make.defs b/sched/instrument/Make.defs index 5f90ba29dc0..60e087b3564 100644 --- a/sched/instrument/Make.defs +++ b/sched/instrument/Make.defs @@ -26,10 +26,6 @@ ifneq ($(CONFIG_SCHED_STACK_RECORD),0) CSRCS += stack_monitor.c endif -ifeq ($(CONFIG_SCHED_GPROF),y) -CSRCS += profile_monitor.c -endif - # Include instrument build support DEPPATH += --dep-path instrument diff --git a/sched/irq/CMakeLists.txt b/sched/irq/CMakeLists.txt index 93f5cbee097..a7ce08452e1 100644 --- a/sched/irq/CMakeLists.txt +++ b/sched/irq/CMakeLists.txt @@ -42,4 +42,9 @@ if(CONFIG_IRQCHAIN) list(APPEND SRCS irq_chain.c) endif() +if(CONFIG_IRQ_WORK_SECTION) + target_compile_definitions( + sched PRIVATE -DIRQ_WORK_SECTION="${CONFIG_IRQ_WORK_SECTION}") +endif() + target_sources(sched PRIVATE ${SRCS}) diff --git a/sched/irq/Make.defs b/sched/irq/Make.defs index 189f87ce000..6c53716e736 100644 --- a/sched/irq/Make.defs +++ b/sched/irq/Make.defs @@ -42,6 +42,10 @@ ifeq ($(CONFIG_IRQCHAIN),y) CSRCS += irq_chain.c endif +ifneq ($(CONFIG_IRQ_WORK_SECTION),"") + CFLAGS += ${DEFINE_PREFIX}IRQ_WORK_SECTION=CONFIG_IRQ_WORK_SECTION +endif + # Include irq build support DEPPATH += --dep-path irq diff --git a/sched/irq/irq_attach_wqueue.c b/sched/irq/irq_attach_wqueue.c index 560c5d81cf2..8d404e5de3b 100644 --- a/sched/irq/irq_attach_wqueue.c +++ b/sched/irq/irq_attach_wqueue.c @@ -71,6 +71,14 @@ static struct irq_work_info_s g_irq_work_vector[NR_IRQS]; static mutex_t g_irq_wqueue_lock = NXMUTEX_INITIALIZER; static FAR struct kwork_wqueue_s *g_irq_wqueue[CONFIG_IRQ_NWORKS]; +#ifdef IRQ_WORK_SECTION +static uint8_t g_irq_work_stack[CONFIG_IRQ_NWORKS][CONFIG_IRQ_WORK_STACKSIZE] +locate_data(IRQ_WORK_SECTION); +#else +static uint8_t g_irq_work_stack[CONFIG_IRQ_NWORKS] + [CONFIG_IRQ_WORK_STACKSIZE]; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -98,7 +106,7 @@ inline_function FAR struct kwork_wqueue_s *irq_get_wqueue(int priority) DEBUGASSERT(i < CONFIG_IRQ_NWORKS); - queue = work_queue_create("isrwork", priority, + queue = work_queue_create("isrwork", priority, g_irq_work_stack[i], CONFIG_IRQ_WORK_STACKSIZE, 1); g_irq_wqueue[i] = queue; diff --git a/sched/misc/assert.c b/sched/misc/assert.c index 215f61991b4..ed4fdd0cde5 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -301,7 +301,7 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t sp) /* Try to restore SP from current_regs if assert from interrupt. */ tcbstack_sp = up_interrupt_context() ? - up_getusrsp((FAR void *)up_current_regs()) : 0; + up_getusrsp((FAR void *)running_regs()) : 0; if (tcbstack_sp < tcbstack_base || tcbstack_sp >= tcbstack_top) { tcbstack_sp = 0; @@ -600,7 +600,7 @@ static void dump_deadlock(void) static noreturn_function int pause_cpu_handler(FAR void *arg) { - memcpy(g_last_regs[this_cpu()], up_current_regs(), sizeof(g_last_regs[0])); + memcpy(g_last_regs[this_cpu()], running_regs(), sizeof(g_last_regs[0])); g_cpu_paused[this_cpu()] = true; up_flush_dcache_all(); while (1); @@ -750,17 +750,14 @@ static void dump_fatal_info(FAR struct tcb_s *rtcb, usbtrace_enumerate(assert_tracecallback, NULL); #endif -#ifdef CONFIG_BOARD_CRASHDUMP - board_crashdump(up_getsp(), rtcb, filename, linenum, msg, regs); -#endif - -#if defined(CONFIG_BOARD_COREDUMP_SYSLOG) || \ - defined(CONFIG_BOARD_COREDUMP_BLKDEV) - /* Flush previous SYSLOG data before possible long time coredump */ syslog_flush(); +#ifdef CONFIG_BOARD_CRASHDUMP_CUSTOM + board_crashdump(up_getsp(), rtcb, filename, linenum, msg, regs); +#elif !defined(CONFIG_BOARD_CRASHDUMP_NONE) + /* Dump core information */ # ifdef CONFIG_BOARD_COREDUMP_FULL diff --git a/sched/misc/coredump.c b/sched/misc/coredump.c index 4f39b51fa4f..e3c7e12e682 100644 --- a/sched/misc/coredump.c +++ b/sched/misc/coredump.c @@ -47,6 +47,11 @@ # define ELF_PAGESIZE 1024 #endif +#if defined(CONFIG_BOARD_COREDUMP_BLKDEV) || \ + defined(CONFIG_BOARD_COREDUMP_MTDDEV) +# define CONFIG_BOARD_COREDUMP_DEV +#endif + #define PROGRAM_ALIGNMENT 64 #define ROUNDUP(x, y) ((x + (y - 1)) / (y)) * (y) @@ -87,8 +92,9 @@ static struct lib_hexdumpstream_s g_hexstream; #endif #ifdef CONFIG_BOARD_COREDUMP_BLKDEV -static struct lib_blkoutstream_s g_blockstream; -static unsigned char *g_blockinfo; +static struct lib_blkoutstream_s g_devstream; +#elif defined(CONFIG_BOARD_COREDUMP_MTDDEV) +static struct lib_mtdoutstream_s g_devstream; #endif #ifdef CONFIG_BOARD_MEMORY_RANGE @@ -164,7 +170,7 @@ static int elf_emit_align(FAR struct elf_dumpinfo_s *cinfo) ELF_PAGESIZE) - cinfo->stream->nput; unsigned char null[256]; off_t total = align; - off_t ret; + off_t ret = 0; memset(null, 0, sizeof(null)); @@ -309,7 +315,7 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo, { if (up_interrupt_context()) { - regs = (FAR uintptr_t *)up_current_regs(); + regs = (FAR uintptr_t *)running_regs(); } else { @@ -670,77 +676,73 @@ static void coredump_dump_syslog(pid_t pid) #endif /**************************************************************************** - * Name: coredump_dump_blkdev + * Name: coredump_dump_dev * * Description: - * Save coredump to block device. + * Save coredump to storage device. * ****************************************************************************/ -#ifdef CONFIG_BOARD_COREDUMP_BLKDEV -static void coredump_dump_blkdev(pid_t pid) +#ifdef CONFIG_BOARD_COREDUMP_DEV +static void coredump_dump_dev(pid_t pid) { - FAR void *stream = &g_blockstream; - FAR struct coredump_info_s *info; - blkcnt_t nsectors; + FAR void *stream = &g_devstream; + struct coredump_info_s info; int ret; - if (g_blockstream.inode == NULL) + if (g_devstream.inode == NULL) { _alert("Coredump device not found\n"); return; } - nsectors = (sizeof(struct coredump_info_s) + - g_blockstream.geo.geo_sectorsize - 1) / - g_blockstream.geo.geo_sectorsize; - - ret = g_blockstream.inode->u.i_bops->read(g_blockstream.inode, - g_blockinfo, g_blockstream.geo.geo_nsectors - nsectors, nsectors); +#ifdef CONFIG_BOARD_COREDUMP_COMPRESSION + lib_lzfoutstream(&g_lzfstream, stream); + stream = &g_lzfstream; +#endif + ret = coredump(g_regions, stream, pid); if (ret < 0) { - _alert("Coredump information read fail\n"); + _alert("Coredump fail %d\n", ret); return; } - info = (FAR struct coredump_info_s *)g_blockinfo; - -#ifdef CONFIG_BOARD_COREDUMP_COMPRESSION - lib_lzfoutstream(&g_lzfstream, - (FAR struct lib_outstream_s *)&g_blockstream); - stream = &g_lzfstream; -#endif + info.magic = COREDUMP_MAGIC; + info.size = g_devstream.common.nput; + clock_gettime(CLOCK_REALTIME, &info.time); + uname(&info.name); - ret = coredump(g_regions, stream, pid); + ret = lib_stream_seek(&g_devstream, -(off_t)sizeof(info), SEEK_END); if (ret < 0) { - _alert("Coredump fail\n"); + _alert("Coredump info seek fail %d\n", ret); return; } - info->magic = COREDUMP_MAGIC; - info->size = g_blockstream.common.nput; - clock_gettime(CLOCK_REALTIME, &info->time); - uname(&info->name); - ret = g_blockstream.inode->u.i_bops->write(g_blockstream.inode, - (FAR void *)info, g_blockstream.geo.geo_nsectors - nsectors, nsectors); + if (info.size > ret) + { + _alert("Coredump no enough space for info\n"); + return; + } + + ret = lib_stream_puts(&g_devstream, &info, sizeof(info)); if (ret < 0) { - _alert("Coredump information write fail\n"); + _alert("Coredump information write fail %d\n", ret); return; } - /* Close block device directly, make sure all data write to block device */ + /* Flush to ensure outstream write all data to storage device */ - ret = g_blockstream.inode->u.i_bops->close(g_blockstream.inode); + ret = lib_stream_flush(&g_devstream); if (ret < 0) { - _alert("Coredump information close fail\n"); + _alert("Coredump flush fail %d\n", ret); return; } - _alert("Finish coredump, write %d bytes to %s\n", - info->size, CONFIG_BOARD_COREDUMP_BLKDEV_PATH); + _alert("Finish coredump, write %zu bytes to %s\n", + info.size, CONFIG_BOARD_COREDUMP_DEVPATH); } #endif @@ -859,7 +861,6 @@ int coredump_add_memory_region(FAR const void *ptr, size_t size, int coredump_initialize(void) { - blkcnt_t nsectors; int ret = 0; #ifdef CONFIG_BOARD_MEMORY_RANGE @@ -867,29 +868,21 @@ int coredump_initialize(void) #endif #ifdef CONFIG_BOARD_COREDUMP_BLKDEV - ret = lib_blkoutstream_open(&g_blockstream, - CONFIG_BOARD_COREDUMP_BLKDEV_PATH); - if (ret < 0) - { - _alert("%s Coredump device not found\n", - CONFIG_BOARD_COREDUMP_BLKDEV_PATH); - return ret; - } - - nsectors = (sizeof(struct coredump_info_s) + - g_blockstream.geo.geo_sectorsize - 1) / - g_blockstream.geo.geo_sectorsize; + ret = lib_blkoutstream_open(&g_devstream, + CONFIG_BOARD_COREDUMP_DEVPATH); +#elif defined(CONFIG_BOARD_COREDUMP_MTDDEV) + ret = lib_mtdoutstream_open(&g_devstream, + CONFIG_BOARD_COREDUMP_DEVPATH); +#endif - g_blockinfo = kmm_malloc(g_blockstream.geo.geo_sectorsize * nsectors); - if (g_blockinfo == NULL) +#ifdef CONFIG_BOARD_COREDUMP_DEV + if (ret < 0) { - _alert("Coredump device memory alloc fail\n"); - lib_blkoutstream_close(&g_blockstream); - return -ENOMEM; + _alert("%s Coredump device not found %d\n", + CONFIG_BOARD_COREDUMP_DEVPATH, ret); } #endif - UNUSED(nsectors); return ret; } @@ -910,8 +903,8 @@ void coredump_dump(pid_t pid) coredump_dump_syslog(pid); #endif -#ifdef CONFIG_BOARD_COREDUMP_BLKDEV - coredump_dump_blkdev(pid); +#ifdef CONFIG_BOARD_COREDUMP_DEV + coredump_dump_dev(pid); #endif } diff --git a/sched/pthread/pthread_barrierwait.c b/sched/pthread/pthread_barrierwait.c index 2486c2d70ed..0cbf4901e95 100644 --- a/sched/pthread/pthread_barrierwait.c +++ b/sched/pthread/pthread_barrierwait.c @@ -82,67 +82,35 @@ int pthread_barrier_wait(FAR pthread_barrier_t *barrier) { - irqstate_t flags; - int semcount; - int ret; - if (barrier == NULL) { return EINVAL; } - /* Disable pre-emption throughout the following */ - - flags = enter_critical_section(); - - /* Find out how many threads are already waiting at the barrier */ - - ret = nxsem_get_value(&barrier->sem, &semcount); - if (ret != OK) - { - leave_critical_section(flags); - return -ret; - } - /* If the number of waiters would be equal to the count, then we are done */ - if ((1 - semcount) >= (int)barrier->count) + nxmutex_lock(&barrier->mutex); + + if ((barrier->wait_count + 1) >= barrier->count) { /* Free all of the waiting threads */ - while (semcount < 0) + while (barrier->wait_count > 0) { + barrier->wait_count--; nxsem_post(&barrier->sem); - nxsem_get_value(&barrier->sem, &semcount); } /* Then return PTHREAD_BARRIER_SERIAL_THREAD to the final thread */ - leave_critical_section(flags); + nxmutex_unlock(&barrier->mutex); + return PTHREAD_BARRIER_SERIAL_THREAD; } - /* Otherwise, this thread must wait as well */ - - while ((ret = nxsem_wait(&barrier->sem)) != OK) - { - /* If the thread is awakened by a signal, just continue to wait */ - - if (ret != -EINTR) - { - /* If it is awakened by some other error, then there is a - * problem - */ - - break; - } - } + barrier->wait_count++; - /* We will only get here when we are one of the N-1 threads that were - * waiting for the final thread at the barrier. We just need to return - * zero. - */ + nxmutex_unlock(&barrier->mutex); - leave_critical_section(flags); - return -ret; + return -nxsem_wait_uninterruptible(&barrier->sem); } diff --git a/sched/pthread/pthread_condbroadcast.c b/sched/pthread/pthread_condbroadcast.c index 599bd976c23..c6d72bd7e81 100644 --- a/sched/pthread/pthread_condbroadcast.c +++ b/sched/pthread/pthread_condbroadcast.c @@ -42,7 +42,10 @@ * * Description: * A thread broadcast on a condition variable. - * + * pthread_cond_broadcast shall unblock all threads currently blocked on a + * specified condition variable cond. We need own the mutex that threads + * calling pthread_cond_wait or pthread_cond_timedwait have associated + * with the condition variable during their wait. * Input Parameters: * None * @@ -56,7 +59,6 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond) { int ret = OK; - int sval; sinfo("cond=%p\n", cond); @@ -73,31 +75,22 @@ int pthread_cond_broadcast(FAR pthread_cond_t *cond) sched_lock(); - /* Get the current value of the semaphore */ + /* Loop until all of the waiting threads have been restarted. */ - if (nxsem_get_value(&cond->sem, &sval) != OK) - { - ret = EINVAL; - } - else + while (cond->wait_count > 0) { - /* Loop until all of the waiting threads have been restarted. */ - - while (sval < 0) - { - /* If the value is less than zero (meaning that one or more - * thread is waiting), then post the condition semaphore. - * Only the highest priority waiting thread will get to execute - */ + /* If the value is less than zero (meaning that one or more + * thread is waiting), then post the condition semaphore. + * Only the highest priority waiting thread will get to execute + */ - ret = -nxsem_post(&cond->sem); + ret = -nxsem_post(&cond->sem); - /* Increment the semaphore count (as was done by the - * above post). - */ + /* Increment the semaphore count (as was done by the + * above post). + */ - sval++; - } + cond->wait_count--; } /* Now we can let the restarted threads run */ diff --git a/sched/pthread/pthread_condclockwait.c b/sched/pthread/pthread_condclockwait.c index ff557bbe5c1..77a62101f9a 100644 --- a/sched/pthread/pthread_condclockwait.c +++ b/sched/pthread/pthread_condclockwait.c @@ -75,7 +75,6 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond, clockid_t clockid, FAR const struct timespec *abstime) { - irqstate_t flags; int ret = OK; int status; @@ -114,14 +113,7 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond, sinfo("Give up mutex...\n"); - /* We must disable pre-emption and interrupts here so that - * the time stays valid until the wait begins. This adds - * complexity because we assure that interrupts and - * pre-emption are re-enabled correctly. - */ - - sched_lock(); - flags = enter_critical_section(); + cond->wait_count++; /* Give up the mutex */ @@ -136,12 +128,6 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond, } } - /* Restore interrupts (pre-emption will be enabled - * when we fall through the if/then/else) - */ - - leave_critical_section(flags); - /* Reacquire the mutex (retaining the ret). */ sinfo("Re-locking...\n"); @@ -151,12 +137,6 @@ int pthread_cond_clockwait(FAR pthread_cond_t *cond, { ret = status; } - - /* Re-enable pre-emption (It is expected that interrupts - * have already been re-enabled in the above logic) - */ - - sched_unlock(); } leave_cancellation_point(); diff --git a/sched/pthread/pthread_condsignal.c b/sched/pthread/pthread_condsignal.c index fb9453b712e..4e9055f773d 100644 --- a/sched/pthread/pthread_condsignal.c +++ b/sched/pthread/pthread_condsignal.c @@ -41,6 +41,10 @@ * * Description: * A thread can signal on a condition variable. + * pthread_cond_signal shall unblock a thread currently blocked on a + * specified condition variable cond. We need own the mutex that threads + * calling pthread_cond_wait or pthread_cond_timedwait have associated + * with the condition variable during their wait. * * Input Parameters: * None @@ -55,7 +59,6 @@ int pthread_cond_signal(FAR pthread_cond_t *cond) { int ret = OK; - int sval; sinfo("cond=%p\n", cond); @@ -65,36 +68,11 @@ int pthread_cond_signal(FAR pthread_cond_t *cond) } else { - /* Get the current value of the semaphore */ - - if (nxsem_get_value(&cond->sem, &sval) != OK) - { - ret = EINVAL; - } - - /* If the value is less than zero (meaning that one or more - * thread is waiting), then post the condition semaphore. - * Only the highest priority waiting thread will get to execute - */ - - else + if (cond->wait_count > 0) { - /* One of my objectives in this design was to make - * pthread_cond_signal() usable from interrupt handlers. However, - * from interrupt handlers, you cannot take the associated mutex - * before signaling the condition. As a result, I think that - * there could be a race condition with the following logic which - * assumes that the if sval < 0 then the thread is waiting. - * Without the mutex, there is no atomic, protected operation that - * will guarantee this to be so. - */ - - sinfo("sval=%d\n", sval); - if (sval < 0) - { - sinfo("Signalling...\n"); - ret = -nxsem_post(&cond->sem); - } + sinfo("Signalling...\n"); + cond->wait_count--; + ret = -nxsem_post(&cond->sem); } } diff --git a/sched/pthread/pthread_condwait.c b/sched/pthread/pthread_condwait.c index fbc914897c9..ca8f05511e4 100644 --- a/sched/pthread/pthread_condwait.c +++ b/sched/pthread/pthread_condwait.c @@ -60,7 +60,6 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex) { int status; int ret; - irqstate_t flags; sinfo("cond=%p mutex=%p\n", cond, mutex); @@ -89,14 +88,9 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex) sinfo("Give up mutex / take cond\n"); - flags = enter_critical_section(); - sched_lock(); + cond->wait_count++; ret = pthread_mutex_breaklock(mutex, &nlocks); - /* Take the semaphore. This may be awakened only be a signal (EINTR) - * or if the thread is canceled (ECANCELED) - */ - status = -nxsem_wait_uninterruptible(&cond->sem); if (ret == OK) { @@ -105,9 +99,6 @@ int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex) ret = status; } - sched_unlock(); - leave_critical_section(flags); - /* Reacquire the mutex. * * When cancellation points are enabled, we need to hold the mutex diff --git a/sched/sched/sched.h b/sched/sched/sched.h index d8ffdf2accb..a9784930610 100644 --- a/sched/sched/sched.h +++ b/sched/sched/sched.h @@ -197,12 +197,6 @@ extern dq_queue_t g_assignedtasks[CONFIG_SMP_NCPUS]; extern FAR struct tcb_s *g_delivertasks[CONFIG_SMP_NCPUS]; -/* g_running_tasks[] holds a references to the running task for each cpu. - * It is valid only when up_interrupt_context() returns true. - */ - -extern FAR struct tcb_s *g_running_tasks[CONFIG_SMP_NCPUS]; - /* This is the list of all tasks that are ready-to-run, but cannot be placed * in the g_readytorun list because: (1) They are higher priority than the * currently active task at the head of the g_readytorun list, and (2) the diff --git a/sched/sched/sched_processtimer.c b/sched/sched/sched_processtimer.c index 0de54a4038f..abea66b666b 100644 --- a/sched/sched/sched_processtimer.c +++ b/sched/sched/sched_processtimer.c @@ -37,6 +37,10 @@ # include #endif +#ifdef CONFIG_CLOCK_TIMEKEEPING +# include "clock/clock_timekeeping.h" +#endif + #include "sched/sched.h" #include "wdog/wdog.h" #include "clock/clock.h" diff --git a/sched/sched/sched_releasetcb.c b/sched/sched/sched_releasetcb.c index 628e42ff07d..ba830abd6ae 100644 --- a/sched/sched/sched_releasetcb.c +++ b/sched/sched/sched_releasetcb.c @@ -107,6 +107,10 @@ int nxsched_release_tcb(FAR struct tcb_s *tcb, uint8_t ttype) if (tcb) { + /* Released tcb shouldn't on any list */ + + DEBUGASSERT(tcb->flink == NULL && tcb->blink == NULL); + #ifndef CONFIG_DISABLE_POSIX_TIMERS /* Release any timers that the task might hold. We do this * before release the PID because it may still be trying to diff --git a/sched/signal/sig_timedwait.c b/sched/signal/sig_timedwait.c index 219de4ee139..4a4f6ab8b7e 100644 --- a/sched/signal/sig_timedwait.c +++ b/sched/signal/sig_timedwait.c @@ -401,7 +401,7 @@ int nxsig_timedwait(FAR const sigset_t *set, FAR struct siginfo *info, siginfo_t unbinfo; int ret; - DEBUGASSERT(set != NULL); + DEBUGASSERT(set != NULL && up_interrupt_context() == false); /* Several operations must be performed below: We must determine if any * signal is pending and, if not, wait for the signal. Since signals can diff --git a/sched/wqueue/kwork_thread.c b/sched/wqueue/kwork_thread.c index 61e04ff9dcc..3a67382815e 100644 --- a/sched/wqueue/kwork_thread.c +++ b/sched/wqueue/kwork_thread.c @@ -230,6 +230,7 @@ static int work_thread(int argc, FAR char *argv[]) * Input Parameters: * name - Name of the new task * priority - Priority of the new task + * stack_addr - Stack buffer of the new task * stack_size - size (in bytes) of the stack needed * wqueue - Work queue instance * @@ -239,7 +240,7 @@ static int work_thread(int argc, FAR char *argv[]) ****************************************************************************/ static int work_thread_create(FAR const char *name, int priority, - int stack_size, + FAR void *stack_addr, int stack_size, FAR struct kwork_wqueue_s *wqueue) { FAR char *argv[3]; @@ -264,8 +265,8 @@ static int work_thread_create(FAR const char *name, int priority, argv[1] = arg1; argv[2] = NULL; - pid = kthread_create(name, priority, stack_size, - work_thread, argv); + pid = kthread_create_with_stack(name, priority, stack_addr, stack_size, + work_thread, argv); DEBUGASSERT(pid > 0); if (pid < 0) @@ -299,8 +300,9 @@ static int work_thread_create(FAR const char *name, int priority, * Input Parameters: * name - Name of the new task * priority - Priority of the new task + * stack_addr - Stack buffer of the new task * stack_size - size (in bytes) of the stack needed - * nthreads - Number of work thread should be created + * nthreads - Number of work thread should be created * * Returned Value: * The work queue handle returned on success. Otherwise, NULL @@ -309,6 +311,7 @@ static int work_thread_create(FAR const char *name, int priority, FAR struct kwork_wqueue_s *work_queue_create(FAR const char *name, int priority, + FAR void *stack_addr, int stack_size, int nthreads) { FAR struct kwork_wqueue_s *wqueue; @@ -337,7 +340,7 @@ FAR struct kwork_wqueue_s *work_queue_create(FAR const char *name, /* Create the work queue thread pool */ - ret = work_thread_create(name, priority, stack_size, wqueue); + ret = work_thread_create(name, priority, stack_addr, stack_size, wqueue); if (ret < 0) { kmm_free(wqueue); @@ -457,7 +460,7 @@ int work_start_highpri(void) sinfo("Starting high-priority kernel worker thread(s)\n"); - return work_thread_create(HPWORKNAME, CONFIG_SCHED_HPWORKPRIORITY, + return work_thread_create(HPWORKNAME, CONFIG_SCHED_HPWORKPRIORITY, NULL, CONFIG_SCHED_HPWORKSTACKSIZE, (FAR struct kwork_wqueue_s *)&g_hpwork); } @@ -485,7 +488,7 @@ int work_start_lowpri(void) sinfo("Starting low-priority kernel worker thread(s)\n"); - return work_thread_create(LPWORKNAME, CONFIG_SCHED_LPWORKPRIORITY, + return work_thread_create(LPWORKNAME, CONFIG_SCHED_LPWORKPRIORITY, NULL, CONFIG_SCHED_LPWORKSTACKSIZE, (FAR struct kwork_wqueue_s *)&g_lpwork); } diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 1c3baae5315..f883a50c879 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -128,6 +128,7 @@ "putenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char *" "pwrite","unistd.h","","ssize_t","int","FAR const void *","size_t","off_t" "read","unistd.h","","ssize_t","int","FAR void *","size_t" +"readv","sys/uio.h","","ssize_t","int","FAR const struct iovec *","int" "readlink","unistd.h","defined(CONFIG_PSEUDOFS_SOFTLINKS)","ssize_t","FAR const char *","FAR char *","size_t" "recv","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR void *","size_t","int" "recvfrom","sys/socket.h","defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int","FAR struct sockaddr*","FAR socklen_t*" @@ -208,3 +209,4 @@ "waitid","sys/wait.h","defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_SCHED_HAVE_PARENT)","int","idtype_t","id_t"," FAR siginfo_t *","int" "waitpid","sys/wait.h","defined(CONFIG_SCHED_WAITPID)","pid_t","pid_t","FAR int *","int" "write","unistd.h","","ssize_t","int","FAR const void *","size_t" +"writev","sys/uio.h","","ssize_t","int","FAR const struct iovec *","int" diff --git a/tools/Config.mk b/tools/Config.mk index 97472ef9b83..6db3090317d 100644 --- a/tools/Config.mk +++ b/tools/Config.mk @@ -659,7 +659,7 @@ endef # CLEAN - Default clean target -ifeq ($(CONFIG_SCHED_GCOV),y) +ifeq ($(CONFIG_COVERAGE_NONE),) EXTRA = *.gcno *.gcda endif diff --git a/tools/Directories.mk b/tools/Directories.mk index 672c4a48eb4..96d63c4706d 100644 --- a/tools/Directories.mk +++ b/tools/Directories.mk @@ -61,14 +61,14 @@ ifeq ($(EXTERNALDIR),external) KERNDEPDIRS += external endif -CONTEXTDIRS = boards drivers fs $(APPDIR) $(ARCH_SRC) +CONTEXTDIRS = boards drivers fs $(APPDIR) $(ARCH_SRC) mm CLEANDIRS += pass1 ifeq ($(CONFIG_BUILD_FLAT),y) KERNDEPDIRS += libs$(DELIM)libc mm -ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),) +ifeq ($(CONFIG_LIB_BUILTIN),y) KERNDEPDIRS += libs$(DELIM)libbuiltin else CLEANDIRS += libs$(DELIM)libbuiltin @@ -90,7 +90,7 @@ else USERDEPDIRS += libs$(DELIM)libc mm -ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),) +ifeq ($(CONFIG_LIB_BUILTIN),y) USERDEPDIRS += libs$(DELIM)libbuiltin else CLEANDIRS += libs$(DELIM)libbuiltin @@ -122,7 +122,7 @@ CLEANDIRS += syscall endif endif -CONTEXTDIRS += libs$(DELIM)libc +CONTEXTDIRS += libs$(DELIM)libc libs$(DELIM)libbuiltin ifeq ($(CONFIG_LIBM_TOOLCHAIN)$(CONFIG_LIBM_NONE),) CONTEXTDIRS += libs$(DELIM)libm @@ -145,11 +145,12 @@ KERNDEPDIRS += libs$(DELIM)libnx else USERDEPDIRS += libs$(DELIM)libnx endif -CONTEXTDIRS += libs$(DELIM)libnx else CLEANDIRS += libs$(DELIM)libnx endif +CONTEXTDIRS += libs$(DELIM)libnx + ifeq ($(CONFIG_AUDIO),y) KERNDEPDIRS += audio else @@ -195,8 +196,4 @@ else CLEANDIRS += openamp endif -ifeq ($(CONFIG_MM_TLSF_MANAGER),y) -CONTEXTDIRS += mm -endif - CLEANDIRS += $(KERNDEPDIRS) $(USERDEPDIRS) diff --git a/tools/FlatLibs.mk b/tools/FlatLibs.mk index 0f0851ba7bd..35b931c054a 100644 --- a/tools/FlatLibs.mk +++ b/tools/FlatLibs.mk @@ -52,7 +52,7 @@ NUTTXLIBS += staging$(DELIM)libarch$(LIBEXT) # Add toolchain library support -ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),) +ifeq ($(CONFIG_LIB_BUILTIN),y) NUTTXLIBS += staging$(DELIM)libbuiltin$(LIBEXT) endif diff --git a/tools/KernelLibs.mk b/tools/KernelLibs.mk index bc47a1f5565..a5ba049fd08 100644 --- a/tools/KernelLibs.mk +++ b/tools/KernelLibs.mk @@ -54,7 +54,7 @@ USERLIBS += staging$(DELIM)libmm$(LIBEXT) staging$(DELIM)libarch$(LIBEXT) # Add toolchain library support -ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),) +ifeq ($(CONFIG_LIB_BUILTIN),y) NUTTXLIBS += staging$(DELIM)libkbuiltin$(LIBEXT) USERLIBS += staging$(DELIM)libbuiltin$(LIBEXT) endif diff --git a/tools/Make.defs b/tools/Make.defs index d8899bbcd80..2b94b325f3c 100644 --- a/tools/Make.defs +++ b/tools/Make.defs @@ -29,6 +29,9 @@ ifeq ($(CONFIG_APPS_DIR),) CONFIG_APPS_DIR = $(TOPDIR)/../apps endif +ifneq ($(firstword $(CONFIG_APPS_DIR)),/) +CONFIG_APPS_DIR := $(TOPDIR)/$(CONFIG_APPS_DIR) +endif APPDIR := $(realpath ${shell if [ -r $(CONFIG_APPS_DIR)/Makefile ]; then echo "$(CONFIG_APPS_DIR)"; fi}) ifeq ($(APPDIR),) diff --git a/tools/ProtectedLibs.mk b/tools/ProtectedLibs.mk index df576118739..e2116dc748c 100644 --- a/tools/ProtectedLibs.mk +++ b/tools/ProtectedLibs.mk @@ -54,7 +54,7 @@ USERLIBS += staging$(DELIM)libmm$(LIBEXT) staging$(DELIM)libarch$(LIBEXT) # Add toolchain library support -ifeq ($(CONFIG_BUILTIN_TOOLCHAIN),) +ifeq ($(CONFIG_LIB_BUILTIN),y) NUTTXLIBS += staging$(DELIM)libkbuiltin$(LIBEXT) USERLIBS += staging$(DELIM)libbuiltin$(LIBEXT) endif diff --git a/tools/ci/testlist/arm-05.dat b/tools/ci/testlist/arm-05.dat index 0095ea78683..2e44e3e8f1c 100644 --- a/tools/ci/testlist/arm-05.dat +++ b/tools/ci/testlist/arm-05.dat @@ -5,6 +5,7 @@ /arm/mps/mps3-an547/configs/ap,CONFIG_ARM_TOOLCHAIN_GNU_EABI /arm/mps/mps3-an547/configs/bl,CONFIG_ARM_TOOLCHAIN_GNU_EABI /arm/mps/mps3-an547/configs/clang,CONFIG_ARM_TOOLCHAIN_CLANG +/arm/mps/mps3-an547/configs/gcov,CONFIG_ARM_TOOLCHAIN_CLANG /arm/mps/mps3-an547/configs/nsh,CONFIG_ARM_TOOLCHAIN_GNU_EABI /arm/mps/mps3-an547/configs/picostest,CONFIG_ARM_TOOLCHAIN_GNU_EABI diff --git a/tools/rp2040/Config.mk b/tools/rp2040/Config.mk index 2d3faa7fd86..51bafdf6f40 100644 --- a/tools/rp2040/Config.mk +++ b/tools/rp2040/Config.mk @@ -26,17 +26,33 @@ # POSTBUILD -- Perform post build operations -ifeq ($(CONFIG_RP2040_UF2_BINARY),y) -ifdef PICO_SDK_PATH -define POSTBUILD - $(Q)echo "Generating: nuttx.uf2"; \ +PICOTOOL_BIN_PATH?=$(PICO_SDK_PATH)$(DELIM)_deps$(DELIM)picotool$(DELIM)picotool - picotool$(HOSTEXEEXT) uf2 convert --quiet -t elf nuttx nuttx.uf2; - $(Q)([ $$? -eq 0 ] && echo nuttx.uf2 >> nuttx.manifest && echo "Done.") -endef -else -define POSTBUILD - $(Q) echo "PICO_SDK_PATH must be specified for flash boot" +define GEN_PICO_UF2 + $(Q)echo "Generating: nuttx.uf2"; \ + + $(Q)$1 uf2 convert --quiet -t elf nuttx nuttx.uf2; + $(Q)([ $$? -eq 0 ] && echo nuttx.uf2 >> nuttx.manifest && echo "Done.") endef -endif + +ifeq ($(CONFIG_RP2040_UF2_BINARY),y) + ifneq ($(shell which picotool),) + define POSTBUILD + $(call GEN_PICO_UF2, picotool) + endef + else ifdef PICO_SDK_PATH + define POSTBUILD + $(Q)(if ! $(PICOTOOL_BIN_PATH) help >&/dev/null; then \ + echo "Building: picotool"; \ + cd $(PICO_SDK_PATH); \ + cmake . >&/dev/null; \ + make picotoolBuild >&/dev/null; \ + fi;) + $(call GEN_PICO_UF2, $(PICOTOOL_BIN_PATH)) + endef + else + define POSTBUILD + $(Q) echo "PICO_SDK_PATH/picotool must be specified/installed for flash boot" + endef + endif endif