[systemd-commits] 6 commits - Makefile.am man/systemd.unit.xml src/core

Michal Schmidt michich at kemper.freedesktop.org
Thu Jul 26 00:51:36 PDT 2012


 Makefile.am                           |    3 +++
 man/systemd.unit.xml                  |   15 +++++++++++++++
 src/core/dbus-unit.c                  |    2 ++
 src/core/load-fragment-gperf.gperf.m4 |    1 +
 src/core/transaction.c                |   12 ++++++++++++
 src/core/unit.c                       |   18 +++++++++++-------
 src/core/unit.h                       |    2 ++
 7 files changed, 46 insertions(+), 7 deletions(-)

New commits:
commit ac6a4abed3e69daf6795e02fa4be1719ae6ae6ab
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Thu Jul 26 09:46:40 2012 +0200

    unit: add missing deps in unit_dependency_table
    
    also reorder the table according to the enum order.

diff --git a/src/core/unit.c b/src/core/unit.c
index da7a570..0d5d15e 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -2859,25 +2859,27 @@ DEFINE_STRING_TABLE_LOOKUP(unit_active_state, UnitActiveState);
 static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = {
         [UNIT_REQUIRES] = "Requires",
         [UNIT_REQUIRES_OVERRIDABLE] = "RequiresOverridable",
-        [UNIT_WANTS] = "Wants",
         [UNIT_REQUISITE] = "Requisite",
         [UNIT_REQUISITE_OVERRIDABLE] = "RequisiteOverridable",
+        [UNIT_WANTS] = "Wants",
+        [UNIT_BINDS_TO] = "BindsTo",
+        [UNIT_PART_OF] = "PartOf",
         [UNIT_REQUIRED_BY] = "RequiredBy",
         [UNIT_REQUIRED_BY_OVERRIDABLE] = "RequiredByOverridable",
-        [UNIT_BINDS_TO] = "BindsTo",
         [UNIT_WANTED_BY] = "WantedBy",
+        [UNIT_BOUND_BY] = "BoundBy",
+        [UNIT_CONSISTS_OF] = "ConsistsOf",
         [UNIT_CONFLICTS] = "Conflicts",
         [UNIT_CONFLICTED_BY] = "ConflictedBy",
-        [UNIT_BOUND_BY] = "BoundBy",
         [UNIT_BEFORE] = "Before",
         [UNIT_AFTER] = "After",
-        [UNIT_REFERENCES] = "References",
-        [UNIT_REFERENCED_BY] = "ReferencedBy",
         [UNIT_ON_FAILURE] = "OnFailure",
         [UNIT_TRIGGERS] = "Triggers",
         [UNIT_TRIGGERED_BY] = "TriggeredBy",
         [UNIT_PROPAGATES_RELOAD_TO] = "PropagatesReloadTo",
-        [UNIT_RELOAD_PROPAGATED_FROM] = "ReloadPropagatedFrom"
+        [UNIT_RELOAD_PROPAGATED_FROM] = "ReloadPropagatedFrom",
+        [UNIT_REFERENCES] = "References",
+        [UNIT_REFERENCED_BY] = "ReferencedBy",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(unit_dependency, UnitDependency);

commit 60649f17bd5ef8659dab474ace8bf42ee23ffca3
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Thu Jul 26 09:42:26 2012 +0200

    unit: make the table of inverse deps symmetric

diff --git a/src/core/unit.c b/src/core/unit.c
index be75cd7..da7a570 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1596,10 +1596,12 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen
                 [UNIT_REQUISITE] = UNIT_REQUIRED_BY,
                 [UNIT_REQUISITE_OVERRIDABLE] = UNIT_REQUIRED_BY_OVERRIDABLE,
                 [UNIT_BINDS_TO] = UNIT_BOUND_BY,
+                [UNIT_PART_OF] = UNIT_CONSISTS_OF,
                 [UNIT_REQUIRED_BY] = _UNIT_DEPENDENCY_INVALID,
                 [UNIT_REQUIRED_BY_OVERRIDABLE] = _UNIT_DEPENDENCY_INVALID,
                 [UNIT_WANTED_BY] = _UNIT_DEPENDENCY_INVALID,
                 [UNIT_BOUND_BY] = UNIT_BINDS_TO,
+                [UNIT_CONSISTS_OF] = UNIT_PART_OF,
                 [UNIT_CONFLICTS] = UNIT_CONFLICTED_BY,
                 [UNIT_CONFLICTED_BY] = UNIT_CONFLICTS,
                 [UNIT_BEFORE] = UNIT_AFTER,
@@ -1611,7 +1613,6 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen
                 [UNIT_TRIGGERED_BY] = UNIT_TRIGGERS,
                 [UNIT_PROPAGATES_RELOAD_TO] = UNIT_RELOAD_PROPAGATED_FROM,
                 [UNIT_RELOAD_PROPAGATED_FROM] = UNIT_PROPAGATES_RELOAD_TO,
-                [UNIT_PART_OF] = UNIT_CONSISTS_OF
         };
         int r, q = 0, v = 0, w = 0;
 

