1 /* 2 * Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _FSSH_DEFS_H 6 #define _FSSH_DEFS_H 7 8 #include "fssh_types.h" 9 10 11 // Limits 12 #define FSSH_B_DEV_NAME_LENGTH 128 13 #define FSSH_B_FILE_NAME_LENGTH 256 14 #define FSSH_B_PATH_NAME_LENGTH 1024 15 #define FSSH_B_ATTR_NAME_LENGTH (FSSH_B_FILE_NAME_LENGTH-1) 16 #define FSSH_B_MIME_TYPE_LENGTH (FSSH_B_ATTR_NAME_LENGTH - 15) 17 #define FSSH_B_MAX_SYMLINKS 16 18 19 // Open Modes 20 #define FSSH_B_READ_ONLY FSSH_O_RDONLY // read only 21 #define FSSH_B_WRITE_ONLY FSSH_O_WRONLY // write only 22 #define FSSH_B_READ_WRITE FSSH_O_RDWR // read and write 23 24 #define FSSH_B_FAIL_IF_EXISTS FSSH_O_EXCL // exclusive create 25 #define FSSH_B_CREATE_FILE FSSH_O_CREAT // create the file 26 #define FSSH_B_ERASE_FILE FSSH_O_TRUNC // erase the file's data 27 #define FSSH_B_OPEN_AT_END FSSH_O_APPEND // point to the end of the data 28 29 // Node Flavors 30 enum fssh_node_flavor { 31 FSSH_B_FILE_NODE = 0x01, 32 FSSH_B_SYMLINK_NODE = 0x02, 33 FSSH_B_DIRECTORY_NODE = 0x04, 34 FSSH_B_ANY_NODE = 0x07 35 }; 36 37 38 #if defined(__GNUC__) && __GNUC__ > 3 39 #define fssh_offsetof(type,member) __builtin_offsetof(type, member) 40 #else 41 #define fssh_offsetof(type,member) ((size_t)&((type*)0)->member) 42 #endif 43 44 #define fssh_min_c(a,b) ((a)>(b)?(b):(a)) 45 #define fssh_max_c(a,b) ((a)>(b)?(a):(b)) 46 47 #define _FSSH_PACKED __attribute__((packed)) 48 49 50 #endif // _FSSH_DEFS_H 51