[go: up one dir, main page]

File: config_flags.h

package info (click to toggle)
drbd-utils 9.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,388 kB
  • sloc: ansic: 43,698; xml: 15,968; cpp: 7,783; sh: 3,699; makefile: 1,353; perl: 353
file content (114 lines) | stat: -rw-r--r-- 3,043 bytes parent folder | download | duplicates (2)
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
#ifndef __DRBD_CONFIG_FLAGS_H
#define __DRBD_CONFIG_FLAGS_H

struct msg_buff;
struct nlattr;

struct context_def;
struct field_def;
struct en_map;

enum check_codes {
	CC_OK,
	CC_NOT_AN_ENUM,
	CC_NOT_A_BOOL,
	CC_NOT_A_NUMBER,
	CC_TOO_SMALL,
	CC_TOO_BIG,
	CC_STR_TOO_LONG,
	CC_NOT_AN_ENUM_NUM,
};

struct field_class {
	bool (*is_default)(struct field_def *, const char *);
	bool (*is_equal)(struct field_def *, const char *, const char *);
	const char *(*get)(struct context_def *, struct field_def *, struct nlattr *);
	bool (*put)(struct context_def *, struct field_def *, struct msg_buff *, const char *);
	int (*usage)(struct field_def *, char *, int);
	void (*describe_xml)(struct field_def *);
	enum check_codes (*check)(struct field_def *, const char*);
};

struct field_def {
	const char *name;
	unsigned short nla_type;
	const struct field_class *ops;
	union {
		struct {
			const char **map;
			int size;
			int def;
		} e;  /* ENUM, ENUM_NOCASE */
		struct {
			long long min;
			long long max;
			long long def;
			bool is_signed;
			char scale;
		} n;  /* NUMERIC */
		struct {
			bool def;
		} b;  /* BOOLEAN */
		struct {
			unsigned max_len;
		} s; /* string */
		struct {
			const struct en_map *map;
			int map_size;
			int min;
			int max;
			int def;
		} en; /* ENUM_NUM */
	} u;
	bool needs_double_quoting;
	bool argument_is_optional;
	bool checked_in_postparse; /* Do not check in drbdadm_parse.c
				      It gets checked and converted later*/
	bool implicit_clamp;
	const char *unit;
};

struct context_def {
	struct nla_policy *nla_policy;
	int nla_policy_size;
	int nla_type;
	struct field_def fields[];
};

extern struct field_class fc_enum;
extern struct field_class fc_enum_nocase;
extern struct field_class fc_numeric;
extern struct field_class fc_boolean;
extern struct field_class fc_flag;
extern struct field_class fc_string;
extern struct field_class fc_enum_num;

extern struct context_def disk_options_ctx;
extern struct context_def net_options_ctx;
extern struct context_def show_net_options_ctx;
extern struct context_def primary_cmd_ctx;
extern struct context_def attach_cmd_ctx;
extern struct context_def detach_cmd_ctx;
extern struct context_def connect_cmd_ctx;
extern struct context_def new_peer_cmd_ctx;
extern struct context_def path_cmd_ctx;
extern struct context_def disconnect_cmd_ctx;
extern struct context_def resize_cmd_ctx;
extern struct context_def resource_options_ctx;
extern struct context_def new_current_uuid_cmd_ctx;
extern struct context_def verify_cmd_ctx;
extern struct context_def device_options_ctx;
extern struct context_def invalidate_ctx;
extern struct context_def create_md_ctx;
extern struct context_def dump_md_ctx;
extern struct context_def adjust_ctx;
extern struct context_def peer_device_options_ctx;
extern struct context_def handlers_ctx;
extern struct context_def proxy_options_ctx;
extern struct context_def startup_options_ctx;
extern struct context_def wildcard_ctx;


extern const char *double_quote_string(const char *str);

#endif  /* __DRBD_CONFIG_FLAGS_H */