summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Stakenvicius <axs@gentoo.org>2013-07-31 12:52:39 -0400
committerIan Stakenvicius <axs@gentoo.org>2013-07-31 13:07:33 -0400
commit9a769172c3af6e9c51b7c55cb9df9fddcc13dbc6 (patch)
tree7ed816e3cf3b2cd8160e9e14723070f13d0f635e /src
parentaa417a4d83999f6d7f092161d5c411b8cbce9977 (diff)
Revert "static-nodes: remove creation of static nodes if HAVE_LIBKMOD"
This reverts commit aa417a4d83999f6d7f092161d5c411b8cbce9977. Preface: The kmod+tmpfiles static dev-node creation requires two commands to be executed at runtime -- it is not something that will automatically occur without a system's setup being explicitly designed or changed so that these commands are executed. Preface2: In order for the kmod+tmpfiles static dev-node creation to work properly, that -must- be executed at startup before {systemd-,}udevd starts. The reason for this is because udevd will only set permissions on those files at startup, and so if udevd starts beforehand then these nodes will exist with permissions that are (probably) too restrictive. The function in udevd which creates static-nodes is non-fatal and only updates mtime on the devnodes if they already exist. As such, if a system is configured to execute kmod+tmpfiles to create static-nodes, because that must occur first, eudev's udevd will not conflict. Also, if a system does not execute kmod+tmpfiles, then eudev will still create the static devnodes, even if kmod-14 or higher is installed. There *may* be a conflict if kmod+tmpfiles is executed after udevd starts, but as per "preface2" this is not a supported configuration. Signed-off-by: Ian Stakenvicius <axs@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/libudev/strv.c37
-rw-r--r--src/libudev/strv.h3
-rw-r--r--src/libudev/util.c35
-rw-r--r--src/libudev/util.h4
-rw-r--r--src/udev/udevd.c4
5 files changed, 0 insertions, 83 deletions
diff --git a/src/libudev/strv.c b/src/libudev/strv.c
index 3619701e9d..041e20d700 100644
--- a/src/libudev/strv.c
+++ b/src/libudev/strv.c
@@ -142,43 +142,6 @@ char **strv_new(const char *x, ...) {
return r;
}
-int strv_push(char ***l, char *value) {
- char **c;
- unsigned n;
-
- if (!value)
- return 0;
-
- n = strv_length(*l);
- c = realloc(*l, sizeof(char*) * (n + 2));
- if (!c)
- return -ENOMEM;
-
- c[n] = value;
- c[n+1] = NULL;
-
- *l = c;
- return 0;
-}
-
-int strv_extend(char ***l, const char *value) {
- char *v;
- int r;
-
- if (!value)
- return 0;
-
- v = strdup(value);
- if (!v)
- return -ENOMEM;
-
- r = strv_push(l, v);
- if (r < 0)
- free(v);
-
- return r;
-}
-
char **strv_uniq(char **l) {
char **i;
diff --git a/src/libudev/strv.h b/src/libudev/strv.h
index 9fba94e566..d9e0e1c20b 100644
--- a/src/libudev/strv.h
+++ b/src/libudev/strv.h
@@ -36,9 +36,6 @@ static inline void strv_freep(char ***l) {
char **strv_copy(char * const *l);
unsigned strv_length(char * const *l) _pure_;
-int strv_extend(char ***l, const char *value);
-int strv_push(char ***l, char *value);
-
char **strv_remove(char **l, const char *s);
char **strv_uniq(char **l);
diff --git a/src/libudev/util.c b/src/libudev/util.c
index 61d000c350..f625cfe99b 100644
--- a/src/libudev/util.c
+++ b/src/libudev/util.c
@@ -664,41 +664,6 @@ int null_or_empty_path(const char *fn) {
return null_or_empty(&st);
}
-char hexchar(int x) {
- static const char table[16] = "0123456789abcdef";
-
- return table[x & 15];
-}
-
-char *xescape(const char *s, const char *bad) {
- char *r, *t;
- const char *f;
-
- /* Escapes all chars in bad, in addition to \ and all special
- * chars, in \xFF style escaping. May be reversed with
- * cunescape. */
-
- r = new(char, strlen(s) * 4 + 1);
- if (!r)
- return NULL;
-
- for (f = s, t = r; *f; f++) {
-
- if ((*f < ' ') || (*f >= 127) ||
- (*f == '\\') || strchr(bad, *f)) {
- *(t++) = '\\';
- *(t++) = 'x';
- *(t++) = hexchar(*f >> 4);
- *(t++) = hexchar(*f);
- } else
- *(t++) = *f;
- }
-
- *t = 0;
-
- return r;
-}
-
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) {
assert(de);
diff --git a/src/libudev/util.h b/src/libudev/util.h
index 7b6571ab10..60b300da3c 100644
--- a/src/libudev/util.h
+++ b/src/libudev/util.h
@@ -131,10 +131,6 @@ char *strnappend(const char *s, const char *suffix, size_t length);
char *truncate_nl(char *s);
-char hexchar(int x) _const_;
-
-char *xescape(const char *s, const char *bad);
-
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) _pure_;
bool ignore_file(const char *filename) _pure_;
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 26f3d846e1..a41c196991 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -811,7 +811,6 @@ static void handle_signal(struct udev *udev, int signo)
}
}
-#ifndef HAVE_LIBKMOD
static void static_dev_create_from_modules(struct udev *udev)
{
struct utsname kernel;
@@ -882,7 +881,6 @@ static void static_dev_create_from_modules(struct udev *udev)
fclose(f);
}
-#endif
/*
* read the kernel commandline, in case we need to get into debug mode
@@ -1035,9 +1033,7 @@ int main(int argc, char *argv[])
mkdir("/run/udev", 0755);
dev_setup(NULL);
-#ifndef HAVE_LIBKMOD
static_dev_create_from_modules(udev);
-#endif
/* before opening new files, make sure std{in,out,err} fds are in a sane state */
if (daemonize) {