blob: 2ff52a9db8b708100e5d5b93fba20885a4a6f2dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
#ifndef __BCF_H
#define __BCF_H
/******************************************
Binary config file format (32-bit only):
*/
#define BCF_MAG0 0x3f /* b_ident[BI_MAG0] */
#define BCF_MAG1 'B' /* b_ident[BI_MAG1] */
#define BCF_MAG2 'C' /* b_ident[BI_MAG2] */
#define BCF_MAG3 'F' /* b_ident[BI_MAG3] */
#define BCFMAG "\77BCF"
#define SZBCFMAG 4
/* b_ident[BI_CLASS]: */
#define BCF_CLASS_NONE 0 /* invalid class */
#define BCF_CLASS_32 1 /* 32-bit objects */
#define BCF_CLASS_64 2 /* 64-bit objects (reserved) */
/* b_ident[BI_DATA]: */
#define BCF_DATA_NONE 0 /* invalid data encoding */
#define BCF_DATA_LSB 1 /* Least Significant Byte */
#define BCF_DATA_MSB 2 /* Most Significant Byte */
#define BV_NONE 0 /* invalid version */
#define BV_CURRENT 1 /* current file version b_ident[BI_VERSION] */
#define BCF_PAD 8 /* start of padding bytes in b_ident b_ident[BI_PAD] */
#define BI_MAG0 0 /* file identification */
#define BI_MAG1 1 /* file identification */
#define BI_MAG2 2 /* file identification */
#define BI_MAG3 3 /* file identification */
#define BI_CLASS 4 /* file class */
#define BI_DATA 5 /* data encoding */
#define BI_VERSION 6 /* file version */
#define BI_PAD 7 /* start of padding bytes */
#define BI_NIDENT (16) /* size of b_ident[] */
#define SI_NIDENT (8) /* size of b_ident[] */
/* Type for a 16-bit quantity: */
typedef uint16_t Bcf32_Half;
/* Type for a 32-bit quantity: */
typedef uint32_t Bcf32_Word;
typedef int32_t Bcf32_Sword;
/* Type for a 64-bit quantity: */
typedef uint64_t Bcf32_Xword;
typedef int64_t Bcf32_Sxword;
/* Types of address: */
typedef uint32_t Bcf32_Addr;
/* Types of file offsets: */
typedef uint32_t Bcf32_Off;
typedef struct {
unsigned char b_ident[BI_NIDENT];
Bcf32_Half b_hsize; /* BCF header's size in bytes */
Bcf32_Word b_fsize; /* Whole BCF file size in bytes */
Bcf32_Off b_shoff; /* section header table’s file offset in bytes */
Bcf32_Half b_shentsize; /* section header's size in bytes */
Bcf32_Half b_shnum; /* number of entries in section headers table */
Bcf32_Off b_rhoff; /* repository header table’s file offset in bytes */
Bcf32_Half b_rhentsize; /* repository header's size in bytes */
Bcf32_Half b_rhnum; /* number of entries in repository headers table */
Bcf32_Off b_dtoff; /* data entries table’s file offset in bytes */
Bcf32_Half b_dtentsize; /* data entry's size in bytes */
Bcf32_Half b_dtnum; /* number of entries in data entries table */
Bcf32_Off b_stoff; /* string table’s file offset in bytes */
} __attribute__ ((packed)) Bcf32_fhdr;
/* Type of setcions: */
#define ST_GLOBAL 1 /* this section contains variable entries only */
#define ST_REPOS 2 /* this section contains repository entries only */
#define SMAG_GLOBAL ".global"
#define SMAG_REPOS ".repos"
typedef struct {
unsigned char s_name[SI_NIDENT];
Bcf32_Half s_type; /* .global or .repos */
Bcf32_Off s_shdr; /* section header's offset in the string table */
Bcf32_Off s_sdata; /* section data/repos's file offset */
Bcf32_Half s_dnum; /* number of data/repos entries in section */
} __attribute__ ((packed)) Bcf32_shdr;
typedef struct {
Bcf32_Off r_rhdr; /* repo header's offset in the string table */
Bcf32_Off r_rdata; /* repo data's file offset */
Bcf32_Half r_dnum; /* number of data entries in repo */
} __attribute__ ((packed)) Bcf32_rhdr;
#define DT_NUMERICAL 0x01
#define DT_PATH 0x02
#define DT_STRING 0x04
typedef struct {
Bcf32_Off d_name; /* variable name's offset in the string table */
union
{
Bcf32_Word d_value; /* numerical variable's value */
Bcf32_Off d_valptr; /* variable value's offset in string table */
} _v;
Bcf32_Half d_type; /* 0x01 - numerical, 0x02 - path, 0x04 - string */
} __attribute__ ((packed)) Bcf32_dntr;
/************************
Shared memory (POSIX API):
*/
#define CSVN_SHM_BCF "/csvn.bcf"
#define CGIT_SHM_BCF "/cgit.bcf"
#endif /* __BCF_H */
|