]> mj.ucw.cz Git - libucw.git/blob - lib/config.h
Cured memory leak.
[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-alpha"
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
27 /* Paths */
28
29 #define DEFAULT_CONFIG "cf/sherlock"
30
31 /* Types */
32
33 typedef unsigned char byte;             /* exactly 8 bits, unsigned */
34 typedef signed char sbyte;              /* exactly 8 bits, signed */
35 typedef unsigned short word;            /* exactly 16 bits, unsigned */
36 typedef short sword;                    /* exactly 16 bits, signed */
37 typedef unsigned short u16;             /* exactly 16 bits, unsigned */
38 typedef short s16;                      /* exactly 16 bits, signed */
39 typedef unsigned int u32;               /* exactly 32 bits, unsigned */
40 typedef int s32;                        /* exactly 32 bits, signed */
41 typedef unsigned int uns;               /* at least 32 bits */
42 typedef unsigned long long int u64;     /* exactly 64 bits, unsigned */
43 typedef long long int s64;              /* exactly 64 bits, signed */
44 typedef unsigned long addr_int_t;       /* Both integer and address */
45 typedef unsigned int sh_time_t;         /* Timestamp */
46
47 #ifndef NULL
48 #define NULL (void *)0
49 #endif
50
51 typedef u32 oid_t;                      /* Object ID */
52
53 /* Data types and functions for accessing file positions */
54
55 #ifdef SHERLOCK_CONFIG_LARGE_DB
56 typedef s64 sh_off_t;
57 #define BYTES_PER_O 5
58 #define BYTES_PER_P 8
59 #define bgeto(f) bget5(f)
60 #define bputo(f,l) bput5(f,l)
61 #define bgetp(f) bgetq(f)
62 #define bputp(f,l) bputq(f,l)
63 #define GET_O(p) GET_U40(p)
64 #define GET_P(p) GET_U64(p)
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 #endif
76
77 /* Misc */
78
79 #ifdef __GNUC__
80
81 #undef inline
82 #define NONRET __attribute__((noreturn))
83 #define UNUSED __attribute__((unused))
84 #define CONSTRUCTOR __attribute__((constructor))
85 #define PACKED __attribute__((packed))
86
87 #else
88 #error This program requires the GNU C compiler.
89 #endif
90
91 #endif