diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2012-11-15 23:11:59 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2012-11-15 23:11:59 -0500 |
commit | a2b01dbfa5730e947b0863366e411a463ab1aa20 (patch) | |
tree | f3e0180212749ace7b422f38416544895545d2d6 /src | |
parent | eb203b01c9ee729e603289a63f881d9866f61ea6 (diff) |
src/libudev: successfully builds
Diffstat (limited to 'src')
-rw-r--r-- | src/libudev/Makefile.am | 6 | ||||
-rw-r--r-- | src/libudev/libudev-device.c | 36 | ||||
-rw-r--r-- | src/libudev/libudev-monitor.c | 2 | ||||
-rw-r--r-- | src/libudev/libudev.sym | 110 | ||||
-rw-r--r-- | src/shared/conf-files.h | 31 | ||||
-rw-r--r-- | src/shared/label.h | 47 | ||||
-rw-r--r-- | src/shared/missing.h | 8 | ||||
-rw-r--r-- | src/shared/path-util.h | 45 | ||||
-rw-r--r-- | src/shared/socket-util.h | 99 | ||||
-rw-r--r-- | src/shared/sparse-endian.h | 87 | ||||
-rw-r--r-- | src/shared/strbuf.h | 56 | ||||
-rw-r--r-- | src/shared/strv.h | 84 | ||||
-rw-r--r-- | src/udev/Makefile.am | 1 |
13 files changed, 454 insertions, 158 deletions
diff --git a/src/libudev/Makefile.am b/src/libudev/Makefile.am index 6db152466b..eeed39bf11 100644 --- a/src/libudev/Makefile.am +++ b/src/libudev/Makefile.am @@ -28,8 +28,7 @@ libudev_la_CFLAGS = \ libudev_la_LDFLAGS = \ $(AM_LDFLAGS) \ - -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ - -Wl,--version-script=libudev.sym + -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) noinst_LTLIBRARIES = \ libudev-private.la @@ -48,8 +47,7 @@ pkgconfiglib_DATA = \ libudev.pc EXTRA_DIST = \ - libudev.pc.in \ - libudev.sym + libudev.pc.in CLEANFILES = \ libudev.pc diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index acf8e24d15..6423651b35 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -875,42 +875,6 @@ found: return udev_device_new_from_syspath(udev, path); } -/** - * udev_device_new_from_environment - * @udev: udev library context - * - * Create new udev device, and fill in information from the - * current process environment. This only works reliable if - * the process is called from a udev rule. It is usually used - * for tools executed from IMPORT= rules. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, if it does not exist - **/ -_public_ struct udev_device *udev_device_new_from_environment(struct udev *udev) -{ - int i; - struct udev_device *udev_device; - - udev_device = udev_device_new(udev); - if (udev_device == NULL) - return NULL; - udev_device_set_info_loaded(udev_device); - - for (i = 0; environ[i] != NULL; i++) - udev_device_add_property_from_string_parse(udev_device, environ[i]); - - if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { - udev_dbg(udev, "missing values, invalid device\n"); - udev_device_unref(udev_device); - udev_device = NULL; - } - - return udev_device; -} - static struct udev_device *device_new_from_parent(struct udev_device *udev_device) { struct udev_device *udev_device_parent = NULL; diff --git a/src/libudev/libudev-monitor.c b/src/libudev/libudev-monitor.c index b02ea8808c..7c5d9d6e45 100644 --- a/src/libudev/libudev-monitor.c +++ b/src/libudev/libudev-monitor.c @@ -17,6 +17,8 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>. ***/ +#define _GNU_SOURCE + #include <stdio.h> #include <stdlib.h> #include <stddef.h> diff --git a/src/libudev/libudev.sym b/src/libudev/libudev.sym deleted file mode 100644 index df6a1aeddf..0000000000 --- a/src/libudev/libudev.sym +++ /dev/null @@ -1,110 +0,0 @@ -/*** - This file is part of systemd. - - 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. -***/ - -LIBUDEV_183 { -global: - udev_device_get_action; - udev_device_get_devlinks_list_entry; - udev_device_get_devnode; - udev_device_get_devnum; - udev_device_get_devpath; - udev_device_get_devtype; - udev_device_get_driver; - udev_device_get_is_initialized; - udev_device_get_parent; - udev_device_get_parent_with_subsystem_devtype; - udev_device_get_properties_list_entry; - udev_device_get_property_value; - udev_device_get_seqnum; - udev_device_get_subsystem; - udev_device_get_sysattr_list_entry; - udev_device_get_sysattr_value; - udev_device_get_sysname; - udev_device_get_sysnum; - udev_device_get_syspath; - udev_device_get_tags_list_entry; - udev_device_get_udev; - udev_device_get_usec_since_initialized; - udev_device_has_tag; - udev_device_new_from_devnum; - udev_device_new_from_environment; - udev_device_new_from_subsystem_sysname; - udev_device_new_from_syspath; - udev_device_ref; - udev_device_unref; - udev_enumerate_add_match_is_initialized; - udev_enumerate_add_match_parent; - udev_enumerate_add_match_property; - udev_enumerate_add_match_subsystem; - udev_enumerate_add_match_sysattr; - udev_enumerate_add_match_sysname; - udev_enumerate_add_match_tag; - udev_enumerate_add_nomatch_subsystem; - udev_enumerate_add_nomatch_sysattr; - udev_enumerate_add_syspath; - udev_enumerate_get_list_entry; - udev_enumerate_get_udev; - udev_enumerate_new; - udev_enumerate_ref; - udev_enumerate_scan_devices; - udev_enumerate_scan_subsystems; - udev_enumerate_unref; - udev_get_log_priority; - udev_get_userdata; - udev_list_entry_get_by_name; - udev_list_entry_get_name; - udev_list_entry_get_next; - udev_list_entry_get_value; - udev_monitor_enable_receiving; - udev_monitor_filter_add_match_subsystem_devtype; - udev_monitor_filter_add_match_tag; - udev_monitor_filter_remove; - udev_monitor_filter_update; - udev_monitor_get_fd; - udev_monitor_get_udev; - udev_monitor_new_from_netlink; - udev_monitor_new_from_socket; - udev_monitor_receive_device; - udev_monitor_ref; - udev_monitor_set_receive_buffer_size; - udev_monitor_unref; - udev_new; - udev_queue_get_kernel_seqnum; - udev_queue_get_queue_is_empty; - udev_queue_get_queued_list_entry; - udev_queue_get_seqnum_is_finished; - udev_queue_get_seqnum_sequence_is_finished; - udev_queue_get_udev; - udev_queue_get_udev_is_active; - udev_queue_get_udev_seqnum; - udev_queue_new; - udev_queue_ref; - udev_queue_unref; - udev_ref; - udev_set_log_fn; - udev_set_log_priority; - udev_set_userdata; - udev_unref; - udev_util_encode_string; -local: - *; -}; - -LIBUDEV_189 { -global: - udev_device_new_from_device_id; -} LIBUDEV_183; - -LIBUDEV_196 { -global: - udev_hwdb_new; - udev_hwdb_ref; - udev_hwdb_unref; - udev_hwdb_get_properties_list_entry; -} LIBUDEV_189; diff --git a/src/shared/conf-files.h b/src/shared/conf-files.h new file mode 100644 index 0000000000..f37ee1f3db --- /dev/null +++ b/src/shared/conf-files.h @@ -0,0 +1,31 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#ifndef fooconffileshfoo +#define fooconffileshfoo + +/*** + This file is part of systemd. + + Copyright 2010-2012 Lennart Poettering + Copyright 2010-2012 Kay Sievers + + 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 "macro.h" + +int conf_files_list(char ***strv, const char *suffix, const char *dir, ...); +int conf_files_list_strv(char ***strv, const char *suffix, const char **dirs); + +#endif diff --git a/src/shared/label.h b/src/shared/label.h new file mode 100644 index 0000000000..1220b18965 --- /dev/null +++ b/src/shared/label.h @@ -0,0 +1,47 @@ +/*-*- 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 <sys/types.h> +#include <stdbool.h> +#include <sys/socket.h> + +int label_init(const char *prefix); +void label_finish(void); + +int label_fix(const char *path, bool ignore_enoent, bool ignore_erofs); + +int label_socket_set(const char *label); +void label_socket_clear(void); + +int label_context_set(const char *path, mode_t mode); +void label_context_clear(void); + +void label_free(const char *label); + +int label_get_create_label_from_exe(const char *exe, char **label); + +int label_mkdir(const char *path, mode_t mode, bool apply); + +void label_retest_selinux(void); + +int label_bind(int fd, const struct sockaddr *addr, socklen_t addrlen); diff --git a/src/shared/missing.h b/src/shared/missing.h index 3777cf69b2..0c8ae7f381 100644 --- a/src/shared/missing.h +++ b/src/shared/missing.h @@ -242,14 +242,6 @@ static inline int name_to_handle_at(int fd, const char *name, struct file_handle } #endif -#ifndef HAVE_SECURE_GETENV -# ifdef HAVE___SECURE_GETENV -# define secure_getenv __secure_getenv -# else -# error neither secure_getenv nor __secure_getenv are available -# endif -#endif - #ifndef CIFS_MAGIC_NUMBER #define CIFS_MAGIC_NUMBER 0xFF534D42 #endif diff --git a/src/shared/path-util.h b/src/shared/path-util.h new file mode 100644 index 0000000000..e81821a28f --- /dev/null +++ b/src/shared/path-util.h @@ -0,0 +1,45 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#ifndef foopathutilhfoo +#define foopathutilhfoo + +/*** + This file is part of systemd. + + Copyright 2010-2012 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 "stdbool.h" + +bool is_path(const char *p); +char **path_split_and_make_absolute(const char *p); +char *path_get_file_name(const char *p); +int path_get_parent(const char *path, char **parent); +bool path_is_absolute(const char *p); +char *path_make_absolute(const char *p, const char *prefix); +char *path_make_absolute_cwd(const char *p); +char *path_kill_slashes(char *path); +char *path_startswith(const char *path, const char *prefix); +bool path_equal(const char *a, const char *b); + +char **path_strv_make_absolute_cwd(char **l); +char **path_strv_canonicalize(char **l); +char **path_strv_remove_empty(char **l); + +int path_is_mount_point(const char *path, bool allow_symlink); +int path_is_read_only_fs(const char *path); + +#endif diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h new file mode 100644 index 0000000000..04cfb83f5a --- /dev/null +++ b/src/shared/socket-util.h @@ -0,0 +1,99 @@ +/*-*- 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 <sys/socket.h> +#include <netinet/in.h> +#include <sys/un.h> +#include <net/if.h> +#include <asm/types.h> +#include <linux/netlink.h> + +#include "macro.h" +#include "util.h" + +union sockaddr_union { + struct sockaddr sa; + struct sockaddr_in in4; + struct sockaddr_in6 in6; + struct sockaddr_un un; + struct sockaddr_nl nl; + struct sockaddr_storage storage; +}; + +typedef struct SocketAddress { + union sockaddr_union sockaddr; + + /* We store the size here explicitly due to the weird + * sockaddr_un semantics for abstract sockets */ + socklen_t size; + + /* Socket type, i.e. SOCK_STREAM, SOCK_DGRAM, ... */ + int type; + + /* Socket protocol, IPPROTO_xxx, usually 0, except for netlink */ + int protocol; +} SocketAddress; + +typedef enum SocketAddressBindIPv6Only { + SOCKET_ADDRESS_DEFAULT, + SOCKET_ADDRESS_BOTH, + SOCKET_ADDRESS_IPV6_ONLY, + _SOCKET_ADDRESS_BIND_IPV6_ONLY_MAX, + _SOCKET_ADDRESS_BIND_IPV6_ONLY_INVALID = -1 +} SocketAddressBindIPv6Only; + +#define socket_address_family(a) ((a)->sockaddr.sa.sa_family) + +int socket_address_parse(SocketAddress *a, const char *s); +int socket_address_parse_netlink(SocketAddress *a, const char *s); +int socket_address_print(const SocketAddress *a, char **p); +int socket_address_verify(const SocketAddress *a); + +bool socket_address_can_accept(const SocketAddress *a); + +int socket_address_listen( + const SocketAddress *a, + int backlog, + SocketAddressBindIPv6Only only, + const char *bind_to_device, + bool free_bind, + bool transparent, + mode_t directory_mode, + mode_t socket_mode, + const char *label, + int *ret); + +bool socket_address_is(const SocketAddress *a, const char *s, int type); +bool socket_address_is_netlink(const SocketAddress *a, const char *s); + +bool socket_address_equal(const SocketAddress *a, const SocketAddress *b); + +bool socket_address_needs_mount(const SocketAddress *a, const char *prefix); + +const char* socket_address_bind_ipv6_only_to_string(SocketAddressBindIPv6Only b); +SocketAddressBindIPv6Only socket_address_bind_ipv6_only_from_string(const char *s); + +int netlink_family_to_string_alloc(int b, char **s); +int netlink_family_from_string(const char *s); + +bool socket_ipv6_is_supported(void); diff --git a/src/shared/sparse-endian.h b/src/shared/sparse-endian.h new file mode 100644 index 0000000000..eb4dbf3615 --- /dev/null +++ b/src/shared/sparse-endian.h @@ -0,0 +1,87 @@ +/* Copyright (c) 2012 Josh Triplett <josh@joshtriplett.org> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + */ +#ifndef SPARSE_ENDIAN_H +#define SPARSE_ENDIAN_H + +#include <endian.h> +#include <stdint.h> + +#ifdef __CHECKER__ +#define __bitwise __attribute__((bitwise)) +#define __force __attribute__((force)) +#else +#define __bitwise +#define __force +#endif + +typedef uint16_t __bitwise le16_t; +typedef uint16_t __bitwise be16_t; +typedef uint32_t __bitwise le32_t; +typedef uint32_t __bitwise be32_t; +typedef uint64_t __bitwise le64_t; +typedef uint64_t __bitwise be64_t; + +#undef htobe16 +#undef htole16 +#undef be16toh +#undef le16toh +#undef htobe32 +#undef htole32 +#undef be32toh +#undef le32toh +#undef htobe64 +#undef htole64 +#undef be64toh +#undef le64toh + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define bswap_16_on_le(x) __bswap_16(x) +#define bswap_32_on_le(x) __bswap_32(x) +#define bswap_64_on_le(x) __bswap_64(x) +#define bswap_16_on_be(x) (x) +#define bswap_32_on_be(x) (x) +#define bswap_64_on_be(x) (x) +#elif __BYTE_ORDER == __BIG_ENDIAN +#define bswap_16_on_le(x) (x) +#define bswap_32_on_le(x) (x) +#define bswap_64_on_le(x) (x) +#define bswap_16_on_be(x) __bswap_16(x) +#define bswap_32_on_be(x) __bswap_32(x) +#define bswap_64_on_be(x) __bswap_64(x) +#endif + +static inline le16_t htole16(uint16_t value) { return (le16_t __force) bswap_16_on_be(value); } +static inline le32_t htole32(uint32_t value) { return (le32_t __force) bswap_32_on_be(value); } +static inline le64_t htole64(uint64_t value) { return (le64_t __force) bswap_64_on_be(value); } + +static inline be16_t htobe16(uint16_t value) { return (be16_t __force) bswap_16_on_le(value); } +static inline be32_t htobe32(uint32_t value) { return (be32_t __force) bswap_32_on_le(value); } +static inline be64_t htobe64(uint64_t value) { return (be64_t __force) bswap_64_on_le(value); } + +static inline uint16_t le16toh(le16_t value) { return bswap_16_on_be((uint16_t __force)value); } +static inline uint32_t le32toh(le32_t value) { return bswap_32_on_be((uint32_t __force)value); } +static inline uint64_t le64toh(le64_t value) { return bswap_64_on_be((uint64_t __force)value); } + +static inline uint16_t be16toh(be16_t value) { return bswap_16_on_le((uint16_t __force)value); } +static inline uint32_t be32toh(be32_t value) { return bswap_32_on_le((uint32_t __force)value); } +static inline uint64_t be64toh(be64_t value) { return bswap_64_on_le((uint64_t __force)value); } + +#endif /* SPARSE_ENDIAN_H */ diff --git a/src/shared/strbuf.h b/src/shared/strbuf.h new file mode 100644 index 0000000000..2347fd4328 --- /dev/null +++ b/src/shared/strbuf.h @@ -0,0 +1,56 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2012 Kay Sievers <kay@vrfy.org> + + 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 <stdarg.h> +#include <stdint.h> +#include <stdbool.h> + +struct strbuf { + char *buf; + size_t len; + struct strbuf_node *root; + + size_t nodes_count; + size_t in_count; + size_t in_len; + size_t dedup_len; + size_t dedup_count; +}; + +struct strbuf_node { + size_t value_off; + size_t value_len; + + struct strbuf_child_entry *children; + uint8_t children_count; +}; + +struct strbuf_child_entry { + uint8_t c; + struct strbuf_node *child; +}; + +struct strbuf *strbuf_new(void); +ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len); +void strbuf_complete(struct strbuf *str); +void strbuf_cleanup(struct strbuf *str); diff --git a/src/shared/strv.h b/src/shared/strv.h new file mode 100644 index 0000000000..45558d8960 --- /dev/null +++ b/src/shared/strv.h @@ -0,0 +1,84 @@ +/*-*- 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 <stdarg.h> +#include <stdbool.h> + +#include "macro.h" + +char *strv_find(char **l, const char *name); +char *strv_find_prefix(char **l, const char *name); + +void strv_free(char **l); +void strv_freep(char ***l); +char **strv_copy(char **l) _malloc_; +unsigned strv_length(char **l); + +char **strv_merge(char **a, char **b); +char **strv_merge_concat(char **a, char **b, const char *suffix); +char **strv_append(char **l, const char *s); + +char **strv_remove(char **l, const char *s); +char **strv_remove_prefix(char **l, const char *s); +char **strv_uniq(char **l); + +#define strv_contains(l, s) (!!strv_find((l), (s))) + +char **strv_new(const char *x, ...) _sentinel_ _malloc_; +char **strv_new_ap(const char *x, va_list ap) _malloc_; + +static inline const char* STRV_IFNOTNULL(const char *x) { + return x ? x : (const char *) -1; +} + +static inline bool strv_isempty(char **l) { + return !l || !*l; +} + +char **strv_split(const char *s, const char *separator) _malloc_; +char **strv_split_quoted(const char *s) _malloc_; + +char *strv_join(char **l, const char *separator) _malloc_; + +char **strv_env_merge(unsigned n_lists, ...); +char **strv_env_delete(char **x, unsigned n_lists, ...); + +char **strv_env_set(char **x, const char *p); +char **strv_env_unset(char **l, const char *p); + +char *strv_env_get_with_length(char **l, const char *name, size_t k); +char *strv_env_get(char **x, const char *n); + +char **strv_env_clean(char **l); + +char **strv_parse_nulstr(const char *s, size_t l); + +bool strv_overlap(char **a, char **b); + +#define STRV_FOREACH(s, l) \ + for ((s) = (l); (s) && *(s); (s)++) + +#define STRV_FOREACH_BACKWARDS(s, l) \ + for (; (l) && ((s) >= (l)); (s)--) + +char **strv_sort(char **l); diff --git a/src/udev/Makefile.am b/src/udev/Makefile.am index 3c2153916e..cd12962418 100644 --- a/src/udev/Makefile.am +++ b/src/udev/Makefile.am @@ -5,6 +5,7 @@ rootprefix=@rootprefix@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -DROOTPREFIX=\"$(rootprefix)\" \ + -DUDEVLIBEXECDIR=\"$(udevlibexecdir)\" \ -I $(top_srcdir)/src/libudev \ -I $(top_srcdir)/src/udev \ -I $(top_srcdir)/src/shared |