]> mj.ucw.cz Git - libucw.git/blob - lib/config.h
Double oops.
[libucw.git] / lib / config.h
1 /*
2  *      Sherlock -- Configuration-Dependent Definitions
3  *
4  *      (c) 1997--2004 Martin Mares <mj@ucw.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU Lesser General Public License.
8  */
9
10 #ifndef _SHERLOCK_CONFIG_H
11 #define _SHERLOCK_CONFIG_H
12
13 /* Configuration switches */
14
15 #include "lib/autoconf.h"
16
17 #ifdef CONFIG_MAX_CONTEXTS
18 #define CONFIG_CONTEXTS
19 #endif
20
21 /* Version */
22
23 #define SHER_VER "3.3" SHERLOCK_VERSION_SUFFIX
24
25 /* Paths */
26
27 #define DEFAULT_CONFIG "cf/sherlock"
28
29 /* Types */
30
31 typedef unsigned char byte;             /* exactly 8 bits, unsigned */
32 typedef signed char sbyte;              /* exactly 8 bits, signed */
33 typedef unsigned short word;            /* exactly 16 bits, unsigned */
34 typedef short sword;                    /* exactly 16 bits, signed */
35 typedef unsigned short u16;             /* exactly 16 bits, unsigned */
36 typedef short s16;                      /* exactly 16 bits, signed */
37 typedef unsigned int u32;               /* exactly 32 bits, unsigned */
38 typedef int s32;                        /* exactly 32 bits, signed */
39 typedef unsigned int uns;               /* at least 32 bits */
40 typedef unsigned long long int u64;     /* exactly 64 bits, unsigned */
41 typedef long long int s64;              /* exactly 64 bits, signed */
42 typedef unsigned long addr_int_t;       /* Both integer and address */
43 typedef unsigned int sh_time_t;         /* Timestamp */
44
45 #ifndef NULL
46 #define NULL (void *)0
47 #endif
48
49 typedef u32 oid_t;                      /* Object ID */
50
51 /* Data types and functions for accessing file positions */
52
53 #ifdef CONFIG_LARGE_DB
54 typedef s64 sh_off_t;
55 #define BYTES_PER_O 5
56 #define BYTES_PER_P 8
57 #define bgeto(f) bget5(f)
58 #define bputo(f,l) bput5(f,l)
59 #define bgetp(f) bgetq(f)
60 #define bputp(f,l) bputq(f,l)
61 #define GET_O(p) GET_U40(p)
62 #define GET_P(p) GET_U64(p)
63 #define PUT_O(p,x) PUT_U40(p,x)
64 #define PUT_P(p,x) PUT_U64(p,x)
65 #else
66 typedef s32 sh_off_t;
67 #define BYTES_PER_O 4
68 #define BYTES_PER_P 4
69 #define bgeto(f) bgetl(f)
70 #define bputo(f,l) bputl(f,l)
71 #define bgetp(f) bgetl(f)
72 #define bputp(f,l) bputl(f,l)
73 #define GET_O(p) GET_U32(p)
74 #define GET_P(p) GET_U32(p)
75 #define PUT_O(p,x) PUT_U32(p,x)
76 #define PUT_P(p,x) PUT_U32(p,x)
77 #endif
78
79 /* Data type for area ID's */
80
81 #ifdef CONFIG_AREAS
82 typedef u32 area_t;
83 #define AREA_NONE 0
84 #define AREA_ANY ~0U
85 #else
86 typedef struct { } area_t;
87 #define AREA_NONE (area_t){}
88 #define AREA_ANY (area_t){}
89 #endif
90
91 /* Misc */
92
93 #ifdef __GNUC__
94
95 #undef inline
96 #define NONRET __attribute__((noreturn))
97 #define UNUSED __attribute__((unused))
98 #define CONSTRUCTOR __attribute__((constructor))
99 #define PACKED __attribute__((packed))
100 #define CONST __attribute__((const))
101 #define PURE __attribute__((const))
102 #define likely(x) __builtin_expect((x),1)
103 #define unlikely(x) __builtin_expect((x),0)
104
105 #else
106 #error This program requires the GNU C compiler.
107 #endif
108
109 #endif