diff --git a/apps/nshlib/nsh_fscmds.c b/apps/nshlib/nsh_fscmds.c index b3c394834..db01d6d90 100644 --- a/apps/nshlib/nsh_fscmds.c +++ b/apps/nshlib/nsh_fscmds.c @@ -54,6 +54,10 @@ # ifdef CONFIG_FS_FAT # include # endif +# ifdef CONFIG_NFS +# include +# include +# endif #endif #endif @@ -1219,13 +1223,15 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) FAR char *address; FAR char *target; FAR char *protocol = NULL; + struct sockaddr_in *sin = NULL; bool badarg = false; #ifdef CONFIG_NET_IPv6 struct in6_addr inaddr; #else - struct in_addr inaddr: + struct in_addr inaddr; #endif int ret; + int tcp = 0; /* Get the NFS mount options */ @@ -1234,7 +1240,7 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { switch (option) { - /* Protocol may be UDP or TCP/IP */ + /* Protocol may be UDP or TCP */ case 'p': protocol = optarg; @@ -1257,6 +1263,25 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } } + /* Decode the protocol string */ + + if (protocol) + { + if (!strncmp(protocol, "tcp", 3)) + { + tcp = 1; + } + else if (!strncmp(protocol, "udp", 3)) + { + tcp = 0; + } + else + { + nsh_output(vtbl, g_fmtarginvalid, argv[0]); + badarg = true; + } + } + /* If a bad argument was encountered, then return without processing the * command. */ @@ -1304,9 +1329,9 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) /* Convert the IP address string into its binary form */ #ifdef CONFIG_NET_IPv6 - ret = inet_pton(AF_INET, address, &inaddr); -#else ret = inet_pton(AF_INET6, address, &inaddr); +#else + ret = inet_pton(AF_INET, address, &inaddr); #endif if (ret != 1) { @@ -1315,7 +1340,24 @@ int cmd_nfsmount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) } /* Place all of the NFS arguements into the nfs_args structure */ -#warning "Missing logic" + + memset(&data, 0, sizeof(data)); + data.version = 3; + data.proto = (tcp) ? 6 : 17; + dato.sotype = (tcp) ? 0 : 1; + sin->sin_family = 2; + sin->sin_port = htons(2049); + sin->sin_addr = inaddr; + data.addr = (struct sockaddr *)sin; + data.flags = 0x00000200; + data.retrans = 3; + data.acregmin = 3; + data.acregmax = 60; + data.acdirmin = 30; + data.acdirmax = 60; + data.rsize = 0; + data.wsize = 0; + data.timeo = (tcp) ? 70 : 7; /* Perform the mount */ diff --git a/nuttx/Kconfig b/nuttx/Kconfig index ffd0125c2..7a8ba9bf2 100644 --- a/nuttx/Kconfig +++ b/nuttx/Kconfig @@ -286,3 +286,4 @@ endmenu menu "Application configuration" source "$APPSDIR/Kconfig" endmenu + diff --git a/nuttx/arch/arm/Kconfig b/nuttx/arch/arm/Kconfig index cc6a79d5e..9df0c20a5 100644 --- a/nuttx/arch/arm/Kconfig +++ b/nuttx/arch/arm/Kconfig @@ -96,7 +96,7 @@ config ARCH_FAMILY default "arm" if ARCH_ARM7TDMI || ARCH_ARM926EJS || ARCH_ARM920T default "armv7-m" if ARCH_CORTEXM -config ARCH +config ARCH_CHIP string default "c5471" if ARCH_CHIP_C5471 default "calypso" if ARCH_CHIP_CALYPSO diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig index 2dbc4b468..e0f822656 100644 --- a/nuttx/arch/arm/src/stm32/Kconfig +++ b/nuttx/arch/arm/src/stm32/Kconfig @@ -50,8 +50,8 @@ config ARCH_CHIP_STM32F407ZG config ARCH_CHIP_STM32F407IE bool "STM32F407IE" -config ARCH_CHIP_STM32F407IE - bool "STM32F407IE" +config ARCH_CHIP_STM32F407IG + bool "STM32F407IG" endchoice diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index bf128e9bf..d46437f2e 100644 --- a/nuttx/configs/Kconfig +++ b/nuttx/configs/Kconfig @@ -270,7 +270,7 @@ config ARCH_BOARD_PIC32_STARTERKIT (DM320004) with the Multimedia Expansion Board (MEB, DM320005). See www.microchip.com for further information. -config ARCH_BOARD_PIC32_PIC32MXMMB +config ARCH_BOARD_PIC32_PIC32MX7MMB bool "Mikroelektronika PIC32MX7 MMB" depends on ARCH_CHIP_PIC32MX795F512L ---help--- diff --git a/nuttx/configs/avr32dev1/Kconfig b/nuttx/configs/avr32dev1/Kconfig index ae2bf3130..9fe07d799 100644 --- a/nuttx/configs/avr32dev1/Kconfig +++ b/nuttx/configs/avr32dev1/Kconfig @@ -2,3 +2,19 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_AVR32DEV1 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif + diff --git a/nuttx/configs/c5471evm/Kconfig b/nuttx/configs/c5471evm/Kconfig index ae2bf3130..025ba5e0e 100644 --- a/nuttx/configs/c5471evm/Kconfig +++ b/nuttx/configs/c5471evm/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_C5471EVM +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/demo9s12ne64/Kconfig b/nuttx/configs/demo9s12ne64/Kconfig index ae2bf3130..1dd59710d 100644 --- a/nuttx/configs/demo9s12ne64/Kconfig +++ b/nuttx/configs/demo9s12ne64/Kconfig @@ -2,3 +2,19 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_DEMOS92S12NEC64 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif + diff --git a/nuttx/configs/ea3131/Kconfig b/nuttx/configs/ea3131/Kconfig index ae2bf3130..705599f34 100644 --- a/nuttx/configs/ea3131/Kconfig +++ b/nuttx/configs/ea3131/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_EA3131 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/ea3152/Kconfig b/nuttx/configs/ea3152/Kconfig index ae2bf3130..fe027ea91 100644 --- a/nuttx/configs/ea3152/Kconfig +++ b/nuttx/configs/ea3152/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_EA3152 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/eagle100/Kconfig b/nuttx/configs/eagle100/Kconfig index ae2bf3130..40b9f8294 100644 --- a/nuttx/configs/eagle100/Kconfig +++ b/nuttx/configs/eagle100/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_EAGLE100 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/hymini-stm32v/Kconfig b/nuttx/configs/hymini-stm32v/Kconfig index ae2bf3130..2d6b612eb 100644 --- a/nuttx/configs/hymini-stm32v/Kconfig +++ b/nuttx/configs/hymini-stm32v/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_HYMINI_STM32V +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/kwikstik-k40/Kconfig b/nuttx/configs/kwikstik-k40/Kconfig index ae2bf3130..3342a978b 100644 --- a/nuttx/configs/kwikstik-k40/Kconfig +++ b/nuttx/configs/kwikstik-k40/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_KWIKSTIK_K40 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/lm3s6432-s2e/Kconfig b/nuttx/configs/lm3s6432-s2e/Kconfig index ae2bf3130..102f4a5f6 100644 --- a/nuttx/configs/lm3s6432-s2e/Kconfig +++ b/nuttx/configs/lm3s6432-s2e/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_LM3S6432S2E +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/lm3s6965-ek/Kconfig b/nuttx/configs/lm3s6965-ek/Kconfig index ae2bf3130..809ae2fe6 100644 --- a/nuttx/configs/lm3s6965-ek/Kconfig +++ b/nuttx/configs/lm3s6965-ek/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_LM3S6965EK +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/lm3s8962-ek/Kconfig b/nuttx/configs/lm3s8962-ek/Kconfig index ae2bf3130..87dc03a9d 100644 --- a/nuttx/configs/lm3s8962-ek/Kconfig +++ b/nuttx/configs/lm3s8962-ek/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_LM3S8962EK +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/lpcxpresso-lpc1768/Kconfig b/nuttx/configs/lpcxpresso-lpc1768/Kconfig index ae2bf3130..944df07b7 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/Kconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_LPCXPRESSO +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/mbed/Kconfig b/nuttx/configs/mbed/Kconfig index ae2bf3130..84d7d461e 100644 --- a/nuttx/configs/mbed/Kconfig +++ b/nuttx/configs/mbed/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_MBED +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/mcu123-lpc214x/Kconfig b/nuttx/configs/mcu123-lpc214x/Kconfig index ae2bf3130..e429d3d75 100644 --- a/nuttx/configs/mcu123-lpc214x/Kconfig +++ b/nuttx/configs/mcu123-lpc214x/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_MCU123 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/mx1ads/Kconfig b/nuttx/configs/mx1ads/Kconfig index ae2bf3130..ba83e1cf7 100644 --- a/nuttx/configs/mx1ads/Kconfig +++ b/nuttx/configs/mx1ads/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_MX1ADS +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/ne64badge/Kconfig b/nuttx/configs/ne64badge/Kconfig index ae2bf3130..e3ac8b4e9 100644 --- a/nuttx/configs/ne64badge/Kconfig +++ b/nuttx/configs/ne64badge/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_NE64BADGE +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/ntosd-dm320/Kconfig b/nuttx/configs/ntosd-dm320/Kconfig index ae2bf3130..67681a845 100644 --- a/nuttx/configs/ntosd-dm320/Kconfig +++ b/nuttx/configs/ntosd-dm320/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_NTOSD_DM320 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/nucleus2g/Kconfig b/nuttx/configs/nucleus2g/Kconfig index ae2bf3130..32a7fae76 100644 --- a/nuttx/configs/nucleus2g/Kconfig +++ b/nuttx/configs/nucleus2g/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_NUCLEUS2G +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/olimex-lpc1766stk/Kconfig b/nuttx/configs/olimex-lpc1766stk/Kconfig index ae2bf3130..b51ab0d9e 100644 --- a/nuttx/configs/olimex-lpc1766stk/Kconfig +++ b/nuttx/configs/olimex-lpc1766stk/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_LPC1766STK +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/olimex-lpc2378/Kconfig b/nuttx/configs/olimex-lpc2378/Kconfig index ae2bf3130..962ea29de 100644 --- a/nuttx/configs/olimex-lpc2378/Kconfig +++ b/nuttx/configs/olimex-lpc2378/Kconfig @@ -2,3 +2,13 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # +# + +if ARCH_BOARD_OLIMEXLPC2378 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/olimex-strp711/Kconfig b/nuttx/configs/olimex-strp711/Kconfig index ae2bf3130..d8ee9b186 100644 --- a/nuttx/configs/olimex-strp711/Kconfig +++ b/nuttx/configs/olimex-strp711/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_OLIMEX_STRP711 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/pic32-starterkit/Kconfig b/nuttx/configs/pic32-starterkit/Kconfig index ae2bf3130..d2dbdba15 100644 --- a/nuttx/configs/pic32-starterkit/Kconfig +++ b/nuttx/configs/pic32-starterkit/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_PIC32_STARTERKIT +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/pic32mx7mmb/Kconfig b/nuttx/configs/pic32mx7mmb/Kconfig index ae2bf3130..41c5a7896 100644 --- a/nuttx/configs/pic32mx7mmb/Kconfig +++ b/nuttx/configs/pic32mx7mmb/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_PIC32_PIC32MX7MMB +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/pjrc-8051/Kconfig b/nuttx/configs/pjrc-8051/Kconfig index ae2bf3130..afa9f6a9f 100644 --- a/nuttx/configs/pjrc-8051/Kconfig +++ b/nuttx/configs/pjrc-8051/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_PJRC_87C52 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/sam3u-ek/Kconfig b/nuttx/configs/sam3u-ek/Kconfig index ae2bf3130..d39ff246e 100644 --- a/nuttx/configs/sam3u-ek/Kconfig +++ b/nuttx/configs/sam3u-ek/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_SAM3UEK +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/skp16c26/Kconfig b/nuttx/configs/skp16c26/Kconfig index ae2bf3130..377c251b3 100644 --- a/nuttx/configs/skp16c26/Kconfig +++ b/nuttx/configs/skp16c26/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_SKP16C26 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/stm3210e-eval/Kconfig b/nuttx/configs/stm3210e-eval/Kconfig index affc61f71..98a45f97a 100644 --- a/nuttx/configs/stm3210e-eval/Kconfig +++ b/nuttx/configs/stm3210e-eval/Kconfig @@ -6,6 +6,18 @@ if ARCH_BOARD_STM3210E_EVAL comment "STM3210E-EVAL LCD Hardware Configuration" +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + config STM3210E_LCD bool "Select support for the STM3210E-EVAL LCD" default y diff --git a/nuttx/configs/stm3220g-eval/Kconfig b/nuttx/configs/stm3220g-eval/Kconfig index ae2bf3130..7ca890fe8 100644 --- a/nuttx/configs/stm3220g-eval/Kconfig +++ b/nuttx/configs/stm3220g-eval/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_STM3220G_EVAL +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/stm3240g-eval/Kconfig b/nuttx/configs/stm3240g-eval/Kconfig index ae2bf3130..a451e1b73 100644 --- a/nuttx/configs/stm3240g-eval/Kconfig +++ b/nuttx/configs/stm3240g-eval/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_STM3240G_EVAL +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/stm32f4discovery/Kconfig b/nuttx/configs/stm32f4discovery/Kconfig index ae2bf3130..808103f2e 100644 --- a/nuttx/configs/stm32f4discovery/Kconfig +++ b/nuttx/configs/stm32f4discovery/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_STM32F4_DISCOVERY +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/sure-pic32mx/Kconfig b/nuttx/configs/sure-pic32mx/Kconfig index ae2bf3130..1154ca34c 100644 --- a/nuttx/configs/sure-pic32mx/Kconfig +++ b/nuttx/configs/sure-pic32mx/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_SUREPIC32MX +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/teensy/Kconfig b/nuttx/configs/teensy/Kconfig index ae2bf3130..5b751c285 100644 --- a/nuttx/configs/teensy/Kconfig +++ b/nuttx/configs/teensy/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_TEENSY +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/configs/twr-k60n512/Kconfig b/nuttx/configs/twr-k60n512/Kconfig index ae2bf3130..549e250bd 100644 --- a/nuttx/configs/twr-k60n512/Kconfig +++ b/nuttx/configs/twr-k60n512/Kconfig @@ -2,3 +2,18 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_TWR_K60N512 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +config ARCH_BUTTONS + bool "Button support" + default n + ---help--- + "Support interfaces to use buttons provided by the board." + +endif diff --git a/nuttx/configs/us7032evb1/Kconfig b/nuttx/configs/us7032evb1/Kconfig index ae2bf3130..d054a1624 100644 --- a/nuttx/configs/us7032evb1/Kconfig +++ b/nuttx/configs/us7032evb1/Kconfig @@ -2,3 +2,12 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +if ARCH_BOARD_TWR_K60N512 +config ARCH_LEDS + bool "NuttX LED support" + default n + ---help--- + "Support control of board LEDs by NuttX to indicate system state" + +endif diff --git a/nuttx/fs/nfs/nfs_args.h b/nuttx/fs/nfs/nfs_args.h deleted file mode 100644 index 9a8dfd980..000000000 --- a/nuttx/fs/nfs/nfs_args.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** - * fs/nfs/nfs_args.h - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. - * Author: Jose Pablo Rojas Vargas - * - * Leveraged from OpenBSD: - * - * Copyright (c) 1989, 1993, 1995 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * 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. - * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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 __FS_NFS_NFS_ARGS_H -#define __FS_NFS_NFS_ARGS_H - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include "nfs_proto.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -/* NFS mount option flags */ - -#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ -#define NFSMNT_WSIZE 0x00000002 /* set write size */ -#define NFSMNT_RSIZE 0x00000004 /* set read size */ -#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ -#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ -#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ -#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ -#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ - -/* 0x100 free, was NFSMNT_NQNFS */ - -#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ - -/* 0x400 free, was NFSMNT_KERB */ - -#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ - -/* 0x1000 free, was NFSMNT_LEASETERM */ - -#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ -#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ -#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */ -#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ -#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ -#define NFSMNT_ACREGMIN 0x00040000 -#define NFSMNT_ACREGMAX 0x00080000 -#define NFSMNT_ACDIRMIN 0x00100000 -#define NFSMNT_ACDIRMAX 0x00200000 -#define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */ -#define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */ -#define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */ -#define NFSMNT_GOTFSINFO 0x00000004 /* Got the V3 fsinfo */ -#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ -#define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */ - -#define NFS_ARGSVERSION 3 /* change when nfs_args changes */ - -/**************************************************************************** - * Public Types - ****************************************************************************/ - -/* Arguments to mount NFS */ - -struct nfs_args -{ - int version; /* args structure version number */ - struct sockaddr *addr; /* file server address */ - int addrlen; /* length of address */ - int sotype; /* Socket type */ - int proto; /* and Protocol */ - nfsfh_t fh; /* File handle to be mounted */ - int fhsize; /* Size, in bytes, of fh */ - int flags; /* flags */ - int wsize; /* write size in bytes */ - int rsize; /* read size in bytes */ - int readdirsize; /* readdir size in bytes */ - int timeo; /* initial timeout in .1 secs */ - int retrans; /* times to retry send */ - int maxgrouplist; /* Max. size of group list */ - int readahead; /* # of blocks to readahead */ - int leaseterm; /* Term (sec) of lease */ - int deadthresh; /* Retrans threshold */ -//char *hostname; /* server's name */ - int acregmin; /* cache attrs for reg files min time */ - int acregmax; /* cache attrs for reg files max time */ - int acdirmin; /* cache attrs for dirs min time */ - int acdirmax; /* cache attrs for dirs max time */ -}; - -#endif /* __FS_NFS_NFS_ARGS_H */ diff --git a/nuttx/fs/nfs/nfs_mount.h b/nuttx/fs/nfs/nfs_mount.h index 29aed1d13..7ca070b9d 100644 --- a/nuttx/fs/nfs/nfs_mount.h +++ b/nuttx/fs/nfs/nfs_mount.h @@ -77,9 +77,9 @@ struct nfsmount int nm_fhsize; /* Size of root file handle */ struct rpcclnt *nm_rpcclnt; /* rpc state */ struct socket *nm_so; /* Rpc socket */ - int nm_sotype; /* Type of socket */ - int nm_soproto; /* and protocol */ - int nm_soflags; /* pr_flags for socket protocol */ + uint8_t nm_sotype; /* Type of socket */ + uint8_t nm_soproto; /* and protocol */ + uint8_t nm_soflags; /* pr_flags for socket protocol */ struct sockaddr *nm_nam; /* Addr of server */ int nm_timeo; /* Init timer for NFSMNT_DUMBTIMR */ int nm_retry; /* Max retries */ diff --git a/nuttx/fs/nfs/nfs_node.h b/nuttx/fs/nfs/nfs_node.h index 3ca0762ef..55148d181 100644 --- a/nuttx/fs/nfs/nfs_node.h +++ b/nuttx/fs/nfs/nfs_node.h @@ -47,7 +47,7 @@ * Included Files ****************************************************************************/ -#include "nfs.h" +#include /**************************************************************************** * Pre-processor Definitions @@ -147,13 +147,13 @@ struct nfsnode uid_t n_accuid; /* Last access requester */ int n_accmode; /* Last mode requested */ int n_accerror; /* Last returned error */ - - off_t n_pushedlo; /* 1st blk in commited range */ - off_t n_pushedhi; /* Last block in range */ - off_t n_pushlo; /* 1st block in commit range */ - off_t n_pushhi; /* Last block in range */ + +//off_t n_pushedlo; /* 1st blk in commited range */ +//off_t n_pushedhi; /* Last block in range */ +//off_t n_pushlo; /* 1st block in commit range */ +//off_t n_pushhi; /* Last block in range */ //struct rwlock n_commitlock; /* Serialize commits */ - int n_commitflags; +//int n_commitflags; }; #endif /* __FS_NFS_NFS_NODE_H */ diff --git a/nuttx/fs/nfs/nfs_proto.h b/nuttx/fs/nfs/nfs_proto.h index bafc230c7..b82b2e104 100644 --- a/nuttx/fs/nfs/nfs_proto.h +++ b/nuttx/fs/nfs/nfs_proto.h @@ -47,6 +47,8 @@ * Included Files ****************************************************************************/ + #include + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -246,9 +248,7 @@ #define nfsv2tov_type(a) nv2tov_type[fxdr_unsigned(uint32_t,(a))&0x7] #define nfsv3tov_type(a) nv3tov_type[fxdr_unsigned(uint32_t,(a))&0x7] -#ifndef NFS_MAXFHSIZE -# define NFS_MAXFHSIZE 64 -#endif +#define NFS_MAXFHSIZE 64 /* File identifier */ @@ -299,14 +299,14 @@ struct fhandle typedef struct fhandle fhandle_t; /* File Handle (32 bytes for version 2), variable up to 64 for version 3. */ - +/* union nfsfh { -//fhandle_t fh_generic; +fhandle_t fh_generic; unsigned char fh_bytes[NFS_MAXFHSIZE]; }; typedef union nfsfh nfsfh_t; - +*/ struct nfsv2_time { uint32_t nfsv2_sec; diff --git a/nuttx/fs/nfs/nfs_socket.c b/nuttx/fs/nfs/nfs_socket.c index b13d0cfb2..feb405719 100644 --- a/nuttx/fs/nfs/nfs_socket.c +++ b/nuttx/fs/nfs/nfs_socket.c @@ -46,11 +46,11 @@ #include #include -#include "nfs_args.h" +#include + #include "rpc.h" #include "rpc_v2.h" #include "nfs_proto.h" -#include "nfs.h" #include "xdr_subs.h" #include "nfs_mount.h" #include "nfs_socket.h" diff --git a/nuttx/fs/nfs/nfs_util.c b/nuttx/fs/nfs/nfs_util.c index 6f5dd6991..a6c82ab22 100755 --- a/nuttx/fs/nfs/nfs_util.c +++ b/nuttx/fs/nfs/nfs_util.c @@ -126,21 +126,8 @@ int nfs_checkmount(struct nfsmount *nmp) */ DEBUGASSERT(nmp); - if (nmp->nm_mounted) + if (!nmp->nm_mounted) { - /* We still think the mount is healthy. Check an see if this is - * still the case - */ - -#warning "This makes no sense... If you get here, then you know that nmp->nm_mounted and the code will always return OK. Something is wrong." - if (nmp->nm_mounted == true) - { - return OK; - } - /* If we get here, the mount is NOT healthy */ - - nmp->nm_mounted = false; - /* Make sure that this is flagged in every opened file */ for (file = nmp->nm_head; file; file = file->n_next) diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index d7c19469d..89f135d7c 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -72,11 +73,9 @@ #include "rpc.h" #include "nfs_proto.h" #include "nfs_node.h" -#include "nfs.h" #include "nfs_mount.h" #include "xdr_subs.h" #include "nfs_socket.h" -#include "nfs_args.h" /**************************************************************************** * Pre-processor Definitions @@ -979,8 +978,7 @@ void nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp) * ****************************************************************************/ -int mountnfs(struct nfs_args *argp,/* struct inode *blkdriver,*/ - struct sockaddr *nam, void **handle) +int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle) { struct nfsmount *nmp; int error; @@ -1024,7 +1022,7 @@ int mountnfs(struct nfs_args *argp,/* struct inode *blkdriver,*/ nmp->nm_readdirsize = NFS_READDIRSIZE; nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_readahead = NFS_DEFRAHEAD; - nmp->nm_fhsize = argp->fhsize; + nmp->nm_fhsize = NFSX_V3FHMAX; nmp->nm_acregmin = NFS_MINATTRTIMO; nmp->nm_acregmax = NFS_MAXATTRTIMO; nmp->nm_acdirmin = NFS_MINATTRTIMO; @@ -1105,7 +1103,7 @@ static int nfs_bind(struct inode *blkdriver, const void *data, void **handle) } nam = args.addr; - error = mountnfs(&args/*, blkdriver*/, nam, handle); + error = mountnfs(&args, nam, handle); return error; } diff --git a/nuttx/fs/nfs/rpc.h b/nuttx/fs/nfs/rpc.h index fcbffe7f5..8a9b72303 100644 --- a/nuttx/fs/nfs/rpc.h +++ b/nuttx/fs/nfs/rpc.h @@ -108,7 +108,7 @@ struct rpctask { dq_entry_t r_chain; - struct rpcclnt *r_rpcclnt; + struct rpcclnt *r_rpcclnt; uint32_t r_xid; int r_flags; /* flags on request, see below */ @@ -195,9 +195,9 @@ struct rpcclnt struct sockaddr *rc_name; struct socket *rc_so; /* Rpc socket */ - int rc_sotype; /* Type of socket */ + uint8_t rc_sotype; /* Type of socket */ int rc_soproto; /* and protocol */ - int rc_soflags; /* pr_flags for socket protocol */ + uint8_t rc_soflags; /* pr_flags for socket protocol */ int rc_timeo; /* Init timer for NFSMNT_DUMBTIMR */ int rc_retry; /* Max retries */ diff --git a/nuttx/fs/nfs/rpc_clnt.c b/nuttx/fs/nfs/rpc_clnt.c index 0709fbf3c..c907a3ff3 100644 --- a/nuttx/fs/nfs/rpc_clnt.c +++ b/nuttx/fs/nfs/rpc_clnt.c @@ -93,8 +93,6 @@ #include "xdr_subs.h" #include "nfs_proto.h" -#include "nfs.h" -#include "nfs_args.h" #include "rpc.h" #include "rpc_clnt_private.h" #include "rpc_v2.h" @@ -940,7 +938,6 @@ int rpcclnt_connect(struct rpcclnt *rpc) rpc->rc_so = NULL; saddr = rpc->rc_name; - rpc->rc_sotype = SOCK_DGRAM; error = psock_socket(saddr->sa_family, rpc->rc_sotype, rpc->rc_soproto, rpc->rc_so); diff --git a/nuttx/include/nuttx/fs/nfs.h b/nuttx/include/nuttx/fs/nfs.h index 36ad59e32..b0ded4db4 100644 --- a/nuttx/include/nuttx/fs/nfs.h +++ b/nuttx/include/nuttx/fs/nfs.h @@ -5,6 +5,14 @@ * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. * Author: Jose Pablo Rojas Vargas * + * Some of the content of this file was leveraged from OpenBSD: + * + * Copyright (c) 1989, 1993, 1995 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Rick Macklem at The University of Guelph. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -12,25 +20,23 @@ * 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 + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University 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. + * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. * ****************************************************************************/ @@ -45,28 +51,384 @@ * Pre-processor Definitions ****************************************************************************/ +#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */ +#define NFS_HZ (CLOCKS_PER_SEC / nfs_ticks) /* Ticks/sec */ +#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */ +#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */ +#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */ +#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops */ +#define NFS_TIMEOUTMUL 2 /* Timeout/Delay multiplier */ +#define NFS_MAXREXMIT 100 /* Stop counting after this many */ +#define NFS_RETRANS 10 /* Num of retrans for soft mounts */ +#define NFS_MAXGRPS 16 /* Max. size of groups list */ +#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */ +#define NFS_MAXATTRTIMO 60 +#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */ +#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */ +#define NFS_READDIRSIZE 8192 /* Def. readdir size */ +#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */ +#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */ +#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */ + +/* Ideally, NFS_DIRBLKSIZ should be bigger, but I've seen servers with + * broken NFS/ethernet drivers that won't work with anything bigger (Linux..) + */ + +#define NFS_DIRBLKSIZ 1024 /* Must be a multiple of DIRBLKSIZ */ +#define NFS_READDIRBLKSIZ 512 /* Size of read dir blocks. XXX */ + +/* Oddballs */ + +#define NFS_CMPFH(n, f, s) \ + ((n)->n_fhsize == (s) && !bcmp((void *)(n)->n_fhp, (void *)(f), (s))) +#define NFS_ISV3(i) (VFSTONFS((i)->f_inode)->nm_flag & NFSMNT_NFSV3) +#define NFS_SRVMAXDATA(n) \ + (((n)->nd_flag & ND_NFSV3) ? (((n)->nd_nam2) ? \ + NFS_MAXDGRAMDATA : NFS_MAXDATA) : NFS_V2MAXDATA) + +/* sys/malloc.h needs M_NFSDIROFF, M_NFSRVDESC and M_NFSBIGFH added. */ + +#ifndef M_NFSRVDESC +# define M_NFSRVDESC M_TEMP +#endif +#ifndef M_NFSDIROFF +# define M_NFSDIROFF M_TEMP +#endif +#ifndef M_NFSBIGFH +# define M_NFSBIGFH M_TEMP +#endif + +/* The B_INVAFTERWRITE flag should be set to whatever is required by the + * buffer cache code to say "Invalidate the block after it is written back". + */ + +#define B_INVAFTERWRITE B_INVAL + +/* Flags for nfssvc() system call. */ + +#define NFSSVC_BIOD 0x002 +#define NFSSVC_NFSD 0x004 +#define NFSSVC_ADDSOCK 0x008 +#define NFSSVC_AUTHIN 0x010 +#define NFSSVC_GOTAUTH 0x040 +#define NFSSVC_AUTHINFAIL 0x080 +#define NFSSVC_MNTD 0x100 + +/* fs.nfs sysctl(3) identifiers */ + +#define NFS_NFSSTATS 1 /* struct: struct nfsstats */ +#define NFS_NIOTHREADS 2 /* number of i/o threads */ +#define NFS_MAXID 3 + +#define FS_NFS_NAMES { \ + { 0, 0 }, \ + { "nfsstats", CTLTYPE_STRUCT }, \ + { "iothreads", CTLTYPE_INT } \ +} + +#define NFSINT_SIGMASK (sigmask(SIGINT)|sigmask(SIGTERM)|sigmask(SIGKILL)| \ + sigmask(SIGHUP)|sigmask(SIGQUIT)) + +/* Socket errors ignored for connectionless sockets?? + * For now, ignore them all + */ + +#define NFSIGNORE_SOERROR(s, e) \ + ((e) != EINTR && (e) != ERESTART && (e) != EWOULDBLOCK && \ + ((s) & PR_CONNREQUIRED) == 0) + +/* Flag values for r_flags */ + +#define R_TIMING 0x01/* timing request (in mntp) */ +#define R_SENT 0x02/* request has been sent */ +#define R_SOFTTERM 0x04/* soft mnt, too many retries */ +#define R_INTR 0x08/* intr mnt, signal pending */ +#define R_SOCKERR 0x10/* Fatal error on socket */ +#define R_TPRINTFMSG 0x20/* Did a tprintf msg. */ +#define R_MUSTRESEND 0x40/* Must resend request */ + +/* On fast networks, the estimator will try to reduce the + * timeout lower than the latency of the server's disks, + * which results in too many timeouts, so cap the lower + * bound. + */ + +#define NFS_MINRTO (NFS_HZ >> 2) + +/* Keep the RTO from increasing to unreasonably large values + * when a server is not responding. + */ + +#define NFS_MAXRTO (20 * NFS_HZ) + +#define NFS_MAX_TIMER (NFS_WRITE_TIMER) +#define NFS_INITRTT (NFS_HZ << 3) + +/* Bits for "ns_flag" */ + +#define SLP_VALID 0x01/* connection is usable */ +#define SLP_DOREC 0x02/* receive operation required */ +#define SLP_NEEDQ 0x04/* connection has data to queue from socket */ +#define SLP_DISCONN 0x08/* connection is closed */ +#define SLP_GETSTREAM 0x10/* extracting RPC from TCP connection */ +#define SLP_LASTFRAG 0x20/* last fragment received on TCP connection */ +#define SLP_ALLFLAGS 0xff/* convenience */ + +#define SLP_INIT 0x01/* NFS data undergoing initialization */ +#define SLP_WANTINIT 0x02/* thread waiting on NFS initialization */ + +/* Bits for "nfsd_flag" */ + +#define NFSD_WAITING 0x01 +#define NFSD_REQINPROG 0x02 +#define NFSD_NEEDAUTH 0x04 +#define NFSD_AUTHFAIL 0x08 + +/* Bits for "nd_flag" */ + +#define ND_NFSV3 0x08 +#define NFSD_CHECKSLP 0x01 + +/* NFS mount option flags */ + +#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ +#define NFSMNT_WSIZE 0x00000002 /* set write size */ +#define NFSMNT_RSIZE 0x00000004 /* set read size */ +#define NFSMNT_TIMEO 0x00000008 /* set initial timeout */ +#define NFSMNT_RETRANS 0x00000010 /* set number of request retries */ +#define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ +#define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ +#define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ + +/* 0x100 free, was NFSMNT_NQNFS */ + +#define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ + +/* 0x400 free, was NFSMNT_KERB */ + +#define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ + +/* 0x1000 free, was NFSMNT_LEASETERM */ + +#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */ +#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */ +#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */ +#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */ +#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */ +#define NFSMNT_ACREGMIN 0x00040000 +#define NFSMNT_ACREGMAX 0x00080000 +#define NFSMNT_ACDIRMIN 0x00100000 +#define NFSMNT_ACDIRMAX 0x00200000 +#define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */ +#define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */ +#define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */ +#define NFSMNT_GOTFSINFO 0x00000004 /* Got the V3 fsinfo */ +#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */ +#define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */ + +#define NFS_ARGSVERSION 3 /* change when nfs_args changes */ +#define NFS_NPROCS 23 +#define NFS_MAXFHSIZE 64 + /**************************************************************************** - * Type Definitions + * Public Types ****************************************************************************/ +/* File Handle (32 bytes for version 2), variable up to 64 for version 3. */ + +union nfsfh +{ + unsigned char fh_bytes[NFS_MAXFHSIZE]; +}; +typedef union nfsfh nfsfh_t; + +#undef COMP +#ifdef COMP +/* Structures for the nfssvc(2) syscall. + * Not that anyone besides nfsd(8) should ever use it. + */ + +struct nfsd_args +{ + int sock; /* Socket to serve */ + void *name; /* Client addr for connection based sockets */ + int namelen; /* Length of name */ +}; + +struct nfsd_srvargs +{ + struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */ + uid_t nsd_uid; /* Effective uid mapped to cred */ + uint32_t nsd_haddr; /* IP address of client */ + int nsd_authlen; /* Length of auth string (ret) */ + unsigned char *nsd_authstr; /* Auth string (ret) */ + int nsd_verflen; /* and the verifier */ + unsigned char *nsd_verfstr; + struct timeval nsd_timestamp; /* timestamp from verifier */ + uint32_t nsd_ttl; /* credential ttl (sec) */ +}; +#endif + +/* Stats structure */ + +struct nfsstats +{ + uint64_t attrcache_hits; + uint64_t attrcache_misses; + uint64_t lookupcache_hits; + uint64_t lookupcache_misses; + uint64_t direofcache_hits; + uint64_t direofcache_misses; + uint64_t biocache_reads; + uint64_t read_bios; + uint64_t read_physios; + uint64_t biocache_writes; + uint64_t write_bios; + uint64_t write_physios; + uint64_t biocache_readlinks; + uint64_t readlink_bios; + uint64_t biocache_readdirs; + uint64_t readdir_bios; + uint64_t rpccnt[NFS_NPROCS]; + uint64_t rpcretries; + uint64_t srvrpccnt[NFS_NPROCS]; + uint64_t srvrpc_errs; + uint64_t srv_errs; + uint64_t rpcrequests; + uint64_t rpctimeouts; + uint64_t rpcunexpected; + uint64_t rpcinvalid; + uint64_t srvcache_inproghits; + uint64_t srvcache_idemdonehits; + uint64_t srvcache_nonidemdonehits; + uint64_t srvcache_misses; + uint64_t forcedsync; + uint64_t srvnqnfs_leases; + uint64_t srvnqnfs_maxleases; + uint64_t srvnqnfs_getleases; + uint64_t srvvop_writes; +}; + +#ifdef COMP +/* The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts. + * What should be in this set is open to debate, but I believe that since + * I/O system calls on ufs are never interrupted by signals the set should + * be minimal. My reasoning is that many current programs that use signals + * such as SIGALRM will not expect file I/O system calls to be interrupted + * by them and break. + */ + +/* Nfs outstanding request list element */ + +struct nfsmount; +struct nfsreq +{ + dq_entry_t r_chain; + struct nfsmount *r_nmp; + uint32_t r_xid; + int r_flags; /* flags on request, see below */ + int r_rexmit; /* current retrans count */ + int r_timer; /* tick counter on reply */ + int r_procnum; /* NFS procedure number */ + int r_rtt; /* RTT for rpc */ +}; + +enum nfs_rto_timers +{ + NFS_DEFAULT_TIMER, + NFS_GETATTR_TIMER, + NFS_LOOKUP_TIMER, + NFS_READ_TIMER, + NFS_WRITE_TIMER, +}; + +/* Network address hash list element */ + +union nethostaddr +{ + uint32_t had_inetaddr; +}; + +struct nfssvc_sock +{ + // TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ + struct file *ns_fp; /* fp from the... */ + struct socket *ns_so; /* ...socket this struct wraps */ + int ns_flag; /* socket status flags */ + int ns_solock; /* lock for connected socket */ + int ns_cc; /* actual chars queued */ + int ns_reclen; /* length of first queued record */ + uint32_t ns_sref; /* # of refs to this struct */ +}; + +/* One of these structures is allocated for each nfsd. */ + +struct nfsd +{ + //TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */ + int nfsd_flag; /* NFSD_ flags */ + struct nfssvc_sock *nfsd_slp; /* Current socket */ + struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */ +}; + +/* This structure is used by the server for describing each request. */ + +struct nfsrv_descript +{ + unsigned int nd_procnum; /* RPC # */ + int nd_flag; /* nd_flag */ + int nd_repstat; /* Reply status */ + uint32_t nd_retxid; /* Reply xid */ +}; +#endif + +/* Arguments to mount NFS */ + +struct nfs_args +{ + uint8_t version; /* args structure version number */ + struct sockaddr *addr; /* file server address */ + //int addrlen; /* length of address */ + uint8_t sotype; /* Socket type */ + uint8_t proto; /* and Protocol */ + nfsfh_t fh; /* File handle to be mounted */ + int fhsize; /* Size, in bytes, of fh */ + int flags; /* flags */ + int wsize; /* write size in bytes */ + int rsize; /* read size in bytes */ + int readdirsize; /* readdir size in bytes */ + int timeo; /* initial timeout in .1 secs */ + int retrans; /* times to retry send */ + int maxgrouplist; /* Max. size of group list */ + int readahead; /* # of blocks to readahead */ + int leaseterm; /* Term (sec) of lease */ + int deadthresh; /* Retrans threshold */ +//char *hostname; /* server's name */ + int acregmin; /* cache attrs for reg files min time */ + int acregmax; /* cache attrs for reg files max time */ + int acdirmin; /* cache attrs for dirs min time */ + int acdirmax; /* cache attrs for dirs max time */ +}; + + /**************************************************************************** * Public Data ****************************************************************************/ -#ifdef __cplusplus +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ +#undef EXTERN +#if defined(__cplusplus) #define EXTERN extern "C" extern "C" { #else #define EXTERN extern #endif -/**************************************************************************** - * Public Function Prototypes - ****************************************************************************/ - #undef EXTERN -#ifdef __cplusplus +#if defined(__cplusplus) } #endif - -#endif /* __INCLUDE_NUTTX_FS_NFS_H */ + +#endif /* _NFS_NFS_H */ diff --git a/nuttx/tools/cmpconfig.c b/nuttx/tools/cmpconfig.c index 1c4cbfe1b..2958acdc7 100644 --- a/nuttx/tools/cmpconfig.c +++ b/nuttx/tools/cmpconfig.c @@ -161,6 +161,11 @@ static void parse_file(FILE *stream, struct variable_s **list) if (ptr) { parse_line(ptr, &varname, &varval); + if (!varval || strcmp(varval, "n") == 0) + { + continue; + } + if (varname) { int varlen = strlen(varname) + 1; @@ -215,7 +220,7 @@ static void compare_variables(struct variable_s *list1, struct variable_s *list2 while (list1 || list2) { - if (list1->val) + if (list1 && list1->val) { varval1 = list1->val; } @@ -224,7 +229,7 @@ static void compare_variables(struct variable_s *list1, struct variable_s *list2 varval1 = ""; } - if (list2->val) + if (list2 && list2->val) { varval2 = list2->val; }