[systemd-commits] 5 commits - Makefile.am man/systemd.automount.xml man/systemd.mount.xml man/systemd.path.xml man/systemd.service.xml man/systemd.socket.xml man/systemd.swap.xml man/systemd.timer.xml src/automount.c src/automount.h src/load-fragment.c

Lennart Poettering lennart at kemper.freedesktop.org
Thu Jul 1 17:38:43 PDT 2010


 Makefile.am               |    4 +
 man/systemd.automount.xml |  165 +++++++++++++++++++++++++++++++++++++++++
 man/systemd.mount.xml     |   25 +++++-
 man/systemd.path.xml      |  174 ++++++++++++++++++++++++++++++++++++++++++++
 man/systemd.service.xml   |    5 -
 man/systemd.socket.xml    |   31 ++++---
 man/systemd.swap.xml      |  146 +++++++++++++++++++++++++++++++++++++
 man/systemd.timer.xml     |  181 ++++++++++++++++++++++++++++++++++++++++++++++
 src/automount.c           |   13 ++-
 src/automount.h           |    2 
 src/load-fragment.c       |    1 
 11 files changed, 724 insertions(+), 23 deletions(-)

New commits:
commit b36b082c8a24d2575909c3e0b4b8aeec49ec17bb
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 02:38:30 2010 +0200

    man: document path units

diff --git a/Makefile.am b/Makefile.am
index 2e001a6..aa60784 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -322,6 +322,7 @@ MANPAGES = \
 	man/systemd.automount.5 \
 	man/systemd.swap.5 \
 	man/systemd.timer.5 \
+	man/systemd.path.5 \
 	man/daemon.7 \
 	man/sd-daemon.7 \
 	man/runlevel.8 \
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index bb969bb..7be7d49 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -88,6 +88,11 @@
                 <para>If an mount point is beneath another mount point
                 in the file system hierarchy a dependency between both
                 units is created automatically.</para>
+
+                <para>Mount points created at runtime independent on
+                unit files or <filename>/etc/fstab</filename> will be
+                monitored by systemd and appear like any other mount
+                unit in systemd.</para>
         </refsect1>
 
         <refsect1>
