summaryrefslogtreecommitdiff
path: root/src/udev/udevd.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2013-06-14 22:56:39 +0200
committerTom Gundersen <teg@jklm.no>2013-07-08 21:26:24 +0200
commitedeb68c53f1cdc452016b4c8512586a70b1262e3 (patch)
tree66e5e1f5048756b501d5642dc1eb57c8745bd1a8 /src/udev/udevd.c
parentfec79699da51a0815ff01e14abcc94b1f6d3926a (diff)
static-nodes: move creation of static nodes from udevd to tmpfiles
As of kmod v14, it is possible to export the static node information from /lib/modules/`uname -r`/modules.devname in tmpfiles.d(5) format. Use this functionality to let systemd-tmpfilesd create the static device nodes at boot, and drop the functionality from systemd-udevd. As an effect of this we can move from systemd-udevd to systemd-tmpfiles-setup-dev: * the conditional CAP_MKNOD (replaced by checking if /sys is mounted rw) * ordering before local-fs-pre.target (see 89d09e1b5c65a2d97840f682e0932c8bb499f166)
Diffstat (limited to 'src/udev/udevd.c')
-rw-r--r--src/udev/udevd.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/udev/udevd.c b/src/udev/udevd.c
index 7d13b4f532..c4127cd03b 100644
--- a/src/udev/udevd.c
+++ b/src/udev/udevd.c
@@ -812,77 +812,6 @@ static void handle_signal(struct udev *udev, int signo)
}
}
-static void static_dev_create_from_modules(struct udev *udev)
-{
- struct utsname kernel;
- char modules[UTIL_PATH_SIZE];
- char buf[4096];
- FILE *f;
-
- if (uname(&kernel) < 0) {
- log_error("uname failed: %m");
- return;
- }
-
- strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL);
- f = fopen(modules, "re");
- if (f == NULL)
- return;
-
- while (fgets(buf, sizeof(buf), f) != NULL) {
- char *s;
- const char *modname;
- const char *devname;
- const char *devno;
- int maj, min;
- char type;
- mode_t mode;
- char filename[UTIL_PATH_SIZE];
-
- if (buf[0] == '#')
- continue;
-
- modname = buf;
- s = strchr(modname, ' ');
- if (s == NULL)
- continue;
- s[0] = '\0';
-
- devname = &s[1];
- s = strchr(devname, ' ');
- if (s == NULL)
- continue;
- s[0] = '\0';
-
- devno = &s[1];
- s = strchr(devno, ' ');
- if (s == NULL)
- s = strchr(devno, '\n');
- if (s != NULL)
- s[0] = '\0';
- if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3)
- continue;
-
- mode = 0600;
- if (type == 'c')
- mode |= S_IFCHR;
- else if (type == 'b')
- mode |= S_IFBLK;
- else
- continue;
-
- strscpyl(filename, sizeof(filename), "/dev/", devname, NULL);
- mkdir_parents_label(filename, 0755);
- label_context_set(filename, mode);
- log_debug("mknod '%s' %c%u:%u\n", filename, type, maj, min);
- if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST)
- utimensat(AT_FDCWD, filename, NULL, 0);
- label_context_clear();
- }
-
- fclose(f);
-}
-
static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink)
{
int ctrl = -1, netlink = -1;
@@ -1067,7 +996,6 @@ int main(int argc, char *argv[])
mkdir("/run/udev", 0755);
dev_setup(NULL);
- static_dev_create_from_modules(udev);
/* before opening new files, make sure std{in,out,err} fds are in a sane state */
if (daemonize) {