]> err.no Git - systemd/commitdiff
device: make use of new libudev tags logic
authorLennart Poettering <lennart@poettering.net>
Fri, 21 May 2010 23:00:28 +0000 (01:00 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 21 May 2010 23:00:28 +0000 (01:00 +0200)
configure.ac
src/99-systemd.rules
src/device.c

index cccb0ee3cc26017f58c3a871ed3ed97473ba9bd9..ffdedeedff94d7e1d6c37a83be0d5060a2206290 100644 (file)
@@ -92,7 +92,7 @@ AC_CHECK_HEADERS([sys/capability.h], [], [AC_MSG_ERROR([*** POSIX caps headers n
 # This makes sure pkg.m4 is available.
 m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
 
-PKG_CHECK_MODULES(UDEV, [ libudev ])
+PKG_CHECK_MODULES(UDEV, [ libudev >= 154 ])
 AC_SUBST(UDEV_CFLAGS)
 AC_SUBST(UDEV_LIBS)
 
index 62aab85e39a8aeec65318e855b5bfacc9f23c0c1..70c0d8191a4b91f711a15264c16dc6ac11c2af67 100644 (file)
@@ -7,10 +7,10 @@
 
 ACTION!="add|change", GOTO="systemd_end"
 
-KERNEL=="tty[0-9]|tty1[0-2]", ENV{SYSTEMD_EXPOSE}="1"
-KERNEL=="ttyS*", ENV{SYSTEMD_EXPOSE}="1"
+KERNEL=="tty[0-9]|tty1[0-2]", TAG="systemd"
+KERNEL=="ttyS*", TAG="systemd"
 
-SUBSYSTEM=="block", ENV{SYSTEMD_EXPOSE}="1"
+SUBSYSTEM=="block", TAG="systemd"
 
 # We need a hardware independent way to identify network devices. We
 # use the /sys/subsystem path for this. Current vanilla kernels don't
@@ -23,6 +23,6 @@ SUBSYSTEM=="block", ENV{SYSTEMD_EXPOSE}="1"
 #
 # http://git.kernel.org/?p=linux/hotplug/udev.git;a=blob;f=libudev/libudev-enumerate.c;h=da831449dcaf5e936a14409e8e68ab12d30a98e2;hb=HEAD#l742
 
-SUBSYSTEM=="net", KERNEL!="lo", ENV{SYSTEMD_EXPOSE}="1", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/%k"
+SUBSYSTEM=="net", KERNEL!="lo", TAG="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/%k"
 
 LABEL="systemd_end"
index e67d0a6c2d71e1d2ec83db8e3fcdc854dd2e41e4..adc6cc1e275cf1d7a78392c03855f0174b63d153 100644 (file)
@@ -144,31 +144,19 @@ static int device_find_escape_name(Manager *m, const char *dn, Unit **_u) {
 }
 
 static int device_process_new_device(Manager *m, struct udev_device *dev, bool update_state) {
-        const char *dn, *wants, *sysfs, *expose, *model, *alias;
+        const char *dn, *wants, *sysfs, *model, *alias;
         Unit *u = NULL;
         int r;
         char *w, *state;
         size_t l;
         bool delete;
         struct udev_list_entry *item = NULL, *first = NULL;
-        int b;
 
         assert(m);
 
         if (!(sysfs = udev_device_get_syspath(dev)))
                 return -ENOMEM;
 
-        if (!(expose = udev_device_get_property_value(dev, "SYSTEMD_EXPOSE")))
-                return 0;
-
-        if ((b = parse_boolean(expose)) < 0) {
-                log_error("Failed to parse SYSTEMD_EXPOSE udev property for device %s: %s", sysfs, expose);
-                return 0;
-        }
-
-        if (!b)
-                return 0;
-
         /* Check whether this entry is even relevant for us. */
         dn = udev_device_get_devnode(dev);
         wants = udev_device_get_property_value(dev, "SYSTEMD_WANTS");
@@ -365,6 +353,11 @@ static int device_enumerate(Manager *m) {
                         goto fail;
                 }
 
+                if (udev_monitor_filter_add_match_tag(m->udev_monitor, "systemd") < 0) {
+                        r = -ENOMEM;
+                        goto fail;
+                }
+
                 if (udev_monitor_enable_receiving(m->udev_monitor) < 0) {
                         r = -EIO;
                         goto fail;
@@ -385,6 +378,10 @@ static int device_enumerate(Manager *m) {
                 r = -ENOMEM;
                 goto fail;
         }
+        if (udev_enumerate_add_match_tag(e, "systemd") < 0) {
+                r = -EIO;
+                goto fail;
+        }
 
         if (udev_enumerate_scan_devices(e) < 0) {
                 r = -EIO;