diff --git a/man/systemd.path.xml b/man/systemd.path.xml
new file mode 100644
index 0000000..44f536c
--- /dev/null
+++ b/man/systemd.path.xml
@@ -0,0 +1,174 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.path">
+        <refentryinfo>
+                <title>systemd.path</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.path</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.path</refname>
+                <refpurpose>systemd path configuration files</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.path</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>A unit configuration file whose name ends in
+                <filename>.path</filename> encodes information about
+                a path monitored by systemd, for
+                path-based activation.</para>
+
+                <para>This man page lists the configuration options
+                specific to this unit type. See
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for the common options of all unit configuration
+                files. The common configuration items are configured
+                in the generic [Unit] and [Install] sections. The
+                path specific configuration options are configured in
+                the [Path] section.</para>
+
+                <para>For each path file a matching unit file must
+                exist, describing the unit to activate when the path
+                changes. By default a service by the same name as the
+                path (except for the suffix) is activated. Example: a
+                path file <filename>foo.path</filename> activates a
+                matching service <filename>foo.service</filename>. The
+                unit to activate may be controlled by
+                <varname>Unit=</varname> (see below).</para>
+
+                <para>Internally, path units use the
+                <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+                API to monitor file systems. Due to that it suffers by the
+                same limitations as inotify, and for example cannot be
+                used to monitor files or directories changed by other
+                machines on remote NFS file systems.</para>
+
+                <para>If an path unit is beneath another mount
+                point in the file system hierarchy a dependency
+                between both units is created automatically.</para>
+        </refsect1>
+
+        <refsect1>
+                <title>Options</title>
+
+                <para>Path files must include a [Path] section,
+                which carries information about the path(s) it
+                monitors. The options specific to the [Path] section
+                of path units are the following:</para>
+
+                <variablelist>
+                        <varlistentry>
+                                <term><varname>PathExists=</varname></term>
+                                <term><varname>PathChanged=</varname></term>
+                                <term><varname>DirectoryNotEmpty=</varname></term>
+
+                                <listitem><para>Defines paths to
+                                monitor for certain changes:
+                                <varname>PathExists=</varname> may be
+                                used to watch the mere existance of a
+                                file or directory. If the file
+                                specified exists the configured unit
+                                is
+                                activated. <varname>PathChanged=</varname>
+                                may be used to watch a file or
+                                directory and activate the configured
+                                unit whenever it changes or is
+                                modified. <varname>DirectoryNotEmpty=</varname>
+                                may be used to watch a directory and
+                                activate the configured unit whenver
+                                it contains at least one file.</para>
+
+                                <para>The arguments of these
+                                directives must be absolute file
+                                system paths.</para>
+
+                                <para>Multiple directives may be
+                                combined, of the same and of different
+                                types, to watch multiple paths.</para>
+
+                                <para>If a path is already existing
+                                (in case of
+                                <varname>PathExists=</varname>) or a
+                                directory already is not empty (in
+                                case of
+                                <varname>DirectoryNotEmpty=</varname>)
+                                at the time the path unit is activated
+                                then the configured unit is
+                                immediately activated as
+                                well. Something similar does not apply
+                                to <varname>PathChanged=</varname>.
+                                </para></listitem>
+                        </varlistentry>
+                        <varlistentry>
+                                <term><varname>Unit=</varname></term>
+
+                                <listitem><para>The unit to activate
+                                when any of the configured paths
+                                changes. The argument is a unit name,
+                                whose suffix is not
+                                <filename>.path</filename>. If not
+                                specified this value defaults to a
+                                service that has the same name as the
+                                path unit, except for the suffix. (See
+                                above.) It is recommended that the
+                                unit name that is activated and the
+                                unit name of the path unit is chosen
+                                identical except for the
+                                suffix.</para></listitem>
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>inotify</refentrytitle><manvolnum>7</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml
index b61cabc..5845383 100644
--- a/man/systemd.timer.xml
+++ b/man/systemd.timer.xml
@@ -153,7 +153,7 @@
                                 <term><varname>Unit=</varname></term>
 
                                 <listitem><para>The unit to activate
-                                when this timer elapses. Argument is a
+                                when this timer elapses. The argument is a
                                 unit name, whose suffix is not
                                 <filename>.timer</filename>. If not
                                 specified this value defaults to a
commit 11fcc3ab1b07c730fac6c8100e2e9d1585223be4
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 02:14:13 2010 +0200

    man: document timer units

diff --git a/Makefile.am b/Makefile.am
index cdf85f9..2e001a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -321,6 +321,7 @@ MANPAGES = \
 	man/systemd.mount.5 \
 	man/systemd.automount.5 \
 	man/systemd.swap.5 \
+	man/systemd.timer.5 \
 	man/daemon.7 \
 	man/sd-daemon.7 \
 	man/runlevel.8 \
