[systemd-commits] 5 commits - Makefile.am src/99-systemd.rules src/device.c src/unit.c src/unit.h

Lennart Poettering lennart at kemper.freedesktop.org
Mon Jul 12 17:18:26 PDT 2010


 Makefile.am          |   10 +++++++---
 src/99-systemd.rules |    7 +++++++
 src/device.c         |    6 +++++-
 src/unit.c           |   17 ++++++++++-------
 src/unit.h           |    2 +-
 5 files changed, 30 insertions(+), 12 deletions(-)

New commits:
commit 0f138303956fcfc2d6e816ac10a60d01dc55c658
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 13 02:18:13 2010 +0200

    units: make maximum unit name longer, since DM names manager to hit the limit

diff --git a/src/unit.h b/src/unit.h
index 3f4bbd9..5d68583 100644
--- a/src/unit.h
+++ b/src/unit.h
@@ -39,7 +39,7 @@ typedef enum UnitDependency UnitDependency;
 #include "socket-util.h"
 #include "execute.h"
 
-#define UNIT_NAME_MAX 128
+#define UNIT_NAME_MAX 256
 #define DEFAULT_TIMEOUT_USEC (60*USEC_PER_SEC)
 #define DEFAULT_RESTART_USEC (100*USEC_PER_MSEC)
 
commit 7e6e7b06e58af6428aa1ae18ffd26dabed8f3466
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 13 02:17:53 2010 +0200

    unit: retroactively start dependencies for job-less units too

diff --git a/src/unit.c b/src/unit.c
index f786359..3f42f0f 100644
--- a/src/unit.c
+++ b/src/unit.c
@@ -949,6 +949,7 @@ static void retroactively_stop_dependencies(Unit *u) {
 
 void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
         dual_timestamp ts;
+        bool unexpected;
 
         assert(u);
         assert(os < _UNIT_ACTIVE_STATE_MAX);
@@ -983,7 +984,7 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
         path_unit_notify(u, ns);
 
         if (u->meta.job) {
-                bool unexpected = false;
+                unexpected = false;
 
                 if (u->meta.job->state == JOB_WAITING)
 
@@ -1046,12 +1047,14 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns) {
                  * requested by a job, then let's retroactively start
                  * or stop dependencies */
 
-                if (unexpected) {
-                        if (UNIT_IS_INACTIVE_OR_DEACTIVATING(os) && UNIT_IS_ACTIVE_OR_ACTIVATING(ns))
-                                retroactively_start_dependencies(u);
-                        else if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
-                                retroactively_stop_dependencies(u);
-                }
+        } else
+                unexpected = true;
+
+        if (unexpected) {
+                if (UNIT_IS_INACTIVE_OR_DEACTIVATING(os) && UNIT_IS_ACTIVE_OR_ACTIVATING(ns))
+                        retroactively_start_dependencies(u);
+                else if (UNIT_IS_ACTIVE_OR_ACTIVATING(os) && UNIT_IS_INACTIVE_OR_DEACTIVATING(ns))
+                        retroactively_stop_dependencies(u);
         }
 
         /* Some names are special */
commit ee5f3479e27286574c34056d4dd16b6d8029e817
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 13 02:17:26 2010 +0200

    device: properly create dependencies

diff --git a/src/device.c b/src/device.c
index 2079f1c..aeafd5e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -252,7 +252,7 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
                                 goto fail;
                         }
 
-                        r = unit_add_dependency_by_name(u, UNIT_WANTS, NULL, e, true);
+                        r = unit_add_dependency_by_name(u, UNIT_WANTS, e, NULL, true);
                         free(e);
 
                         if (r < 0)
@@ -270,8 +270,12 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
         return 0;
 
 fail:
+
+        log_warning("Failed to load device unit: %s", strerror(-r));
+
         if (delete && u)
                 unit_free(u);
+
         return r;
 }
 
commit 7c9c5d0eb1af19804c583fffdb95ca38049b204c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 13 02:17:06 2010 +0200

    units: dm is an awful piece of work

diff --git a/src/99-systemd.rules b/src/99-systemd.rules
index 003796e..f7d9915 100644
--- a/src/99-systemd.rules
+++ b/src/99-systemd.rules
@@ -12,6 +12,10 @@ KERNEL=="ttyS*", TAG="systemd"
 
 SUBSYSTEM=="block", TAG="systemd"
 
+# DM finds it funny to create additional device nodes, we need to
+merge them here, so that we recognize identical devices.
+SUBSYSTEM=="block", ENV{DM_NAME}!="", ENV{SYSTEMD_ALIAS}="/dev/mapper/$env{DM_NAME}"
+
 # We need a hardware independent way to identify network devices. We
 # use the /sys/subsystem path for this. Current vanilla kernels don't
 # actually support that hierarchy right now, however upcoming kernels
commit da78e1b444924a7e10bdde6eeba8e6c818169a86
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Jul 13 02:16:44 2010 +0200

    units: introduce bluetooth.target/printer.target which are activated if the right hardware is plugged in

diff --git a/Makefile.am b/Makefile.am
index 51fe5a9..ff8e847 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -145,7 +145,9 @@ dist_systemunit_DATA = \
 	units/sys-kernel-security.automount \
 	units/sys-kernel-security.mount \
 	units/var-lock.mount \
-	units/var-run.mount
+	units/var-run.mount \
+	units/printer.target \
+	units/bluetooth.target
 
 nodist_systemunit_DATA = \
 	units/sysinit.target \
@@ -709,11 +711,13 @@ install-data-hook:
 		$(LN_S) ../systemd-logger.socket systemd-logger.socket && \
 		$(LN_S) ../systemd-initctl.socket systemd-initctl.socket )
 	( cd $(DESTDIR)$(sessionunitdir) && \
-		rm -f shutdown.target sockets.target local-fs.target swap.target && \
+		rm -f shutdown.target sockets.target local-fs.target swap.target bluetooth.target printer.target && \
 		$(LN_S) $(systemunitdir)/shutdown.target shutdown.target && \
 		$(LN_S) $(systemunitdir)/sockets.target sockets.target && \
 		$(LN_S) $(systemunitdir)/local-fs.target local-fs.target && \
-		$(LN_S) $(systemunitdir)/swap.target swap.target )
+		$(LN_S) $(systemunitdir)/swap.target swap.target && \
+		$(LN_S) $(systemunitdir)/bluetooth.target bluetooth.target && \
+		$(LN_S) $(systemunitdir)/printer.target printer.target)
 	( cd $(DESTDIR)$(systemunitdir) && \
 		rm -f runlevel0.target runlevel1.target runlevel6.target && \
 		$(LN_S) poweroff.target runlevel0.target && \
diff --git a/src/99-systemd.rules b/src/99-systemd.rules
index 70c0d81..003796e 100644
--- a/src/99-systemd.rules
+++ b/src/99-systemd.rules
@@ -25,4 +25,7 @@ SUBSYSTEM=="block", TAG="systemd"
 
 SUBSYSTEM=="net", KERNEL!="lo", TAG="systemd", ENV{SYSTEMD_ALIAS}="/sys/subsystem/net/devices/%k"
 
+SUBSYSTEM=="bluetooth", TAG="systemd", ENV{SYSTEMD_WANTS}="bluetooth.target"
+SUBSYSTEM=="printer", TAG="systemd", ENV{SYSTEMD_WANTS}="printer.target"
+
 LABEL="systemd_end"


More information about the systemd-commits mailing list