commit b05afff1afe19cf7b48d9d0d2e8b5b4aa9e949dd
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Thu Jul 26 09:38:39 2012 +0200

    dbus-unit: expose PartOf/ConsistsOf properties

diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c
index 2d2f378..ad817d7 100644
--- a/src/core/dbus-unit.c
+++ b/src/core/dbus-unit.c
@@ -786,10 +786,12 @@ const BusProperty bus_unit_properties[] = {
         { "RequisiteOverridable", bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_REQUISITE_OVERRIDABLE]),   true },
         { "Wants",                bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_WANTS]),                   true },
         { "BindsTo",              bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_BINDS_TO]),                true },
+        { "PartOf",               bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_PART_OF]),                 true },
         { "RequiredBy",           bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_REQUIRED_BY]),             true },
         { "RequiredByOverridable",bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_REQUIRED_BY_OVERRIDABLE]), true },
         { "WantedBy",             bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_WANTED_BY]),               true },
         { "BoundBy",              bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_BOUND_BY]),                true },
+        { "ConsistsOf",           bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_CONSISTS_OF]),             true },
         { "Conflicts",            bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_CONFLICTS]),               true },
         { "ConflictedBy",         bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_CONFLICTED_BY]),           true },
         { "Before",               bus_unit_append_dependencies,      "as", offsetof(Unit, dependencies[UNIT_BEFORE]),                  true },

commit f3d52e8cf23582d9150bd62a05dbedb8dd102f9c
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Thu Jul 26 09:34:27 2012 +0200

    man: rewrite the description of PartOf

diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index bdd8f7d..3b3a9f3 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -444,16 +444,16 @@
                         <varlistentry>
                                 <term><varname>PartOf=</varname></term>
 
-                                 <listitem><para>Configures dependency
-                                 on other unit. When systemd stops or
-                                 restarts unit listed here, stop or
-                                 restart is propagated to dependent
-                                 units. Note that this is one way
-                                 dependency and changes to dependent
-                                 units does not affect listed unit. If
-                                 something else is desired, please
-                                 use some other type of dependency.
-                                 </para></listitem>
+                                <listitem><para>Configures dependencies
+                                similar to <varname>Requires=</varname>,
+                                but limited to stopping and restarting
+                                of units. When systemd stops or restarts
+                                the units listed here, the action is
+                                propagated to this unit.
+                                Note that this is a one way dependency -
+                                changes to this unit do not affect the
+                                listed units.
+                                </para></listitem>
                         </varlistentry>
 
                         <varlistentry>

commit 85e9a1010d16064ce435b84f02dc585bc645aade
Author: Michal Sekletar <msekleta at redhat.com>
Date:   Fri Jul 20 15:55:01 2012 +0200

    systemd: added new dependency PartOf
    
    This should address TODO item "new dependency type to "group" services
    in a target". Semantic of new dependency is as follows. Once configured
    it creates dependency which will cause that all dependent units get
    stopped if unit they all depend on is stopped or restarted.  Usual use
    case would be configuring PartOf=some.target in template unit file
    and WantedBy=some.target in [Install] section and enabling desired
    number of instances. In this case starting one instance won't pull in
    target but stopping or starting target(in case of WantedBy is properly
    configured) will cause stop/start of all instances.

diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml
index 2868620..bdd8f7d 100644
--- a/man/systemd.unit.xml
+++ b/man/systemd.unit.xml
@@ -442,6 +442,21 @@
                         </varlistentry>
 
                         <varlistentry>
+                                <term><varname>PartOf=</varname></term>
+
+                                 <listitem><para>Configures dependency
+                                 on other unit. When systemd stops or
+                                 restarts unit listed here, stop or
+                                 restart is propagated to dependent
+                                 units. Note that this is one way
+                                 dependency and changes to dependent
+                                 units does not affect listed unit. If
+                                 something else is desired, please
+                                 use some other type of dependency.
+                                 </para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
                                 <term><varname>Conflicts=</varname></term>
 
                                 <listitem><para>Configures negative
