util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]

This commit is contained in:
Lennart Poettering 2015-10-26 16:18:16 +01:00
parent f47fc3ffc4
commit 6bedfcbb29
136 changed files with 689 additions and 505 deletions

View File

@ -787,6 +787,8 @@ libbasic_la_SOURCES = \
src/basic/string-util.h \
src/basic/fd-util.c \
src/basic/fd-util.h \
src/basic/parse-util.c \
src/basic/parse-util.h \
src/basic/user-util.c \
src/basic/user-util.h \
src/basic/extract-word.c \

View File

@ -33,6 +33,7 @@
#include "hashmap.h"
#include "log.h"
#include "pager.h"
#include "parse-util.h"
#include "special.h"
#include "strv.h"
#include "strxcpyx.h"

View File

@ -28,6 +28,7 @@
#include "string-util.h"
#include "udev-util.h"
#include "util.h"
#include "parse-util.h"
static struct udev_device *find_pci_or_platform_parent(struct udev_device *device) {
struct udev_device *parent;

View File

@ -26,6 +26,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "macro.h"
#include "parse-util.h"
#include "process-util.h"
#include "user-util.h"
#include "util.h"

View File

@ -21,9 +21,10 @@
#include <string.h>
#include "util.h"
#include "cap-list.h"
#include "missing.h"
#include "parse-util.h"
#include "util.h"
static const struct capability_name* lookup_capability(register const char *str, register unsigned int len);

View File

@ -30,6 +30,7 @@
#include "fileio.h"
#include "log.h"
#include "macro.h"
#include "parse-util.h"
#include "util.h"
int have_effective_cap(int value) {

View File

@ -37,6 +37,7 @@
#include "login-util.h"
#include "macro.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "set.h"

View File

@ -20,9 +20,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "extract-word.h"
#include "util.h"
#include "cpu-set-util.h"
#include "extract-word.h"
#include "parse-util.h"
#include "util.h"
cpu_set_t* cpu_set_malloc(unsigned *ncpus) {
cpu_set_t *c;

View File

@ -20,6 +20,7 @@
***/
#include "fd-util.h"
#include "parse-util.h"
#include "util.h"
int close_nointr(int fd) {

View File

@ -28,6 +28,7 @@
#include "fd-util.h"
#include "fdset.h"
#include "macro.h"
#include "parse-util.h"
#include "set.h"
#include "util.h"

View File

@ -42,6 +42,7 @@
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
#include "parse-util.h"
#define SNDBUF_SIZE (8*1024*1024)

408
src/basic/parse-util.c Normal file
View File

@ -0,0 +1,408 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "parse-util.h"
#include "string-util.h"
#include "util.h"
int parse_boolean(const char *v) {
assert(v);
if (streq(v, "1") || strcaseeq(v, "yes") || strcaseeq(v, "y") || strcaseeq(v, "true") || strcaseeq(v, "t") || strcaseeq(v, "on"))
return 1;
else if (streq(v, "0") || strcaseeq(v, "no") || strcaseeq(v, "n") || strcaseeq(v, "false") || strcaseeq(v, "f") || strcaseeq(v, "off"))
return 0;
return -EINVAL;
}
int parse_pid(const char *s, pid_t* ret_pid) {
unsigned long ul = 0;
pid_t pid;
int r;
assert(s);
assert(ret_pid);
r = safe_atolu(s, &ul);
if (r < 0)
return r;
pid = (pid_t) ul;
if ((unsigned long) pid != ul)
return -ERANGE;
if (pid <= 0)
return -ERANGE;
*ret_pid = pid;
return 0;
}
int parse_mode(const char *s, mode_t *ret) {
char *x;
long l;
assert(s);
assert(ret);
errno = 0;
l = strtol(s, &x, 8);
if (errno != 0)
return -errno;
if (!x || x == s || *x)
return -EINVAL;
if (l < 0 || l > 07777)
return -ERANGE;
*ret = (mode_t) l;
return 0;
}
int parse_size(const char *t, uint64_t base, uint64_t *size) {
/* Soo, sometimes we want to parse IEC binary suffixes, and
* sometimes SI decimal suffixes. This function can parse
* both. Which one is the right way depends on the
* context. Wikipedia suggests that SI is customary for
* hardware metrics and network speeds, while IEC is
* customary for most data sizes used by software and volatile
* (RAM) memory. Hence be careful which one you pick!
*
* In either case we use just K, M, G as suffix, and not Ki,
* Mi, Gi or so (as IEC would suggest). That's because that's
* frickin' ugly. But this means you really need to make sure
* to document which base you are parsing when you use this
* call. */
struct table {
const char *suffix;
unsigned long long factor;
};
static const struct table iec[] = {
{ "E", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "P", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "T", 1024ULL*1024ULL*1024ULL*1024ULL },
{ "G", 1024ULL*1024ULL*1024ULL },
{ "M", 1024ULL*1024ULL },
{ "K", 1024ULL },
{ "B", 1ULL },
{ "", 1ULL },
};
static const struct table si[] = {
{ "E", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
{ "P", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
{ "T", 1000ULL*1000ULL*1000ULL*1000ULL },
{ "G", 1000ULL*1000ULL*1000ULL },
{ "M", 1000ULL*1000ULL },
{ "K", 1000ULL },
{ "B", 1ULL },
{ "", 1ULL },
};
const struct table *table;
const char *p;
unsigned long long r = 0;
unsigned n_entries, start_pos = 0;
assert(t);
assert(base == 1000 || base == 1024);
assert(size);
if (base == 1000) {
table = si;
n_entries = ELEMENTSOF(si);
} else {
table = iec;
n_entries = ELEMENTSOF(iec);
}
p = t;
do {
unsigned long long l, tmp;
double frac = 0;
char *e;
unsigned i;
p += strspn(p, WHITESPACE);
if (*p == '-')
return -ERANGE;
errno = 0;
l = strtoull(p, &e, 10);
if (errno > 0)
return -errno;
if (e == p)
return -EINVAL;
if (*e == '.') {
e++;
/* strtoull() itself would accept space/+/- */
if (*e >= '0' && *e <= '9') {
unsigned long long l2;
char *e2;
l2 = strtoull(e, &e2, 10);
if (errno > 0)
return -errno;
/* Ignore failure. E.g. 10.M is valid */
frac = l2;
for (; e < e2; e++)
frac /= 10;
}
}
e += strspn(e, WHITESPACE);
for (i = start_pos; i < n_entries; i++)
if (startswith(e, table[i].suffix))
break;
if (i >= n_entries)
return -EINVAL;
if (l + (frac > 0) > ULLONG_MAX / table[i].factor)
return -ERANGE;
tmp = l * table[i].factor + (unsigned long long) (frac * table[i].factor);
if (tmp > ULLONG_MAX - r)
return -ERANGE;
r += tmp;
if ((unsigned long long) (uint64_t) r != r)
return -ERANGE;
p = e + strlen(table[i].suffix);
start_pos = i + 1;
} while (*p);
*size = r;
return 0;
}
char *format_bytes(char *buf, size_t l, uint64_t t) {
unsigned i;
/* This only does IEC units so far */
static const struct {
const char *suffix;
uint64_t factor;
} table[] = {
{ "E", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "P", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "T", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "G", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "M", UINT64_C(1024)*UINT64_C(1024) },
{ "K", UINT64_C(1024) },
};
if (t == (uint64_t) -1)
return NULL;
for (i = 0; i < ELEMENTSOF(table); i++) {
if (t >= table[i].factor) {
snprintf(buf, l,
"%" PRIu64 ".%" PRIu64 "%s",
t / table[i].factor,
((t*UINT64_C(10)) / table[i].factor) % UINT64_C(10),
table[i].suffix);
goto finish;
}
}
snprintf(buf, l, "%" PRIu64 "B", t);
finish:
buf[l-1] = 0;
return buf;
}
int safe_atou(const char *s, unsigned *ret_u) {
char *x = NULL;
unsigned long l;
assert(s);
assert(ret_u);
errno = 0;
l = strtoul(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((unsigned long) (unsigned) l != l)
return -ERANGE;
*ret_u = (unsigned) l;
return 0;
}
int safe_atoi(const char *s, int *ret_i) {
char *x = NULL;
long l;
assert(s);
assert(ret_i);
errno = 0;
l = strtol(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((long) (int) l != l)
return -ERANGE;
*ret_i = (int) l;
return 0;
}
int safe_atollu(const char *s, long long unsigned *ret_llu) {
char *x = NULL;
unsigned long long l;
assert(s);
assert(ret_llu);
errno = 0;
l = strtoull(s, &x, 0);
if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_llu = l;
return 0;
}
int safe_atolli(const char *s, long long int *ret_lli) {
char *x = NULL;
long long l;
assert(s);
assert(ret_lli);
errno = 0;
l = strtoll(s, &x, 0);
if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_lli = l;
return 0;
}
int safe_atou8(const char *s, uint8_t *ret) {
char *x = NULL;
unsigned long l;
assert(s);
assert(ret);
errno = 0;
l = strtoul(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((unsigned long) (uint8_t) l != l)
return -ERANGE;
*ret = (uint8_t) l;
return 0;
}
int safe_atou16(const char *s, uint16_t *ret) {
char *x = NULL;
unsigned long l;
assert(s);
assert(ret);
errno = 0;
l = strtoul(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((unsigned long) (uint16_t) l != l)
return -ERANGE;
*ret = (uint16_t) l;
return 0;
}
int safe_atoi16(const char *s, int16_t *ret) {
char *x = NULL;
long l;
assert(s);
assert(ret);
errno = 0;
l = strtol(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((long) (int16_t) l != l)
return -ERANGE;
*ret = (int16_t) l;
return 0;
}
int safe_atod(const char *s, double *ret_d) {
char *x = NULL;
double d = 0;
locale_t loc;
assert(s);
assert(ret_d);
loc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
if (loc == (locale_t) 0)
return -errno;
errno = 0;
d = strtod_l(s, &x, loc);
if (!x || x == s || *x || errno) {
freelocale(loc);
return errno ? -errno : -EINVAL;
}
freelocale(loc);
*ret_d = (double) d;
return 0;
}

88
src/basic/parse-util.h Normal file
View File

@ -0,0 +1,88 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <inttypes.h>
#include <sys/types.h>
#include "macro.h"
int parse_boolean(const char *v) _pure_;
int parse_pid(const char *s, pid_t* ret_pid);
int parse_mode(const char *s, mode_t *ret);
int parse_size(const char *t, uint64_t base, uint64_t *size);
#define FORMAT_BYTES_MAX 8
char *format_bytes(char *buf, size_t l, uint64_t t);
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
int safe_atollu(const char *s, unsigned long long *ret_u);
int safe_atolli(const char *s, long long int *ret_i);
int safe_atou8(const char *s, uint8_t *ret);
int safe_atou16(const char *s, uint16_t *ret);
int safe_atoi16(const char *s, int16_t *ret);
static inline int safe_atou32(const char *s, uint32_t *ret_u) {
assert_cc(sizeof(uint32_t) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);
}
static inline int safe_atoi32(const char *s, int32_t *ret_i) {
assert_cc(sizeof(int32_t) == sizeof(int));
return safe_atoi(s, (int*) ret_i);
}
static inline int safe_atou64(const char *s, uint64_t *ret_u) {
assert_cc(sizeof(uint64_t) == sizeof(unsigned long long));
return safe_atollu(s, (unsigned long long*) ret_u);
}
static inline int safe_atoi64(const char *s, int64_t *ret_i) {
assert_cc(sizeof(int64_t) == sizeof(long long int));
return safe_atolli(s, (long long int*) ret_i);
}
#if LONG_MAX == INT_MAX
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);
}
static inline int safe_atoli(const char *s, long int *ret_u) {
assert_cc(sizeof(long int) == sizeof(int));
return safe_atoi(s, (int*) ret_u);
}
#else
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned long long));
return safe_atollu(s, (unsigned long long*) ret_u);
}
static inline int safe_atoli(const char *s, long int *ret_u) {
assert_cc(sizeof(long int) == sizeof(long long int));
return safe_atolli(s, (long long int*) ret_u);
}
#endif
int safe_atod(const char *s, double *ret_d);

View File

@ -32,6 +32,7 @@
#include "log.h"
#include "macro.h"
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"

View File

@ -19,11 +19,11 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "parse-util.h"
#include "signal-util.h"
#include "string-util.h"
#include "util.h"
#include "signal-util.h"
int reset_all_signal_handlers(void) {
static const struct sigaction sa = {
.sa_handler = SIG_DFL,
@ -268,3 +268,7 @@ int signal_from_string_try_harder(const char *s) {
return signo;
}
void nop_signal_handler(int sig) {
/* nothing here */
}

View File

@ -39,3 +39,5 @@ const char *signal_to_string(int i) _const_;
int signal_from_string(const char *s) _pure_;
int signal_from_string_try_harder(const char *s);
void nop_signal_handler(int sig);

View File

@ -35,6 +35,7 @@
#include "formats-util.h"
#include "macro.h"
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
#include "socket-util.h"
#include "string-util.h"

View File

@ -34,6 +34,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "io-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "socket-util.h"

View File

@ -22,11 +22,12 @@
#include <pwd.h>
#include <grp.h>
#include "user-util.h"
#include "macro.h"
#include "util.h"
#include "string-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "user-util.h"
#include "util.h"
bool uid_is_valid(uid_t uid) {

View File

@ -89,6 +89,7 @@
#include "macro.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "random-util.h"
@ -133,201 +134,6 @@ int unlink_noerrno(const char *path) {
return 0;
}
int parse_boolean(const char *v) {
assert(v);
if (streq(v, "1") || strcaseeq(v, "yes") || strcaseeq(v, "y") || strcaseeq(v, "true") || strcaseeq(v, "t") || strcaseeq(v, "on"))
return 1;
else if (streq(v, "0") || strcaseeq(v, "no") || strcaseeq(v, "n") || strcaseeq(v, "false") || strcaseeq(v, "f") || strcaseeq(v, "off"))
return 0;
return -EINVAL;
}
int parse_pid(const char *s, pid_t* ret_pid) {
unsigned long ul = 0;
pid_t pid;
int r;
assert(s);
assert(ret_pid);
r = safe_atolu(s, &ul);
if (r < 0)
return r;
pid = (pid_t) ul;
if ((unsigned long) pid != ul)
return -ERANGE;
if (pid <= 0)
return -ERANGE;
*ret_pid = pid;
return 0;
}
int safe_atou(const char *s, unsigned *ret_u) {
char *x = NULL;
unsigned long l;
assert(s);
assert(ret_u);
errno = 0;
l = strtoul(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((unsigned long) (unsigned) l != l)
return -ERANGE;
*ret_u = (unsigned) l;
return 0;
}
int safe_atoi(const char *s, int *ret_i) {
char *x = NULL;
long l;
assert(s);
assert(ret_i);
errno = 0;
l = strtol(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((long) (int) l != l)
return -ERANGE;
*ret_i = (int) l;
return 0;
}
int safe_atou8(const char *s, uint8_t *ret) {
char *x = NULL;
unsigned long l;
assert(s);
assert(ret);
errno = 0;
l = strtoul(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((unsigned long) (uint8_t) l != l)
return -ERANGE;
*ret = (uint8_t) l;
return 0;
}
int safe_atou16(const char *s, uint16_t *ret) {
char *x = NULL;
unsigned long l;
assert(s);
assert(ret);
errno = 0;
l = strtoul(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((unsigned long) (uint16_t) l != l)
return -ERANGE;
*ret = (uint16_t) l;
return 0;
}
int safe_atoi16(const char *s, int16_t *ret) {
char *x = NULL;
long l;
assert(s);
assert(ret);
errno = 0;
l = strtol(s, &x, 0);
if (!x || x == s || *x || errno)
return errno > 0 ? -errno : -EINVAL;
if ((long) (int16_t) l != l)
return -ERANGE;
*ret = (int16_t) l;
return 0;
}
int safe_atollu(const char *s, long long unsigned *ret_llu) {
char *x = NULL;
unsigned long long l;
assert(s);
assert(ret_llu);
errno = 0;
l = strtoull(s, &x, 0);
if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_llu = l;
return 0;
}
int safe_atolli(const char *s, long long int *ret_lli) {
char *x = NULL;
long long l;
assert(s);
assert(ret_lli);
errno = 0;
l = strtoll(s, &x, 0);
if (!x || x == s || *x || errno)
return errno ? -errno : -EINVAL;
*ret_lli = l;
return 0;
}
int safe_atod(const char *s, double *ret_d) {
char *x = NULL;
double d = 0;
locale_t loc;
assert(s);
assert(ret_d);
loc = newlocale(LC_NUMERIC_MASK, "C", (locale_t) 0);
if (loc == (locale_t) 0)
return -errno;
errno = 0;
d = strtod_l(s, &x, loc);
if (!x || x == s || *x || errno) {
freelocale(loc);
return errno ? -errno : -EINVAL;
}
freelocale(loc);
*ret_d = (double) d;
return 0;
}
int fchmod_umask(int fd, mode_t m) {
mode_t u;
int r;
@ -1195,134 +1001,6 @@ bool fstype_is_network(const char *fstype) {
return nulstr_contains(table, fstype);
}
int parse_size(const char *t, uint64_t base, uint64_t *size) {
/* Soo, sometimes we want to parse IEC binary suffixes, and
* sometimes SI decimal suffixes. This function can parse
* both. Which one is the right way depends on the
* context. Wikipedia suggests that SI is customary for
* hardware metrics and network speeds, while IEC is
* customary for most data sizes used by software and volatile
* (RAM) memory. Hence be careful which one you pick!
*
* In either case we use just K, M, G as suffix, and not Ki,
* Mi, Gi or so (as IEC would suggest). That's because that's
* frickin' ugly. But this means you really need to make sure
* to document which base you are parsing when you use this
* call. */
struct table {
const char *suffix;
unsigned long long factor;
};
static const struct table iec[] = {
{ "E", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "P", 1024ULL*1024ULL*1024ULL*1024ULL*1024ULL },
{ "T", 1024ULL*1024ULL*1024ULL*1024ULL },
{ "G", 1024ULL*1024ULL*1024ULL },
{ "M", 1024ULL*1024ULL },
{ "K", 1024ULL },
{ "B", 1ULL },
{ "", 1ULL },
};
static const struct table si[] = {
{ "E", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
{ "P", 1000ULL*1000ULL*1000ULL*1000ULL*1000ULL },
{ "T", 1000ULL*1000ULL*1000ULL*1000ULL },
{ "G", 1000ULL*1000ULL*1000ULL },
{ "M", 1000ULL*1000ULL },
{ "K", 1000ULL },
{ "B", 1ULL },
{ "", 1ULL },
};
const struct table *table;
const char *p;
unsigned long long r = 0;
unsigned n_entries, start_pos = 0;
assert(t);
assert(base == 1000 || base == 1024);
assert(size);
if (base == 1000) {
table = si;
n_entries = ELEMENTSOF(si);
} else {
table = iec;
n_entries = ELEMENTSOF(iec);
}
p = t;
do {
unsigned long long l, tmp;
double frac = 0;
char *e;
unsigned i;
p += strspn(p, WHITESPACE);
if (*p == '-')
return -ERANGE;
errno = 0;
l = strtoull(p, &e, 10);
if (errno > 0)
return -errno;
if (e == p)
return -EINVAL;
if (*e == '.') {
e++;
/* strtoull() itself would accept space/+/- */
if (*e >= '0' && *e <= '9') {
unsigned long long l2;
char *e2;
l2 = strtoull(e, &e2, 10);
if (errno > 0)
return -errno;
/* Ignore failure. E.g. 10.M is valid */
frac = l2;
for (; e < e2; e++)
frac /= 10;
}
}
e += strspn(e, WHITESPACE);
for (i = start_pos; i < n_entries; i++)
if (startswith(e, table[i].suffix))
break;
if (i >= n_entries)
return -EINVAL;
if (l + (frac > 0) > ULLONG_MAX / table[i].factor)
return -ERANGE;
tmp = l * table[i].factor + (unsigned long long) (frac * table[i].factor);
if (tmp > ULLONG_MAX - r)
return -ERANGE;
r += tmp;
if ((unsigned long long) (uint64_t) r != r)
return -ERANGE;
p = e + strlen(table[i].suffix);
start_pos = i + 1;
} while (*p);
*size = r;
return 0;
}
bool is_device_path(const char *path) {
/* Returns true on paths that refer to a device, either in
@ -2300,45 +1978,6 @@ int prot_from_flags(int flags) {
}
}
char *format_bytes(char *buf, size_t l, uint64_t t) {
unsigned i;
static const struct {
const char *suffix;
uint64_t factor;
} table[] = {
{ "E", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "P", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "T", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "G", UINT64_C(1024)*UINT64_C(1024)*UINT64_C(1024) },
{ "M", UINT64_C(1024)*UINT64_C(1024) },
{ "K", UINT64_C(1024) },
};
if (t == (uint64_t) -1)
return NULL;
for (i = 0; i < ELEMENTSOF(table); i++) {
if (t >= table[i].factor) {
snprintf(buf, l,
"%" PRIu64 ".%" PRIu64 "%s",
t / table[i].factor,
((t*UINT64_C(10)) / table[i].factor) % UINT64_C(10),
table[i].suffix);
goto finish;
}
}
snprintf(buf, l, "%" PRIu64 "B", t);
finish:
buf[l-1] = 0;
return buf;
}
void* memdup(const void *p, size_t l) {
void *r;
@ -4111,27 +3750,6 @@ int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char
return 0;
}
int parse_mode(const char *s, mode_t *ret) {
char *x;
long l;
assert(s);
assert(ret);
errno = 0;
l = strtol(s, &x, 8);
if (errno != 0)
return -errno;
if (!x || x == s || *x)
return -EINVAL;
if (l < 0 || l > 07777)
return -ERANGE;
*ret = (mode_t) l;
return 0;
}
int mount_move_root(const char *path) {
assert(path);
@ -4220,10 +3838,6 @@ int fgetxattr_malloc(int fd, const char *name, char **value) {
}
}
void nop_signal_handler(int sig) {
/* nothing here */
}
int version(void) {
puts(PACKAGE_STRING "\n"
SYSTEMD_FEATURES);

View File

@ -53,8 +53,6 @@
#define COMMENTS "#;"
#define GLOB_CHARS "*?["
#define FORMAT_BYTES_MAX 8
size_t page_size(void) _pure_;
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
@ -87,64 +85,6 @@ static inline const char* one_zero(bool b) {
return b ? "1" : "0";
}
int parse_size(const char *t, uint64_t base, uint64_t *size);
int parse_boolean(const char *v) _pure_;
int parse_pid(const char *s, pid_t* ret_pid);
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
int safe_atollu(const char *s, unsigned long long *ret_u);
int safe_atolli(const char *s, long long int *ret_i);
int safe_atod(const char *s, double *ret_d);
int safe_atou8(const char *s, uint8_t *ret);
#if LONG_MAX == INT_MAX
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);
}
static inline int safe_atoli(const char *s, long int *ret_u) {
assert_cc(sizeof(long int) == sizeof(int));
return safe_atoi(s, (int*) ret_u);
}
#else
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned long long));
return safe_atollu(s, (unsigned long long*) ret_u);
}
static inline int safe_atoli(const char *s, long int *ret_u) {
assert_cc(sizeof(long int) == sizeof(long long int));
return safe_atolli(s, (long long int*) ret_u);
}
#endif
static inline int safe_atou32(const char *s, uint32_t *ret_u) {
assert_cc(sizeof(uint32_t) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);
}
static inline int safe_atoi32(const char *s, int32_t *ret_i) {
assert_cc(sizeof(int32_t) == sizeof(int));
return safe_atoi(s, (int*) ret_i);
}
static inline int safe_atou64(const char *s, uint64_t *ret_u) {
assert_cc(sizeof(uint64_t) == sizeof(unsigned long long));
return safe_atollu(s, (unsigned long long*) ret_u);
}
static inline int safe_atoi64(const char *s, int64_t *ret_i) {
assert_cc(sizeof(int64_t) == sizeof(long long int));
return safe_atolli(s, (long long int*) ret_i);
}
int safe_atou16(const char *s, uint16_t *ret);
int safe_atoi16(const char *s, int16_t *ret);
int readlinkat_malloc(int fd, const char *p, char **ret);
int readlink_malloc(const char *p, char **r);
int readlink_value(const char *p, char **ret);
@ -336,8 +276,6 @@ bool kexec_loaded(void);
int prot_from_flags(int flags) _const_;
char *format_bytes(char *buf, size_t l, uint64_t t);
void* memdup(const void *p, size_t l) _alloc_(2);
int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *path, ...);
@ -680,15 +618,11 @@ int syslog_parse_priority(const char **p, int *priority, bool with_facility);
int rename_noreplace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
int parse_mode(const char *s, mode_t *ret);
int mount_move_root(const char *path);
int getxattr_malloc(const char *path, const char *name, char **value, bool allow_symlink);
int fgetxattr_malloc(int fd, const char *name, char **value);
void nop_signal_handler(int sig);
int version(void);
bool fdname_is_valid(const char *s);

View File

@ -55,6 +55,7 @@
#include "io-util.h"
#include "list.h"
#include "macro.h"
#include "parse-util.h"
#include "path-util.h"
#include "store.h"
#include "string-util.h"

View File

@ -35,6 +35,7 @@
#include "cgroup-util.h"
#include "fd-util.h"
#include "fileio.h"
#include "parse-util.h"
#include "store.h"
#include "string-util.h"
#include "strxcpyx.h"

View File

@ -36,6 +36,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "hashmap.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "terminal-util.h"

View File

@ -40,6 +40,7 @@
#include "label.h"
#include "mkdir.h"
#include "mount.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "special.h"

View File

@ -30,6 +30,7 @@
#include "fd-util.h"
#include "formats-util.h"
#include "kdbus.h"
#include "parse-util.h"
#include "service.h"
#include "signal-util.h"
#include "special.h"

View File

@ -25,6 +25,7 @@
#include "cgroup-util.h"
#include "cgroup.h"
#include "fd-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "special.h"

View File

@ -36,13 +36,13 @@
#include "ioprio.h"
#include "missing.h"
#include "namespace.h"
#include "parse-util.h"
#include "path-util.h"
#include "strv.h"
#include "utf8.h"
#ifdef HAVE_SECCOMP
#include "seccomp-util.h"
#endif
#include "strv.h"
#include "utf8.h"
BUS_DEFINE_PROPERTY_GET_ENUM(bus_property_get_exec_output, exec_output, ExecOutput);

View File

@ -25,14 +25,15 @@
#include "libudev.h"
#include "dbus-device.h"
#include "device.h"
#include "log.h"
#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "swap.h"
#include "udev-util.h"
#include "unit-name.h"
#include "unit.h"
#include "device.h"
static const UnitActiveState state_translation_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = UNIT_INACTIVE,

View File

@ -76,6 +76,7 @@
#include "missing.h"
#include "mkdir.h"
#include "namespace.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "rm-rf.h"

View File

@ -28,8 +28,10 @@
#include "dbus-job.h"
#include "dbus.h"
#include "escape.h"
#include "job.h"
#include "log.h"
#include "macro.h"
#include "parse-util.h"
#include "set.h"
#include "special.h"
#include "string-util.h"
@ -37,7 +39,6 @@
#include "terminal-util.h"
#include "unit.h"
#include "virt.h"
#include "job.h"
Job* job_new_raw(Unit *unit) {
Job *j;

View File

@ -27,6 +27,7 @@
#include "fd-util.h"
#include "formats-util.h"
#include "killall.h"
#include "parse-util.h"
#include "process-util.h"
#include "set.h"
#include "string-util.h"

View File

@ -48,6 +48,7 @@
#include "load-fragment.h"
#include "log.h"
#include "missing.h"
#include "parse-util.h"
#include "path-util.h"
#ifdef HAVE_SECCOMP
#include "seccomp-util.h"

View File

@ -67,6 +67,7 @@
#include "missing.h"
#include "mount-setup.h"
#include "pager.h"
#include "parse-util.h"
#include "process-util.h"
#include "selinux-setup.h"
#include "selinux-util.h"

View File

@ -62,6 +62,7 @@
#include "manager.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-lookup.h"
#include "path-util.h"
#include "process-util.h"

View File

@ -36,6 +36,7 @@
#include "mkdir.h"
#include "mount-setup.h"
#include "mount.h"
#include "parse-util.h"
#include "path-util.h"
#include "smack-util.h"
#include "special.h"

View File

@ -39,6 +39,7 @@
#include "load-fragment.h"
#include "log.h"
#include "manager.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "service.h"

View File

@ -19,9 +19,10 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "parse-util.h"
#include "show-status.h"
#include "string-util.h"
#include "util.h"
#include "show-status.h"
int parse_show_status(const char *v, ShowStatus *ret) {
int r;

View File

@ -37,6 +37,7 @@
#include "killall.h"
#include "log.h"
#include "missing.h"
#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "switch-root.h"

View File

@ -23,10 +23,12 @@
#include "bus-common-errors.h"
#include "dbus-snapshot.h"
#include "parse-util.h"
#include "parse-util.h"
#include "snapshot.h"
#include "string-util.h"
#include "unit-name.h"
#include "unit.h"
#include "snapshot.h"
static const UnitActiveState state_translation_table[_SNAPSHOT_STATE_MAX] = {
[SNAPSHOT_DEAD] = UNIT_INACTIVE,

View File

@ -23,6 +23,8 @@
typedef struct Snapshot Snapshot;
#include "unit.h"
struct Snapshot {
Unit meta;

View File

@ -43,6 +43,7 @@
#include "log.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "selinux-util.h"
#include "signal-util.h"

View File

@ -32,6 +32,7 @@
#include "fd-util.h"
#include "formats-util.h"
#include "fstab-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "special.h"
#include "string-util.h"

View File

@ -24,6 +24,7 @@
#include "bus-error.h"
#include "bus-util.h"
#include "dbus-timer.h"
#include "parse-util.h"
#include "special.h"
#include "string-util.h"
#include "timer.h"

View File

@ -44,6 +44,7 @@
#include "macro.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "set.h"

View File

@ -28,6 +28,7 @@
#include "hashmap.h"
#include "log.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"

View File

@ -32,6 +32,7 @@
#include "escape.h"
#include "fileio.h"
#include "log.h"
#include "parse-util.h"
#include "path-util.h"
#include "string-util.h"
#include "strv.h"

View File

@ -24,6 +24,7 @@
#include "unit-name.h"
#include "mkdir.h"
#include "string-util.h"
#include "parse-util.h"
static const char *arg_dest = "/tmp";
static char **arg_mask = NULL;

View File

@ -30,6 +30,7 @@
#include "hashmap.h"
#include "log.h"
#include "pager.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"

View File

@ -26,17 +26,18 @@
#include "ask-password-api.h"
#include "copy.h"
#include "fd-util.h"
#include "fileio.h"
#include "hostname-util.h"
#include "locale-util.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "random-util.h"
#include "string-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "time-util.h"
#include "string-util.h"
#include "fd-util.h"
static char *arg_root = NULL;
static char *arg_locale = NULL; /* $LANG */

View File

@ -37,6 +37,7 @@
#include "bus-util.h"
#include "device-util.h"
#include "fd-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"

View File

@ -31,6 +31,7 @@
#include "log.h"
#include "mkdir.h"
#include "mount-setup.h"
#include "parse-util.h"
#include "path-util.h"
#include "special.h"
#include "string-util.h"

View File

@ -37,6 +37,7 @@
#include "gpt.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "special.h"
#include "string-util.h"

View File

@ -24,16 +24,17 @@
#include <unistd.h>
#include <sys/utsname.h>
#include "util.h"
#include "strv.h"
#include "def.h"
#include "virt.h"
#include "env-util.h"
#include "fileio-label.h"
#include "bus-util.h"
#include "def.h"
#include "env-util.h"
#include "event-util.h"
#include "selinux-util.h"
#include "fileio-label.h"
#include "hostname-util.h"
#include "parse-util.h"
#include "selinux-util.h"
#include "strv.h"
#include "util.h"
#include "virt.h"
#define VALID_DEPLOYMENT_CHARS (DIGITS LETTERS "-.:")

View File

@ -32,6 +32,7 @@
#include "machine-pool.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "signal-util.h"

View File

@ -24,6 +24,7 @@
#include "fd-util.h"
#include "io-util.h"
#include "machine-pool.h"
#include "parse-util.h"
#include "pull-job.h"
#include "string-util.h"
#include "strv.h"

View File

@ -27,6 +27,7 @@
#include "hostname-util.h"
#include "import-util.h"
#include "machine-image.h"
#include "parse-util.h"
#include "pull-dkr.h"
#include "pull-raw.h"
#include "pull-tar.h"

View File

@ -40,6 +40,7 @@
#include "log.h"
#include "logs-show.h"
#include "microhttpd-util.h"
#include "parse-util.h"
#include "sigbus.h"
#include "util.h"

View File

@ -22,6 +22,7 @@
#include "fd-util.h"
#include "journal-remote-parse.h"
#include "journald-native.h"
#include "parse-util.h"
#include "string-util.h"
#define LINE_CHUNK 8*1024u

View File

@ -44,6 +44,7 @@
#include "journal-remote.h"
#include "journald-native.h"
#include "macro.h"
#include "parse-util.h"
#include "signal-util.h"
#include "socket-util.h"
#include "string-util.h"

View File

@ -34,6 +34,7 @@
#include "journal-upload.h"
#include "log.h"
#include "mkdir.h"
#include "parse-util.h"
#include "sigbus.h"
#include "signal-util.h"
#include "string-util.h"

View File

@ -29,6 +29,7 @@
#include "sd-journal.h"
#include "fd-util.h"
#include "parse-util.h"
#include "string-util.h"
#include "util.h"

View File

@ -47,6 +47,7 @@
#include "log.h"
#include "macro.h"
#include "mkdir.h"
#include "parse-util.h"
#include "process-util.h"
#include "special.h"
#include "stacktrace.h"

View File

@ -34,6 +34,7 @@
#include "log.h"
#include "macro.h"
#include "pager.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "set.h"
@ -41,8 +42,8 @@
#include "signal-util.h"
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"
#include "user-util.h"
#include "util.h"
static enum {
ACTION_NONE,

View File

@ -35,6 +35,7 @@
#include "journal-def.h"
#include "journal-file.h"
#include "lookup3.h"
#include "parse-util.h"
#include "random-util.h"
#include "string-util.h"

View File

@ -29,6 +29,7 @@
#include "journal-def.h"
#include "journal-file.h"
#include "journal-vacuum.h"
#include "parse-util.h"
#include "string-util.h"
#include "util.h"

View File

@ -56,6 +56,7 @@
#include "logs-show.h"
#include "mkdir.h"
#include "pager.h"
#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "sigbus.h"

View File

@ -23,13 +23,14 @@
#include <fcntl.h>
#include <sys/socket.h>
#include "fd-util.h"
#include "fileio.h"
#include "journald-server.h"
#include "journald-console.h"
#include "formats-util.h"
#include "journald-console.h"
#include "journald-server.h"
#include "parse-util.h"
#include "process-util.h"
#include "terminal-util.h"
#include "fd-util.h"
static bool prefix_timestamp(void) {

View File

@ -34,6 +34,7 @@
#include "journald-kmsg.h"
#include "journald-server.h"
#include "journald-syslog.h"
#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"

View File

@ -32,6 +32,7 @@
#include "journald-syslog.h"
#include "journald-wall.h"
#include "memfd-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "selinux-util.h"
#include "socket-util.h"

View File

@ -54,6 +54,7 @@
#include "journald-syslog.h"
#include "missing.h"
#include "mkdir.h"
#include "parse-util.h"
#include "process-util.h"
#include "rm-rf.h"
#include "selinux-util.h"

View File

@ -39,6 +39,7 @@
#include "journald-syslog.h"
#include "journald-wall.h"
#include "mkdir.h"
#include "parse-util.h"
#include "selinux-util.h"
#include "socket-util.h"
#include "string-util.h"

View File

@ -21,6 +21,7 @@
#include "compress.h"
#include "macro.h"
#include "parse-util.h"
#include "random-util.h"
#include "string-util.h"
#include "util.h"

View File

@ -22,6 +22,7 @@
#include "sd-journal.h"
#include "log.h"
#include "parse-util.h"
#include "rm-rf.h"
#include "util.h"

View File

@ -24,11 +24,13 @@
#include <fcntl.h>
#include "sd-journal.h"
#include "journal-file.h"
#include "journal-vacuum.h"
#include "util.h"
#include "log.h"
#include "parse-util.h"
#include "rm-rf.h"
#include "util.h"
/* This program tests skipping around in a multi-file journal.
*/

View File

@ -19,16 +19,18 @@
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <unistd.h>
#include <fcntl.h>
#include <unistd.h>
#include "sd-journal.h"
#include "util.h"
#include "log.h"
#include "macro.h"
#include "rm-rf.h"
#include "journal-file.h"
#include "journal-internal.h"
#include "log.h"
#include "macro.h"
#include "parse-util.h"
#include "rm-rf.h"
#include "util.h"
#define N_ENTRIES 200

View File

@ -29,12 +29,13 @@
#include "conf-parser.h"
#include "dhcp-lease-internal.h"
#include "log.h"
#include "network-internal.h"
#include "parse-util.h"
#include "siphash24.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "util.h"
#include "network-internal.h"
const char *net_get_name(struct udev_device *device) {
const char *name, *field;

View File

@ -34,6 +34,7 @@
#include "hostname-util.h"
#include "in-addr-util.h"
#include "network-internal.h"
#include "parse-util.h"
#include "unaligned.h"
int sd_dhcp_lease_get_address(sd_dhcp_lease *lease, struct in_addr *addr) {

View File

@ -32,6 +32,7 @@
#include "event-util.h"
#include "in-addr-util.h"
#include "netlink-util.h"
#include "parse-util.h"
#include "string-util.h"
#include "util.h"

View File

@ -32,6 +32,7 @@
#include "fd-util.h"
#include "fileio.h"
#include "formats-util.h"
#include "parse-util.h"
#include "process-util.h"
#include "string-util.h"
#include "strv.h"

View File

@ -45,6 +45,7 @@
#include "fileio.h"
#include "formats-util.h"
#include "memfd-util.h"
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"

View File

@ -33,6 +33,7 @@
#include "fd-util.h"
#include "log.h"
#include "pager.h"
#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "strv.h"

View File

@ -48,6 +48,7 @@
#include "hostname-util.h"
#include "macro.h"
#include "missing.h"
#include "parse-util.h"
#include "string-util.h"
#include "strv.h"
#include "util.h"

View File

@ -36,6 +36,7 @@
#include "sd-daemon.h"
#include "fd-util.h"
#include "parse-util.h"
#include "path-util.h"
#include "socket-util.h"
#include "strv.h"

View File

@ -32,6 +32,7 @@
#include "hashmap.h"
#include "macro.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "refcnt.h"
#include "set.h"

View File

@ -31,6 +31,7 @@
#include "fileio.h"
#include "hashmap.h"
#include "macro.h"
#include "parse-util.h"
#include "path-util.h"
#include "set.h"
#include "string-util.h"

View File

@ -36,6 +36,7 @@
#include "io-util.h"
#include "login-util.h"
#include "macro.h"
#include "parse-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "strv.h"

View File

@ -33,6 +33,7 @@
#include "strv.h"
#include "util.h"
#include "fd-util.h"
#include "parse-util.h"
_public_ int sd_network_get_operational_state(char **state) {
_cleanup_free_ char *s = NULL;

View File

@ -41,6 +41,7 @@
#include "device-util.h"
#include "libudev-device-internal.h"
#include "libudev-private.h"
#include "parse-util.h"
/**
* SECTION:libudev-device

View File

@ -35,6 +35,7 @@
#include "logs-show.h"
#include "macro.h"
#include "pager.h"
#include "parse-util.h"
#include "process-util.h"
#include "signal-util.h"
#include "spawn-polkit-agent.h"

View File

@ -30,6 +30,7 @@
#include "formats-util.h"
#include "logind-inhibit.h"
#include "mkdir.h"
#include "parse-util.h"
#include "string-util.h"
#include "user-util.h"
#include "util.h"

View File

@ -31,6 +31,7 @@
#include "logind-acl.h"
#include "logind-seat.h"
#include "mkdir.h"
#include "parse-util.h"
#include "string-util.h"
#include "terminal-util.h"
#include "util.h"

View File

@ -41,6 +41,7 @@
#include "io-util.h"
#include "logind-session.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "terminal-util.h"
#include "user-util.h"

View File

@ -36,6 +36,7 @@
#include "label.h"
#include "logind-user.h"
#include "mkdir.h"
#include "parse-util.h"
#include "path-util.h"
#include "rm-rf.h"
#include "smack-util.h"

View File

@ -41,6 +41,7 @@
#include "hostname-util.h"
#include "login-util.h"
#include "macro.h"
#include "parse-util.h"
#include "socket-util.h"
#include "strv.h"
#include "terminal-util.h"

View File

@ -35,6 +35,7 @@
#include "machine-dbus.h"
#include "machine.h"
#include "mkdir.h"
#include "parse-util.h"
#include "special.h"
#include "terminal-util.h"
#include "unit-name.h"

View File

@ -48,6 +48,7 @@
#include "macro.h"
#include "mkdir.h"
#include "pager.h"
#include "parse-util.h"
#include "path-util.h"
#include "process-util.h"
#include "ptyfwd.h"

View File

@ -36,6 +36,7 @@
#include "local-addresses.h"
#include "netlink-util.h"
#include "pager.h"
#include "parse-util.h"
#include "socket-util.h"
#include "string-util.h"
#include "strv.h"

View File

@ -24,12 +24,13 @@
#include "conf-parser.h"
#include "firewall-util.h"
#include "netlink-util.h"
#include "networkd-address.h"
#include "networkd.h"
#include "parse-util.h"
#include "set.h"
#include "string-util.h"
#include "utf8.h"
#include "util.h"
#include "networkd-address.h"
int address_new(Address **ret) {
_cleanup_address_free_ Address *address = NULL;

View File

@ -22,8 +22,9 @@
#include "bus-util.h"
#include "strv.h"
#include "networkd.h"
#include "networkd-link.h"
#include "networkd.h"
#include "parse-util.h"
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_operational_state, link_operstate, LinkOperationalState);
static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_administrative_state, link_state, LinkState);

Some files were not shown because too many files have changed in this diff Show More