summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/conf-parser.c24
-rw-r--r--src/shared/conf-parser.h39
-rw-r--r--src/shared/install.c2
-rw-r--r--src/shared/net-util.c3
-rw-r--r--src/shared/net-util.h12
5 files changed, 53 insertions, 27 deletions
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 95d64fcca2..1e3cee5beb 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,
&section,
+ &section_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 312315b35e..42602b3b08 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 16504eef0f..100ed69744 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 f2fd0819d3..fa89bd904f 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 d6ca737e7f..c7edfb96f0 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);