xref: /haiku/src/add-ons/kernel/file_systems/fat/fssh_defines.h (revision ba0223da5d79c5cd27496ee0e5712921cebb7642)
1 /*
2  * Copyright 2001-2024 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef FAT_FSSH_DEFINES_H
6 #define FAT_FSSH_DEFINES_H
7 
8 
9 // Macros used by the driver and not provided by the FS shell interface.
10 
11 #include <assert.h>
12 
13 
14 #ifndef LONGLONG_MAX
15 #define LONGLONG_MAX LONG_LONG_MAX
16 #endif
17 
18 #ifdef B_USE_POSITIVE_POSIX_ERRORS
19 #define B_TO_POSIX_ERROR(error) (-(error))
20 #define B_FROM_POSIX_ERROR(error) (-(error))
21 #else
22 #define B_TO_POSIX_ERROR(error) (error)
23 #define B_FROM_POSIX_ERROR(error) (error)
24 #endif // B_USE_POSITIVE_POSIX_ERRORS
25 
26 #define howmany(x, y) (((x) + ((y) - 1)) / (y))
27 
28 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
29 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
30 
31 #ifndef __cplusplus
32 #ifndef min
33 #define min(a, b) ((a) > (b) ? (b) : (a))
34 #endif
35 #ifndef max
36 #define max(a, b) ((a) > (b) ? (a) : (b))
37 #endif
38 #endif // __cplusplus
39 
40 #ifndef MAXNAMLEN
41 #ifdef NAME_MAX
42 #define MAXNAMLEN NAME_MAX
43 #else
44 #define MAXNAMLEN 256
45 #endif // NAME_MAX
46 #endif // MAXNAMLEN
47 
48 #define ASSERT(x) assert(x)
49 
50 #endif // FAT_FSSH_DEFINES_H
51