diff --git a/src/core/load-fragment-gperf.gperf.m4 b/src/core/load-fragment-gperf.gperf.m4
index d6a4711..2b1cfa0 100644
--- a/src/core/load-fragment-gperf.gperf.m4
+++ b/src/core/load-fragment-gperf.gperf.m4
@@ -112,6 +112,7 @@ Unit.PropagatesReloadTo,         config_parse_unit_deps,             UNIT_PROPAG
 Unit.PropagateReloadTo,          config_parse_unit_deps,             UNIT_PROPAGATES_RELOAD_TO,     0
 Unit.ReloadPropagatedFrom,       config_parse_unit_deps,             UNIT_RELOAD_PROPAGATED_FROM,   0
 Unit.PropagateReloadFrom,        config_parse_unit_deps,             UNIT_RELOAD_PROPAGATED_FROM,   0
+Unit.PartOf,                     config_parse_unit_deps,             UNIT_PART_OF,                  0
 Unit.RequiresMountsFor,          config_parse_unit_requires_mounts_for, 0,                          offsetof(Unit, requires_mounts_for)
 Unit.StopWhenUnneeded,           config_parse_bool,                  0,                             offsetof(Unit, stop_when_unneeded)
 Unit.RefuseManualStart,          config_parse_bool,                  0,                             offsetof(Unit, refuse_manual_start)
diff --git a/src/core/transaction.c b/src/core/transaction.c
index a1cf706..1f8d803 100644
--- a/src/core/transaction.c
+++ b/src/core/transaction.c
@@ -994,6 +994,18 @@ int transaction_add_job_and_dependencies(
                                                 dbus_error_free(e);
                                 }
                         }
+
+                        SET_FOREACH(dep, ret->unit->dependencies[UNIT_CONSISTS_OF], i) {
+                                r = transaction_add_job_and_dependencies(tr, type, dep, ret, true, override, false, false, ignore_order, e);
+                                if (r < 0) {
+                                        if (r != -EBADR)
+                                                goto fail;
+
+                                        if (e)
+                                                dbus_error_free(e);
+                                }
+                        }
+
                 }
 
                 if (type == JOB_RELOAD) {
diff --git a/src/core/unit.c b/src/core/unit.c
index 7b2f597..be75cd7 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1610,7 +1610,8 @@ int unit_add_dependency(Unit *u, UnitDependency d, Unit *other, bool add_referen
                 [UNIT_TRIGGERS] = UNIT_TRIGGERED_BY,
                 [UNIT_TRIGGERED_BY] = UNIT_TRIGGERS,
                 [UNIT_PROPAGATES_RELOAD_TO] = UNIT_RELOAD_PROPAGATED_FROM,
-                [UNIT_RELOAD_PROPAGATED_FROM] = UNIT_PROPAGATES_RELOAD_TO
+                [UNIT_RELOAD_PROPAGATED_FROM] = UNIT_PROPAGATES_RELOAD_TO,
+                [UNIT_PART_OF] = UNIT_CONSISTS_OF
         };
         int r, q = 0, v = 0, w = 0;
 
diff --git a/src/core/unit.h b/src/core/unit.h
index 2102b7a..89bd61c 100644
--- a/src/core/unit.h
+++ b/src/core/unit.h
@@ -75,12 +75,14 @@ enum UnitDependency {
         UNIT_REQUISITE_OVERRIDABLE,
         UNIT_WANTS,
         UNIT_BINDS_TO,
+        UNIT_PART_OF,
 
         /* Inverse of the above */
         UNIT_REQUIRED_BY,             /* inverse of 'requires' and 'requisite' is 'required_by' */
         UNIT_REQUIRED_BY_OVERRIDABLE, /* inverse of 'requires_overridable' and 'requisite_overridable' is 'soft_required_by' */
         UNIT_WANTED_BY,               /* inverse of 'wants' */
         UNIT_BOUND_BY,                /* inverse of 'binds_to' */
+        UNIT_CONSISTS_OF,             /* inverse of 'part_of' */
 
         /* Negative dependencies */
         UNIT_CONFLICTS,               /* inverse of 'conflicts' is 'conflicted_by' */

commit c37046cd3cabc07a6e4c5ec09049f56294e10a51
Author: Michal Schmidt <mschmidt at redhat.com>
Date:   Thu Jul 26 07:47:12 2012 +0200

    build-sys: create ntp-units.d dropin directories on install

diff --git a/Makefile.am b/Makefile.am
index 27666ea..458aec5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2982,6 +2982,9 @@ dbusinterface_DATA += \
 	org.freedesktop.timedate1.xml
 
 timedated-install-data-hook:
+	$(MKDIR_P) -m 0755 \
+		$(DESTDIR)$(prefix)/lib/ntp-units.d \
+		$(DESTDIR)$(sysconfdir)/ntp-units.d
 	( cd $(DESTDIR)$(systemunitdir) && \
 		rm -f dbus-org.freedesktop.timedate1.service  && \
 		$(LN_S) systemd-timedated.service dbus-org.freedesktop.timedate1.service )



More information about the systemd-commits mailing list