[systemd-commits] 2 commits - man/systemd-networkd.service.xml src/core src/journal src/login src/network src/shared src/test src/udev
Tom Gundersen
tomegun at kemper.freedesktop.org
Mon Nov 25 10:40:32 PST 2013
man/systemd-networkd.service.xml | 17 ++++++
src/core/load-fragment.c | 55 ++++++++++++++++++--
src/core/load-fragment.h | 106 +++++++++++++++++++--------------------
src/core/main.c | 3 +
src/journal/journald-server.h | 4 -
src/login/logind-action.h | 2
src/network/networkd-address.c | 79 +++++++++++++++++++++++++++--
src/network/networkd-gperf.gperf | 2
src/network/networkd-network.c | 22 ++++++--
src/network/networkd-route.c | 103 ++++++++++++++++++++++++++++++++++++-
src/network/networkd.h | 31 +++++++++--
src/shared/conf-parser.c | 24 +++++++-
src/shared/conf-parser.h | 39 +++++++-------
src/shared/install.c | 2
src/shared/net-util.c | 3 +
src/shared/net-util.h | 12 ++--
src/test/test-unit-file.c | 21 ++++---
src/udev/net/ethtool-util.h | 4 -
src/udev/net/link-config.h | 4 -
19 files changed, 412 insertions(+), 121 deletions(-)
New commits:
commit 6ae115c1fe95611b39d2f20cfcea3d385429f59e
Author: Tom Gundersen <teg at jklm.no>
Date: Tue Nov 19 16:54:42 2013 +0100
networkd: add support for [Address] sections
This will allow specifying more options per address than the
simple Address= entry in the [Network] section.
Preliminary support for the same functionality for [Route] sections
are added, but not yet hooked up, as more testing is needed.
diff --git a/man/systemd-networkd.service.xml b/man/systemd-networkd.service.xml
index f3239bb..8bf2d92 100644
--- a/man/systemd-networkd.service.xml
+++ b/man/systemd-networkd.service.xml
@@ -162,6 +162,23 @@
.</para>
</listitem>
</varlistentry>
+ </variablelist>
+
+ <para>The <literal>[Address]</literal> section accepts the following keys:</para>
+
+ <variablelist class='network-directives'>
+ <varlistentry>
+ <term><varname>Address</varname></term>
+ <listitem>
+ <para>As in the <literal>[Network]</literal> section.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>Label</varname></term>
+ <listitem>
+ <para>An address label.</para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 0e582d6..4c321dc 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -28,9 +28,20 @@
#include "conf-parser.h"
#include "net-util.h"
-int address_new(Network *network, Address **ret) {
+int address_new(Network *network, unsigned section, Address **ret) {
_cleanup_address_free_ Address *address = NULL;
+ if (section) {
+ uint64_t key = section;
+ address = hashmap_get(network->addresses_by_section, &key);
+ if (address) {
+ *ret = address;
+ address = NULL;
+
+ return 0;
+ }
+ }
+
address = new0(Address, 1);
if (!address)
return -ENOMEM;
@@ -39,6 +50,11 @@ int address_new(Network *network, Address **ret) {
LIST_PREPEND(addresses, network->addresses, address);
+ if (section) {
+ address->section = section;
+ hashmap_put(network->addresses_by_section, &address->section, address);
+ }
+
*ret = address;
address = NULL;
@@ -51,7 +67,10 @@ void address_free(Address *address) {
LIST_REMOVE(addresses, address->network->addresses, address);
- free(address->label);
+ if (address->section)
+ hashmap_remove(address->network->addresses_by_section,
+ &address->section);
+
free(address);
}
@@ -121,17 +140,19 @@ int config_parse_address(const char *unit,
const char *rvalue,
void *data,
void *userdata) {
+ Network *network = userdata;
_cleanup_address_free_ Address *n = NULL;
_cleanup_free_ char *address = NULL;
const char *e;
int r;
assert(filename);
+ assert(section);
assert(lvalue);
assert(rvalue);
assert(data);
- r = address_new(userdata, &n);
+ r = address_new(network, section_line, &n);
if (r < 0)
return r;
@@ -172,3 +193,54 @@ int config_parse_address(const char *unit,
return 0;
}
+
+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) {
+ Network *network = userdata;
+ _cleanup_address_free_ Address *n = NULL;
+ _cleanup_free_ char *address = NULL;
+ char *label;
+ int r;
+
+ assert(filename);
+ assert(section);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ r = address_new(network, section_line, &n);
+ if (r < 0)
+ return r;
+
+ label = strdup(rvalue);
+ if (!label)
+ return log_oom();
+
+ if (!ascii_is_valid(label) || strlen(label) >= IFNAMSIZ) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Interface label is not ASCII clean or is too"
+ " long, ignoring assignment: %s", rvalue);
+ free(label);
+ return 0;
+ }
+
+ free(n->label);
+ if (*label)
+ n->label = label;
+ else {
+ free(label);
+ n->label = NULL;
+ }
+
+ n = NULL;
+
+ return 0;
+}
diff --git a/src/network/networkd-gperf.gperf b/src/network/networkd-gperf.gperf
index a0ca6aa..7fbe466 100644
--- a/src/network/networkd-gperf.gperf
+++ b/src/network/networkd-gperf.gperf
@@ -23,3 +23,5 @@ Match.Name, config_parse_ifname, 0, offsetof(Networ
Network.Description, config_parse_string, 0, offsetof(Network, description)
Network.Address, config_parse_address, 0, 0
Network.Gateway, config_parse_gateway, 0, 0
+Address.Address, config_parse_address, 0, 0
+Address.Label, config_parse_label, 0, 0
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 7be9645..dc2af9d 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -45,8 +45,21 @@ static int network_load_one(Manager *manager, const char *filename) {
network->manager = manager;
LIST_HEAD_INIT(network->addresses);
+ LIST_HEAD_INIT(network->routes);
- r = config_parse(NULL, filename, file, "Match\0Network\0", config_item_perf_lookup,
+ network->addresses_by_section = hashmap_new(uint64_hash_func, uint64_compare_func);
+ if (!network->addresses_by_section)
+ return log_oom();
+
+ network->routes_by_section = hashmap_new(uint64_hash_func, uint64_compare_func);
+ if (!network->routes_by_section)
+ return log_oom();
+
+ network->filename = strdup(filename);
+ if (!network->filename)
+ return log_oom();
+
+ r = config_parse(NULL, filename, file, "Match\0Network\0Address\0Route\0", config_item_perf_lookup,
(void*) network_gperf_lookup, false, false, network);
if (r < 0) {
log_warning("Could not parse config file %s: %s", filename, strerror(-r));
@@ -54,10 +67,6 @@ static int network_load_one(Manager *manager, const char *filename) {
} else
log_debug("Parsed configuration file %s", filename);
- network->filename = strdup(filename);
- if (!network->filename)
- return log_oom();
-
LIST_PREPEND(networks, manager->networks, network);
network = NULL;
@@ -121,6 +130,9 @@ void network_free(Network *network) {
while ((address = network->addresses))
address_free(address);
+ hashmap_free(network->addresses_by_section);
+ hashmap_free(network->routes_by_section);
+
LIST_REMOVE(networks, network->manager->networks, network);
free(network);
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 3eca3cc..b88c622 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -28,9 +28,21 @@
#include "conf-parser.h"
#include "net-util.h"
-int route_new(Network *network, Route **ret) {
+int route_new(Network *network, unsigned section, Route **ret) {
_cleanup_route_free_ Route *route = NULL;
+ if (section) {
+ uint64_t key = section;
+
+ route = hashmap_get(network->routes_by_section, &key);
+ if (route) {
+ *ret = route;
+ route = NULL;
+
+ return 0;
+ }
+ }
+
route = new0(Route, 1);
if (!route)
return -ENOMEM;
@@ -39,6 +51,11 @@ int route_new(Network *network, Route **ret) {
LIST_PREPEND(routes, network->routes, route);
+ if (section) {
+ route->section = section;
+ hashmap_put(network->routes_by_section, &route->section, route);
+ }
+
*ret = route;
route = NULL;
@@ -51,6 +68,10 @@ void route_free(Route *route) {
LIST_REMOVE(routes, route->network->routes, route);
+ if (route->section)
+ hashmap_remove(route->network->routes_by_section,
+ &route->section);
+
free(route);
}
@@ -65,9 +86,9 @@ int route_configure(Route *route, Link *link,
assert(link->ifindex > 0);
assert(route->family == AF_INET || route->family == AF_INET6);
- r = sd_rtnl_message_route_new(RTM_NEWROUTE, route->family, 0, 0, 0,
- RT_TABLE_MAIN, RT_SCOPE_UNIVERSE, RTPROT_BOOT,
- RTN_UNICAST, 0, &req);
+ r = sd_rtnl_message_route_new(RTM_NEWROUTE, route->family, route->dst_prefixlen,
+ 0, 0, RT_TABLE_MAIN, RT_SCOPE_UNIVERSE,
+ RTPROT_BOOT, RTN_UNICAST, 0, &req);
if (r < 0) {
log_error("Could not create RTM_NEWROUTE message: %s", strerror(-r));
return r;
@@ -79,6 +100,12 @@ int route_configure(Route *route, Link *link,
return r;
}
+ r = sd_rtnl_message_append(req, RTA_DST, &route->dst_addr);
+ if (r < 0) {
+ log_error("Could not append RTA_DST attribute: %s", strerror(-r));
+ return r;
+ }
+
r = sd_rtnl_message_append(req, RTA_OIF, &link->ifindex);
if (r < 0) {
log_error("Could not append RTA_OIF attribute: %s", strerror(-r));
@@ -106,16 +133,18 @@ int config_parse_gateway(const char *unit,
const char *rvalue,
void *data,
void *userdata) {
+ Network *network = userdata;
_cleanup_route_free_ Route *n = NULL;
_cleanup_free_ char *route = NULL;
int r;
assert(filename);
+ assert(section);
assert(lvalue);
assert(rvalue);
assert(data);
- r = route_new(userdata, &n);
+ r = route_new(network, section_line, &n);
if (r < 0)
return r;
@@ -130,3 +159,66 @@ int config_parse_gateway(const char *unit,
return 0;
}
+
+int config_parse_destination(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) {
+ Network *network = userdata;
+ _cleanup_route_free_ Route *n = NULL;
+ _cleanup_free_ char *address = NULL;
+ const char *e;
+ int r;
+
+ assert(filename);
+ assert(section);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ r = route_new(network, section_line, &n);
+ if (r < 0)
+ return r;
+
+ /* Destination=address/prefixlen */
+
+ /* prefixlen */
+ e = strchr(rvalue, '/');
+ if (e) {
+ unsigned i;
+ r = safe_atou(e + 1, &i);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Route destination prefix length is invalid, "
+ "ignoring assignment: %s", e + 1);
+ return 0;
+ }
+
+ n->dst_prefixlen = (unsigned char) i;
+
+ address = strndup(rvalue, e - rvalue);
+ if (!address)
+ return log_oom();
+ } else {
+ address = strdup(rvalue);
+ if (!address)
+ return log_oom();
+ }
+
+ r = net_parse_inaddr(address, &n->family, &n->dst_addr);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, EINVAL,
+ "Destination is invalid, ignoring assignment: %s", address);
+ return 0;
+ }
+
+ n = NULL;
+
+ return 0;
+}
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 11012f5..04a56ea 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -54,11 +54,15 @@ struct Network {
LIST_HEAD(Address, addresses);
LIST_HEAD(Route, routes);
+ Hashmap *addresses_by_section;
+ Hashmap *routes_by_section;
+
LIST_FIELDS(Network, networks);
};
struct Address {
Network *network;
+ uint64_t section;
unsigned char family;
unsigned char prefixlen;
@@ -76,14 +80,21 @@ struct Address {
struct Route {
Network *network;
+ uint64_t section;
unsigned char family;
+ unsigned char dst_prefixlen;
union {
struct in_addr in;
struct in6_addr in6;
} in_addr;
+ union {
+ struct in_addr in;
+ struct in6_addr in6;
+ } dst_addr;
+
LIST_FIELDS(Route, routes);
};
@@ -156,7 +167,7 @@ int network_apply(Manager *manager, Network *network, Link *link);
const struct ConfigPerfItem* network_gperf_lookup(const char *key, unsigned length);
/* Route */
-int route_new(Network *network, Route **ret);
+int route_new(Network *network, unsigned section, Route **ret);
void route_free(Route *route);
int route_configure(Route *route, Link *link, sd_rtnl_message_handler_t callback);
@@ -167,8 +178,12 @@ int config_parse_gateway(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);
+int config_parse_destination(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);
+
/* Address */
-int address_new(Network *network, Address **ret);
+int address_new(Network *network, unsigned section, Address **ret);
void address_free(Address *address);
int address_configure(Address *address, Link *link, sd_rtnl_message_handler_t callback);
@@ -179,6 +194,10 @@ 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);
+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);
+
/* Link */
int link_new(Manager *manager, struct udev_device *device, Link **ret);
commit 71a6151083d842b2f5bf04e50239f0bf85d34d2e
Author: Tom Gundersen <teg at jklm.no>
Date: Tue Nov 19 16:17:55 2013 +0100
conf-parser: distinguish between multiple sections with the same name
Pass on the line on which a section was decleared to the parsers, so they
can distinguish between multiple sections (if they chose to). Currently
no parsers take advantage of this, but a follow-up patch will do that
to distinguish
[Address]
Address=192.168.0.1/24
Label=one
[Address]
Address=192.168.0.2/24
Label=two
from
[Address]
Address=192.168.0.1/24
Label=one
Address=192.168.0.2/24
Label=two
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 110f7fb..e9bfbd3 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -58,6 +58,7 @@ int config_parse_warn_compat(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -75,6 +76,7 @@ int config_parse_unit_deps(const char* unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -119,6 +121,7 @@ int config_parse_unit_string_printf(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -139,7 +142,7 @@ int config_parse_unit_string_printf(const char *unit,
log_syntax(unit, LOG_ERR, filename, line, -r,
"Failed to resolve unit specifiers on %s, ignoring: %s", rvalue, strerror(-r));
- return config_parse_string(unit, filename, line, section, lvalue, ltype,
+ return config_parse_string(unit, filename, line, section, section_line, lvalue, ltype,
k ? k : rvalue, data, userdata);
}
@@ -147,6 +150,7 @@ int config_parse_unit_strv_printf(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -167,7 +171,7 @@ int config_parse_unit_strv_printf(const char *unit,
log_syntax(unit, LOG_ERR, filename, line, -r,
"Failed to resolve unit specifiers on %s, ignoring: %s", rvalue, strerror(-r));
- return config_parse_strv(unit, filename, line, section, lvalue, ltype,
+ return config_parse_strv(unit, filename, line, section, section_line, lvalue, ltype,
k ? k : rvalue, data, userdata);
}
@@ -175,6 +179,7 @@ int config_parse_unit_path_printf(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -195,7 +200,7 @@ int config_parse_unit_path_printf(const char *unit,
log_syntax(unit, LOG_ERR, filename, line, -r,
"Failed to resolve unit specifiers on %s, ignoring: %s", rvalue, strerror(-r));
- return config_parse_path(unit, filename, line, section, lvalue, ltype,
+ return config_parse_path(unit, filename, line, section, section_line, lvalue, ltype,
k ? k : rvalue, data, userdata);
}
@@ -203,6 +208,7 @@ int config_parse_socket_listen(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -313,6 +319,7 @@ int config_parse_socket_bind(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -351,6 +358,7 @@ int config_parse_exec_nice(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -388,6 +396,7 @@ int config_parse_exec_oom_score_adjust(const char* unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -425,6 +434,7 @@ int config_parse_exec(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -596,6 +606,7 @@ int config_parse_socket_bindtodevice(const char* unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -630,6 +641,7 @@ int config_parse_exec_io_class(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -661,6 +673,7 @@ int config_parse_exec_io_priority(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -692,6 +705,7 @@ int config_parse_exec_cpu_sched_policy(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -726,6 +740,7 @@ int config_parse_exec_cpu_sched_prio(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -767,6 +782,7 @@ int config_parse_exec_cpu_affinity(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -824,6 +840,7 @@ int config_parse_exec_capabilities(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -856,6 +873,7 @@ int config_parse_exec_secure_bits(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -905,6 +923,7 @@ int config_parse_bounding_set(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -964,6 +983,7 @@ int config_parse_limit(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1008,6 +1028,7 @@ int config_parse_sysv_priority(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1040,6 +1061,7 @@ int config_parse_kill_signal(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1069,6 +1091,7 @@ int config_parse_exec_mount_flags(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1115,6 +1138,7 @@ int config_parse_timer(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1185,6 +1209,7 @@ int config_parse_trigger_unit(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1239,6 +1264,7 @@ int config_parse_path_spec(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1305,6 +1331,7 @@ int config_parse_socket_service(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1346,6 +1373,7 @@ int config_parse_service_sockets(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1398,6 +1426,7 @@ int config_parse_service_timeout(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1412,7 +1441,7 @@ int config_parse_service_timeout(const char *unit,
assert(rvalue);
assert(s);
- r = config_parse_sec(unit, filename, line, section, lvalue, ltype,
+ r = config_parse_sec(unit, filename, line, section, section_line, lvalue, ltype,
rvalue, data, userdata);
if (r < 0)
return r;
@@ -1430,6 +1459,7 @@ int config_parse_unit_env_file(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1477,6 +1507,7 @@ int config_parse_environ(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1542,6 +1573,7 @@ int config_parse_ip_tos(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1570,6 +1602,7 @@ int config_parse_unit_condition_path(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1631,6 +1664,7 @@ int config_parse_unit_condition_string(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1686,6 +1720,7 @@ int config_parse_unit_condition_null(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1744,6 +1779,7 @@ int config_parse_unit_requires_mounts_for(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1789,6 +1825,7 @@ int config_parse_documentation(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1811,7 +1848,7 @@ int config_parse_documentation(const char *unit,
return 0;
}
- r = config_parse_unit_strv_printf(unit, filename, line, section, lvalue, ltype,
+ r = config_parse_unit_strv_printf(unit, filename, line, section, section_line, lvalue, ltype,
rvalue, data, userdata);
if (r < 0)
return r;
@@ -1846,6 +1883,7 @@ int config_parse_syscall_filter(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1927,6 +1965,7 @@ int config_parse_unit_slice(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -1976,6 +2015,7 @@ int config_parse_cpu_shares(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -2011,6 +2051,7 @@ int config_parse_memory_limit(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -2044,6 +2085,7 @@ int config_parse_device_allow(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -2103,6 +2145,7 @@ int config_parse_blockio_weight(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -2139,6 +2182,7 @@ int config_parse_blockio_device_weight(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -2209,6 +2253,7 @@ int config_parse_blockio_bandwidth(
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
diff --git a/src/core/load-fragment.h b/src/core/load-fragment.h
index 404df76..99b8e03 100644
--- a/src/core/load-fragment.h
+++ b/src/core/load-fragment.h
@@ -29,59 +29,59 @@ int unit_load_fragment(Unit *u);
void unit_dump_config_items(FILE *f);
-int config_parse_warn_compat(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_deps(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_string_printf(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_strv_printf(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_path_printf(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_documentation(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_socket_listen(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_socket_bind(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_nice(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_oom_score_adjust(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_service_timeout(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_service_type(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_service_restart(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_socket_bindtodevice(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_output(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_input(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_io_class(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_io_priority(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_cpu_sched_policy(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_cpu_sched_prio(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_cpu_affinity(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_capabilities(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_secure_bits(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_bounding_set(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_limit(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_sysv_priority(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_kill_signal(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_exec_mount_flags(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_timer(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_trigger_unit(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_path_spec(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_socket_service(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_service_sockets(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_env_file(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_ip_tos(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_condition_path(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_condition_string(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_condition_null(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_kill_mode(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_notify_access(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_start_limit_action(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_requires_mounts_for(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_syscall_filter(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_environ(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unit_slice(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_cpu_shares(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_memory_limit(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_device_policy(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_device_allow(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_blockio_weight(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_blockio_device_weight(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_blockio_bandwidth(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_warn_compat(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);
+int config_parse_unit_deps(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);
+int config_parse_unit_string_printf(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);
+int config_parse_unit_strv_printf(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);
+int config_parse_unit_path_printf(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);
+int config_parse_documentation(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);
+int config_parse_socket_listen(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);
+int config_parse_socket_bind(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);
+int config_parse_exec_nice(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);
+int config_parse_exec_oom_score_adjust(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);
+int config_parse_exec(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);
+int config_parse_service_timeout(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);
+int config_parse_service_type(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);
+int config_parse_service_restart(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);
+int config_parse_socket_bindtodevice(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);
+int config_parse_output(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);
+int config_parse_input(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);
+int config_parse_exec_io_class(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);
+int config_parse_exec_io_priority(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);
+int config_parse_exec_cpu_sched_policy(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);
+int config_parse_exec_cpu_sched_prio(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);
+int config_parse_exec_cpu_affinity(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);
+int config_parse_exec_capabilities(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);
+int config_parse_exec_secure_bits(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);
+int config_parse_bounding_set(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);
+int config_parse_limit(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);
+int config_parse_sysv_priority(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);
+int config_parse_kill_signal(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);
+int config_parse_exec_mount_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);
+int config_parse_timer(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);
+int config_parse_trigger_unit(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);
+int config_parse_path_spec(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);
+int config_parse_socket_service(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);
+int config_parse_service_sockets(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);
+int config_parse_unit_env_file(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);
+int config_parse_ip_tos(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);
+int config_parse_unit_condition_path(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);
+int config_parse_unit_condition_string(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);
+int config_parse_unit_condition_null(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);
+int config_parse_kill_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);
+int config_parse_notify_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);
+int config_parse_start_limit_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);
+int config_parse_unit_requires_mounts_for(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);
+int config_parse_syscall_filter(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);
+int config_parse_environ(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);
+int config_parse_unit_slice(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);
+int config_parse_cpu_shares(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);
+int config_parse_memory_limit(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);
+int config_parse_device_policy(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);
+int config_parse_device_allow(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);
+int config_parse_blockio_weight(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);
+int config_parse_blockio_device_weight(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);
+int config_parse_blockio_bandwidth(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);
/* gperf prototypes */
const struct ConfigPerfItem* load_fragment_gperf_lookup(const char *key, unsigned length);
diff --git a/src/core/main.c b/src/core/main.c
index 4d4f6e8..bc92f65 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -435,6 +435,7 @@ static int parse_proc_cmdline_word(const char *word) {
const char *filename, \
unsigned line, \
const char *section, \
+ unsigned section_line, \
const char *lvalue, \
int ltype, \
const char *rvalue, \
@@ -466,6 +467,7 @@ static int config_parse_cpu_affinity2(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -538,6 +540,7 @@ static int config_parse_join_controllers(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
diff --git a/src/journal/journald-server.h b/src/journal/journald-server.h
index 069cd17..db577b8 100644
--- a/src/journal/journald-server.h
+++ b/src/journal/journald-server.h
@@ -133,12 +133,12 @@ void server_driver_message(Server *s, sd_id128_t message_id, const char *format,
/* gperf lookup function */
const struct ConfigPerfItem* journald_gperf_lookup(const char *key, unsigned length);
-int config_parse_storage(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+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);
const char *storage_to_string(Storage s) _const_;
Storage storage_from_string(const char *s) _pure_;
-int config_parse_split_mode(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+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);
const char *split_mode_to_string(SplitMode s) _const_;
SplitMode split_mode_from_string(const char *s) _pure_;
diff --git a/src/login/logind-action.h b/src/login/logind-action.h
index 74f7144..e9b424b 100644
--- a/src/login/logind-action.h
+++ b/src/login/logind-action.h
@@ -48,4 +48,4 @@ int manager_handle_action(
const char* handle_action_to_string(HandleAction h) _const_;
HandleAction handle_action_from_string(const char *s) _pure_;
-int config_parse_handle_action(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+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);
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 9fb24c9..0e582d6 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -115,6 +115,7 @@ 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,
diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c
index 6ac5c52..3eca3cc 100644
--- a/src/network/networkd-route.c
+++ b/src/network/networkd-route.c
@@ -100,6 +100,7 @@ int config_parse_gateway(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
diff --git a/src/network/networkd.h b/src/network/networkd.h
index 498f2cd..11012f5 100644
--- a/src/network/networkd.h
+++ b/src/network/networkd.h
@@ -164,8 +164,8 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Route*, route_free);
#define _cleanup_route_free_ _cleanup_(route_freep)
int config_parse_gateway(const char *unit, const char *filename, unsigned line,
- const char *section, const char *lvalue, int ltype,
- const char *rvalue, void *data, void *userdata);
+ const char *section, unsigned section_line, const char *lvalue,
+ int ltype, const char *rvalue, void *data, void *userdata);
/* Address */
int address_new(Network *network, Address **ret);
@@ -176,8 +176,8 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(Address*, address_free);
#define _cleanup_address_free_ _cleanup_(address_freep)
int config_parse_address(const char *unit, const char *filename, unsigned line,
- const char *section, const char *lvalue, int ltype,
- const char *rvalue, void *data, void *userdata);
+ const char *section, unsigned section_line, const char *lvalue,
+ int ltype, const char *rvalue, void *data, void *userdata);
/* Link */
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 95d64fc..1e3cee5 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -156,6 +156,7 @@ static int next_assignment(const char *unit,
ConfigItemLookup lookup,
void *table,
const char *section,
+ unsigned section_line,
const char *lvalue,
const char *rvalue,
bool relaxed,
@@ -178,8 +179,8 @@ static int next_assignment(const char *unit,
if (r > 0) {
if (func)
- return func(unit, filename, line, section, lvalue, ltype,
- rvalue, data, userdata);
+ return func(unit, filename, line, section, section_line,
+ lvalue, ltype, rvalue, data, userdata);
return 0;
}
@@ -202,6 +203,7 @@ static int parse_line(const char* unit,
bool relaxed,
bool allow_include,
char **section,
+ unsigned *section_line,
char *l,
void *userdata) {
@@ -262,9 +264,11 @@ static int parse_line(const char* unit,
free(n);
free(*section);
*section = NULL;
+ *section_line = 0;
} else {
free(*section);
*section = n;
+ *section_line = line;
}
return 0;
@@ -294,6 +298,7 @@ static int parse_line(const char* unit,
lookup,
table,
*section,
+ *section_line,
strstrip(l),
strstrip(e),
relaxed,
@@ -313,7 +318,7 @@ int config_parse(const char *unit,
_cleanup_free_ char *section = NULL, *continuation = NULL;
_cleanup_fclose_ FILE *ours = NULL;
- unsigned line = 0;
+ unsigned line = 0, section_line = 0;
int r;
assert(filename);
@@ -382,6 +387,7 @@ int config_parse(const char *unit,
relaxed,
allow_include,
§ion,
+ §ion_line,
p,
userdata);
free(c);
@@ -398,6 +404,7 @@ int config_parse(const char *unit,
const char *filename, \
unsigned line, \
const char *section, \
+ unsigned section_line, \
const char *lvalue, \
int ltype, \
const char *rvalue, \
@@ -434,6 +441,7 @@ int config_parse_bytes_size(const char* unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -465,6 +473,7 @@ int config_parse_bytes_off(const char* unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -493,6 +502,7 @@ int config_parse_bool(const char* unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -522,6 +532,7 @@ int config_parse_string(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -562,6 +573,7 @@ int config_parse_path(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -607,6 +619,7 @@ int config_parse_strv(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -663,6 +676,7 @@ int config_parse_path_strv(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -720,6 +734,7 @@ int config_parse_mode(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -757,6 +772,7 @@ int config_parse_facility(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -787,6 +803,7 @@ int config_parse_level(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -816,6 +833,7 @@ int config_parse_set_status(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
diff --git a/src/shared/conf-parser.h b/src/shared/conf-parser.h
index 312315b..42602b3 100644
--- a/src/shared/conf-parser.h
+++ b/src/shared/conf-parser.h
@@ -34,6 +34,7 @@ typedef int (*ConfigParserCallback)(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -91,24 +92,24 @@ int config_parse(const char *unit,
void *userdata);
/* Generic parsers */
-int config_parse_int(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_unsigned(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_long(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_uint64(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_double(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_bytes_size(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_bytes_off(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_bool(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_string(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_path(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_strv(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_path_strv(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_sec(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_nsec(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_mode(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_facility(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_level(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_set_status(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_int(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);
+int config_parse_unsigned(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);
+int config_parse_long(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);
+int config_parse_uint64(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);
+int config_parse_double(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);
+int config_parse_bytes_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);
+int config_parse_bytes_off(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);
+int config_parse_bool(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);
+int config_parse_string(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);
+int config_parse_path(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);
+int config_parse_strv(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);
+int config_parse_path_strv(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);
+int config_parse_sec(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);
+int config_parse_nsec(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);
+int config_parse_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);
+int config_parse_facility(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);
+int config_parse_level(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);
+int config_parse_set_status(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);
int log_syntax_internal(const char *unit, int level,
const char *file, unsigned line, const char *func,
@@ -126,6 +127,7 @@ int log_syntax_internal(const char *unit, int level,
const char *filename, \
unsigned line, \
const char *section, \
+ unsigned section_line, \
const char *lvalue, \
int ltype, \
const char *rvalue, \
@@ -154,6 +156,7 @@ int log_syntax_internal(const char *unit, int level,
const char *filename, \
unsigned line, \
const char *section, \
+ unsigned section_line, \
const char *lvalue, \
int ltype, \
const char *rvalue, \
diff --git a/src/shared/install.c b/src/shared/install.c
index 16504ee..100ed69 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -922,6 +922,7 @@ static int config_parse_also(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -957,6 +958,7 @@ static int config_parse_user(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
diff --git a/src/shared/net-util.c b/src/shared/net-util.c
index f2fd081..fa89bd9 100644
--- a/src/shared/net-util.c
+++ b/src/shared/net-util.c
@@ -87,6 +87,7 @@ int config_parse_ifname(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -127,6 +128,7 @@ int config_parse_ifalias(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
@@ -167,6 +169,7 @@ int config_parse_hwaddr(const char *unit,
const char *filename,
unsigned line,
const char *section,
+ unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
diff --git a/src/shared/net-util.h b/src/shared/net-util.h
index d6ca737..c7edfb9 100644
--- a/src/shared/net-util.h
+++ b/src/shared/net-util.h
@@ -36,15 +36,15 @@ bool net_match_config(const struct ether_addr *match_mac,
const char *dev_name);
int config_parse_hwaddr(const char *unit, const char *filename, unsigned line,
- const char *section, const char *lvalue, int ltype,
- const char *rvalue, void *data, void *userdata);
+ const char *section, unsigned section_line, const char *lvalue,
+ int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_ifname(const char *unit, const char *filename, unsigned line,
- const char *section, const char *lvalue, int ltype,
- const char *rvalue, void *data, void *userdata);
+ const char *section, unsigned section_line, const char *lvalue,
+ int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_ifalias(const char *unit, const char *filename, unsigned line,
- const char *section, const char *lvalue, int ltype,
- const char *rvalue, void *data, void *userdata);
+ const char *section, unsigned section_line, const char *lvalue,
+ int ltype, const char *rvalue, void *data, void *userdata);
int net_parse_inaddr(const char *address, unsigned char *family, void *dst);
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index 0413ae2..1b4133b 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -80,6 +80,7 @@ static void test_config_parse_exec(void) {
/* const char *filename, */
/* unsigned line, */
/* const char *section, */
+ /* unsigned section_line, */
/* const char *lvalue, */
/* int ltype, */
/* const char *rvalue, */
@@ -90,13 +91,13 @@ static void test_config_parse_exec(void) {
ExecCommand *c = NULL, *c1;
/* basic test */
- r = config_parse_exec(NULL, "fake", 1, "section",
+ r = config_parse_exec(NULL, "fake", 1, "section", 1,
"LValue", 0, "/RValue r1",
&c, NULL);
assert_se(r >= 0);
check_execcommand(c, "/RValue", "/RValue", "r1", false);
- r = config_parse_exec(NULL, "fake", 2, "section",
+ r = config_parse_exec(NULL, "fake", 2, "section", 1,
"LValue", 0, "/RValue///slashes/// r1",
&c, NULL);
/* test slashes */
@@ -106,7 +107,7 @@ static void test_config_parse_exec(void) {
"r1", false);
/* honour_argv0 */
- r = config_parse_exec(NULL, "fake", 3, "section",
+ r = config_parse_exec(NULL, "fake", 3, "section", 1,
"LValue", 0, "@/RValue///slashes2/// argv0 r1",
&c, NULL);
assert_se(r >= 0);
@@ -114,7 +115,7 @@ static void test_config_parse_exec(void) {
check_execcommand(c1, "/RValue/slashes2", "argv0", "r1", false);
/* ignore && honour_argv0 */
- r = config_parse_exec(NULL, "fake", 4, "section",
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "-@/RValue///slashes3/// argv0a r1",
&c, NULL);
assert_se(r >= 0);
@@ -123,7 +124,7 @@ static void test_config_parse_exec(void) {
"/RValue/slashes3", "argv0a", "r1", true);
/* ignore && honour_argv0 */
- r = config_parse_exec(NULL, "fake", 4, "section",
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "@-/RValue///slashes4/// argv0b r1",
&c, NULL);
assert_se(r >= 0);
@@ -132,21 +133,21 @@ static void test_config_parse_exec(void) {
"/RValue/slashes4", "argv0b", "r1", true);
/* ignore && ignore */
- r = config_parse_exec(NULL, "fake", 4, "section",
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "--/RValue argv0 r1",
&c, NULL);
assert_se(r == 0);
assert_se(c1->command_next == NULL);
/* ignore && ignore */
- r = config_parse_exec(NULL, "fake", 4, "section",
+ r = config_parse_exec(NULL, "fake", 4, "section", 1,
"LValue", 0, "- at -/RValue argv0 r1",
&c, NULL);
assert_se(r == 0);
assert_se(c1->command_next == NULL);
/* semicolon */
- r = config_parse_exec(NULL, "fake", 5, "section",
+ r = config_parse_exec(NULL, "fake", 5, "section", 1,
"LValue", 0,
"-@/RValue argv0 r1 ; "
"/goo/goo boo",
@@ -161,7 +162,7 @@ static void test_config_parse_exec(void) {
"/goo/goo", "/goo/goo", "boo", false);
/* trailing semicolon */
- r = config_parse_exec(NULL, "fake", 5, "section",
+ r = config_parse_exec(NULL, "fake", 5, "section", 1,
"LValue", 0,
"-@/RValue argv0 r1 ; ",
&c, NULL);
@@ -173,7 +174,7 @@ static void test_config_parse_exec(void) {
assert_se(c1->command_next == NULL);
/* escaped semicolon */
- r = config_parse_exec(NULL, "fake", 5, "section",
+ r = config_parse_exec(NULL, "fake", 5, "section", 1,
"LValue", 0,
"/usr/bin/find \\;",
&c, NULL);
diff --git a/src/udev/net/ethtool-util.h b/src/udev/net/ethtool-util.h
index a02088f..c8638f2 100644
--- a/src/udev/net/ethtool-util.h
+++ b/src/udev/net/ethtool-util.h
@@ -51,5 +51,5 @@ Duplex duplex_from_string(const char *d) _pure_;
const char *wol_to_string(WakeOnLan wol) _const_;
WakeOnLan wol_from_string(const char *wol) _pure_;
-int config_parse_duplex(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_wol(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_duplex(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);
+int config_parse_wol(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);
diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h
index f74a790..a55c6f5 100644
--- a/src/udev/net/link-config.h
+++ b/src/udev/net/link-config.h
@@ -86,5 +86,5 @@ MACPolicy mac_policy_from_string(const char *p) _pure_;
/* gperf lookup function */
const struct ConfigPerfItem* link_config_gperf_lookup(const char *key, unsigned length);
-int config_parse_mac_policy(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
-int config_parse_name_policy(const char *unit, const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
+int config_parse_mac_policy(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);
+int config_parse_name_policy(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);
More information about the systemd-commits
mailing list