diff --git a/man/systemd.timer.xml b/man/systemd.timer.xml
new file mode 100644
index 0000000..b61cabc
--- /dev/null
+++ b/man/systemd.timer.xml
@@ -0,0 +1,181 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.timer">
+        <refentryinfo>
+                <title>systemd.timer</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.timer</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.timer</refname>
+                <refpurpose>systemd timer configuration files</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.timer</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>A unit configuration file whose name ends in
+                <filename>.timer</filename> encodes information about
+                a timer controlled and supervised by systemd, for
+                timer-based activation.</para>
+
+                <para>This man page lists the configuration options
+                specific to this unit type. See
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for the common options of all unit configuration
+                files. The common configuration items are configured
+                in the generic [Unit] and [Install] sections. The
+                timer specific configuration options are configured in
+                the [Timer] section.</para>
+
+                <para>For each timer file a matching unit file must
+                exist, describing the unit to activate when the timer
+                elapses. By default a service by the same name as the
+                timer (except for the suffix) is activated. Example: a
+                timer file <filename>foo.timer</filename> activates a
+                matching service <filename>foo.service</filename>. The
+                unit to activate may be controlled by
+                <varname>Unit=</varname> (see below).</para>
+        </refsect1>
+
+        <refsect1>
+                <title>Options</title>
+
+                <para>Timer files must include a [Timer] section,
+                which carries information about the timer it
+                defines. The options specific to the [Timer] section
+                of timer units are the following:</para>
+
+                <variablelist>
+                        <varlistentry>
+                                <term><varname>OnActive=</varname></term>
+                                <term><varname>OnBootup=</varname></term>
+                                <term><varname>OnStartup=</varname></term>
+                                <term><varname>OnUnitActive=</varname></term>
+                                <term><varname>OnUnitInactive=</varname></term>
+
+                                <listitem><para>Defines timers
+                                relative to different starting points:
+                                <varname>OnActive=</varname> defines a
+                                timer relative to the moment the timer
+                                itself is
+                                activated. <varname>OnBootup=</varname>
+                                defines a timer relative to when the
+                                machine was booted
+                                up. <varname>OnStartup=</varname>
+                                defines a timer relative to when
+                                systemd was
+                                started. <varname>OnUnitActive=</varname>
+                                defines a timer relative to when the
+                                unit the timer is activating was last
+                                activated. <varname>OnUnitInactive=</varname>
+                                defines a timer relative to when the
+                                unit the timer is activating was last
+                                deactivated.</para>
+
+                                <para>Multiple directives may be
+                                combined, of the same and of different
+                                types. For example, by combining
+                                <varname>OnBoot=</varname> and
+                                <varname>OnUnitActive=</varname> it is
+                                possible to define a timer that
+                                elapses in regular intervals and
+                                activates a specific service each
+                                time.</para>
+
+                                <para>The arguments to the directives
+                                are time spans configured in
+                                seconds. Example: "OnBoot=50" means
+                                50s after boot-up. The argument may
+                                also include time units. Example:
+                                "OnBoot=5h 30min" means 5 hours and 30
+                                minutes after boot-up. For details
+                                about the syntax of time spans see
+                                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+                                <para>If a timer configured with
+                                <varname>OnBootup=</varname> or
+                                <varname>OnStartup=</varname> is
+                                already in the past when the timer
+                                unit is activated, it will immediately
+                                elapse and the configured unit is
+                                started. This is not the case for
+                                timers defined in the other
+                                directives.</para></listitem>
+
+                                <para>These are monotonic timers,
+                                independant of wall-clock time and timezones. If the
+                                computer is temporarily suspended, the
+                                monotonic clock stops too.</para>
+
+                        </varlistentry>
+                        <varlistentry>
+                                <term><varname>Unit=</varname></term>
+
+                                <listitem><para>The unit to activate
+                                when this timer elapses. Argument is a
+                                unit name, whose suffix is not
+                                <filename>.timer</filename>. If not
+                                specified this value defaults to a
+                                service that has the same name as the
+                                timer unit, except for the
+                                suffix. (See above.) It is recommended
+                                that the unit name that is activated
+                                and the unit name of the timer unit
+                                is chosen identical except for the
+                                suffix.</para></listitem>
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
commit e0cabd4bb536bce3a9636a12b8dbc512c28c2395
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 01:33:54 2010 +0200

    man: document swap units

diff --git a/Makefile.am b/Makefile.am
index 7df50ce..cdf85f9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -320,6 +320,7 @@ MANPAGES = \
 	man/systemd.socket.5 \
 	man/systemd.mount.5 \
 	man/systemd.automount.5 \
+	man/systemd.swap.5 \
 	man/daemon.7 \
 	man/sd-daemon.7 \
 	man/runlevel.8 \
diff --git a/man/systemd.automount.xml b/man/systemd.automount.xml
index a09839a..b777738 100644
--- a/man/systemd.automount.xml
+++ b/man/systemd.automount.xml
@@ -68,10 +68,10 @@
                 automount specific configuration options are configured
                 in the [Automount] section.</para>
 
-                <para>Automount units must be named after the file
-                paths they reflect. Example: the automount point
-                <filename>/home/lennart</filename> must be configured
-                in a unit file
+                <para>Automount units must be named after the
+                automount directories they control. Example: the
+                automount point <filename>/home/lennart</filename>
+                must be configured in a unit file
                 <filename>home-lennart.automount</filename>. For
                 details about the escaping logic used to convert a
                 file system path to a unit name see
@@ -92,6 +92,9 @@
                 on-demand mounting as well as parallelized mounting of
                 file systems.</para>
 
+                <para>If an automount point is beneath another mount
+                point in the file system hierarchy a dependency
+                between both units is created automatically.</para>
         </refsect1>
 
         <refsect1>
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 94ed664..bb969bb 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -71,8 +71,8 @@
                 <para>Additional options are listed in
                 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
 
-                <para>Mount units must be named after the file paths
-                they reflect. Example: the mount point
+                <para>Mount units must be named after the mount point
+                directories they control. Example: the mount point
                 <filename>/home/lennart</filename> must be configured
                 in a unit file
                 <filename>home-lennart.mount</filename>. For details
@@ -84,6 +84,10 @@
                 an automount unit, to allow on-demand or parallelized
                 mounting. See
                 <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+                <para>If an mount point is beneath another mount point
+                in the file system hierarchy a dependency between both
+                units is created automatically.</para>
         </refsect1>
 
         <refsect1>
diff --git a/man/systemd.swap.xml b/man/systemd.swap.xml
new file mode 100644
index 0000000..6b2abed
--- /dev/null
+++ b/man/systemd.swap.xml
@@ -0,0 +1,146 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.swap">
+        <refentryinfo>
+                <title>systemd.swap</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.swap</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.swap</refname>
+                <refpurpose>systemd swap configuration files</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.swap</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>A unit configuration file whose name ends in
+                <filename>.swap</filename> encodes information about a
+                swap device or file for memory paging controlled and
+                supervised by systemd.</para>
+
+                <para>This man page lists the configuration options
+                specific to this unit type. See
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for the common options of all unit configuration
+                files. The common configuration items are configured
+                in the generic [Unit] and [Install] sections. The swap
+                specific configuration options are configured in the
+                [Swap] section.</para>
+
+                <para>Swap units must be named after the devices they
+                control. Example: the swap device
+                <filename>/dev/sda5</filename> must be configured in a
+                unit file <filename>dev-sda5.swap</filename>. For
+                details about the escaping logic used to convert a
+                file system path to a unit name see
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+        </refsect1>
+
+        <refsect1>
+                <title><filename>fstab</filename></title>
+
+                <para>Swap units may either be configured via unit
+                files, or via <filename>/etc/fstab</filename> (see
+                <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for details).</para>
+
+                <para>If a swap device or file is configured in both
+                <filename>/etc/fstab</filename> and a unit file the
+                configuration in the latter takes precedence.</para>
+        </refsect1>
+
+        <refsect1>
+                <title>Options</title>
+
+                <para>Swap files must include a [Swap] section, which
+                carries information about the swap device it
+                supervises. The options specific to the [Swap] section
+                of swap units are the following:</para>
+
+                <variablelist>
+
+                        <varlistentry>
+                                <term><varname>What=</varname></term>
+                                <listitem><para>Takes an absolute path
+                                of a device node or file to use for
+                                paging. See
+                                <citerefentry><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                                for details. If this refers to a
+                                device node a dependency on the
+                                respective device unit is
+                                automatically created. (See
+                                <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                                for more information.) If this refers
+                                to a file a dependency on the
+                                respective mount unit is automatically
+                                created. (See
+                                <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                                for more information.) This option is
+                                mandatory.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>Priority=</varname></term>
+
+                                <listitem><para>Swap priority to use
+                                when activating the swap device or
+                                file. This takes an integer. This
+                                setting is optional.</para></listitem>
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.device</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>swapon</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
commit 65232ea79d8f6b1288c33852f89b575a9200162d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 01:17:55 2010 +0200

    man: document automount units

diff --git a/Makefile.am b/Makefile.am
index 457276e..7df50ce 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -319,6 +319,7 @@ MANPAGES = \
 	man/systemd.service.5 \
 	man/systemd.socket.5 \
 	man/systemd.mount.5 \
+	man/systemd.automount.5 \
 	man/daemon.7 \
 	man/sd-daemon.7 \
 	man/runlevel.8 \
diff --git a/man/systemd.automount.xml b/man/systemd.automount.xml
new file mode 100644
index 0000000..a09839a
--- /dev/null
+++ b/man/systemd.automount.xml
@@ -0,0 +1,162 @@
+<?xml version='1.0'?> <!--*-nxml-*-->
+<?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+        "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<!--
+  This file is part of systemd.
+
+  Copyright 2010 Lennart Poettering
+
+  systemd is free software; you can redistribute it and/or modify it
+  under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  systemd is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
+-->
+
+<refentry id="systemd.automount">
+        <refentryinfo>
+                <title>systemd.automount</title>
+                <productname>systemd</productname>
+
+                <authorgroup>
+                        <author>
+                                <contrib>Developer</contrib>
+                                <firstname>Lennart</firstname>
+                                <surname>Poettering</surname>
+                                <email>lennart at poettering.net</email>
+                        </author>
+                </authorgroup>
+        </refentryinfo>
+
+        <refmeta>
+                <refentrytitle>systemd.automount</refentrytitle>
+                <manvolnum>5</manvolnum>
+        </refmeta>
+
+        <refnamediv>
+                <refname>systemd.automount</refname>
+                <refpurpose>systemd automount configuration files</refpurpose>
+        </refnamediv>
+
+        <refsynopsisdiv>
+                <para><filename>systemd.automount</filename></para>
+        </refsynopsisdiv>
+
+        <refsect1>
+                <title>Description</title>
+
+                <para>A unit configuration file whose name ends in
+                <filename>.automount</filename> encodes information
+                about a file system automount point controlled and
+                supervised by systemd.</para>
+
+                <para>This man page lists the configuration options
+                specific to this unit type. See
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for the common options of all unit configuration
+                files. The common configuration items are configured
+                in the generic [Unit] and [Install] sections. The
+                automount specific configuration options are configured
+                in the [Automount] section.</para>
+
+                <para>Automount units must be named after the file
+                paths they reflect. Example: the automount point
+                <filename>/home/lennart</filename> must be configured
+                in a unit file
+                <filename>home-lennart.automount</filename>. For
+                details about the escaping logic used to convert a
+                file system path to a unit name see
+                <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+                <para>For each automount unit file a matching mount
+                unit file (see
+                <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for details) must exist which is activated when the
+                automount path is accessed. Example: if an automount
+                unit <filename>home-lennart.automount</filename> is
+                active and the user accesses
+                <filename>/home/lennart</filename> the mount unit
+                <filename>home-lennart.mount</filename> will be
+                activated.</para>
+
+                <para>Automount units may be used to implement
+                on-demand mounting as well as parallelized mounting of
+                file systems.</para>
+
+        </refsect1>
+
+        <refsect1>
+                <title><filename>fstab</filename></title>
+
+                <para>Automount units may either be configured via unit
+                files, or via <filename>/etc/fstab</filename> (see
+                <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for details).</para>
+
+                <para>For details how systemd parses
+                <filename>/etc/fstab</filename> see
+                <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+                <para>If an automount point is configured in both
+                <filename>/etc/fstab</filename> and a unit file the
+                configuration in the latter takes precedence.</para>
+        </refsect1>
+
+        <refsect1>
+                <title>Options</title>
+
+                <para>Automount files must include an [Automount]
+                section, which carries information about the file
+                system automount points it supervises. The options
+                specific to the [Automount] section of automount units
+                are the following:</para>
+
+                <variablelist>
+
+                        <varlistentry>
+                                <term><varname>Where=</varname></term>
+                                <listitem><para>Takes an absolute path
+                                of a directory of the automount
+                                point. If the automount point is not
+                                existing at time of the automount
+                                point is installed it is created. This
+                                string must be reflected in the unit
+                                file name. (See above.) This option is
+                                mandatory.</para></listitem>
+                        </varlistentry>
+
+                        <varlistentry>
+                                <term><varname>DirectoryMode=</varname></term>
+                                <listitem><para>Directories of automount
+                                points (and any parent directories)
+                                are automatically created if
+                                needed. This option specifies the file
+                                system access mode used when creating
+                                these directories. Defaults to
+                                0755.</para></listitem>
+                        </varlistentry>
+                </variablelist>
+        </refsect1>
+
+        <refsect1>
+                  <title>See Also</title>
+                  <para>
+                          <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
+                          <citerefentry><refentrytitle>automount</refentrytitle><manvolnum>8</manvolnum></citerefentry>
+                  </para>
+        </refsect1>
+
+</refentry>
diff --git a/man/systemd.mount.xml b/man/systemd.mount.xml
index 275e354..94ed664 100644
--- a/man/systemd.mount.xml
+++ b/man/systemd.mount.xml
@@ -55,8 +55,9 @@
                 <title>Description</title>
 
                 <para>A unit configuration file whose name ends in
