]> mj.ucw.cz Git - libucw.git/blob - lib/config.h
de3e0a62ca0d30c7dbfaccc999941788dcdc8a1b
[libucw.git] / lib / config.h
1 /*
2  *      Sherlock Library -- Configuration-Dependent Definitions
3  *
4  *      (c) 1997--2000 Martin Mares <mj@ucw.cz>
5  */
6
7 #ifndef _SHERLOCK_CONFIG_H
8 #define _SHERLOCK_CONFIG_H
9
10 /* Version */
11
12 #define SHER_VER "2.0"
13
14 /* Features */
15
16 #define  SHERLOCK_CONFIG_LARGE_DB       /* Support for DB files >4GB */
17 #define  SHERLOCK_CONFIG_LFS            /* Large files on 32-bit systems */
18 #define  SHERLOCK_CONFIG_LFS_LIBC       /* LFS supported directly by libc */
19
20 /* CPU characteristics */
21
22 #define CPU_LITTLE_ENDIAN
23 #undef CPU_BIG_ENDIAN
24 #define CPU_ALLOW_UNALIGNED
25 #define CPU_STRUCT_ALIGN 4
26 #undef CPU_64BIT_POINTERS
27
28 /* Paths */
29
30 #define DEFAULT_CONFIG "cf/sherlock"
31
32 /* Types */
33
34 typedef unsigned char byte;             /* exactly 8 bits, unsigned */
35 typedef signed char sbyte;              /* exactly 8 bits, signed */
36 typedef unsigned short word;            /* exactly 16 bits, unsigned */
37 typedef short sword;                    /* exactly 16 bits, signed */
38 typedef unsigned short u16;             /* exactly 16 bits, unsigned */
39 typedef short s16;                      /* exactly 16 bits, signed */
40 typedef unsigned int u32;               /* exactly 32 bits, unsigned */
41 typedef int s32;                        /* exactly 32 bits, signed */
42 typedef unsigned int uns;               /* at least 32 bits */
43 typedef unsigned long long int u64;     /* exactly 64 bits, unsigned */
44 typedef long long int s64;              /* exactly 64 bits, signed */
45 typedef unsigned long addr_int_t;       /* Both integer and address */
46 typedef unsigned int sh_time_t;         /* Timestamp */
47
48 #ifndef NULL
49 #define NULL (void *)0
50 #endif
51
52 typedef u32 oid_t;                      /* Object ID */
53
54 /* Data types and functions for accessing file positions */
55
56 #ifdef SHERLOCK_CONFIG_LARGE_DB
57 typedef s64 sh_off_t;
58 #define BYTES_PER_O 5
59 #define BYTES_PER_P 8
60 #define bgeto(f) bget5(f)
61 #define bputo(f,l) bput5(f,l)
62 #define bgetp(f) bgetq(f)
63 #define bputp(f,l) bputq(f,l)
64 #define GET_O(p) GET_U40(p)
65 #define GET_P(p) GET_U64(p)
66 #else
67 typedef s32 sh_off_t;
68 #define BYTES_PER_O 4
69 #define BYTES_PER_P 4
70 #define bgeto(f) bgetl(f)
71 #define bputo(f,l) bputl(f,l)
72 #define bgetp(f) bgetl(f)
73 #define bputp(f,l) bputl(f,l)
74 #define GET_O(p) GET_U32(p)
75 #define GET_P(p) GET_U32(p)
76 #endif
77
78 /* Misc */
79
80 #ifdef __GNUC__
81
82 #undef inline
83 #define NONRET __attribute__((noreturn))
84 #define UNUSED __attribute__((unused))
85 #define CONSTRUCTOR __attribute__((constructor))
86 #define PACKED __attribute__((packed))
87
88 #else
89 #error This program requires the GNU C compiler.
90 #endif
91
92 #endif