>From 0ef3127531c95ad9a740cb997a1f94ef257dd4f0 Mon Sep 17 00:00:00 2001 From: Didier Roche <didro...@ubuntu.com> Date: Mon, 26 Jan 2015 15:45:46 +0100 Subject: [PATCH 02/12] Factorize plymouth_running in plymouth.c
Add plymouth.c/h facility which will contains all plymouth related functionalities. This is part of the static library. Adapt existing code to point to the new location. --- Makefile.am | 5 ++++- src/core/main.c | 1 + src/core/manager.c | 1 + src/fsck/fsck.c | 1 + src/shared/plymouth.c | 31 +++++++++++++++++++++++++++++++ src/shared/plymouth.h | 26 ++++++++++++++++++++++++++ src/shared/util.c | 4 ---- src/shared/util.h | 2 -- 8 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 src/shared/plymouth.c create mode 100644 src/shared/plymouth.h diff --git a/Makefile.am b/Makefile.am index f782e66..18be607 100644 --- a/Makefile.am +++ b/Makefile.am @@ -905,7 +905,10 @@ libsystemd_shared_la_SOURCES = \ src/shared/sigbus.h \ src/shared/build.h \ src/shared/import-util.c \ - src/shared/import-util.h + src/shared/import-util.h \ + src/shared/plymouth.c \ + src/shared/plymouth.h \ + $(NULL) if HAVE_UTMP libsystemd_shared_la_SOURCES += \ diff --git a/src/core/main.c b/src/core/main.c index e2e1399..74cfaff 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -68,6 +68,7 @@ #include "manager.h" #include "dbus-manager.h" #include "load-fragment.h" +#include "plymouth.h" #include "mount-setup.h" #include "loopback-setup.h" diff --git a/src/core/manager.c b/src/core/manager.c index e2df911..0b943b0 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -52,6 +52,7 @@ #include "macro.h" #include "strv.h" #include "log.h" +#include "plymouth.h" #include "util.h" #include "mkdir.h" #include "ratelimit.h" diff --git a/src/fsck/fsck.c b/src/fsck/fsck.c index 4c4e150..91dff5c 100644 --- a/src/fsck/fsck.c +++ b/src/fsck/fsck.c @@ -32,6 +32,7 @@ #include "sd-bus.h" #include "libudev.h" +#include "plymouth.h" #include "util.h" #include "special.h" #include "bus-util.h" diff --git a/src/shared/plymouth.c b/src/shared/plymouth.c new file mode 100644 index 0000000..c4865dd --- /dev/null +++ b/src/shared/plymouth.c @@ -0,0 +1,31 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + This file is part of systemd. + + Copyright 2015 Canonical + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <stdbool.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "plymouth.h" + +bool plymouth_running(void) { + return access("/run/plymouth/pid", F_OK) >= 0; +} diff --git a/src/shared/plymouth.h b/src/shared/plymouth.h new file mode 100644 index 0000000..39c8c37 --- /dev/null +++ b/src/shared/plymouth.h @@ -0,0 +1,26 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#pragma once + +/*** + This file is part of systemd. + + Copyright 2015 Canonical + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <stdbool.h> + +bool plymouth_running(void); diff --git a/src/shared/util.c b/src/shared/util.c index 891182a..3002224 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4218,10 +4218,6 @@ bool nulstr_contains(const char*nulstr, const char *needle) { return false; } -bool plymouth_running(void) { - return access("/run/plymouth/pid", F_OK) >= 0; -} - char* strshorten(char *s, size_t l) { assert(s); diff --git a/src/shared/util.h b/src/shared/util.h index ca0c2e5..2cdc419 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -553,8 +553,6 @@ int kill_and_sigcont(pid_t pid, int sig); bool nulstr_contains(const char*nulstr, const char *needle); -bool plymouth_running(void); - bool hostname_is_valid(const char *s) _pure_; char* hostname_cleanup(char *s, bool lowercase); -- 2.1.4
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel