Initial version
This commit is contained in:
@ -0,0 +1,112 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Defines macros used to interact with the Reliance Edge API.
|
||||
*/
|
||||
#ifndef REDAPIMACS_H
|
||||
#define REDAPIMACS_H
|
||||
|
||||
|
||||
/** Clear all events: manual transactions only. */
|
||||
#define RED_TRANSACT_MANUAL 0x00000000U
|
||||
|
||||
/** Transact prior to unmounting in red_umount() or RedFseUnmount(). */
|
||||
#define RED_TRANSACT_UMOUNT 0x00000001U
|
||||
|
||||
/** Transact after a successful red_open() which created a file. */
|
||||
#define RED_TRANSACT_CREAT 0x00000002U
|
||||
|
||||
/** Transact after a successful red_unlink() or red_rmdir(). */
|
||||
#define RED_TRANSACT_UNLINK 0x00000004U
|
||||
|
||||
/** Transact after a successful red_mkdir(). */
|
||||
#define RED_TRANSACT_MKDIR 0x00000008U
|
||||
|
||||
/** Transact after a successful red_rename(). */
|
||||
#define RED_TRANSACT_RENAME 0x00000010U
|
||||
|
||||
/** Transact after a successful red_link(). */
|
||||
#define RED_TRANSACT_LINK 0x00000020U
|
||||
|
||||
/** Transact after a successful red_close(). */
|
||||
#define RED_TRANSACT_CLOSE 0x00000040U
|
||||
|
||||
/** Transact after a successful red_write() or RedFseWrite(). */
|
||||
#define RED_TRANSACT_WRITE 0x00000080U
|
||||
|
||||
/** Transact after a successful red_fsync(). */
|
||||
#define RED_TRANSACT_FSYNC 0x00000100U
|
||||
|
||||
/** Transact after a successful red_ftruncate(), RedFseTruncate(), or red_open() with RED_O_TRUNC that actually truncates. */
|
||||
#define RED_TRANSACT_TRUNCATE 0x00000200U
|
||||
|
||||
/** Transact to free space in disk full situations. */
|
||||
#define RED_TRANSACT_VOLFULL 0x00000400U
|
||||
|
||||
#if REDCONF_READ_ONLY == 1
|
||||
|
||||
/** Mask of all supported automatic transaction events. */
|
||||
#define RED_TRANSACT_MASK 0U
|
||||
|
||||
#elif REDCONF_API_POSIX == 1
|
||||
|
||||
/** @brief Mask of all supported automatic transaction events.
|
||||
*/
|
||||
#define RED_TRANSACT_MASK \
|
||||
( \
|
||||
RED_TRANSACT_UMOUNT | \
|
||||
RED_TRANSACT_CREAT | \
|
||||
((REDCONF_API_POSIX_UNLINK == 1) ? RED_TRANSACT_UNLINK : 0U) | \
|
||||
((REDCONF_API_POSIX_MKDIR == 1) ? RED_TRANSACT_MKDIR : 0U) | \
|
||||
((REDCONF_API_POSIX_RENAME == 1) ? RED_TRANSACT_RENAME : 0U) | \
|
||||
((REDCONF_API_POSIX_LINK == 1) ? RED_TRANSACT_LINK : 0U) | \
|
||||
RED_TRANSACT_CLOSE | \
|
||||
RED_TRANSACT_WRITE | \
|
||||
RED_TRANSACT_FSYNC | \
|
||||
((REDCONF_API_POSIX_FTRUNCATE == 1) ? RED_TRANSACT_TRUNCATE : 0U) | \
|
||||
RED_TRANSACT_VOLFULL \
|
||||
)
|
||||
|
||||
#else /* REDCONF_API_FSE == 1 */
|
||||
|
||||
/** @brief Mask of all supported automatic transaction events.
|
||||
*/
|
||||
#define RED_TRANSACT_MASK \
|
||||
( \
|
||||
RED_TRANSACT_UMOUNT | \
|
||||
RED_TRANSACT_WRITE | \
|
||||
((REDCONF_API_FSE_TRUNCATE == 1) ? RED_TRANSACT_TRUNCATE : 0U) | \
|
||||
RED_TRANSACT_VOLFULL \
|
||||
)
|
||||
|
||||
#endif /* REDCONF_READ_ONLY */
|
||||
|
||||
#if (REDCONF_TRANSACT_DEFAULT & RED_TRANSACT_MASK) != REDCONF_TRANSACT_DEFAULT
|
||||
#error "Configuration error: invalid value of REDCONF_TRANSACT_DEFAULT"
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,349 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Compile-time validity checks for the REDCONF macros.
|
||||
*/
|
||||
#ifndef REDCONFIGCHK_H
|
||||
#define REDCONFIGCHK_H
|
||||
|
||||
#ifdef RED_CONFIG_MINCOMPAT_VER
|
||||
#if (RED_VERSION_VAL & 0xFFFFFF00U) < (RED_CONFIG_MINCOMPAT_VER & 0xFFFFFF00U)
|
||||
/* This indicates that your configuration files were generated by a
|
||||
version of the Reliance Edge Configuration Utility that is designed
|
||||
for a more recent version of Reliance Edge and is no longer compatible
|
||||
with this version. You can update to the most recent version of
|
||||
Reliance Edge or contact RelianceEdgeSupport@datalight.com to obtain
|
||||
the correct legacy version of the Configuration Utility.
|
||||
*/
|
||||
#error "Your configuration is not compatible with this version of Reliance Edge. Please download the latest version of Reliance Edge or recreate your configuration with an older version of the Configuration Utility."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef REDCONF_READ_ONLY
|
||||
#error "Configuration error: REDCONF_READ_ONLY must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX
|
||||
#error "Configuration error: REDCONF_API_POSIX must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_FSE
|
||||
#error "Configuration error: REDCONF_API_FSE must be defined."
|
||||
#endif
|
||||
|
||||
#if REDCONF_API_POSIX == 1
|
||||
#ifndef REDCONF_API_POSIX_FORMAT
|
||||
#error "Configuration error: REDCONF_API_POSIX_FORMAT must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX_UNLINK
|
||||
#error "Configuration error: REDCONF_API_POSIX_UNLINK must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX_MKDIR
|
||||
#error "Configuration error: REDCONF_API_POSIX_MKDIR must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX_RMDIR
|
||||
#error "Configuration error: REDCONF_API_POSIX_RMDIR must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX_RENAME
|
||||
#error "Configuration error: REDCONF_API_POSIX_RENAME must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX_LINK
|
||||
#error "Configuration error: REDCONF_API_POSIX_LINK must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX_FTRUNCATE
|
||||
#error "Configuration error: REDCONF_API_POSIX_FTRUNCATE must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_POSIX_READDIR
|
||||
#error "Configuration error: REDCONF_API_POSIX_READDIR must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_NAME_MAX
|
||||
#error "Configuration error: REDCONF_NAME_MAX must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_PATH_SEPARATOR
|
||||
#error "Configuration error: REDCONF_PATH_SEPARATOR must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_RENAME_ATOMIC
|
||||
#error "Configuration error: REDCONF_RENAME_ATOMIC must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_HANDLE_COUNT
|
||||
#error "Configuration error: REDCONF_HANDLE_COUNT must be defined."
|
||||
#endif
|
||||
#endif
|
||||
#if REDCONF_API_FSE == 1
|
||||
#ifndef REDCONF_API_FSE_FORMAT
|
||||
#error "Configuration error: REDCONF_API_FSE_FORMAT must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_FSE_TRUNCATE
|
||||
#error "Configuration error: REDCONF_API_FSE_TRUNCATE must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_FSE_TRANSMASKSET
|
||||
#error "Configuration error: REDCONF_API_FSE_TRANSMASKSET must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_API_FSE_TRANSMASKGET
|
||||
#error "Configuration error: REDCONF_API_FSE_TRANSMASKGET must be defined."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef REDCONF_TASK_COUNT
|
||||
#error "Configuration error: REDCONF_TASK_COUNT must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_ENDIAN_BIG
|
||||
#error "Configuration error: REDCONF_ENDIAN_BIG must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_ALIGNMENT_SIZE
|
||||
#error "Configuration error: REDCONF_ALIGNMENT_SIZE must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_CRC_ALGORITHM
|
||||
#error "Configuration error: REDCONF_CRC_ALGORITHM must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_INODE_TIMESTAMPS
|
||||
#error "Configuration error: REDCONF_INODE_TIMESTAMPS must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_ATIME
|
||||
#error "Configuration error: REDCONF_ATIME must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_DIRECT_POINTERS
|
||||
#error "Configuration error: REDCONF_DIRECT_POINTERS must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_INDIRECT_POINTERS
|
||||
#error "Configuration error: REDCONF_INDIRECT_POINTERS must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_INODE_BLOCKS
|
||||
#error "Configuration error: REDCONF_INODE_BLOCKS must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_IMAP_EXTERNAL
|
||||
#error "Configuration error: REDCONF_IMAP_EXTERNAL must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_IMAP_INLINE
|
||||
#error "Configuration error: REDCONF_IMAP_INLINE must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_OUTPUT
|
||||
#error "Configuration error: REDCONF_OUTPUT must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_ASSERTS
|
||||
#error "Configuration error: REDCONF_ASSERTS must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_TRANSACT_DEFAULT
|
||||
#error "Configuration error: REDCONF_TRANSACT_DEFAULT must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_BUFFER_COUNT
|
||||
#error "Configuration error: REDCONF_BUFFER_COUNT must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_BLOCK_SIZE
|
||||
#error "Configuration error: REDCONF_BLOCK_SIZE must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_VOLUME_COUNT
|
||||
#error "Configuration error: REDCONF_VOLUME_COUNT must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_DISCARDS
|
||||
/* Reliance Edge 1.0.5 and below did not have REDCONF_DISCARDS. You can
|
||||
fix this error by downloading the latest version of the Configuration
|
||||
Utility (assuming you are using the latest version of Reliance Edge)
|
||||
from http://www.datalight.com/reliance-edge, loading your redconf.c
|
||||
and redconf.h files, and saving them again, replacing the original
|
||||
files.
|
||||
*/
|
||||
#error "Configuration error: your redconf.h is not compatible. Update your redconf files with a compatible version of the configuration utility."
|
||||
#endif
|
||||
#ifndef REDCONF_IMAGE_BUILDER
|
||||
#error "Configuration error: REDCONF_IMAGE_BUILDER must be defined."
|
||||
#endif
|
||||
#ifndef REDCONF_CHECKER
|
||||
#error "Configuration error: REDCONF_CHECKER must be defined."
|
||||
#endif
|
||||
|
||||
|
||||
#if (REDCONF_READ_ONLY != 0) && (REDCONF_READ_ONLY != 1)
|
||||
#error "Configuration error: REDCONF_READ_ONLY must be either 0 or 1"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX != 0) && (REDCONF_API_POSIX != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX must be either 0 or 1."
|
||||
#endif
|
||||
#if (REDCONF_API_FSE != 0) && (REDCONF_API_FSE != 1)
|
||||
#error "Configuration error: REDCONF_API_FSE must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_FSE == 0) && (REDCONF_API_POSIX == 0)
|
||||
#error "Configuration error: either REDCONF_API_FSE or REDCONF_API_POSIX must be set to 1."
|
||||
#endif
|
||||
|
||||
#if REDCONF_API_POSIX == 1
|
||||
#if REDCONF_API_FSE != 0
|
||||
#error "Configuration error: REDCONF_API_FSE must be 0 if REDCONF_API_POSIX is 1"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_FORMAT != 0) && (REDCONF_API_POSIX_FORMAT != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_FORMAT must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_UNLINK != 0) && (REDCONF_API_POSIX_UNLINK != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_UNLINK must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_MKDIR != 0) && (REDCONF_API_POSIX_MKDIR != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_MKDIR must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_RMDIR != 0) && (REDCONF_API_POSIX_RMDIR != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_RMDIR must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_RENAME != 0) && (REDCONF_API_POSIX_RENAME != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_RENAME must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_LINK != 0) && (REDCONF_API_POSIX_LINK != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_LINK must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_FTRUNCATE != 0) && (REDCONF_API_POSIX_FTRUNCATE != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_FTRUNCATE must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX_READDIR != 0) && (REDCONF_API_POSIX_READDIR != 1)
|
||||
#error "Configuration error: REDCONF_API_POSIX_READDIR must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_NAME_MAX < 1U) || (REDCONF_NAME_MAX > (REDCONF_BLOCK_SIZE - 4U))
|
||||
#error "Configuration error: invalid value of REDCONF_NAME_MAX"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_PATH_SEPARATOR < 1) || (REDCONF_PATH_SEPARATOR > 127)
|
||||
#error "Configuration error: invalid value of REDCONF_PATH_SEPARATOR"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_RENAME_ATOMIC != 0) && (REDCONF_RENAME_ATOMIC != 1)
|
||||
#error "Configuration error: REDCONF_RENAME_ATOMIC must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_HANDLE_COUNT < 1U) || (REDCONF_HANDLE_COUNT > 4096U)
|
||||
#error "Configuration error: invalid value of REDCONF_HANDLE_COUNT"
|
||||
#endif
|
||||
#endif
|
||||
#if REDCONF_API_FSE == 1
|
||||
#if (REDCONF_API_FSE_FORMAT != 0) && (REDCONF_API_FSE_FORMAT != 1)
|
||||
#error "Configuration error: REDCONF_API_FSE_FORMAT must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_FSE_TRUNCATE != 0) && (REDCONF_API_FSE_TRUNCATE != 1)
|
||||
#error "Configuration error: REDCONF_API_FSE_TRUNCATE must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_FSE_TRANSMASKSET != 0) && (REDCONF_API_FSE_TRANSMASKSET != 1)
|
||||
#error "Configuration error: REDCONF_API_FSE_TRANSMASKSET must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_FSE_TRANSMASKGET != 0) && (REDCONF_API_FSE_TRANSMASKGET != 1)
|
||||
#error "Configuration error: REDCONF_API_FSE_TRANSMASKGET must be either 0 or 1."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if REDCONF_TASK_COUNT < 1U
|
||||
#error "Configuration error: invalid value of REDCONF_TASK_COUNT"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_ENDIAN_BIG != 0) && (REDCONF_ENDIAN_BIG != 1)
|
||||
#error "Configuration error: REDCONF_ENDIAN_BIG must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_ALIGNMENT_SIZE != 1U) && (REDCONF_ALIGNMENT_SIZE != 2U) && (REDCONF_ALIGNMENT_SIZE != 4U) && (REDCONF_ALIGNMENT_SIZE != 8U)
|
||||
#error "Configuration error: invalid value REDCONF_ALIGNMENT_SIZE"
|
||||
#endif
|
||||
|
||||
/* REDCONF_CRC_ALGORITHM checked in crc.c
|
||||
*/
|
||||
|
||||
#if (REDCONF_INODE_TIMESTAMPS != 0) && (REDCONF_INODE_TIMESTAMPS != 1)
|
||||
#error "Configuration error: REDCONF_INODE_TIMESTAMPS must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_ATIME != 0) && (REDCONF_ATIME != 1)
|
||||
#error "Configuration error: REDCONF_ATIME must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_INODE_TIMESTAMPS == 0) && (REDCONF_ATIME == 1)
|
||||
#error "Configuration error: REDCONF_ATIME must be 0 when REDCONF_INODE_TIMESTAMPS is 0."
|
||||
#endif
|
||||
|
||||
/* REDCONF_DIRECT_POINTERS and REDCONF_INDIRECT_POINTERS checked in rednodes.h
|
||||
*/
|
||||
|
||||
#if (REDCONF_INODE_BLOCKS != 0) && (REDCONF_INODE_BLOCKS != 1)
|
||||
#error "Configuration error: REDCONF_INODE_BLOCKS must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
/* Further validity checking of imap specs done in RelCoreInit()
|
||||
*/
|
||||
#if (REDCONF_IMAP_EXTERNAL != 0) && (REDCONF_IMAP_EXTERNAL != 1)
|
||||
#error "Configuration error: REDCONF_IMAP_EXTERNAL must be either 0 or 1."
|
||||
#endif
|
||||
#if (REDCONF_IMAP_INLINE != 0) && (REDCONF_IMAP_INLINE != 1)
|
||||
#error "Configuration error: REDCONF_IMAP_INLINE must be either 0 or 1."
|
||||
#endif
|
||||
#if (REDCONF_IMAP_INLINE == 0) && (REDCONF_IMAP_EXTERNAL == 0)
|
||||
#error "Configuration error: At least one of REDCONF_IMAP_INLINE and REDCONF_IMAP_EXTERNAL must be set"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_OUTPUT != 0) && (REDCONF_OUTPUT != 1)
|
||||
#error "Configuration error: REDCONF_OUTPUT must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_ASSERTS != 0) && (REDCONF_ASSERTS != 1)
|
||||
#error "Configuration error: REDCONF_ASSERTS must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
/* REDCONF_BLOCK_SIZE checked in redmacs.h
|
||||
*/
|
||||
|
||||
#if (REDCONF_VOLUME_COUNT < 1U) || (REDCONF_VOLUME_COUNT > 255U)
|
||||
#error "REDCONF_VOLUME_COUNT must be an integer between 1 and 255"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_DISCARDS != 0) && (REDCONF_DISCARDS != 1)
|
||||
#error "Configuration error: REDCONF_DISCARDS must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
/* REDCONF_BUFFER_COUNT lower limit checked in buffer.c
|
||||
*/
|
||||
#if REDCONF_BUFFER_COUNT > 255U
|
||||
#error "REDCONF_BUFFER_COUNT cannot be greater than 255"
|
||||
#endif
|
||||
|
||||
#if (REDCONF_IMAGE_BUILDER != 0) && (REDCONF_IMAGE_BUILDER != 1)
|
||||
#error "Configuration error: REDCONF_IMAGE_BUILDER must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
#if (REDCONF_CHECKER != 0) && (REDCONF_CHECKER != 1)
|
||||
#error "Configuration error: REDCONF_CHECKER must be either 0 or 1."
|
||||
#endif
|
||||
|
||||
|
||||
#if (REDCONF_DISCARDS == 1) && (RED_KIT == RED_KIT_GPL)
|
||||
#error "REDCONF_DISCARDS not supported in Reliance Edge under GPL. Contact sales@datalight.com to upgrade."
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -0,0 +1,97 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDCOREAPI_H
|
||||
#define REDCOREAPI_H
|
||||
|
||||
|
||||
#include <redstat.h>
|
||||
|
||||
|
||||
REDSTATUS RedCoreInit(void);
|
||||
REDSTATUS RedCoreUninit(void);
|
||||
|
||||
REDSTATUS RedCoreVolSetCurrent(uint8_t bVolNum);
|
||||
|
||||
#if FORMAT_SUPPORTED
|
||||
REDSTATUS RedCoreVolFormat(void);
|
||||
#endif
|
||||
#if REDCONF_CHECKER == 1
|
||||
REDSTATUS RedCoreVolCheck(void);
|
||||
#endif
|
||||
REDSTATUS RedCoreVolMount(void);
|
||||
REDSTATUS RedCoreVolUnmount(void);
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
REDSTATUS RedCoreVolTransact(void);
|
||||
#endif
|
||||
#if REDCONF_API_POSIX == 1
|
||||
REDSTATUS RedCoreVolStat(REDSTATFS *pStatFS);
|
||||
#endif
|
||||
|
||||
#if (REDCONF_READ_ONLY == 0) && ((REDCONF_API_POSIX == 1) || (REDCONF_API_FSE_TRANSMASKSET == 1))
|
||||
REDSTATUS RedCoreTransMaskSet(uint32_t ulEventMask);
|
||||
#endif
|
||||
#if (REDCONF_API_POSIX == 1) || (REDCONF_API_FSE_TRANSMASKGET == 1)
|
||||
REDSTATUS RedCoreTransMaskGet(uint32_t *pulEventMask);
|
||||
#endif
|
||||
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1)
|
||||
REDSTATUS RedCoreCreate(uint32_t ulPInode, const char *pszName, bool fDir, uint32_t *pulInode);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_LINK == 1)
|
||||
REDSTATUS RedCoreLink(uint32_t ulPInode, const char *pszName, uint32_t ulInode);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) && ((REDCONF_API_POSIX_UNLINK == 1) || (REDCONF_API_POSIX_RMDIR == 1))
|
||||
REDSTATUS RedCoreUnlink(uint32_t ulPInode, const char *pszName);
|
||||
#endif
|
||||
#if REDCONF_API_POSIX == 1
|
||||
REDSTATUS RedCoreLookup(uint32_t ulPInode, const char *pszName, uint32_t *pulInode);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_RENAME == 1)
|
||||
REDSTATUS RedCoreRename(uint32_t ulSrcPInode, const char *pszSrcName, uint32_t ulDstPInode, const char *pszDstName);
|
||||
#endif
|
||||
#if REDCONF_API_POSIX == 1
|
||||
REDSTATUS RedCoreStat(uint32_t ulInode, REDSTAT *pStat);
|
||||
#endif
|
||||
#if REDCONF_API_FSE == 1
|
||||
REDSTATUS RedCoreFileSizeGet(uint32_t ulInode, uint64_t *pullSize);
|
||||
#endif
|
||||
|
||||
REDSTATUS RedCoreFileRead(uint32_t ulInode, uint64_t ullStart, uint32_t *pulLen, void *pBuffer);
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
REDSTATUS RedCoreFileWrite(uint32_t ulInode, uint64_t ullStart, uint32_t *pulLen, const void *pBuffer);
|
||||
#endif
|
||||
#if TRUNCATE_SUPPORTED
|
||||
REDSTATUS RedCoreFileTruncate(uint32_t ulInode, uint64_t ullSize);
|
||||
#endif
|
||||
|
||||
#if (REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_READDIR == 1)
|
||||
REDSTATUS RedCoreDirRead(uint32_t ulInode, uint32_t *pulPos, char *pszName, uint32_t *pulInode);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,224 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief This header contains macros which deviate from MISRA C:2012
|
||||
*/
|
||||
#ifndef REDDEVIATIONS_H
|
||||
#define REDDEVIATIONS_H
|
||||
|
||||
|
||||
/** @brief Append a suffix to a constant so that it is an unsigned 64-bit value.
|
||||
|
||||
Usages of this macro deviate from MISRA C:2012 Rule 1.2 (advisory). The
|
||||
rule prohibits the use of language extensions. The ULL suffix became part
|
||||
of the C standard with C99. Since this code base adheres to C89, use of
|
||||
this suffix is a language extension. Reliance Edge needs to deal with
|
||||
64-bit quantities, which by convention are explicitly suffixed. In at
|
||||
least one case, with the INODE_SIZE_MAX macro, the code needs a way to force
|
||||
a constant to be 64-bits even though its value is not so large that it would
|
||||
be automatically promoted to 64-bits. Thus the need for this macro and the
|
||||
deviation. In practice, the ULL suffix has proven to be a nearly universal
|
||||
extension among C89 compilers.
|
||||
|
||||
As rule 19.2 is advisory, a deviation record is not required. This notice
|
||||
is the only record of the deviation. PC-Lint does not issue an error for
|
||||
this deviation so there is no error inhibition option.
|
||||
|
||||
Usages of this macro also deviate from MISRA C:2012 Rule 20.10 (advisory).
|
||||
The rule prohibits use of the ## preprocessor operator. The code is not
|
||||
obscure, and the operator is used only once, so this is deemed to be safe.
|
||||
|
||||
As rule 20.10 is advisory, a deviation record is not required. This notice
|
||||
is the only record of the deviation.
|
||||
|
||||
Consistent use of this macro, even in non MISRA C code, is encouraged to
|
||||
make it easier to search for 64-bit values.
|
||||
|
||||
*/
|
||||
#define UINT64_SUFFIX(number) (number##ULL)
|
||||
|
||||
|
||||
/** @brief Append a suffix to a constant so that it is a signed 64-bit value.
|
||||
|
||||
Usages of this macro deviate from MISRA C:2012 Rule 1.2 (advisory). See the
|
||||
description of UINT64_SUFFIX() for details.
|
||||
|
||||
Usages of this macro deviate from MISRA C:2012 Rule 20.10 (advisory). See
|
||||
the description of UINT64_SUFFIX() for details.
|
||||
*/
|
||||
#define INT64_SUFFIX(number) (number##LL)
|
||||
|
||||
|
||||
/** @brief Cast a pointer to a const uint8_t pointer.
|
||||
|
||||
All usages of this macro deviate from MISRA C:2012 Rule 11.5 (advisory).
|
||||
Because there are no alignment requirements for a uint8_t pointer, this is
|
||||
safe. However, it is technically a deviation from the rule.
|
||||
|
||||
As Rule 11.5 is advisory, a deviation record is not required. This notice
|
||||
and the PC-Lint error inhibition option are the only records of the
|
||||
deviation.
|
||||
*/
|
||||
#define CAST_VOID_PTR_TO_CONST_UINT8_PTR(PTR) ((const uint8_t *)(PTR))
|
||||
|
||||
|
||||
/** @brief Cast a pointer to a uint8_t pointer.
|
||||
|
||||
All usages of this macro deviate from MISRA C:2012 Rule 11.5 (advisory).
|
||||
Because there are no alignment requirements for a uint8_t pointer, this is
|
||||
safe. However, it is technically a deviation from the rule.
|
||||
|
||||
As Rule 11.5 is advisory, a deviation record is not required. This notice
|
||||
and the PC-Lint error inhibition option are the only records of the
|
||||
deviation.
|
||||
*/
|
||||
#define CAST_VOID_PTR_TO_UINT8_PTR(PTR) ((uint8_t *)(PTR))
|
||||
|
||||
|
||||
/** @brief Cast a pointer to a const uint32_t pointer.
|
||||
|
||||
Usages of this macro may deviate from MISRA C:2012 Rule 11.5 (advisory).
|
||||
It is only used in cases where the pointer is known to be aligned, and thus
|
||||
it is safe to do so.
|
||||
|
||||
As Rule 11.5 is advisory, a deviation record is not required. This notice
|
||||
and the PC-Lint error inhibition option are the only records of the
|
||||
deviation.
|
||||
|
||||
Usages of this macro may deviate from MISRA C:2012 Rule 11.3 (required).
|
||||
As Rule 11.3 is required, a separate deviation record is required.
|
||||
|
||||
Regarding the cast to (const void *): this is there to placate some
|
||||
compilers which emit warnings when a type with lower alignment requirements
|
||||
(such as const uint8_t *) is cast to a type with higher alignment
|
||||
requirements. In the places where this macro is used, the pointer is
|
||||
checked to be of sufficient alignment.
|
||||
*/
|
||||
#define CAST_CONST_UINT32_PTR(PTR) ((const uint32_t *)(const void *)(PTR))
|
||||
|
||||
|
||||
/** @brief Cast a pointer to a pointer to (void **).
|
||||
|
||||
Usages of this macro deviate from MISRA C:2012 Rule 11.3 (required).
|
||||
It is only used for populating a node structure pointer with a buffer
|
||||
pointer. Buffer pointers are 8-byte aligned, thus it is safe to do so.
|
||||
|
||||
As Rule 11.3 is required, a separate deviation record is required.
|
||||
*/
|
||||
#define CAST_VOID_PTR_PTR(PTRPTR) ((void **)(PTRPTR))
|
||||
|
||||
|
||||
/** @brief Create a two-dimensional byte array which is safely aligned.
|
||||
|
||||
Usages of this macro deviate from MISRA C:2012 Rule 19.2 (advisory).
|
||||
A union is required to force alignment of the block buffers, which are used
|
||||
to access metadata nodes, which must be safely aligned for 64-bit types.
|
||||
|
||||
As rule 19.2 is advisory, a deviation record is not required. This notice
|
||||
and the PC-Lint error inhibition option are the only records of the
|
||||
deviation.
|
||||
*/
|
||||
#define ALIGNED_2D_BYTE_ARRAY(un, nam, size1, size2) \
|
||||
union \
|
||||
{ \
|
||||
uint8_t nam[size1][size2]; \
|
||||
uint64_t DummyAlign; \
|
||||
} un
|
||||
|
||||
|
||||
/** @brief Determine whether RedMemMove() must copy memory in the forward
|
||||
direction, instead of in the reverse.
|
||||
|
||||
In order to copy between overlapping memory regions, RedMemMove() must copy
|
||||
forward if the destination memory is lower, and backward if the destination
|
||||
memory is higher. Failure to do so would yield incorrect results.
|
||||
|
||||
The only way to make this determination without gross inefficiency is to
|
||||
use pointer comparison. Pointer comparisons are undefined unless both
|
||||
pointers point within the same object or array (or one element past the end
|
||||
of the array); see section 6.3.8 of ANSI C89. While RedMemMove() is
|
||||
normally only used when memory regions overlap, which would not result in
|
||||
undefined behavior, it (like memmove()) is supposed to work even for non-
|
||||
overlapping regions, which would make this function invoke undefined
|
||||
behavior. Experience has shown the pointer comparisons of this sort behave
|
||||
intuitively on common platforms, even though the behavior is undefined. For
|
||||
those platforms where this is not the case, this implementation of memmove()
|
||||
should be replaced with an alternate one.
|
||||
|
||||
Usages of this macro deviate from MISRA-C:2012 Rule 18.3 (required). As
|
||||
Rule 18.3 is required, a separate deviation record is required.
|
||||
*/
|
||||
#define MEMMOVE_MUST_COPY_FORWARD(dest, src) ((dest) < (src))
|
||||
|
||||
|
||||
/** @brief Cast a pointer to a (const DIRENT *).
|
||||
|
||||
Usages of this macro deviate from MISRA-C:2012 Rule 11.3 (required).
|
||||
It is used for populating a directory entry structure pointer with a
|
||||
buffer pointer. Buffer pointers are 8-byte aligned, and DIRENT only
|
||||
requires 4-byte alignment, thus the typecast is safe.
|
||||
|
||||
As Rule 11.3 is required, a separate deviation record is required.
|
||||
*/
|
||||
#define CAST_CONST_DIRENT_PTR(PTR) ((const DIRENT *)(PTR))
|
||||
|
||||
|
||||
/** @brief Determine whether a pointer is aligned.
|
||||
|
||||
A pointer is aligned if its address is an even multiple of
|
||||
::REDCONF_ALIGNMENT_SIZE.
|
||||
|
||||
This is used in the slice-by-8 RedCrc32Update() function, which needs to
|
||||
know whether a pointer is aligned, since the slice-by-8 algorithm needs to
|
||||
access the memory in an aligned fashion, and if the pointer is not aligned,
|
||||
this can result in faults or suboptimal performance (depending on platform).
|
||||
|
||||
There is no way to perform this check without deviating from MISRA C rules
|
||||
against casting pointers to integer types. Usage of this macro deviates
|
||||
from MISRA C:2012 Rule 11.4 (advisory). The main rationale the rule cites
|
||||
against converting pointers to integers is that the chosen integer type may
|
||||
not be able to represent the pointer; this is a non-issue here since we use
|
||||
uintptr_t. The text says the rule still applies when using uintptr_t due to
|
||||
concern about unaligned pointers, but that is not an issue here since the
|
||||
integer value of the pointer is not saved and not converted back into a
|
||||
pointer and dereferenced. The result of casting a pointer to a sufficiently
|
||||
large integer is implementation-defined, but macros similar to this one have
|
||||
been used by Datalight for a long time in a wide variety of environments and
|
||||
they have always worked as expected.
|
||||
|
||||
As Rule 11.4 is advisory, a deviation record is not required. This notice
|
||||
and the PC-Lint error inhibition option are the only records of the
|
||||
deviation.
|
||||
|
||||
@note PC-Lint also thinks this macro as it is used below violates Rule 11.6
|
||||
(required). This is a false positive, since Rule 11.6 only applies to
|
||||
void pointers. Below, we use it on a pointer-to-object (uint8_t *),
|
||||
which is covered by Rule 11.4.
|
||||
*/
|
||||
#define IS_ALIGNED_PTR(ptr) (((uintptr_t)(ptr) & (REDCONF_ALIGNMENT_SIZE - 1U)) == 0U)
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,114 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Error values for Reliance Edge APIs
|
||||
*/
|
||||
#ifndef REDERRNO_H
|
||||
#define REDERRNO_H
|
||||
|
||||
|
||||
/** @brief Return type for Reliance Edge error values.
|
||||
*/
|
||||
typedef int32_t REDSTATUS;
|
||||
|
||||
|
||||
/* The errno numbers are the same as Linux.
|
||||
*/
|
||||
|
||||
/** Operation not permitted. */
|
||||
#define RED_EPERM 1
|
||||
|
||||
/** No such file or directory. */
|
||||
#define RED_ENOENT 2
|
||||
|
||||
/** I/O error. */
|
||||
#define RED_EIO 5
|
||||
|
||||
/** Bad file number. */
|
||||
#define RED_EBADF 9
|
||||
|
||||
/** Out of memory */
|
||||
#define RED_ENOMEM 12
|
||||
|
||||
/** Device or resource busy. */
|
||||
#define RED_EBUSY 16
|
||||
|
||||
/** File exists. */
|
||||
#define RED_EEXIST 17
|
||||
|
||||
/** Cross-device link. */
|
||||
#define RED_EXDEV 18
|
||||
|
||||
/** Not a directory. */
|
||||
#define RED_ENOTDIR 20
|
||||
|
||||
/** Is a directory. */
|
||||
#define RED_EISDIR 21
|
||||
|
||||
/** Invalid argument. */
|
||||
#define RED_EINVAL 22
|
||||
|
||||
/** File table overflow. */
|
||||
#define RED_ENFILE 23
|
||||
|
||||
/** Too many open files. */
|
||||
#define RED_EMFILE 24
|
||||
|
||||
/** File too large. */
|
||||
#define RED_EFBIG 27
|
||||
|
||||
/** No space left on device. */
|
||||
#define RED_ENOSPC 28
|
||||
|
||||
/** Read-only file system. */
|
||||
#define RED_EROFS 30
|
||||
|
||||
/** Too many links. */
|
||||
#define RED_EMLINK 31
|
||||
|
||||
/** Math result not representable. */
|
||||
#define RED_ERANGE 34
|
||||
|
||||
/** File name too long. */
|
||||
#define RED_ENAMETOOLONG 36
|
||||
|
||||
/** Function not implemented. */
|
||||
#define RED_ENOSYS 38
|
||||
|
||||
/** Directory not empty. */
|
||||
#define RED_ENOTEMPTY 39
|
||||
|
||||
/** No data available. */
|
||||
#define RED_ENODATA 61
|
||||
|
||||
/** Too many users. */
|
||||
#define RED_EUSERS 87
|
||||
|
||||
/** Nothing will be okay ever again. */
|
||||
#define RED_EFUBAR RED_EINVAL
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,53 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDEXCLUDE_H
|
||||
#define REDEXCLUDE_H
|
||||
|
||||
|
||||
#define DELETE_SUPPORTED \
|
||||
( \
|
||||
(REDCONF_READ_ONLY == 0) \
|
||||
&& ( (REDCONF_API_POSIX == 1) \
|
||||
&& ( (REDCONF_API_POSIX_RMDIR == 1) \
|
||||
|| (REDCONF_API_POSIX_UNLINK == 1) \
|
||||
|| ((REDCONF_API_POSIX_RENAME == 1) && (REDCONF_RENAME_ATOMIC == 1)))))
|
||||
|
||||
#define TRUNCATE_SUPPORTED \
|
||||
( \
|
||||
(REDCONF_READ_ONLY == 0) \
|
||||
&& ( ((REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_FTRUNCATE == 1)) \
|
||||
|| ((REDCONF_API_FSE == 1) && (REDCONF_API_FSE_TRUNCATE == 1))))
|
||||
|
||||
#define FORMAT_SUPPORTED \
|
||||
( \
|
||||
(REDCONF_READ_ONLY == 0) \
|
||||
&& ( ((REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_FORMAT == 1)) \
|
||||
|| ((REDCONF_API_FSE == 1) && (REDCONF_API_FSE_FORMAT == 1)) \
|
||||
|| (REDCONF_IMAGE_BUILDER == 1)))
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,46 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDFS_H
|
||||
#define REDFS_H
|
||||
|
||||
|
||||
#include <redconf.h>
|
||||
#include "redver.h"
|
||||
#include "redconfigchk.h"
|
||||
#include <redtypes.h>
|
||||
#include "rederrno.h"
|
||||
#include "reddeviations.h"
|
||||
#include "redmacs.h"
|
||||
#include "redapimacs.h"
|
||||
#include "redutils.h"
|
||||
#include "redosserv.h"
|
||||
#include "redmisc.h"
|
||||
#include "redexclude.h"
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,105 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Interface for the Reliance Edge FSE API.
|
||||
|
||||
The FSE (File Systems Essentials) API is a minimalist file system API
|
||||
intended for simple use cases with a fixed number of statically-defined
|
||||
files. It does not support creating or deleting files dynamically. Files
|
||||
are referenced by a fixed file number, rather than by name; there are no
|
||||
file names and no directories. There are also no file handles: files are
|
||||
not opened or closed, and file offsets are given explicitly.
|
||||
|
||||
If the FSE API is too limited to meet the needs of your application,
|
||||
consider using the more feature-rich POSIX-like file system API instead.
|
||||
*/
|
||||
#ifndef REDFSE_H
|
||||
#define REDFSE_H
|
||||
|
||||
/* This header is intended for application use; some applications are written
|
||||
in C++.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <redconf.h>
|
||||
|
||||
#if REDCONF_API_FSE == 1
|
||||
|
||||
#include <redtypes.h>
|
||||
#include "redapimacs.h"
|
||||
#include "rederrno.h"
|
||||
|
||||
|
||||
/** @brief First valid file number.
|
||||
|
||||
This macro can be used to statically define file numbers for given files,
|
||||
as in the below example:
|
||||
|
||||
~~~{.c}
|
||||
#define LOG_FILE (RED_FILENUM_FIRST_VALID)
|
||||
#define DATABASE_FILE (RED_FILENUM_FIRST_VALID + 1U)
|
||||
#define ICON1_FILE (RED_FILENUM_FIRST_VALID + 2U)
|
||||
#define ICON2_FILE (RED_FILENUM_FIRST_VALID + 3U)
|
||||
~~~
|
||||
*/
|
||||
#define RED_FILENUM_FIRST_VALID (2U)
|
||||
|
||||
|
||||
REDSTATUS RedFseInit(void);
|
||||
REDSTATUS RedFseUninit(void);
|
||||
REDSTATUS RedFseMount(uint8_t bVolNum);
|
||||
REDSTATUS RedFseUnmount(uint8_t bVolNum);
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE_FORMAT == 1)
|
||||
REDSTATUS RedFseFormat(uint8_t bVolNum);
|
||||
#endif
|
||||
int32_t RedFseRead(uint8_t bVolNum, uint32_t ulFileNum, uint64_t ullFileOffset, uint32_t ulLength, void *pBuffer);
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
int32_t RedFseWrite(uint8_t bVolNum, uint32_t ulFileNum, uint64_t ullFileOffset, uint32_t ulLength, const void *pBuffer);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE_TRUNCATE == 1)
|
||||
REDSTATUS RedFseTruncate(uint8_t bVolNum, uint32_t ulFileNum, uint64_t ullNewFileSize);
|
||||
#endif
|
||||
int64_t RedFseSizeGet(uint8_t bVolNum, uint32_t ulFileNum);
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE_TRANSMASKSET == 1)
|
||||
REDSTATUS RedFseTransMaskSet(uint8_t bVolNum, uint32_t ulEventMask);
|
||||
#endif
|
||||
#if REDCONF_API_FSE_TRANSMASKGET == 1
|
||||
REDSTATUS RedFseTransMaskGet(uint8_t bVolNum, uint32_t *pulEventMask);
|
||||
#endif
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
REDSTATUS RedFseTransact(uint8_t bVolNum);
|
||||
#endif
|
||||
|
||||
#endif /* REDCONF_API_FSE == 1 */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,77 @@
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Dieter Baron and Thomas Klausner.
|
||||
*
|
||||
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
|
||||
*/
|
||||
/** @file
|
||||
@brief Interfaces for getopt() and getopt_long() work-alike functions.
|
||||
|
||||
This code was taken from FreeBSD and slightly modified, mostly to rename
|
||||
symbols with external linkage to avoid naming conflicts in systems where
|
||||
there are real getopt()/getopt_long() implementations. Changed to use
|
||||
fixed-width types to allow code using these interfaces to be consistent
|
||||
with the rest of the product.
|
||||
*/
|
||||
#ifndef REDGETOPT_H
|
||||
#define REDGETOPT_H
|
||||
|
||||
|
||||
#define red_no_argument 0
|
||||
#define red_required_argument 1
|
||||
#define red_optional_argument 2
|
||||
|
||||
|
||||
/** @brief Specifies a long option.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/* name of long option */
|
||||
const char *name;
|
||||
/*
|
||||
* one of red_no_argument, red_required_argument, and red_optional_argument:
|
||||
* whether option takes an argument
|
||||
*/
|
||||
int32_t has_arg;
|
||||
/* if not NULL, set *flag to val when option found */
|
||||
int32_t *flag;
|
||||
/* if flag not NULL, value to set *flag to; else return value */
|
||||
int32_t val;
|
||||
} REDOPTION;
|
||||
|
||||
|
||||
int32_t RedGetopt(int32_t nargc, char * const *nargv, const char *options);
|
||||
int32_t RedGetoptLong(int32_t nargc, char * const *nargv, const char *options, const REDOPTION *long_options, int32_t *idx);
|
||||
|
||||
|
||||
extern const char *red_optarg;
|
||||
extern int32_t red_optind;
|
||||
extern int32_t red_opterr;
|
||||
extern int32_t red_optopt;
|
||||
extern int32_t red_optreset;
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,103 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDMACS_H
|
||||
#define REDMACS_H
|
||||
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void *)0)
|
||||
#endif
|
||||
|
||||
#ifndef UINT8_MAX
|
||||
#define UINT8_MAX (0xFFU)
|
||||
#endif
|
||||
#ifndef UINT16_MAX
|
||||
#define UINT16_MAX (0xFFFFU)
|
||||
#endif
|
||||
#ifndef UINT32_MAX
|
||||
#define UINT32_MAX (0xFFFFFFFFU)
|
||||
#endif
|
||||
#ifndef UINT64_MAX
|
||||
#define UINT64_MAX UINT64_SUFFIX(0xFFFFFFFFFFFFFFFF)
|
||||
#endif
|
||||
#ifndef INT32_MAX
|
||||
#define INT32_MAX (0x7FFFFFFF)
|
||||
#endif
|
||||
#ifndef INT64_MAX
|
||||
#define INT64_MAX INT64_SUFFIX(0x7FFFFFFFFFFFFFFF)
|
||||
#endif
|
||||
|
||||
#ifndef true
|
||||
#define true (1)
|
||||
#endif
|
||||
#ifndef false
|
||||
#define false (0)
|
||||
#endif
|
||||
|
||||
#define SECTOR_SIZE_MIN (256U)
|
||||
|
||||
#if REDCONF_BLOCK_SIZE == 256U
|
||||
#define BLOCK_SIZE_P2 8U
|
||||
#elif REDCONF_BLOCK_SIZE == 512U
|
||||
#define BLOCK_SIZE_P2 9U
|
||||
#elif REDCONF_BLOCK_SIZE == 1024U
|
||||
#define BLOCK_SIZE_P2 10U
|
||||
#elif REDCONF_BLOCK_SIZE == 2048U
|
||||
#define BLOCK_SIZE_P2 11U
|
||||
#elif REDCONF_BLOCK_SIZE == 4096U
|
||||
#define BLOCK_SIZE_P2 12U
|
||||
#elif REDCONF_BLOCK_SIZE == 8192U
|
||||
#define BLOCK_SIZE_P2 13U
|
||||
#elif REDCONF_BLOCK_SIZE == 16384U
|
||||
#define BLOCK_SIZE_P2 14U
|
||||
#elif REDCONF_BLOCK_SIZE == 32768U
|
||||
#define BLOCK_SIZE_P2 15U
|
||||
#elif REDCONF_BLOCK_SIZE == 65536U
|
||||
#define BLOCK_SIZE_P2 16U
|
||||
#else
|
||||
#error "REDCONF_BLOCK_SIZE must be a power of two value between 256 and 65536"
|
||||
#endif
|
||||
|
||||
#define REDMIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#define INODE_INVALID (0U) /* General-purpose invalid inode number (must be zero). */
|
||||
#define INODE_FIRST_VALID (2U) /* First valid inode number. */
|
||||
#define INODE_ROOTDIR (INODE_FIRST_VALID) /* Inode number of the root directory. */
|
||||
|
||||
/* Expands to a "const" qualifier when the volume count is one, otherwise
|
||||
expands to nothing. This is useful for variables that never change in
|
||||
single-volume configurations but do change in multi-volume configurations.
|
||||
*/
|
||||
#if REDCONF_VOLUME_COUNT == 1U
|
||||
#define CONST_IF_ONE_VOLUME const
|
||||
#else
|
||||
#define CONST_IF_ONE_VOLUME
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,48 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDMISC_H
|
||||
#define REDMISC_H
|
||||
|
||||
|
||||
/** @brief Type of an inode or handle.
|
||||
|
||||
Used to indicate the actual or expected type of an inode or handle.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
FTYPE_FILE, /**< Type is file. */
|
||||
FTYPE_DIR, /**< Type is directory. */
|
||||
|
||||
/** Type is either file or directory: used only to indicate an expected
|
||||
type, never as an actual type.
|
||||
*/
|
||||
FTYPE_EITHER
|
||||
} FTYPE;
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,86 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDOSSERV_H
|
||||
#define REDOSSERV_H
|
||||
|
||||
|
||||
#include <redostypes.h>
|
||||
|
||||
|
||||
/** @brief Type of access requested when opening a block device.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
BDEV_O_RDONLY, /**< Open block device for read access. */
|
||||
BDEV_O_WRONLY, /**< Open block device for write access. */
|
||||
BDEV_O_RDWR /**< Open block device for read and write access. */
|
||||
} BDEVOPENMODE;
|
||||
|
||||
REDSTATUS RedOsBDevOpen(uint8_t bVolNum, BDEVOPENMODE mode);
|
||||
REDSTATUS RedOsBDevClose(uint8_t bVolNum);
|
||||
REDSTATUS RedOsBDevRead(uint8_t bVolNum, uint64_t ullSectorStart, uint32_t ulSectorCount, void *pBuffer);
|
||||
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
REDSTATUS RedOsBDevWrite(uint8_t bVolNum, uint64_t ullSectorStart, uint32_t ulSectorCount, const void *pBuffer);
|
||||
REDSTATUS RedOsBDevFlush(uint8_t bVolNum);
|
||||
#endif
|
||||
|
||||
/* Non-standard API: for host machines only.
|
||||
*/
|
||||
REDSTATUS RedOsBDevConfig(uint8_t bVolNum, const char *pszBDevSpec);
|
||||
|
||||
|
||||
#if REDCONF_TASK_COUNT > 1U
|
||||
REDSTATUS RedOsMutexInit(void);
|
||||
REDSTATUS RedOsMutexUninit(void);
|
||||
void RedOsMutexAcquire(void);
|
||||
void RedOsMutexRelease(void);
|
||||
#endif
|
||||
#if (REDCONF_TASK_COUNT > 1U) && (REDCONF_API_POSIX == 1)
|
||||
uint32_t RedOsTaskId(void);
|
||||
#endif
|
||||
|
||||
REDSTATUS RedOsClockInit(void);
|
||||
REDSTATUS RedOsClockUninit(void);
|
||||
uint32_t RedOsClockGetTime(void);
|
||||
|
||||
REDSTATUS RedOsTimestampInit(void);
|
||||
REDSTATUS RedOsTimestampUninit(void);
|
||||
REDTIMESTAMP RedOsTimestamp(void);
|
||||
uint64_t RedOsTimePassed(REDTIMESTAMP tsSince);
|
||||
|
||||
#if REDCONF_OUTPUT == 1
|
||||
void RedOsOutputString(const char *pszString);
|
||||
#endif
|
||||
|
||||
#if REDCONF_ASSERTS == 1
|
||||
void RedOsAssertFail(const char *pszFileName, uint32_t ulLineNum);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,38 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Interfaces of path utilities for the POSIX-like API layer.
|
||||
*/
|
||||
#ifndef REDPATH_H
|
||||
#define REDPATH_H
|
||||
|
||||
|
||||
REDSTATUS RedPathSplit(const char *pszPath, uint8_t *pbVolNum, const char **ppszLocalPath);
|
||||
REDSTATUS RedPathLookup(const char *pszLocalPath, uint32_t *pulInode);
|
||||
REDSTATUS RedPathToName(const char *pszLocalPath, uint32_t *pulPInode, const char **ppszName);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,196 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Interface for the Reliance Edge POSIX-like API.
|
||||
|
||||
The POSIX-like file system API is the primary file system API for
|
||||
Reliance Edge, which supports the full functionality of the file system.
|
||||
This API aims to be compatible with POSIX where reasonable, but it is
|
||||
simplified considerably to meet the needs of resource-constrained embedded
|
||||
systems. The API has also been extended to provide access to the unique
|
||||
features of Reliance Edge, and to cover areas (like mountins and formatting)
|
||||
which do not have APIs in the POSIX specification.
|
||||
*/
|
||||
#ifndef REDPOSIX_H
|
||||
#define REDPOSIX_H
|
||||
|
||||
/* This header is intended for application use; some applications are written
|
||||
in C++.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <redconf.h>
|
||||
|
||||
#if REDCONF_API_POSIX == 1
|
||||
|
||||
#include <redtypes.h>
|
||||
#include "redapimacs.h"
|
||||
#include "rederrno.h"
|
||||
#include "redstat.h"
|
||||
|
||||
/** Open for reading only. */
|
||||
#define RED_O_RDONLY 0x00000001U
|
||||
|
||||
/** Open for writing only. */
|
||||
#define RED_O_WRONLY 0x00000002U
|
||||
|
||||
/** Open for reading and writing. */
|
||||
#define RED_O_RDWR 0x00000004U
|
||||
|
||||
/** File offset for all writes is end-of-file. */
|
||||
#define RED_O_APPEND 0x00000008U
|
||||
|
||||
/** Create the file. */
|
||||
#define RED_O_CREAT 0x00000010U
|
||||
|
||||
/** Error if path already exists. */
|
||||
#define RED_O_EXCL 0x00000020U
|
||||
|
||||
/** Truncate file to size zero. */
|
||||
#define RED_O_TRUNC 0x00000040U
|
||||
|
||||
|
||||
/** @brief Last file system error (errno).
|
||||
|
||||
Under normal circumstances, each task using the file system has an
|
||||
independent `red_errno` value. Applications do not need to worry about
|
||||
one task obliterating an error value that another task needed to read. The
|
||||
value is initially zero. When one of the POSIX-like APIs return an
|
||||
indication of error, `red_errno` is set to an error value.
|
||||
|
||||
In some circumstances, `red_errno` will be a global errno location which
|
||||
is shared by multiple tasks. If the calling task is not registered as a
|
||||
file system user and all of the task slots are full, there can be no
|
||||
task-specific errno, so the global errno is used. Likewise, if the file
|
||||
system driver is uninitialized, there are no registered file system users
|
||||
and `red_errno` always refers to the global errno. Under these
|
||||
circumstances, multiple tasks manipulating `red_errno` could be
|
||||
problematic. When the task count is set to one, `red_errno` always refers
|
||||
to the global errno.
|
||||
|
||||
Note that `red_errno` is usable as an lvalue; i.e., in addition to reading
|
||||
the error value, the error value can be set:
|
||||
|
||||
~~~{.c}
|
||||
red_errno = 0;
|
||||
~~~
|
||||
*/
|
||||
#define red_errno (*red_errnoptr())
|
||||
|
||||
|
||||
/** @brief Positions from which to seek within a file.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/* 0/1/2 are the traditional values for SET/CUR/END, respectively. Prior
|
||||
to the release of Unix System V in 1983, the SEEK_* symbols did not
|
||||
exist and C programs hard-coded the 0/1/2 values with those meanings.
|
||||
*/
|
||||
RED_SEEK_SET = 0, /**< Set file offset to given offset. */
|
||||
RED_SEEK_CUR = 1, /**< Set file offset to current offset plus signed offset. */
|
||||
RED_SEEK_END = 2 /**< Set file offset to EOF plus signed offset. */
|
||||
} REDWHENCE;
|
||||
|
||||
|
||||
#if REDCONF_API_POSIX_READDIR == 1
|
||||
/** @brief Opaque directory handle.
|
||||
*/
|
||||
typedef struct sREDHANDLE REDDIR;
|
||||
|
||||
|
||||
/** @brief Directory entry information.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t d_ino; /**< File serial number (inode number). */
|
||||
char d_name[REDCONF_NAME_MAX+1U]; /**< Name of entry. */
|
||||
REDSTAT d_stat; /**< File information (POSIX extension). */
|
||||
} REDDIRENT;
|
||||
#endif
|
||||
|
||||
|
||||
int32_t red_init(void);
|
||||
int32_t red_uninit(void);
|
||||
int32_t red_mount(const char *pszVolume);
|
||||
int32_t red_umount(const char *pszVolume);
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_FORMAT == 1)
|
||||
int32_t red_format(const char *pszVolume);
|
||||
#endif
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
int32_t red_transact(const char *pszVolume);
|
||||
#endif
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
int32_t red_settransmask(const char *pszVolume, uint32_t ulEventMask);
|
||||
#endif
|
||||
int32_t red_gettransmask(const char *pszVolume, uint32_t *pulEventMask);
|
||||
int32_t red_statvfs(const char *pszVolume, REDSTATFS *pStatvfs);
|
||||
int32_t red_open(const char *pszPath, uint32_t ulOpenMode);
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_UNLINK == 1)
|
||||
int32_t red_unlink(const char *pszPath);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_MKDIR == 1)
|
||||
int32_t red_mkdir(const char *pszPath);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_RMDIR == 1)
|
||||
int32_t red_rmdir(const char *pszPath);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_RENAME == 1)
|
||||
int32_t red_rename(const char *pszOldPath, const char *pszNewPath);
|
||||
#endif
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_LINK == 1)
|
||||
int32_t red_link(const char *pszPath, const char *pszHardLink);
|
||||
#endif
|
||||
int32_t red_close(int32_t iFildes);
|
||||
int32_t red_read(int32_t iFildes, void *pBuffer, uint32_t ulLength);
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
int32_t red_write(int32_t iFildes, const void *pBuffer, uint32_t ulLength);
|
||||
#endif
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
int32_t red_fsync(int32_t iFildes);
|
||||
#endif
|
||||
int64_t red_lseek(int32_t iFildes, int64_t llOffset, REDWHENCE whence);
|
||||
#if (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX_FTRUNCATE == 1)
|
||||
int32_t red_ftruncate(int32_t iFildes, uint64_t ullSize);
|
||||
#endif
|
||||
int32_t red_fstat(int32_t iFildes, REDSTAT *pStat);
|
||||
#if REDCONF_API_POSIX_READDIR == 1
|
||||
REDDIR *red_opendir(const char *pszPath);
|
||||
REDDIRENT *red_readdir(REDDIR *pDirStream);
|
||||
void red_rewinddir(REDDIR *pDirStream);
|
||||
int32_t red_closedir(REDDIR *pDirStream);
|
||||
#endif
|
||||
REDSTATUS *red_errnoptr(void);
|
||||
|
||||
#endif /* REDCONF_API_POSIX */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,94 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDSTAT_H
|
||||
#define REDSTAT_H
|
||||
|
||||
|
||||
/** Mode bit for a directory. */
|
||||
#define RED_S_IFDIR 0x4000U
|
||||
|
||||
/** Mode bit for a regular file. */
|
||||
#define RED_S_IFREG 0x8000U
|
||||
|
||||
/** @brief Test for a directory.
|
||||
*/
|
||||
#define RED_S_ISDIR(m) (((m) & RED_S_IFDIR) != 0U)
|
||||
|
||||
/** @brief Test for a regular file.
|
||||
*/
|
||||
#define RED_S_ISREG(m) (((m) & RED_S_IFREG) != 0U)
|
||||
|
||||
|
||||
/** File system is read-only. */
|
||||
#define RED_ST_RDONLY 0x00000001U
|
||||
|
||||
/** File system ignores suid and sgid bits. */
|
||||
#define RED_ST_NOSUID 0x00000002U
|
||||
|
||||
|
||||
/** @brief Status information on an inode.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t st_dev; /**< Volume number of volume containing file. */
|
||||
uint32_t st_ino; /**< File serial number (inode number). */
|
||||
uint16_t st_mode; /**< Mode of file. */
|
||||
uint16_t st_nlink; /**< Number of hard links to the file. */
|
||||
uint64_t st_size; /**< File size in bytes. */
|
||||
#if REDCONF_INODE_TIMESTAMPS == 1
|
||||
uint32_t st_atime; /**< Time of last access (seconds since 01-01-1970). */
|
||||
uint32_t st_mtime; /**< Time of last data modification (seconds since 01-01-1970). */
|
||||
uint32_t st_ctime; /**< Time of last status change (seconds since 01-01-1970). */
|
||||
#endif
|
||||
#if REDCONF_INODE_BLOCKS == 1
|
||||
uint32_t st_blocks; /**< Number of blocks allocated for this object. */
|
||||
#endif
|
||||
} REDSTAT;
|
||||
|
||||
|
||||
/** @brief Status information on a file system volume.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t f_bsize; /**< File system block size. */
|
||||
uint32_t f_frsize; /**< Fundamental file system block size. */
|
||||
uint32_t f_blocks; /**< Total number of blocks on file system in units of f_frsize. */
|
||||
uint32_t f_bfree; /**< Total number of free blocks. */
|
||||
uint32_t f_bavail; /**< Number of free blocks available to non-privileged process. */
|
||||
uint32_t f_files; /**< Total number of file serial numbers. */
|
||||
uint32_t f_ffree; /**< Total number of free file serial numbers. */
|
||||
uint32_t f_favail; /**< Number of file serial numbers available to non-privileged process. */
|
||||
uint32_t f_fsid; /**< File system ID (useless, populated with zero). */
|
||||
uint32_t f_flag; /**< Bit mask of f_flag values. Includes read-only file system flag. */
|
||||
uint32_t f_namemax; /**< Maximum filename length. */
|
||||
uint64_t f_maxfsize; /**< Maximum file size (POSIX extension). */
|
||||
uint32_t f_dev; /**< Volume number (POSIX extension). */
|
||||
} REDSTATFS;
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,265 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Prototypes for Reliance Edge test entry points.
|
||||
*/
|
||||
#ifndef REDTESTS_H
|
||||
#define REDTESTS_H
|
||||
|
||||
#include <redtypes.h>
|
||||
#include "redtestutils.h"
|
||||
#include "redver.h"
|
||||
|
||||
/* This macro is only defined by the error injection project.
|
||||
*/
|
||||
#ifdef REDCONF_ERROR_INJECTION
|
||||
#include <rederrinject.h>
|
||||
#endif
|
||||
|
||||
#define FSSTRESS_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_GPL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_PATH_SEPARATOR == '/') \
|
||||
&& (REDCONF_API_POSIX == 1) && (REDCONF_API_POSIX_UNLINK == 1) && (REDCONF_API_POSIX_MKDIR == 1) \
|
||||
&& (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_RENAME == 1) && (REDCONF_API_POSIX_LINK == 1) \
|
||||
&& (REDCONF_API_POSIX_FTRUNCATE == 1) && (REDCONF_API_POSIX_READDIR == 1))
|
||||
|
||||
#define FSE_STRESS_TEST_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \
|
||||
&& (REDCONF_API_FSE_FORMAT == 1) && (REDCONF_API_FSE_TRANSMASKSET == 1) && (REDCONF_API_FSE_TRANSMASKGET == 1) \
|
||||
&& (REDCONF_API_FSE_TRUNCATE == 1))
|
||||
|
||||
#define POSIX_API_TEST_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
|
||||
&& (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_UNLINK == 1))
|
||||
|
||||
#define FSE_API_TEST_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_FSE == 1) \
|
||||
&& (REDCONF_API_FSE_FORMAT == 1))
|
||||
|
||||
#define STOCH_POSIX_TEST_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
|
||||
&& (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_READDIR == 1) \
|
||||
&& (REDCONF_API_POSIX_MKDIR == 1) && (REDCONF_API_POSIX_RMDIR == 1) && (REDCONF_API_POSIX_UNLINK == 1) \
|
||||
&& (REDCONF_API_POSIX_RENAME == 1))
|
||||
|
||||
#define FSIOTEST_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_API_POSIX == 1))
|
||||
|
||||
#define BDEVTEST_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0))
|
||||
|
||||
#define DISKFULL_TEST_SUPPORTED \
|
||||
( ((RED_KIT == RED_KIT_COMMERCIAL) || (RED_KIT == RED_KIT_SANDBOX)) \
|
||||
&& (REDCONF_OUTPUT == 1) && (REDCONF_READ_ONLY == 0) && (REDCONF_API_POSIX == 1) \
|
||||
&& (REDCONF_API_POSIX_FORMAT == 1) && (REDCONF_API_POSIX_FTRUNCATE == 1))
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PARAMSTATUS_OK, /* Parameters were good; continue. */
|
||||
PARAMSTATUS_BAD, /* Parameters were bad; stop. */
|
||||
PARAMSTATUS_HELP /* Help request; not an error, but stop. */
|
||||
} PARAMSTATUS;
|
||||
|
||||
|
||||
#if FSSTRESS_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
bool fNoCleanup; /**< --no-cleanup */
|
||||
uint32_t ulLoops; /**< --loops */
|
||||
uint32_t ulNops; /**< --nops */
|
||||
bool fNamePad; /**< --namepad */
|
||||
uint32_t ulSeed; /**< --seed */
|
||||
bool fVerbose; /**< --verbose */
|
||||
} FSSTRESSPARAM;
|
||||
|
||||
PARAMSTATUS FsstressParseParams(int argc, char *argv[], FSSTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void FsstressDefaultParams(FSSTRESSPARAM *pParam);
|
||||
int FsstressStart(const FSSTRESSPARAM *pParam);
|
||||
#endif
|
||||
|
||||
#if STOCH_POSIX_TEST_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
const char *pszVolume; /**< Volume path prefix. */
|
||||
uint32_t ulIterations; /**< --iterations */
|
||||
uint32_t ulFileListMax; /**< --files */
|
||||
uint32_t ulDirListMax; /**< --dirs */
|
||||
uint32_t ulOpenFileListMax; /**< --open-files */
|
||||
uint32_t ulOpenDirListMax; /**< --open-dirs */
|
||||
uint32_t ulRandomSeed; /**< --seed */
|
||||
} STOCHPOSIXPARAM;
|
||||
|
||||
PARAMSTATUS RedStochPosixParseParams(int argc, char *argv[], STOCHPOSIXPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void RedStochPosixDefaultParams(STOCHPOSIXPARAM *pParam);
|
||||
int RedStochPosixStart(const STOCHPOSIXPARAM *pParam);
|
||||
#endif
|
||||
|
||||
#if FSE_STRESS_TEST_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bVolNum; /**< Volume number. */
|
||||
uint32_t ulFileCount; /**< --files */
|
||||
uint32_t ulMaxFileSize; /**< --max */
|
||||
uint32_t ulMaxOpSize; /**< --buffer-size */
|
||||
uint32_t ulNops; /**< --nops */
|
||||
uint32_t ulLoops; /**< --loops */
|
||||
uint32_t ulSampleRate; /**< --sample-rate */
|
||||
uint64_t ullSeed; /**< --seed */
|
||||
} FSESTRESSPARAM;
|
||||
|
||||
PARAMSTATUS FseStressParseParams(int argc, char *argv[], FSESTRESSPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void FseStressDefaultParams(FSESTRESSPARAM *pParam);
|
||||
int FseStressStart(const FSESTRESSPARAM *pParam);
|
||||
#endif
|
||||
|
||||
#if POSIX_API_TEST_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
const char *pszVolume; /**< Volume path prefix. */
|
||||
bool fQuick; /**< --quick */
|
||||
bool fQuitOnFailure; /**< --quit-on-failure */
|
||||
bool fDebugErrors; /**< --debug */
|
||||
} POSIXTESTPARAM;
|
||||
|
||||
PARAMSTATUS RedPosixTestParseParams(int argc, char *argv[], POSIXTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void RedPosixTestDefaultParams(POSIXTESTPARAM *pParam);
|
||||
int RedPosixTestStart(const POSIXTESTPARAM *pParam);
|
||||
#endif
|
||||
|
||||
|
||||
#if POSIX_API_TEST_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
const char *pszVolume; /**< Volume path prefix. */
|
||||
bool fQuick; /**< --quick */
|
||||
bool fVerbose; /**< --verbose */
|
||||
bool fQuitOnFailure; /**< --quit-on-failure */
|
||||
bool fDebugErrors; /**< --debug */
|
||||
} OSAPITESTPARAM;
|
||||
|
||||
PARAMSTATUS RedOsApiTestParseParams(int argc, char *argv[], OSAPITESTPARAM *pParam, const char **ppszDevice);
|
||||
void RedOsApiTestDefaultParams(OSAPITESTPARAM *pParam);
|
||||
int RedOsApiTestStart(const OSAPITESTPARAM *pParam);
|
||||
#endif
|
||||
|
||||
|
||||
#if FSE_API_TEST_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bVolNum; /**< Volume number. */
|
||||
bool fQuitOnFailure; /**< --quit-on-failure */
|
||||
bool fDebugErrors; /**< --debug */
|
||||
} FSETESTPARAM;
|
||||
|
||||
PARAMSTATUS RedFseTestParseParams(int argc, char *argv[], FSETESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void RedFseTestDefaultParams(FSETESTPARAM *pParam);
|
||||
int RedFseTestStart(const FSETESTPARAM *pParam);
|
||||
#endif
|
||||
|
||||
#if FSIOTEST_SUPPORTED
|
||||
typedef enum
|
||||
{
|
||||
TESTFS_RELEDGE, /* Datalight Reliance Edge */
|
||||
TESTFS_FATFS, /* ChaN's FatFs */
|
||||
TESTFS_FATSL /* FreeRTOS+FAT SL */
|
||||
} TESTFS;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
TESTFS testfs; /**< --fs */
|
||||
const char *pszVolume; /**< Volume path prefix. */
|
||||
bool fSeqRead; /**< --seq=r */
|
||||
bool fSeqWrite; /**< --seq=w */
|
||||
bool fSeqRewrite; /**< --seq=e */
|
||||
bool fRandomRead; /**< --rand=r */
|
||||
bool fRandomWrite; /**< --rand=w */
|
||||
bool fMixedWrite; /**< --mixed */
|
||||
bool fScanTest; /**< --scan */
|
||||
uint32_t ulFSBlockSize; /**< --block-size */
|
||||
uint32_t ulMaxFileSize; /**< --max */
|
||||
uint32_t ulRandomReadPasses; /**< --rand-pass=r:w (r part) */
|
||||
uint32_t ulRandomWritePasses; /**< --rand-pass=r:w (w part) */
|
||||
uint32_t ulMixedWritePasses; /**< --mixed-pass */
|
||||
int32_t iFlushOnWriteRatio; /**< --rand-fow */
|
||||
uint32_t ulBufferMin; /**< --start */
|
||||
uint32_t ulBufferSize; /**< --buffer-size */
|
||||
bool fWriteVerify; /**< --verify */
|
||||
uint32_t ulSampleRate; /**< --sample-rate */
|
||||
uint32_t ulScanCount; /**< --scan-files */
|
||||
uint64_t ullSeed; /**< --seed */
|
||||
} FSIOTESTPARAM;
|
||||
|
||||
PARAMSTATUS FSIOTestParseParams(int argc, char *argv[], FSIOTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void FSIOTestDefaultParams(FSIOTESTPARAM *pParam);
|
||||
int FSIOTestStart(const FSIOTESTPARAM *pParam);
|
||||
#endif
|
||||
|
||||
#if BDEVTEST_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bDrvNum; /**< Volume number (for sector size/count). */
|
||||
bool fSeqWrite; /**< --seq:w */
|
||||
bool fSeqRead; /**< --seq:r */
|
||||
bool fRandWrite; /**< --rand:w */
|
||||
bool fRandRead; /**< --rand:r */
|
||||
uint32_t ulSampleSecs; /**< --sample-rate */
|
||||
uint32_t ulPasses; /**< --passes */
|
||||
uint32_t ulMinIOSectors; /**< --count=min[:max] (min part) */
|
||||
uint32_t ulMaxIOSectors; /**< --count=min[:max] (max part) */
|
||||
uint32_t ulMaxSizeKB; /**< --max */
|
||||
uint32_t ulTestSeconds; /**< --time */
|
||||
bool fVerify; /**< --verify */
|
||||
bool fAsyncWrites; /**< --async */
|
||||
uint64_t ullSeed; /**< --seed */
|
||||
} BDEVTESTPARAM;
|
||||
|
||||
PARAMSTATUS BDevTestParseParams(int argc, char *argv[], BDEVTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void BDevTestDefaultParams(BDEVTESTPARAM *pParam);
|
||||
int BDevTestStart(const BDEVTESTPARAM *pParam);
|
||||
#endif
|
||||
|
||||
#if DISKFULL_TEST_SUPPORTED
|
||||
typedef struct
|
||||
{
|
||||
const char *pszVolume; /**< Volume path prefix. */
|
||||
bool fQuitOnFailure; /**< --quit-on-failure */
|
||||
bool fDebugErrors; /**< --debug */
|
||||
} DISKFULLTESTPARAM;
|
||||
|
||||
PARAMSTATUS DiskFullTestParseParams(int argc, char *argv[], DISKFULLTESTPARAM *pParam, uint8_t *pbVolNum, const char **ppszDevice);
|
||||
void DiskFullTestDefaultParams(DISKFULLTESTPARAM *pParam);
|
||||
int DiskFullTestStart(const DISKFULLTESTPARAM *pParam);
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,71 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Reliance Edge utilities only needed for tests.
|
||||
*/
|
||||
#ifndef REDTESTUTILS_H
|
||||
#define REDTESTUTILS_H
|
||||
|
||||
|
||||
#define ISDIGIT(c) (((c) >= '0') && ((c) <= '9'))
|
||||
|
||||
|
||||
void RedRandSeed(uint64_t ullSeed);
|
||||
uint64_t RedRand64(uint64_t *pullSeed);
|
||||
uint32_t RedRand32(uint32_t *pulSeed);
|
||||
|
||||
char *RedRatio(char *pBuffer, uint32_t ulBufferLen, uint64_t ullDividend, uint64_t ullDivisor, uint32_t ulDecPlaces);
|
||||
uint64_t RedMulDiv64(uint64_t ullBase, uint32_t ulMultiplier, uint64_t ullDivisor);
|
||||
uint64_t RedUint64DivMod32(uint64_t ullDividend, uint32_t ulDivisor, uint32_t *pulRemainder);
|
||||
uint64_t RedUint64DivMod64(uint64_t ullDividend, uint64_t ullDivisor, uint64_t *pullRemainder);
|
||||
|
||||
char *RedScaleBytes(uint32_t ulByteValue, char *pszBuffer, uint32_t ulBufferSize);
|
||||
char *RedScaleKB(uint32_t ulKBValue, char *pszBuffer, uint32_t ulBufferSize);
|
||||
uint32_t RedGetKBPerSecond(uint64_t ullKB, uint32_t ulMS);
|
||||
uint32_t RedGetKBPerSecondSectors(uint32_t ulBytesPerSector, uint64_t ullSectors, uint64_t ullUS);
|
||||
|
||||
int32_t RedAtoI(const char *pszNum);
|
||||
const char *RedHtoUL(const char *pszNum, uint32_t *pulNum);
|
||||
const char *RedHtoULL(const char *pszNum, uint64_t *pullNum);
|
||||
const char *RedNtoUL(const char *pszNum, uint32_t *pulNum);
|
||||
const char *RedNtoULL(const char *pszNum, uint64_t *pullNum);
|
||||
const char *RedSizeToUL(const char *pszNum, uint32_t *pulResult);
|
||||
|
||||
int32_t RedStrICmp(const char *pszStr1, const char *pszStr2);
|
||||
int32_t RedStrNICmp(const char *pszStr1, const char *pszStr2, uint32_t ulLen);
|
||||
char RedToLower(char c);
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#if REDCONF_OUTPUT == 1
|
||||
void RedPrintf(const char *pszFormat, ...);
|
||||
void RedVPrintf(const char *pszFormat, va_list arglist);
|
||||
#endif
|
||||
int32_t RedSNPrintf(char *pcBuffer, uint32_t ulBufferLen, const char *pszFormat, ...);
|
||||
int32_t RedVSNPrintf(char *pcBuffer, uint32_t ulBufferLen, const char *pszFormat, va_list arglist);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,37 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Interfaces for common-code utilities for tools and tests.
|
||||
*/
|
||||
#ifndef REDTOOLCMN_H
|
||||
#define REDTOOLCMN_H
|
||||
|
||||
|
||||
uint8_t RedFindVolumeNumber(const char *pszVolume);
|
||||
bool RedConfirmOperation(const char *pszMessage);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,183 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
#ifndef REDTOOLS_H
|
||||
#define REDTOOLS_H
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#define HOST_PATH_MAX MAX_PATH
|
||||
#else
|
||||
#include <linux/limits.h>
|
||||
#define HOST_PATH_MAX PATH_MAX
|
||||
#endif
|
||||
|
||||
|
||||
#if REDCONF_IMAGE_BUILDER == 1
|
||||
|
||||
#define MACRO_NAME_MAX_LEN 32
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bVolNumber;
|
||||
const char *pszInputDir;
|
||||
const char *pszOutputFile;
|
||||
#if REDCONF_API_POSIX == 1
|
||||
const char *pszVolName;
|
||||
#else
|
||||
const char *pszMapFile;
|
||||
const char *pszDefineFile;
|
||||
bool fNowarn;
|
||||
#endif
|
||||
} IMGBLDPARAM;
|
||||
|
||||
|
||||
void ImgbldParseParams(int argc, char *argv [], IMGBLDPARAM *pParam);
|
||||
int ImgbldStart(IMGBLDPARAM *pParam);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if REDCONF_API_POSIX == 1
|
||||
char asOutFilePath[HOST_PATH_MAX];
|
||||
#else
|
||||
uint32_t ulOutFileIndex;
|
||||
#endif
|
||||
char asInFilePath[HOST_PATH_MAX];
|
||||
} FILEMAPPING;
|
||||
|
||||
|
||||
extern void *gpCopyBuffer;
|
||||
extern uint32_t gulCopyBufferSize;
|
||||
|
||||
|
||||
/* Implemented in ibposix.c
|
||||
*/
|
||||
#if REDCONF_API_POSIX == 1
|
||||
REDSTATUS IbPosixCopyDir(const char *pszVolName, const char *pszInDir);
|
||||
int IbPosixCreateDir(const char *pszVolName, const char *pszFullPath, const char *pszBasePath);
|
||||
int IbConvertPath(const char *pszVolName, const char *pszFullPath, const char *pszBasePath, char *szOutPath);
|
||||
#endif
|
||||
|
||||
|
||||
/* Implemented in ibfse.c
|
||||
*/
|
||||
#if REDCONF_API_FSE == 1
|
||||
typedef struct sFILELISTENTRY FILELISTENTRY;
|
||||
struct sFILELISTENTRY
|
||||
{
|
||||
FILEMAPPING fileMapping;
|
||||
FILELISTENTRY *pNext;
|
||||
};
|
||||
|
||||
|
||||
void FreeFileList(FILELISTENTRY **ppsFileList);
|
||||
|
||||
int IbFseGetFileList(const char *pszPath, const char *pszIndirPath, FILELISTENTRY **ppFileListHead);
|
||||
int IbFseOutputDefines(FILELISTENTRY *pFileList, const IMGBLDPARAM *pOptions);
|
||||
int IbFseCopyFiles(int volNum, const FILELISTENTRY *pFileList);
|
||||
#endif
|
||||
|
||||
|
||||
/* Implemented in os-specific space (ibwin.c and iblinux.c)
|
||||
*/
|
||||
#if REDCONF_API_POSIX == 1
|
||||
int IbPosixCopyDirRecursive(const char *pszVolName, const char *pszInDir);
|
||||
#endif
|
||||
#if REDCONF_API_FSE == 1
|
||||
int IbFseBuildFileList(const char *pszDirPath, FILELISTENTRY **ppFileListHead);
|
||||
#endif
|
||||
#if REDCONF_API_FSE == 1
|
||||
int IbSetRelativePath(char *pszPath, const char *pszParentPath);
|
||||
#endif
|
||||
bool IsRegularFile(const char *pszPath);
|
||||
|
||||
|
||||
/* Implemented in ibcommon.c
|
||||
*/
|
||||
int IbCopyFile(int volNum, const FILEMAPPING *pFileMapping);
|
||||
int IbCheckFileExists(const char *pszPath, bool *pfExists);
|
||||
|
||||
|
||||
/* Implemented separately in ibfse.c and ibposix.c
|
||||
*/
|
||||
int IbApiInit(void);
|
||||
int IbApiUninit(void);
|
||||
int IbWriteFile(int volNum, const FILEMAPPING *pFileMapping, uint64_t ullOffset, void *pData, uint32_t ulDataLen);
|
||||
|
||||
#endif /* IMAGE_BUILDER */
|
||||
|
||||
/* For image copier tool
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#define HOST_PSEP '\\'
|
||||
#if !__STDC__
|
||||
#define snprintf _snprintf
|
||||
#define stat _stat
|
||||
#define S_IFDIR _S_IFDIR
|
||||
#define rmdir _rmdir
|
||||
#endif
|
||||
#else
|
||||
#define HOST_PSEP '/'
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t bVolNumber;
|
||||
const char *pszOutputDir;
|
||||
const char *pszBDevSpec;
|
||||
#if REDCONF_API_POSIX == 1
|
||||
const char *pszVolName;
|
||||
#endif
|
||||
bool fNoWarn;
|
||||
} IMGCOPYPARAM;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#if REDCONF_API_POSIX == 1
|
||||
const char *pszVolume; /* Volume path prefix. */
|
||||
uint32_t ulVolPrefixLen; /* strlen(COPIER::pszVolume) */
|
||||
#else
|
||||
uint8_t bVolNum; /* Volume number. */
|
||||
#endif
|
||||
const char *pszOutputDir; /* Output directory path. */
|
||||
bool fNoWarn; /* If true, no warning to overwrite. */
|
||||
uint8_t *pbCopyBuffer; /* Buffer for copying file data. */
|
||||
} COPIER;
|
||||
|
||||
|
||||
void ImgcopyParseParams(int argc, char *argv [], IMGCOPYPARAM *pParam);
|
||||
int ImgcopyStart(IMGCOPYPARAM *pParam);
|
||||
|
||||
/* Implemented separately in imgcopywin.c and imgcopylinux.c. These functions
|
||||
print an error message and abort on failure.
|
||||
*/
|
||||
void ImgcopyMkdir(const char *pszDir);
|
||||
void ImgcopyRecursiveRmdir(const char *pszDir);
|
||||
|
||||
|
||||
#endif /* REDTOOLS_H */
|
||||
|
@ -0,0 +1,71 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDUTILS_H
|
||||
#define REDUTILS_H
|
||||
|
||||
|
||||
#if REDCONF_ASSERTS == 1
|
||||
#define REDERROR() RedOsAssertFail(__FILE__, __LINE__)
|
||||
#define REDASSERT(EXP) ((EXP) ? (void)0 : REDERROR())
|
||||
#else
|
||||
#define REDERROR() ((void)0)
|
||||
#define REDASSERT(EXP) ((void)0)
|
||||
#endif
|
||||
|
||||
|
||||
void RedMemCpy(void *pDest, const void *pSrc, uint32_t ulLen);
|
||||
void RedMemMove(void *pDest, const void *pSrc, uint32_t ulLen);
|
||||
void RedMemSet(void *pDest, uint8_t bVal, uint32_t ulLen);
|
||||
int32_t RedMemCmp(const void *pMem1, const void *pMem2, uint32_t ulLen);
|
||||
|
||||
uint32_t RedStrLen(const char *pszStr);
|
||||
int32_t RedStrCmp(const char *pszStr1, const char *pszStr2);
|
||||
int32_t RedStrNCmp(const char *pszStr1, const char *pszStr2, uint32_t ulLen);
|
||||
void RedStrNCpy(char *pszDst, const char *pszSrc, uint32_t ulLen);
|
||||
|
||||
uint32_t RedCrc32Update(uint32_t ulInitCrc32, const void *pBuffer, uint32_t ulLength);
|
||||
uint32_t RedCrcNode(const void *pBuffer);
|
||||
|
||||
#if REDCONF_API_POSIX == 1
|
||||
uint32_t RedNameLen(const char *pszName);
|
||||
#endif
|
||||
|
||||
bool RedBitGet(const uint8_t *pbBitmap, uint32_t ulBit);
|
||||
void RedBitSet(uint8_t *pbBitmap, uint32_t ulBit);
|
||||
void RedBitClear(uint8_t *pbBitmap, uint32_t ulBit);
|
||||
|
||||
#ifdef REDCONF_ENDIAN_SWAP
|
||||
uint64_t RedRev64(uint64_t ullToRev);
|
||||
uint32_t RedRev32(uint32_t ulToRev);
|
||||
uint16_t RedRev16(uint16_t uToRev);
|
||||
#endif
|
||||
|
||||
void RedSignOn(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,111 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
@brief Macros for version numbers, build number, and product information.
|
||||
*/
|
||||
#ifndef REDVER_H
|
||||
#define REDVER_H
|
||||
|
||||
|
||||
/** @brief Consecutive number assigned to each automated build.
|
||||
|
||||
<!-- This macro is updated automatically: do not edit! -->
|
||||
*/
|
||||
#define RED_BUILD_NUMBER "700"
|
||||
|
||||
#define RED_KIT_GPL 0U /* Open source GPL kit. */
|
||||
#define RED_KIT_COMMERCIAL 1U /* Commercially-licensed kit. */
|
||||
#define RED_KIT_SANDBOX 2U /* Not a kit: developer sandbox. */
|
||||
|
||||
/** @brief Indicates the Reliance Edge kit.
|
||||
|
||||
<!-- This macro is updated automatically: do not edit! -->
|
||||
*/
|
||||
#define RED_KIT RED_KIT_GPL
|
||||
|
||||
|
||||
/** @brief Version number to display in output.
|
||||
*/
|
||||
#define RED_VERSION "v2.0"
|
||||
|
||||
/** @brief Version number in hex.
|
||||
|
||||
The most significant byte is the major version number, etc.
|
||||
*/
|
||||
#define RED_VERSION_VAL 0x02000000U
|
||||
|
||||
/** @brief On-disk version number.
|
||||
|
||||
This is incremented only when the on-disk layout is updated in such a way
|
||||
which is incompatible with previously released versions of the file system.
|
||||
*/
|
||||
#define RED_DISK_LAYOUT_VERSION 1U
|
||||
|
||||
|
||||
/** @brief Base name of the file system product.
|
||||
*/
|
||||
#define RED_PRODUCT_BASE_NAME "Reliance Edge"
|
||||
|
||||
|
||||
/* Specifies whether the product is in alpha stage, beta stage, or neither.
|
||||
*/
|
||||
#if 0
|
||||
#if 0
|
||||
#define ALPHABETA " (Alpha)"
|
||||
#else
|
||||
#define ALPHABETA " (Beta)"
|
||||
#endif
|
||||
#else
|
||||
#define ALPHABETA ""
|
||||
#endif
|
||||
|
||||
/** @brief Full product name and version.
|
||||
*/
|
||||
#define RED_PRODUCT_NAME "Datalight " RED_PRODUCT_BASE_NAME " " RED_VERSION " Build " RED_BUILD_NUMBER ALPHABETA
|
||||
|
||||
|
||||
/** @brief Product copyright.
|
||||
*/
|
||||
#define RED_PRODUCT_LEGAL "Copyright (c) 2014-2017 Datalight, Inc. All Rights Reserved Worldwide."
|
||||
|
||||
|
||||
/** @brief Product patents.
|
||||
*/
|
||||
#define RED_PRODUCT_PATENT "Patents: US#7284101."
|
||||
|
||||
|
||||
/** @brief Product edition.
|
||||
*/
|
||||
#if RED_KIT == RED_KIT_GPL
|
||||
#define RED_PRODUCT_EDITION "Open-Source GPLv2 Edition -- Compiled " __DATE__ " at " __TIME__
|
||||
#elif RED_KIT == RED_KIT_COMMERCIAL
|
||||
#define RED_PRODUCT_EDITION "Commercial Edition -- Compiled " __DATE__ " at " __TIME__
|
||||
#else
|
||||
#define RED_PRODUCT_EDITION "Developer Sandbox -- Compiled " __DATE__ " at " __TIME__
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -0,0 +1,141 @@
|
||||
/* ----> DO NOT REMOVE THE FOLLOWING NOTICE <----
|
||||
|
||||
Copyright (c) 2014-2015 Datalight, Inc.
|
||||
All Rights Reserved Worldwide.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; use version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
/* Businesses and individuals that for commercial or other reasons cannot
|
||||
comply with the terms of the GPLv2 license may obtain a commercial license
|
||||
before incorporating Reliance Edge into proprietary software for
|
||||
distribution in any form. Visit http://www.datalight.com/reliance-edge for
|
||||
more information.
|
||||
*/
|
||||
/** @file
|
||||
*/
|
||||
#ifndef REDVOLUME_H
|
||||
#define REDVOLUME_H
|
||||
|
||||
|
||||
/** @brief Per-volume configuration structure.
|
||||
|
||||
Contains the configuration values that may differ between volumes. Must be
|
||||
declared in an array in redconf.c in the Reliance Edge project directory and
|
||||
statically initialized with values representing the volume configuration of
|
||||
the target system.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** The sector size for the block device underlying the volume: the basic
|
||||
unit for reading and writing to the storage media. Commonly ranges
|
||||
between 512 and 4096, but any power-of-two value not greater than the
|
||||
block size will work.
|
||||
*/
|
||||
uint32_t ulSectorSize;
|
||||
|
||||
/** The number of sectors in this file system volume.
|
||||
*/
|
||||
uint64_t ullSectorCount;
|
||||
|
||||
/** Whether a sector write on the block device underlying the volume is
|
||||
atomic. It is atomic if when the sector write is interrupted, the
|
||||
contents of the sector are guaranteed to be either all of the new data,
|
||||
or all of the old data. If unsure, leave as false.
|
||||
*/
|
||||
bool fAtomicSectorWrite;
|
||||
|
||||
/** This is the maximum number of inodes (files and directories). This
|
||||
number includes the root directory inode (inode 2; created during
|
||||
format), but does not include inodes 0 or 1, which do not exist on
|
||||
disk. The number of inodes cannot be less than 1.
|
||||
*/
|
||||
uint32_t ulInodeCount;
|
||||
|
||||
/** This is the maximum number of times a block device I/O operation will
|
||||
be retried. If a block device read, write, or flush fails, Reliance
|
||||
Edge will try again up to this number of times until the operation is
|
||||
successful. Set this to 0 to disable retries.
|
||||
*/
|
||||
uint8_t bBlockIoRetries;
|
||||
|
||||
#if REDCONF_API_POSIX == 1
|
||||
/** The path prefix for the volume; for example, "VOL1:", "FlashDisk", etc.
|
||||
*/
|
||||
const char *pszPathPrefix;
|
||||
#endif
|
||||
} VOLCONF;
|
||||
|
||||
extern const VOLCONF gaRedVolConf[REDCONF_VOLUME_COUNT];
|
||||
extern const VOLCONF * CONST_IF_ONE_VOLUME gpRedVolConf;
|
||||
|
||||
|
||||
/** @brief Per-volume run-time data.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
/** Whether the volume is currently mounted.
|
||||
*/
|
||||
bool fMounted;
|
||||
|
||||
#if REDCONF_READ_ONLY == 0
|
||||
/** Whether the volume is read-only.
|
||||
*/
|
||||
bool fReadOnly;
|
||||
|
||||
/** The active automatic transaction mask.
|
||||
*/
|
||||
uint32_t ulTransMask;
|
||||
#endif
|
||||
|
||||
/** The power of 2 difference between sector size and block size.
|
||||
*/
|
||||
uint8_t bBlockSectorShift;
|
||||
|
||||
/** The number of logical blocks in this file system volume. The unit here
|
||||
is the global block size.
|
||||
*/
|
||||
uint32_t ulBlockCount;
|
||||
|
||||
/** The total number of allocable blocks; Also the maximum count of free
|
||||
blocks.
|
||||
*/
|
||||
uint32_t ulBlocksAllocable;
|
||||
|
||||
/** The maximum number of bytes that an inode is capable of addressing.
|
||||
*/
|
||||
uint64_t ullMaxInodeSize;
|
||||
|
||||
/** The current metadata sequence number. This value is included in all
|
||||
metadata nodes and incremented every time a metadata node is written.
|
||||
It is assumed to never wrap around.
|
||||
*/
|
||||
uint64_t ullSequence;
|
||||
} VOLUME;
|
||||
|
||||
/* Array of VOLUME structures, populated at during RedCoreInit().
|
||||
*/
|
||||
extern VOLUME gaRedVolume[REDCONF_VOLUME_COUNT];
|
||||
|
||||
/* Volume number currently being accessed; populated during
|
||||
RedCoreVolSetCurrent().
|
||||
*/
|
||||
extern CONST_IF_ONE_VOLUME uint8_t gbRedVolNum;
|
||||
|
||||
/* Pointer to the volume currently being accessed; populated during
|
||||
RedCoreVolSetCurrent().
|
||||
*/
|
||||
extern VOLUME * CONST_IF_ONE_VOLUME gpRedVolume;
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user