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 * @brief Defines macros used to interact with the Reliance Edge API. 29 */ 30 #ifndef REDAPIMACS_H 31 #define REDAPIMACS_H 32 33 34 /** Clear all events: manual transactions only. */ 35 #define RED_TRANSACT_MANUAL 0x00000000U 36 37 /** Transact prior to unmounting in red_umount() or RedFseUnmount(). */ 38 #define RED_TRANSACT_UMOUNT 0x00000001U 39 40 /** Transact after a successful red_open() which created a file. */ 41 #define RED_TRANSACT_CREAT 0x00000002U 42 43 /** Transact after a successful red_unlink() or red_rmdir(). */ 44 #define RED_TRANSACT_UNLINK 0x00000004U 45 46 /** Transact after a successful red_mkdir(). */ 47 #define RED_TRANSACT_MKDIR 0x00000008U 48 49 /** Transact after a successful red_rename(). */ 50 #define RED_TRANSACT_RENAME 0x00000010U 51 52 /** Transact after a successful red_link(). */ 53 #define RED_TRANSACT_LINK 0x00000020U 54 55 /** Transact after a successful red_close(). */ 56 #define RED_TRANSACT_CLOSE 0x00000040U 57 58 /** Transact after a successful red_write() or RedFseWrite(). */ 59 #define RED_TRANSACT_WRITE 0x00000080U 60 61 /** Transact after a successful red_fsync(). */ 62 #define RED_TRANSACT_FSYNC 0x00000100U 63 64 /** Transact after a successful red_ftruncate(), RedFseTruncate(), or red_open() with RED_O_TRUNC that actually truncates. */ 65 #define RED_TRANSACT_TRUNCATE 0x00000200U 66 67 /** Transact to free space in disk full situations. */ 68 #define RED_TRANSACT_VOLFULL 0x00000400U 69 70 #if REDCONF_READ_ONLY == 1 71 72 /** Mask of all supported automatic transaction events. */ 73 #define RED_TRANSACT_MASK 0U 74 75 #elif REDCONF_API_POSIX == 1 76 77 /** @brief Mask of all supported automatic transaction events. 78 */ 79 #define RED_TRANSACT_MASK \ 80 ( \ 81 RED_TRANSACT_UMOUNT | \ 82 RED_TRANSACT_CREAT | \ 83 ( ( REDCONF_API_POSIX_UNLINK == 1 ) ? RED_TRANSACT_UNLINK : 0U ) | \ 84 ( ( REDCONF_API_POSIX_MKDIR == 1 ) ? RED_TRANSACT_MKDIR : 0U ) | \ 85 ( ( REDCONF_API_POSIX_RENAME == 1 ) ? RED_TRANSACT_RENAME : 0U ) | \ 86 ( ( REDCONF_API_POSIX_LINK == 1 ) ? RED_TRANSACT_LINK : 0U ) | \ 87 RED_TRANSACT_CLOSE | \ 88 RED_TRANSACT_WRITE | \ 89 RED_TRANSACT_FSYNC | \ 90 ( ( REDCONF_API_POSIX_FTRUNCATE == 1 ) ? RED_TRANSACT_TRUNCATE : 0U ) | \ 91 RED_TRANSACT_VOLFULL \ 92 ) 93 94 #else /* REDCONF_API_FSE == 1 */ 95 96 /** @brief Mask of all supported automatic transaction events. 97 */ 98 #define RED_TRANSACT_MASK \ 99 ( \ 100 RED_TRANSACT_UMOUNT | \ 101 RED_TRANSACT_WRITE | \ 102 ( ( REDCONF_API_FSE_TRUNCATE == 1 ) ? RED_TRANSACT_TRUNCATE : 0U ) | \ 103 RED_TRANSACT_VOLFULL \ 104 ) 105 106 #endif /* REDCONF_READ_ONLY */ 107 108 #if ( REDCONF_TRANSACT_DEFAULT & RED_TRANSACT_MASK ) != REDCONF_TRANSACT_DEFAULT 109 #error "Configuration error: invalid value of REDCONF_TRANSACT_DEFAULT" 110 #endif 111 112 113 #endif /* ifndef REDAPIMACS_H */ 114