[systemd-commits] 6 commits - man/file-hierarchy.xml src/core src/nspawn src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Tue Mar 31 06:37:01 PDT 2015


 man/file-hierarchy.xml |    6 +++---
 src/core/namespace.c   |    2 +-
 src/nspawn/nspawn.c    |   22 ++++++++--------------
 src/shared/virt.c      |   24 ++++++++++++++++++++++--
 4 files changed, 34 insertions(+), 20 deletions(-)

New commits:
commit 4f923a1984476de3441922ee5bf7102ebdd250ef
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Mar 31 15:34:01 2015 +0200

    nspawn: drop sd_booted() check
    
    We have no such check in any of the other tools, hence don't have one in
    nspawn either.
    
    (This should make things nicer for Rocket, among other things)
    
    Note: removing this check does not mean that we support running nspawn
    on non-systemd. We explicitly don't. It just means that we remove the
    check for running it like that. You are still on your own if you do...

diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 685dafa..b830141 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -3707,12 +3707,6 @@ int main(int argc, char *argv[]) {
                 goto finish;
         }
 
-        if (sd_booted() <= 0) {
-                log_error("Not running on a systemd system.");
-                r = -EINVAL;
-                goto finish;
-        }
-
         log_close();
         n_fd_passed = sd_listen_fds(false);
         if (n_fd_passed > 0) {

commit 4543768d13946e9193b367330cb32ded4d96058a
Author: Iago López Galeiras <iago at endocode.com>
Date:   Tue Mar 31 11:50:29 2015 +0200

    nspawn: change filesystem type from "bind" to NULL in mount() syscalls
    
    Try to keep syscalls as minimal as possible.

diff --git a/src/core/namespace.c b/src/core/namespace.c
index f8a2bbc..718da23 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -293,7 +293,7 @@ static int mount_kdbus(BindMount *m) {
                 goto fail;
         }
 
-        r = mount(m->path, busnode, "bind", MS_BIND, NULL);
+        r = mount(m->path, busnode, NULL, MS_BIND, NULL);
         if (r < 0) {
                 log_error_errno(errno, "bind mount of %s failed: %m", m->path);
                 r = -errno;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 300b6df..685dafa 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -1007,7 +1007,7 @@ static int mount_binds(const char *dest, char **l, bool ro) {
                                 return log_error_errno(r, "Failed to create mount point %s: %m", where);
                 }
 
-                if (mount(*x, where, "bind", MS_BIND, NULL) < 0)
+                if (mount(*x, where, NULL, MS_BIND, NULL) < 0)
                         return log_error_errno(errno, "mount(%s) failed: %m", where);
 
                 if (ro) {
@@ -1323,7 +1323,7 @@ static int setup_volatile(const char *directory) {
                 goto fail;
         }
 
-        if (mount(f, t, "bind", MS_BIND|MS_REC, NULL) < 0) {
+        if (mount(f, t, NULL, MS_BIND|MS_REC, NULL) < 0) {
                 log_error_errno(errno, "Failed to create /usr bind mount: %m");
                 r = -errno;
                 goto fail;
@@ -1394,10 +1394,10 @@ static int setup_boot_id(const char *dest) {
         if (r < 0)
                 return log_error_errno(r, "Failed to write boot id: %m");
 
-        if (mount(from, to, "bind", MS_BIND, NULL) < 0) {
+        if (mount(from, to, NULL, MS_BIND, NULL) < 0) {
                 log_error_errno(errno, "Failed to bind mount boot id: %m");
                 r = -errno;
-        } else if (mount(from, to, "bind", MS_BIND|MS_REMOUNT|MS_RDONLY, NULL))
+        } else if (mount(from, to, NULL, MS_BIND|MS_REMOUNT|MS_RDONLY, NULL))
                 log_warning_errno(errno, "Failed to make boot id read-only: %m");
 
         unlink(from);
@@ -1508,7 +1508,7 @@ static int setup_dev_console(const char *dest, const char *console) {
         if (mknod(to, (st.st_mode & ~07777) | 0600, st.st_rdev) < 0)
                 return log_error_errno(errno, "mknod() for /dev/console failed: %m");
 
-        if (mount(console, to, "bind", MS_BIND, NULL) < 0)
+        if (mount(console, to, NULL, MS_BIND, NULL) < 0)
                 return log_error_errno(errno, "Bind mount for /dev/console failed: %m");
 
         return 0;
@@ -1551,7 +1551,7 @@ static int setup_kmsg(const char *dest, int kmsg_socket) {
         if (r < 0)
                 return log_error_errno(r, "Failed to correct access mode for /dev/kmsg: %m");
 
-        if (mount(from, to, "bind", MS_BIND, NULL) < 0)
+        if (mount(from, to, NULL, MS_BIND, NULL) < 0)
                 return log_error_errno(errno, "Bind mount for /proc/kmsg failed: %m");
 
         fd = open(from, O_RDWR|O_NDELAY|O_CLOEXEC);
@@ -1926,7 +1926,7 @@ static int setup_journal(const char *directory) {
                 return r;
         }
 
-        if (mount(p, q, "bind", MS_BIND, NULL) < 0)
+        if (mount(p, q, NULL, MS_BIND, NULL) < 0)
                 return log_error_errno(errno, "Failed to bind mount journal from host into guest: %m");
 
         return 0;
@@ -4034,7 +4034,7 @@ int main(int argc, char *argv[]) {
                                 _exit(EXIT_FAILURE);
 
                         /* Turn directory into bind mount */
-                        if (mount(arg_directory, arg_directory, "bind", MS_BIND|MS_REC, NULL) < 0) {
+                        if (mount(arg_directory, arg_directory, NULL, MS_BIND|MS_REC, NULL) < 0) {
                                 log_error_errno(errno, "Failed to make bind mount: %m");
                                 _exit(EXIT_FAILURE);
                         }

commit ffd8644641d32abf2b6aac03feea7e7c1eed9348
Author: Lennart Poettering <lennart at poettering.net>
Date:   Tue Mar 31 15:32:43 2015 +0200

    man: fix line breaks in code examples

diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml
index 364e1307..df97884 100644
--- a/man/file-hierarchy.xml
+++ b/man/file-hierarchy.xml
@@ -256,9 +256,9 @@
         used for package-specific data, unless this data is
         architecture-dependent, too. To query
         <varname>$libdir</varname> for the primary architecture of the
-        system, invoke: <programlisting># pkg-config --variable=libdir
-        systemd</programlisting> or <programlisting># systemd-path
-        system-library-arch</programlisting> </para></listitem>
+        system, invoke:
+        <programlisting># pkg-config --variable=libdir systemd</programlisting> or
+        <programlisting># systemd-path system-library-arch</programlisting></para></listitem>
 
       </varlistentry>
 

commit ce09c71d56a11a4e4cd1df001737e913720c1118
Author: Andrew Jones <drjones at redhat.com>
Date:   Tue Mar 31 11:08:13 2015 +0200

    ARM: detect-virt: detect QEMU/KVM
    
    QEMU/KVM guests do not have hypervisor nodes, but they do have
    fw-cfg nodes (since qemu v2.3.0-rc0). fw-cfg nodes are documented,
    see kernel doc Documentation/devicetree/bindings/arm/fw-cfg.txt,
    and therefore we should be able to rely on it in this detection.
    
    Unfortunately, we currently don't have enough information in the
    DT, or elsewhere, to determine if we're using KVM acceleration
    with QEMU or not, so we can only report 'qemu' at this time, even
    if KVM is in use. This shouldn't really matter in practice though,
    because if detect-virt is used interactively it will be clear to
    the user whether or not KVM acceleration is present by the overall
    speed of the guest. If used by a script, then the script's behavior
    should not change whether it's 'qemu' or 'kvm'. QEMU emulated
    guests and QEMU/KVM guests of the same type should behave
    identically, only the speed at which they run should differ.

diff --git a/src/shared/virt.c b/src/shared/virt.c
index 7125232..54c4655 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -115,6 +115,23 @@ static int detect_vm_devicetree(const char **_id) {
                         *_id = "xen";
                         return 1;
                 }
+        } else if (r == -ENOENT) {
+                _cleanup_closedir_ DIR *dir = NULL;
+                struct dirent *dent;
+
+                dir = opendir("/proc/device-tree");
+                if (!dir) {
+                        if (errno == ENOENT)
+                                return 0;
+                        return -errno;
+                }
+
+                FOREACH_DIRENT(dent, dir, return -errno) {
+                        if (strstr(dent->d_name, "fw-cfg")) {
+                                *_id = "qemu";
+                                return 1;
+                        }
+                }
         }
 #endif
         return 0;

commit db6a86897efb337100165c017da81cc70fac51e2
Author: Andrew Jones <drjones at redhat.com>
Date:   Tue Mar 31 11:08:12 2015 +0200

    ARM: detect-virt: detect Xen

diff --git a/src/shared/virt.c b/src/shared/virt.c
index aa3501f..7125232 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -102,7 +102,7 @@ static int detect_vm_cpuid(const char **_id) {
 }
 
 static int detect_vm_devicetree(const char **_id) {
-#if defined(__powerpc__) || defined(__powerpc64__)
+#if defined(__arm__) || defined(__aarch64__) || defined(__powerpc__) || defined(__powerpc64__)
         _cleanup_free_ char *hvtype = NULL;
         int r;
 
@@ -111,6 +111,9 @@ static int detect_vm_devicetree(const char **_id) {
                 if (streq(hvtype, "linux,kvm")) {
                         *_id = "kvm";
                         return 1;
+                } else if (strstr(hvtype, "xen")) {
+                        *_id = "xen";
+                        return 1;
                 }
         }
 #endif

commit b8f1df82646d27452ba2ee9f843df42ee7a2c002
Author: Andrew Jones <drjones at redhat.com>
Date:   Tue Mar 31 11:08:11 2015 +0200

    detect-virt: use /proc/device-tree
    
    Kernel doc Documentation/ABI/testing/sysfs-firmware-ofw says that
    the /proc/device-tree symlink should be used, as opposed to
    directly accessing /sys/firmware/devicetree/base. The former is
    ABI, but not the later.

diff --git a/src/shared/virt.c b/src/shared/virt.c
index 7c1381f..aa3501f 100644
--- a/src/shared/virt.c
+++ b/src/shared/virt.c
@@ -106,7 +106,7 @@ static int detect_vm_devicetree(const char **_id) {
         _cleanup_free_ char *hvtype = NULL;
         int r;
 
-        r = read_one_line_file("/sys/firmware/devicetree/base/hypervisor/compatible", &hvtype);
+        r = read_one_line_file("/proc/device-tree/hypervisor/compatible", &hvtype);
         if (r >= 0) {
                 if (streq(hvtype, "linux,kvm")) {
                         *_id = "kvm";



More information about the systemd-commits mailing list