1 /* ----> DO NOT REMOVE THE FOLLOWING NOTICE <---- 2 * 3 * Copyright (c) 2014-2015 Datalight, Inc. 4 * All Rights Reserved Worldwide. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; use version 2 of the License. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but "AS-IS," WITHOUT ANY WARRANTY; without even the implied warranty 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along 16 * with this program; if not, write to the Free Software Foundation, Inc., 17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18 */ 19 20 /* Businesses and individuals that for commercial or other reasons cannot 21 * comply with the terms of the GPLv2 license may obtain a commercial license 22 * before incorporating Reliance Edge into proprietary software for 23 * distribution in any form. Visit http://www.datalight.com/reliance-edge for 24 * more information. 25 */ 26 27 /** @file 28 */ 29 #ifndef REDMACS_H 30 #define REDMACS_H 31 32 33 #ifndef NULL 34 #define NULL ( ( void * ) 0 ) 35 #endif 36 37 #ifndef UINT8_MAX 38 #define UINT8_MAX ( 0xFFU ) 39 #endif 40 #ifndef UINT16_MAX 41 #define UINT16_MAX ( 0xFFFFU ) 42 #endif 43 #ifndef UINT32_MAX 44 #define UINT32_MAX ( 0xFFFFFFFFU ) 45 #endif 46 #ifndef UINT64_MAX 47 #define UINT64_MAX UINT64_SUFFIX( 0xFFFFFFFFFFFFFFFF ) 48 #endif 49 #ifndef INT32_MAX 50 #define INT32_MAX ( 0x7FFFFFFF ) 51 #endif 52 #ifndef INT64_MAX 53 #define INT64_MAX INT64_SUFFIX( 0x7FFFFFFFFFFFFFFF ) 54 #endif 55 56 #ifndef true 57 #define true ( 1 ) 58 #endif 59 #ifndef false 60 #define false ( 0 ) 61 #endif 62 63 #define SECTOR_SIZE_MIN ( 256U ) 64 65 #if REDCONF_BLOCK_SIZE == 256U 66 #define BLOCK_SIZE_P2 8U 67 #elif REDCONF_BLOCK_SIZE == 512U 68 #define BLOCK_SIZE_P2 9U 69 #elif REDCONF_BLOCK_SIZE == 1024U 70 #define BLOCK_SIZE_P2 10U 71 #elif REDCONF_BLOCK_SIZE == 2048U 72 #define BLOCK_SIZE_P2 11U 73 #elif REDCONF_BLOCK_SIZE == 4096U 74 #define BLOCK_SIZE_P2 12U 75 #elif REDCONF_BLOCK_SIZE == 8192U 76 #define BLOCK_SIZE_P2 13U 77 #elif REDCONF_BLOCK_SIZE == 16384U 78 #define BLOCK_SIZE_P2 14U 79 #elif REDCONF_BLOCK_SIZE == 32768U 80 #define BLOCK_SIZE_P2 15U 81 #elif REDCONF_BLOCK_SIZE == 65536U 82 #define BLOCK_SIZE_P2 16U 83 #else /* if REDCONF_BLOCK_SIZE == 256U */ 84 #error "REDCONF_BLOCK_SIZE must be a power of two value between 256 and 65536" 85 #endif /* if REDCONF_BLOCK_SIZE == 256U */ 86 87 #define REDMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) 88 89 #define INODE_INVALID ( 0U ) /* General-purpose invalid inode number (must be zero). */ 90 #define INODE_FIRST_VALID ( 2U ) /* First valid inode number. */ 91 #define INODE_ROOTDIR ( INODE_FIRST_VALID ) /* Inode number of the root directory. */ 92 93 /* Expands to a "const" qualifier when the volume count is one, otherwise 94 * expands to nothing. This is useful for variables that never change in 95 * single-volume configurations but do change in multi-volume configurations. 96 */ 97 #if REDCONF_VOLUME_COUNT == 1U 98 #define CONST_IF_ONE_VOLUME const 99 #else 100 #define CONST_IF_ONE_VOLUME 101 #endif 102 103 104 #endif /* ifndef REDMACS_H */ 105