1 /* 2 * Copyright 2007-2010, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _FSSH_TYPES_H 6 #define _FSSH_TYPES_H 7 8 9 #include <inttypes.h> 10 11 12 typedef volatile int32_t vint32_t; 13 typedef volatile int64_t vint64_t; 14 15 #ifdef HAIKU_HOST_PLATFORM_64_BIT 16 typedef uint64_t fssh_addr_t; 17 typedef uint64_t fssh_phys_addr_t; 18 typedef uint64_t fssh_generic_addr_t; 19 typedef uint64_t fssh_size_t; 20 typedef int64_t fssh_ssize_t; 21 #else 22 typedef uint32_t fssh_addr_t; 23 typedef uint32_t fssh_phys_addr_t; 24 typedef uint32_t fssh_generic_addr_t; 25 typedef uint32_t fssh_size_t; 26 typedef int32_t fssh_ssize_t; 27 #endif 28 typedef fssh_phys_addr_t fssh_phys_size_t; 29 typedef fssh_generic_addr_t fssh_generic_size_t; 30 31 typedef int32_t fssh_dev_t; 32 typedef int64_t fssh_ino_t; 33 34 typedef int64_t fssh_off_t; 35 36 typedef int64_t fssh_bigtime_t; 37 38 typedef int32_t fssh_status_t; 39 typedef uint32_t fssh_type_code; 40 41 typedef uint32_t fssh_mode_t; 42 typedef uint32_t fssh_nlink_t; 43 typedef uint32_t fssh_uid_t; 44 typedef uint32_t fssh_gid_t; 45 typedef int32_t fssh_pid_t; 46 47 #ifndef NULL 48 #define NULL (0) 49 #endif 50 51 52 // NOTE: For this to work the __STDC_FORMAT_MACROS feature macro must be 53 // defined. 54 55 /* printf()/scanf() format strings for [u]int* types */ 56 #define FSSH_B_PRId8 PRId8 57 #define FSSH_B_PRIi8 PRIi8 58 #define FSSH_B_PRId16 PRId16 59 #define FSSH_B_PRIi16 PRIi16 60 #define FSSH_B_PRId32 PRId32 61 #define FSSH_B_PRIi32 PRIi32 62 #define FSSH_B_PRId64 PRId64 63 #define FSSH_B_PRIi64 PRIi64 64 #define FSSH_B_PRIu8 PRIu8 65 #define FSSH_B_PRIo8 PRIo8 66 #define FSSH_B_PRIx8 PRIx8 67 #define FSSH_B_PRIX8 PRIX8 68 #define FSSH_B_PRIu16 PRIu16 69 #define FSSH_B_PRIo16 PRIo16 70 #define FSSH_B_PRIx16 PRIx16 71 #define FSSH_B_PRIX16 PRIX16 72 #define FSSH_B_PRIu32 PRIu32 73 #define FSSH_B_PRIo32 PRIo32 74 #define FSSH_B_PRIx32 PRIx32 75 #define FSSH_B_PRIX32 PRIX32 76 #define FSSH_B_PRIu64 PRIu64 77 #define FSSH_B_PRIo64 PRIo64 78 #define FSSH_B_PRIx64 PRIx64 79 #define FSSH_B_PRIX64 PRIX64 80 81 #define FSSH_B_SCNd8 SCNd8 82 #define FSSH_B_SCNi8 SCNi8 83 #define FSSH_B_SCNd16 SCNd16 84 #define FSSH_B_SCNi16 SCNi16 85 #define FSSH_B_SCNd32 SCNd32 86 #define FSSH_B_SCNi32 SCNi32 87 #define FSSH_B_SCNd64 SCNd64 88 #define FSSH_B_SCNi64 SCNi64 89 #define FSSH_B_SCNu8 SCNu8 90 #define FSSH_B_SCNo8 SCNo8 91 #define FSSH_B_SCNx8 SCNx8 92 #define FSSH_B_SCNu16 SCNu16 93 #define FSSH_B_SCNu16 SCNu16 94 #define FSSH_B_SCNx16 SCNx16 95 #define FSSH_B_SCNu32 SCNu32 96 #define FSSH_B_SCNo32 SCNo32 97 #define FSSH_B_SCNx32 SCNx32 98 #define FSSH_B_SCNu64 SCNu64 99 #define FSSH_B_SCNo64 SCNo64 100 #define FSSH_B_SCNx64 SCNx64 101 102 103 /* printf() format strings for some standard types */ 104 /* addr_t, size_t, ssize_t */ 105 #ifdef HAIKU_HOST_PLATFORM_64_BIT 106 # define FSSH_B_PRIuADDR FSSH_B_PRIu64 107 # define FSSH_B_PRIoADDR FSSH_B_PRIo64 108 # define FSSH_B_PRIxADDR FSSH_B_PRIx64 109 # define FSSH_B_PRIXADDR FSSH_B_PRIX64 110 # define FSSH_B_PRIuSIZE FSSH_B_PRIu64 111 # define FSSH_B_PRIoSIZE FSSH_B_PRIo64 112 # define FSSH_B_PRIxSIZE FSSH_B_PRIx64 113 # define FSSH_B_PRIXSIZE FSSH_B_PRIX64 114 # define FSSH_B_PRIdSSIZE FSSH_B_PRId64 115 # define FSSH_B_PRIiSSIZE FSSH_B_PRIi64 116 #else 117 # define FSSH_B_PRIuADDR FSSH_B_PRIu32 118 # define FSSH_B_PRIoADDR FSSH_B_PRIo32 119 # define FSSH_B_PRIxADDR FSSH_B_PRIx32 120 # define FSSH_B_PRIXADDR FSSH_B_PRIX32 121 # define FSSH_B_PRIuSIZE FSSH_B_PRIu32 122 # define FSSH_B_PRIoSIZE FSSH_B_PRIo32 123 # define FSSH_B_PRIxSIZE FSSH_B_PRIx32 124 # define FSSH_B_PRIXSIZE FSSH_B_PRIX32 125 # define FSSH_B_PRIdSSIZE FSSH_B_PRId32 126 # define FSSH_B_PRIiSSIZE FSSH_B_PRIi32 127 #endif 128 /* phys_addr_t */ 129 #ifdef HAIKU_HOST_PLATFORM_64_BIT 130 # define FSSH_B_PRIuPHYSADDR FSSH_B_PRIu64 131 # define FSSH_B_PRIoPHYSADDR FSSH_B_PRIo64 132 # define FSSH_B_PRIxPHYSADDR FSSH_B_PRIx64 133 # define FSSH_B_PRIXPHYSADDR FSSH_B_PRIX64 134 #else 135 # define FSSH_B_PRIuPHYSADDR FSSH_B_PRIu32 136 # define FSSH_B_PRIoPHYSADDR FSSH_B_PRIo32 137 # define FSSH_B_PRIxPHYSADDR FSSH_B_PRIx32 138 # define FSSH_B_PRIXPHYSADDR FSSH_B_PRIX32 139 #endif 140 /* generic_addr_t */ 141 #define FSSH_B_PRIuGENADDR FSSH_B_PRIuPHYSADDR 142 #define FSSH_B_PRIoGENADDR FSSH_B_PRIoPHYSADDR 143 #define FSSH_B_PRIxGENADDR FSSH_B_PRIxPHYSADDR 144 #define FSSH_B_PRIXGENADDR FSSH_B_PRIXPHYSADDR 145 /* off_t */ 146 #define FSSH_B_PRIdOFF FSSH_B_PRId64 147 #define FSSH_B_PRIiOFF FSSH_B_PRIi64 148 /* dev_t */ 149 #define FSSH_B_PRIdDEV FSSH_B_PRId32 150 #define FSSH_B_PRIiDEV FSSH_B_PRIi32 151 /* ino_t */ 152 #define FSSH_B_PRIdINO FSSH_B_PRId64 153 #define FSSH_B_PRIiINO FSSH_B_PRIi64 154 /* time_t */ 155 #define FSSH_B_PRIdTIME FSSH_B_PRId32 156 #define FSSH_B_PRIiTIME FSSH_B_PRIi32 157 158 159 /* limits */ 160 #ifdef HAIKU_HOST_PLATFORM_64_BIT 161 # define FSSH_SIZE_MAX UINT64_MAX 162 # define FSSH_SSIZE_MAX INT64_MAX 163 #else 164 # define FSSH_SIZE_MAX UINT32_MAX 165 # define FSSH_SSIZE_MAX INT32_MAX 166 #endif 167 168 169 #endif // _FSSH_TYPES_H 170