-                .mount encodes information about a file system mount
-                point controlled and supervised by systemd.</para>
+                <filename>.mount</filename> encodes information about
+                a file system mount point controlled and supervised by
+                systemd.</para>
 
                 <para>This man page lists the configuration options
                 specific to this unit type. See
@@ -78,6 +79,11 @@
                 about the escaping logic used to convert a file system
                 path to a unit name see
                 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
+
+                <para>Optionally, a mount unit may be accompanied by
+                an automount unit, to allow on-demand or parallelized
+                mounting. See
+                <citerefentry><refentrytitle>systemd.automount</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
         </refsect1>
 
         <refsect1>
@@ -117,7 +123,7 @@
                 this section are shared with other unit types. These
                 options are documented in
                 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
-                options specific to the [Mount] section of service
+                options specific to the [Mount] section of mount
                 units are the following:</para>
 
                 <variablelist>
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
index c6fdc0d..8005a51 100644
--- a/man/systemd.service.xml
+++ b/man/systemd.service.xml
@@ -55,8 +55,9 @@
                 <title>Description</title>
 
                 <para>A unit configuration file whose name ends in
-                .service encodes information about a process
-                controlled and supervised by systemd.</para>
+                <filename>.service</filename> encodes information
+                about a process controlled and supervised by
+                systemd.</para>
 
                 <para>This man page lists the configuration options
                 specific to this unit type. See
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
index 65ef8c0..e15ea60 100644
--- a/man/systemd.socket.xml
+++ b/man/systemd.socket.xml
@@ -54,10 +54,11 @@
         <refsect1>
                 <title>Description</title>
 
-                <para>A unit configuration file whose name ends in .socket
-                encodes information about an IPC or network socket or
-                a file system FIFO controlled and supervised by systemd,
-                for socket-based activation.</para>
+                <para>A unit configuration file whose name ends in
+                <filename>.socket</filename> encodes information about
+                an IPC or network socket or a file system FIFO
+                controlled and supervised by systemd, for socket-based
+                activation.</para>
 
                 <para>This man page lists the configuration options
                 specific to this unit type. See
@@ -71,13 +72,15 @@
                 <para>Additional options are listed in
                 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
 
