Skip to content

Commit 8904ab8

Browse files
authored
Merge pull request systemd#9062 from poettering/parse-conf-macro
add new CONFIG_PARSER_PROTOTYPE() macro
2 parents 52d2566 + 5f92e51 commit 8904ab8

24 files changed

+286
-306
lines changed

src/core/ip-address-access.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Copyright 2016 Daniel Mack
88
***/
99

10+
#include "conf-parser.h"
1011
#include "in-addr-util.h"
1112
#include "list.h"
1213

@@ -19,7 +20,7 @@ struct IPAddressAccessItem {
1920
LIST_FIELDS(IPAddressAccessItem, items);
2021
};
2122

22-
int config_parse_ip_address_access(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
23+
CONFIG_PARSER_PROTOTYPE(config_parse_ip_address_access);
2324

2425
IPAddressAccessItem* ip_address_access_free_all(IPAddressAccessItem *first);
2526

src/core/load-fragment.h

Lines changed: 96 additions & 95 deletions
Large diffs are not rendered by default.

src/journal/journald-server.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
typedef struct Server Server;
1616

17+
#include "conf-parser.h"
1718
#include "hashmap.h"
1819
#include "journal-file.h"
1920
#include "journald-context.h"
@@ -195,14 +196,14 @@ void server_driver_message(Server *s, pid_t object_pid, const char *message_id,
195196
/* gperf lookup function */
196197
const struct ConfigPerfItem* journald_gperf_lookup(const char *key, GPERF_LEN_TYPE length);
197198

198-
int config_parse_storage(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
199-
int config_parse_line_max(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
200-
int config_parse_compress(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
199+
CONFIG_PARSER_PROTOTYPE(config_parse_storage);
200+
CONFIG_PARSER_PROTOTYPE(config_parse_line_max);
201+
CONFIG_PARSER_PROTOTYPE(config_parse_compress);
201202

202203
const char *storage_to_string(Storage s) _const_;
203204
Storage storage_from_string(const char *s) _pure_;
204205

205-
int config_parse_split_mode(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
206+
CONFIG_PARSER_PROTOTYPE(config_parse_split_mode);
206207

207208
const char *split_mode_to_string(SplitMode s) _const_;
208209
SplitMode split_mode_from_string(const char *s) _pure_;

src/libsystemd-network/network-internal.h

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "sd-dhcp-lease.h"
1313

1414
#include "condition.h"
15+
#include "conf-parser.h"
1516
#include "set.h"
1617
#include "udev.h"
1718

@@ -35,33 +36,13 @@ bool net_match_config(Set *match_mac,
3536
const char *dev_type,
3637
const char *dev_name);
3738

38-
int config_parse_net_condition(const char *unit, const char *filename, unsigned line,
39-
const char *section, unsigned section_line, const char *lvalue,
40-
int ltype, const char *rvalue, void *data, void *userdata);
41-
42-
int config_parse_hwaddr(const char *unit, const char *filename, unsigned line,
43-
const char *section, unsigned section_line, const char *lvalue,
44-
int ltype, const char *rvalue, void *data, void *userdata);
45-
46-
int config_parse_hwaddrs(const char *unit, const char *filename, unsigned line,
47-
const char *section, unsigned section_line, const char *lvalue,
48-
int ltype, const char *rvalue, void *data, void *userdata);
49-
50-
int config_parse_ifnames(const char *unit, const char *filename, unsigned line,
51-
const char *section, unsigned section_line, const char *lvalue,
52-
int ltype, const char *rvalue, void *data, void *userdata);
53-
54-
int config_parse_ifalias(const char *unit, const char *filename, unsigned line,
55-
const char *section, unsigned section_line, const char *lvalue,
56-
int ltype, const char *rvalue, void *data, void *userdata);
57-
58-
int config_parse_iaid(const char *unit, const char *filename, unsigned line,
59-
const char *section, unsigned section_line, const char *lvalue,
60-
int ltype, const char *rvalue, void *data, void *userdata);
61-
62-
int config_parse_bridge_port_priority(const char *unit, const char *filename, unsigned line,
63-
const char *section, unsigned section_line, const char *lvalue,
64-
int ltype, const char *rvalue, void *data, void *userdata);
39+
CONFIG_PARSER_PROTOTYPE(config_parse_net_condition);
40+
CONFIG_PARSER_PROTOTYPE(config_parse_hwaddr);
41+
CONFIG_PARSER_PROTOTYPE(config_parse_hwaddrs);
42+
CONFIG_PARSER_PROTOTYPE(config_parse_ifnames);
43+
CONFIG_PARSER_PROTOTYPE(config_parse_ifalias);
44+
CONFIG_PARSER_PROTOTYPE(config_parse_iaid);
45+
CONFIG_PARSER_PROTOTYPE(config_parse_bridge_port_priority);
6546

6647
int net_get_unique_predictable_data(struct udev_device *device, uint64_t *result);
6748
const char *net_get_name(struct udev_device *device);

src/login/logind-action.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
Copyright 2012 Lennart Poettering
88
***/
99

10+
#include "conf-parser.h"
11+
1012
typedef enum HandleAction {
1113
HANDLE_IGNORE,
1214
HANDLE_POWEROFF,
@@ -36,4 +38,5 @@ const char* handle_action_to_string(HandleAction h) _const_;
3638
HandleAction handle_action_from_string(const char *s) _pure_;
3739

3840
const char* manager_target_for_action(HandleAction handle);
39-
int config_parse_handle_action(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
41+
42+
CONFIG_PARSER_PROTOTYPE(config_parse_handle_action);

src/login/logind-user.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
typedef struct User User;
1111

12+
#include "conf-parser.h"
1213
#include "list.h"
1314
#include "logind.h"
1415

@@ -80,4 +81,4 @@ UserState user_state_from_string(const char *s) _pure_;
8081
int bus_user_method_terminate(sd_bus_message *message, void *userdata, sd_bus_error *error);
8182
int bus_user_method_kill(sd_bus_message *message, void *userdata, sd_bus_error *error);
8283

83-
int config_parse_compat_user_tasks_max(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
84+
CONFIG_PARSER_PROTOTYPE(config_parse_compat_user_tasks_max);

src/login/logind.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "sd-bus.h"
1414
#include "sd-event.h"
1515

16+
#include "conf-parser.h"
1617
#include "hashmap.h"
1718
#include "list.h"
1819
#include "set.h"
@@ -179,8 +180,8 @@ const struct ConfigPerfItem* logind_gperf_lookup(const char *key, GPERF_LEN_TYPE
179180

180181
int manager_set_lid_switch_ignore(Manager *m, usec_t until);
181182

182-
int config_parse_n_autovts(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
183-
int config_parse_tmpfs_size(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
183+
CONFIG_PARSER_PROTOTYPE(config_parse_n_autovts);
184+
CONFIG_PARSER_PROTOTYPE(config_parse_tmpfs_size);
184185

185186
int manager_get_session_from_creds(Manager *m, sd_bus_message *message, const char *name, sd_bus_error *error, Session **ret);
186187
int manager_get_user_from_creds(Manager *m, sd_bus_message *message, uid_t uid, sd_bus_error *error, User **ret);

src/network/networkd-address-label.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <inttypes.h>
1111
#include <stdbool.h>
1212

13+
#include "conf-parser.h"
1314
#include "in-addr-util.h"
1415

1516
typedef struct AddressLabel AddressLabel;
@@ -41,5 +42,5 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(AddressLabel*, address_label_free);
4142

4243
int address_label_configure(AddressLabel *address, Link *link, sd_netlink_message_handler_t callback, bool update);
4344

44-
int config_parse_address_label(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
45-
int config_parse_address_label_prefix(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
45+
CONFIG_PARSER_PROTOTYPE(config_parse_address_label);
46+
CONFIG_PARSER_PROTOTYPE(config_parse_address_label_prefix);

src/network/networkd-address.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <inttypes.h>
1111
#include <stdbool.h>
1212

13+
#include "conf-parser.h"
1314
#include "in-addr-util.h"
1415

1516
typedef struct Address Address;
@@ -66,9 +67,9 @@ bool address_is_ready(const Address *a);
6667

6768
DEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
6869

69-
int config_parse_address(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
70-
int config_parse_broadcast(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
71-
int config_parse_label(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
72-
int config_parse_lifetime(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
73-
int config_parse_address_flags(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
74-
int config_parse_address_scope(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
70+
CONFIG_PARSER_PROTOTYPE(config_parse_address);
71+
CONFIG_PARSER_PROTOTYPE(config_parse_broadcast);
72+
CONFIG_PARSER_PROTOTYPE(config_parse_label);
73+
CONFIG_PARSER_PROTOTYPE(config_parse_lifetime);
74+
CONFIG_PARSER_PROTOTYPE(config_parse_address_flags);
75+
CONFIG_PARSER_PROTOTYPE(config_parse_address_scope);

src/network/networkd-brvlan.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99

1010
#include <stdint.h>
1111

12+
#include "conf-parser.h"
13+
1214
typedef struct Link Link;
1315

1416
int br_vlan_configure(Link *link, uint16_t pvid, uint32_t *br_vid_bitmap, uint32_t *br_untagged_bitmap);
1517

16-
int config_parse_brvlan_pvid(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
17-
int config_parse_brvlan_vlan(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
18-
int config_parse_brvlan_untagged(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
18+
CONFIG_PARSER_PROTOTYPE(config_parse_brvlan_pvid);
19+
CONFIG_PARSER_PROTOTYPE(config_parse_brvlan_vlan);
20+
CONFIG_PARSER_PROTOTYPE(config_parse_brvlan_untagged);

0 commit comments

Comments
 (0)