xref: /haiku/src/add-ons/kernel/file_systems/fat/fssh_defines.h (revision f6839b1ca74ff9e6160f330a15a2362629c9eec6)
1342a1b22SJim906 /*
2342a1b22SJim906  * Copyright 2001-2024 Haiku, Inc. All rights reserved.
3342a1b22SJim906  * Distributed under the terms of the MIT License.
4342a1b22SJim906  */
5342a1b22SJim906 #ifndef FAT_FSSH_DEFINES_H
6342a1b22SJim906 #define FAT_FSSH_DEFINES_H
7342a1b22SJim906 
8342a1b22SJim906 
9342a1b22SJim906 // Macros used by the driver and not provided by the FS shell interface.
10342a1b22SJim906 
11342a1b22SJim906 #include <assert.h>
12342a1b22SJim906 
13342a1b22SJim906 
14*f6839b1cSAugustin Cavalier #ifndef LONGLONG_MAX
15342a1b22SJim906 #define LONGLONG_MAX LONG_LONG_MAX
16*f6839b1cSAugustin Cavalier #endif
17342a1b22SJim906 
18342a1b22SJim906 #ifdef B_USE_POSITIVE_POSIX_ERRORS
19342a1b22SJim906 #define B_TO_POSIX_ERROR(error) (-(error))
20342a1b22SJim906 #define B_FROM_POSIX_ERROR(error) (-(error))
21342a1b22SJim906 #else
22342a1b22SJim906 #define B_TO_POSIX_ERROR(error) (error)
23342a1b22SJim906 #define B_FROM_POSIX_ERROR(error) (error)
24342a1b22SJim906 #endif // B_USE_POSITIVE_POSIX_ERRORS
25342a1b22SJim906 
26342a1b22SJim906 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
27342a1b22SJim906 
28342a1b22SJim906 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
29342a1b22SJim906 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
30342a1b22SJim906 
31342a1b22SJim906 #ifndef __cplusplus
32342a1b22SJim906 #ifndef min
33342a1b22SJim906 #define min(a, b) ((a) > (b) ? (b) : (a))
34342a1b22SJim906 #endif
35342a1b22SJim906 #ifndef max
36342a1b22SJim906 #define max(a, b) ((a) > (b) ? (a) : (b))
37342a1b22SJim906 #endif
38342a1b22SJim906 #endif // __cplusplus
39342a1b22SJim906 
40342a1b22SJim906 #ifndef MAXNAMLEN
41342a1b22SJim906 #ifdef NAME_MAX
42342a1b22SJim906 #define MAXNAMLEN NAME_MAX
43342a1b22SJim906 #else
44342a1b22SJim906 #define MAXNAMLEN 256
45342a1b22SJim906 #endif // NAME_MAX
46342a1b22SJim906 #endif // MAXNAMLEN
47342a1b22SJim906 
48342a1b22SJim906 #define ASSERT(x) assert(x)
49342a1b22SJim906 
50342a1b22SJim906 #endif // FAT_FSSH_DEFINES_H
51