-                <para>For each socket file a matching service file (see <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry> for details)
-                must exist, describing the service to start on
-                incoming traffic on the socket. Depending on the
-                setting of <option>Accept=</option> (see below) this
-                must either be named like the socket unit, but with
-                the suffix replaced; or it must be a template file
-                named the same way. Example: a socket file
+                <para>For each socket file a matching service file
+                (see
+                <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+                for details) must exist, describing the service to
+                start on incoming traffic on the socket. Depending on
+                the setting of <option>Accept=</option> (see below)
+                this must either be named like the socket unit, but
+                with the suffix replaced; or it must be a template
+                file named the same way. Example: a socket file
                 <filename>foo.socket</filename> needs a matching
                 service <filename>foo.service</filename> if
                 <option>Accept=false</option> is set. If
@@ -85,6 +88,10 @@
                 file <filename>foo at .service</filename> must exist from
                 which services are instantiated for each incoming
                 connection.</para>
+
+                <para>Socket units may be used to implement on-demand
+                starting of services as well as parallelized starting
+                of services.</para>
         </refsect1>
 
         <refsect1>
@@ -96,7 +103,7 @@
                 this section are shared with other unit types. These
                 options are documented in
                 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
-                options specific to the [Socket] section of service
+                options specific to the [Socket] section of socket
                 units are the following:</para>
 
                 <variablelist>
commit 1cf18f27331286dfb56d92e1800facf4f696ad27
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jul 2 01:17:21 2010 +0200

    automount: add DirectoryMode= setting

diff --git a/src/automount.c b/src/automount.c
index 5e669c5..b8d7ad2 100644
--- a/src/automount.c
+++ b/src/automount.c
@@ -53,6 +53,8 @@ static void automount_init(Unit *u) {
 
         a->pipe_watch.fd = a->pipe_fd = -1;
         a->pipe_watch.type = WATCH_INVALID;
+
+        a->directory_mode = 0755;
 }
 
 static void repeat_unmout(const char *path) {
@@ -253,9 +255,11 @@ static void automount_dump(Unit *u, FILE *f, const char *prefix) {
 
         fprintf(f,
                 "%sAutomount State: %s\n"
-                "%sWhere: %s\n",
+                "%sWhere: %s\n"
+                "%sDirectoryMode: %04o\n",
                 prefix, automount_state_to_string(a->state),
-                prefix, a->where);
+                prefix, a->where,
+                prefix, a->directory_mode);
 }
 
 static void automount_enter_dead(Automount *a, bool success) {
@@ -536,9 +540,10 @@ static void automount_enter_runnning(Automount *a) {
         assert(a);
         assert(a->mount);
 
-        /* Before we do anything, let's see if somebody is playing games with us? */
+        mkdir_p(a->where, a->directory_mode);
 
-        if (stat(a->where, &st) < 0) {
+        /* Before we do anything, let's see if somebody is playing games with us? */
+        if (lstat(a->where, &st) < 0) {
                 log_warning("%s failed stat automount point: %m", a->meta.id);
                 goto fail;
         }
diff --git a/src/automount.h b/src/automount.h
index 44e6100..13b56ef 100644
--- a/src/automount.h
+++ b/src/automount.h
@@ -48,6 +48,8 @@ struct Automount {
         Watch pipe_watch;
         dev_t dev_id;
 
+        mode_t directory_mode;
+
         Set *tokens;
 
         bool failure:1;
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 43a4027..49b577f 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1566,6 +1566,7 @@ static int load_from_path(Unit *u, const char *path) {
                 EXEC_CONTEXT_CONFIG_ITEMS(u->mount.exec_context, "Mount"),
 
                 { "Where",                  config_parse_path,            &u->automount.where,                             "Automount" },
+                { "DirectoryMode",          config_parse_mode,            &u->automount.directory_mode,                    "Automount" },
 
                 { "What",                   config_parse_path,            &u->swap.parameters_fragment.what,               "Swap"    },
                 { "Priority",               config_parse_int,             &u->swap.parameters_fragment.priority,           "Swap"    },


More information about the systemd-commits mailing list