1 /* 2 * Copyright 2007-2009, 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 9 #include "fssh_types.h" 10 11 12 // 32/64 bitness 13 #ifdef HAIKU_HOST_PLATFORM_64_BIT 14 # define FSSH_B_HAIKU_64_BIT 1 15 #else 16 # define FSSH_B_HAIKU_32_BIT 1 17 #endif 18 19 // Limits 20 #define FSSH_B_DEV_NAME_LENGTH 128 21 #define FSSH_B_FILE_NAME_LENGTH 256 22 #define FSSH_B_PATH_NAME_LENGTH 1024 23 #define FSSH_B_ATTR_NAME_LENGTH (FSSH_B_FILE_NAME_LENGTH-1) 24 #define FSSH_B_MIME_TYPE_LENGTH (FSSH_B_ATTR_NAME_LENGTH - 15) 25 #define FSSH_B_MAX_SYMLINKS 16 26 27 // Open Modes 28 #define FSSH_B_READ_ONLY FSSH_O_RDONLY // read only 29 #define FSSH_B_WRITE_ONLY FSSH_O_WRONLY // write only 30 #define FSSH_B_READ_WRITE FSSH_O_RDWR // read and write 31 32 #define FSSH_B_FAIL_IF_EXISTS FSSH_O_EXCL // exclusive create 33 #define FSSH_B_CREATE_FILE FSSH_O_CREAT // create the file 34 #define FSSH_B_ERASE_FILE FSSH_O_TRUNC // erase the file's data 35 #define FSSH_B_OPEN_AT_END FSSH_O_APPEND // point to the end of the data 36 37 // Node Flavors 38 enum fssh_node_flavor { 39 FSSH_B_FILE_NODE = 0x01, 40 FSSH_B_SYMLINK_NODE = 0x02, 41 FSSH_B_DIRECTORY_NODE = 0x04, 42 FSSH_B_ANY_NODE = 0x07 43 }; 44 45 46 #if defined(__GNUC__) && __GNUC__ > 3 47 #define fssh_offsetof(type,member) __builtin_offsetof(type, member) 48 #else 49 #define fssh_offsetof(type,member) ((size_t)&((type*)0)->member) 50 #endif 51 52 #define fssh_alignof(type) __alignof__(type) 53 54 #define fssh_min_c(a,b) ((a)>(b)?(b):(a)) 55 #define fssh_max_c(a,b) ((a)>(b)?(a):(b)) 56 57 #define _FSSH_PACKED __attribute__((packed)) 58 59 60 #endif // _FSSH_DEFS_H 61