Add nuttx to the system framework, which is 10.1.0

This commit is contained in:
TangYiwen123
2021-06-09 14:33:15 +08:00
parent 06c351e27c
commit 804bd57aa0
5000 changed files with 1488544 additions and 0 deletions
@@ -0,0 +1,61 @@
/****************************************************************************
* apps/include/fsutils/flash_eraseall.h
*
* Copyright (C) 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 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.
*
****************************************************************************/
#ifndef __APPS_INCLUDE_FSUTILS_FLASH_ERASEALL_H
#define __APPS_INCLUDE_FSUTILS_FLASH_ERASEALL_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: flash_eraseall
*
* Description:
* Call a block driver with the MDIOC_BULKERASE ioctl command. This will
* cause the MTD driver to erase all of the flash.
*
****************************************************************************/
int flash_eraseall(FAR const char *driver);
#endif /* __APPS_INCLUDE_FSUTILS_FLASH_ERASEALL_H */
@@ -0,0 +1,138 @@
/****************************************************************************
* apps/include/fsutils/inifile.h
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 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.
*
****************************************************************************/
#ifndef __APPS_INCLUDE_FSUTILS_INIFILE_H
#define __APPS_INCLUDE_FSUTILS_INIFILE_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
typedef FAR void *INIHANDLE;
/****************************************************************************
* Public Data
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: inifile_initialize
*
* Description:
* Initialize for access to the INI file 'inifile_name'
*
****************************************************************************/
INIHANDLE inifile_initialize(FAR const char *inifile_name);
/****************************************************************************
* Name: inifile_uninitialize
*
* Description:
* Free resources commit to INI file parsing
*
****************************************************************************/
void inifile_uninitialize(INIHANDLE handle);
/****************************************************************************
* Name: inifile_read_string
*
* Description:
* Obtains the specified string value for the specified variable name
* within the specified section of the INI file. The receiver of the
* value string should call inifile_free_string when it no longer needs
* the memory held by the value string.
*
****************************************************************************/
FAR char *inifile_read_string(INIHANDLE handle,
FAR const char *section,
FAR const char *variable,
FAR const char *defvalue);
/****************************************************************************
* Name: inifile_read_integer
*
* Description:
* Obtains the specified integer value for the specified variable name
* within the specified section of the INI file
*
****************************************************************************/
long inifile_read_integer(INIHANDLE handle,
FAR const char *section,
FAR const char *variable,
FAR long defvalue);
/****************************************************************************
* Name: inifile_free_string
*
* Description:
* Release resources allocated for the value string previously obtained
* from inifile_read_string. The purpose of this inline function is to
* hide the memory allocator used by this implementation.
*
****************************************************************************/
void inifile_free_string(FAR char *value);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __APPS_INCLUDE_FSUTILS_INIFILE_H */
@@ -0,0 +1,220 @@
/****************************************************************************
* apps/include/fsutils/ipcfg.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 __APPS_INCLUDE_FSUTILS_IPCFG_H
#define __APPS_INCLUDE_FSUTILS_IPCFG_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <netinet/in.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Prototype enumerations are bit encoded */
#define _IPCFG_STATIC (1 << 0) /* Bit 0: Have static addresses */
#define _IPCFG_DHCP (1 << 1) /* Bit 1: Use DHCP (IPv4) */
#define _IPCFG_AUTOCONF (1 << 1) /* Bit 1: Use ICMPv4 auto-configuration */
#define IPCFG_HAVE_STATIC(p) (((p) & _IPCFG_STATIC) != 0)
#define IPCFG_USE_DHCP(p) (((p) & _IPCFG_DHCP) != 0)
#define IPCFG_USE_AUTOCONF(p) (((p) & _IPCFG_AUTOCONF) != 0)
/****************************************************************************
* Public Types
****************************************************************************/
/* The structure contains the parsed content of the ipcfg-<dev> file.
* Summary of file content:
*
* Common Settings:
*
* DEVICE=name
* where name is the name of the physical device.
*
* IPv4 Settings:
*
* IPv4PROTO=protocol
* where protocol is one of the following:
*
* none - No protocol selected
* static - Use static IP
* dhcp - The DHCP protocol should be used
* fallback - Use DHCP with fall back static IP
*
* All of the following addresses are in network order. The special value
* zero is used to indicate that the address is not available:
*
* IPv4IPADDR=address
* where address is the IPv4 address. Used only with static or fallback
* protocols.
*
* IPv4NETMASK=address
* where address is the netmask. Used only with static or fallback
* protocols.
*
* IPv4ROUTER=address
* where address is the IPv4 default router address. Used only with
* static or fallback protocols.
*
* IPv4DNS=address
* where address is a (optional) name server address.
*/
/* Values for the IPv4PROTO setting */
enum ipv4cfg_bootproto_e
{
IPv4PROTO_NONE = 0, /* 00: No protocol assigned */
IPv4PROTO_STATIC = 1, /* 01: Use static IP */
IPv4PROTO_DHCP = 2, /* 10: Use DHCP */
IPv4PROTO_FALLBACK = 3 /* 11: Use DHCP with fall back static IP */
};
struct ipv4cfg_s
{
enum ipv4cfg_bootproto_e proto; /* Configure for static and/or DHCP */
/* The following fields are required for static/fallback configurations */
in_addr_t ipaddr; /* IPv4 address */
in_addr_t netmask; /* Network mask */
in_addr_t router; /* Default router */
/* The following fields are optional for dhcp and fallback configurations */
in_addr_t dnsaddr; /* Name server address */
};
/* IPv6 Settings:
*
* IPv6BOOTPROTO=protocol
* where protocol is one of the following:
*
* none - No protocol selected
* static - Use static IP
* autoconf - ICMPv6 auto-configuration should be used
* fallback - Use auto-configuration with fall back static IP
*
* All of the following addresses are in network order. The special value
* zero is used to indicate that the address is not available:
*
* IPv6IPADDR=address
* where address is the IPv6 address. Used only with static or fallback
* protocols.
*
* IPv6NETMASK=address
* where address is the netmask. Used only with static or fallback
* protocols.
*
* IPv6ROUTER=address
* where address is the IPv6 default router address. Used only with
* static or fallback protocols.
*/
/* Values for the IPv6BOOTPROTO setting */
enum ipv6cfg_bootproto_e
{
IPv6PROTO_NONE = 0, /* 00: No protocol assigned */
IPv6PROTO_STATIC = 1, /* 01: Use static IP */
IPv6PROTO_AUTOCONF = 2, /* 10: Use ICMPv6 auto-configuration */
IPv6PROTO_FALLBACK = 3 /* 11: Use auto-configuration with fall back static IP */
};
struct ipv6cfg_s
{
enum ipv6cfg_bootproto_e proto; /* Configure for static and/or autoconfig */
/* The following fields are required for static/fallback configurations */
struct in6_addr ipaddr; /* IPv6 address */
struct in6_addr netmask; /* Network mask */
struct in6_addr router; /* Default router */
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: ipcfg_read
*
* Description:
* Read and parse the IP configuration file for the specified network
* device.
*
* Input Parameters:
* netdev - The network device. For examplel "eth0"
* ipcfg - Pointer to a user provided location to receive the IP
* configuration. Refers to either struct ipv4cfg_s or
* ipv6cfg_s, depending on the value of af.
* af - Identifies the address family whose IP configuration is
* requested. May be either AF_INET or AF_INET6.
*
* Returned Value:
* Zero is returned on success; a negated errno value is returned on any
* failure.
*
****************************************************************************/
int ipcfg_read(FAR const char *netdev, FAR void *ipcfg, sa_family_t af);
/****************************************************************************
* Name: ipcfg_write
*
* Description:
* Write the IP configuration file for the specified network device.
*
* Input Parameters:
* netdev - The network device. For examplel "eth0"
* ipcfg - The IP configuration to be written. Refers to either struct
* ipv4cfg_s or ipv6cfg_s, depending on the value of af.
* af - Identifies the address family whose IP configuration is
* to be written. May be either AF_INET or AF_INET6.
*
* Returned Value:
* Zero is returned on success; a negated errno value is returned on any
* failure.
*
****************************************************************************/
#ifdef CONFIG_IPCFG_WRITABLE
int ipcfg_write(FAR const char *netdev, FAR const void *ipcfg,
sa_family_t af);
#endif
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* __APPS_INCLUDE_FSUTILS_IPCFG_H */
@@ -0,0 +1,150 @@
/****************************************************************************
* apps/include/fsutils/mkfatfs.h
*
* Copyright (C) 2008-2009, 2012, 2015, 2017 Gregory Nutt. All rights
* reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* 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.
* 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.
*
****************************************************************************/
#ifndef __APPS_INCLUDE_FSUTILS_MKFATFS_H
#define __APPS_INCLUDE_FSUTILS_MKFATFS_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define MKFATFS_DEFAULT_NFATS 2 /* 2: Default number of FATs */
#define MKFATFS_DEFAULT_FATTYPE 0 /* 0: Autoselect FAT size */
#define MKFATFS_DEFAULT_CLUSTSHIFT 0xff /* 0xff: Autoselect cluster size */
#define MKFATFS_DEFAULT_VOLUMELABEL { ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' }
#define MKFATFS_DEFAULT_BKUPBOOT 0 /* 0: Determine sector number of the backup boot sector */
#define MKFATFS_DEFAULT_ROOTDIRENTS 0 /* 0: Autoselect number of root directory entries */
#define MKFATFS_DEFAULT_RSVDSECCOUNT 0 /* 0: Autoselect number reserved sectors (usually 32) */
#define MKFATFS_DEFAULT_HIDSEC 0 /* No hidden sectors */
#define MKFATFS_DEFAULT_VOLUMEID 0 /* No volume ID */
#define MKFATFS_DEFAULT_NSECTORS 0 /* 0: Use all sectors on device */
#define FAT_FORMAT_INITIALIZER \
{ \
MKFATFS_DEFAULT_NFATS, \
MKFATFS_DEFAULT_FATTYPE, \
MKFATFS_DEFAULT_CLUSTSHIFT, \
MKFATFS_DEFAULT_VOLUMELABEL, \
MKFATFS_DEFAULT_BKUPBOOT, \
MKFATFS_DEFAULT_ROOTDIRENTS, \
MKFATFS_DEFAULT_RSVDSECCOUNT, \
MKFATFS_DEFAULT_HIDSEC, \
MKFATFS_DEFAULT_VOLUMEID, \
MKFATFS_DEFAULT_NSECTORS \
}
/****************************************************************************
* Public Types
****************************************************************************/
/* These are input parameters for the format. On return, these values may be
* overwritten with actual values used in the format.
*/
struct fat_format_s
{
uint8_t ff_nfats; /* Number of FATs */
uint8_t ff_fattype; /* FAT size: 0 (autoselect), 12, 16, or 32 */
uint8_t ff_clustshift; /* Log2 of sectors per cluster: 0-5, 0xff (autoselect) */
uint8_t ff_volumelabel[11]; /* Volume label */
uint16_t ff_backupboot; /* Sector number of the backup boot sector (0=use default)*/
uint16_t ff_rootdirentries; /* Number of root directory entries */
uint16_t ff_rsvdseccount; /* Reserved sectors */
uint32_t ff_hidsec; /* Count of hidden sectors preceding fat */
uint32_t ff_volumeid; /* FAT volume id */
uint32_t ff_nsectors; /* Number of sectors from device to use: 0: Use all */
};
/****************************************************************************
* Public Data
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: mkfatfs
*
* Description:
* Make a FAT file system image on the specified block device. This
* function can automatically format a FAT12 or FAT16 file system. By
* tradition, FAT32 will only be selected is explicitly requested.
*
* Inputs:
* pathname - the full path to a registered block driver
* fmt - Describes characteristics of the desired filesystem
*
* Return:
* Zero (OK) on success; -1 (ERROR) on failure with errno set appropriately:
*
* EINVAL - NULL block driver string, bad number of FATS in 'fmt', bad FAT
* size in 'fmt', bad cluster size in 'fmt'
* ENOENT - 'pathname' does not refer to anything in the filesystem.
* ENOTBLK - 'pathname' does not refer to a block driver
* EACCESS - block driver does not support write or geometry methods
*
* Assumptions:
* - The caller must assure that the block driver is not mounted and not in
* use when this function is called. The result of formatting a mounted
* device is indeterminate (but likely not good).
*
****************************************************************************/
int mkfatfs(FAR const char *pathname, FAR struct fat_format_s *fmt);
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __APPS_INCLUDE_FSUTILS_MKFATFS_H */
@@ -0,0 +1,121 @@
/****************************************************************************
* apps/include/fsutils/mksmartfs.h
*
* Copyright (C) 2015 Ken Pettit. All rights reserved.
* Author: Ken Pettit <pettitkd@gmail.com>
*
* 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.
* 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.
*
****************************************************************************/
#ifndef __APPS_INCLUDE_FSUTILS_MKSMARTFS_H
#define __APPS_INCLUDE_FSUTILS_MKSMARTFS_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: issmartfs
*
* Description:
* Check a SMART (Sector Mapped Allocation for Really Tiny) Flash file
* system image on the specified block device (must be a SMART device).
*
* Inputs:
* pathname - the full path to a registered block driver
*
* Return:
* Zero (OK) on success; -1 (ERROR) on failure with errno set appropriately:
*
* EINVAL - NULL block driver string
* ENOENT - 'pathname' does not refer to anything in the filesystem.
* ENOTBLK - 'pathname' does not refer to a block driver
* EFTYPE - the block driver hasn't been formatted yet
*
****************************************************************************/
int issmartfs(FAR const char *pathname);
/****************************************************************************
* Name: mksmartfs
*
* Description:
* Make a SMART (Sector Mapped Allocation for Really Tiny) Flash file
* system image on the specified block device (must be a SMART device).
*
* Inputs:
* pathname - the full path to a registered block driver
* nrootdirs - the number of Root Directory entries to support
* on this device (supports multiple mount points).
*
* Return:
* Zero (OK) on success; -1 (ERROR) on failure with errno set appropriately:
*
* EINVAL - NULL block driver string
* ENOENT - 'pathname' does not refer to anything in the filesystem.
* ENOTBLK - 'pathname' does not refer to a block driver
* EACCESS - block driver does not support write or geometry methods or
* is not a SMART device
*
* Assumptions:
* - The caller must assure that the block driver is not mounted and not in
* use when this function is called. The result of formatting a mounted
* device is indeterminate (but likely not good).
*
****************************************************************************/
#ifdef CONFIG_SMARTFS_MULTI_ROOT_DIRS
int mksmartfs(FAR const char *pathname, uint16_t sectorsize,
uint8_t nrootdirs);
#else
int mksmartfs(FAR const char *pathname, uint16_t sectorsize);
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __APPS_INCLUDE_FSUTILS_MKSMARTFS_H */
@@ -0,0 +1,124 @@
/****************************************************************************
* apps/include/fsutils/passwd.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 __APPS_INCLUDE_FSUTILS_PASSWD_H
#define __APPS_INCLUDE_FSUTILS_PASSWD_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* passwd_verify() return value tests */
#define PASSWORD_VERIFY_MATCH(ret) (ret == 1)
#define PASSWORD_VERIFY_NOMATCH(ret) (ret == 0)
#define PASSWORD_VERIFY_ERROR(ret) (ret < 0)
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
/****************************************************************************
* Name: passwd_adduser
*
* Description:
* Add a new user to the /etc/passwd file. If the user already exists,
* then this function will fail with -EEXIST.
*
* Input Parameters:
* username - Identifies the user to be added
* password - The password for the new user
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* failure.
*
****************************************************************************/
#if defined(CONFIG_FSUTILS_PASSWD_READONLY)
int passwd_adduser(FAR const char *username, FAR const char *password);
/****************************************************************************
* Name: passwd_deluser
*
* Description:
* Remove an existing user from the /etc/passwd file. If the user does
* not exist, then this function will fail.
*
* Input Parameters:
* username - Identifies the user to be deleted
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* failure.
*
****************************************************************************/
int passwd_deluser(FAR const char *username);
/****************************************************************************
* Name: passwd_update
*
* Description:
* Change a user in the /etc/passwd file. If the user does not exist,
* then this function will fail.
*
* Input Parameters:
* username - Identifies the user whose password will be updated
* password - The new password for the existing user
*
* Returned Value:
* Zero (OK) is returned on success; a negated errno value is returned on
* failure.
*
****************************************************************************/
int passwd_update(FAR const char *username, FAR const char *password);
#endif /* CONFIG_FSUTILS_PASSWD_READONLY */
/****************************************************************************
* Name: passwd_verify
*
* Description:
* Return true if the username exists in the /etc/passwd file and if the
* password matches the user password in that failed.
*
* Input Parameters:
* username - Identifies the user whose password will be verified
* password - The password to be verified
*
* Returned Value:
* One (1) is returned on success match, Zero (OK) is returned on an
* unsuccessful match; a negated errno value is returned on any other
* failure.
*
****************************************************************************/
int passwd_verify(FAR const char *username, FAR const char *password);
#endif /* __APPS_INCLUDE_FSUTILS_PASSWD_H */