Re: [systemd-devel] [PATCH 3/8] power: refactor the three power management binaries to src/power

2015-04-23 Thread Lennart Poettering
On Fri, 27.02.15 03:26, Zbigniew Jędrzejewski-Szmek (zbys...@in.waw.pl) wrote:

 I'm not sure we want this... Can you add some justification? Do they share
 code?

I am pretty sure we don't want this.

shutdown.c really belongs in src/core/. It's a binary that replaces
PID 1 during shutdown, and becomes PID 1 itself. It gets some private
data passed from the real systemd, and thus is more or less just an
external component of it. It also has nothing to do with power
management at all.

shutdownd.c is also has nothing to do with power management. And if we
want to change anything about it, then probably only to delete it from
the tree. In fact, Daniel is working of getting rid of it and merging
its feature set into logind.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 3/8] power: refactor the three power management binaries to src/power

2015-02-27 Thread Shawn Landden
On Thu, Feb 26, 2015 at 6:26 PM, Zbigniew Jędrzejewski-Szmek 
zbys...@in.waw.pl wrote:

 I'm not sure we want this... Can you add some justification? Do they share
 code?

I found it confusing what parts each of these handled, and some code
sharing is possible, but none is shared currently. This also eliminates one
directory. All of these are handled by units:

sleep.target
shutdown.target
etc...


 On Fri, Feb 20, 2015 at 02:31:00PM -0800, Shawn Landden wrote:
  ---
   Makefile.am   |   6 +-
   src/core/shutdown.c   | 420
 -
   src/power/Makefile|  28 +++
 This should be a symlink.

 To make all of these symlinks would be a much larger patch, but I can send
such a patch

   src/power/shutdown.c  | 420
 +
   src/power/shutdownd.c | 461
 ++
   src/power/sleep.c | 219 ++
   src/shutdownd/Makefile|   1 -
   src/shutdownd/shutdownd.c | 461
 --
   src/sleep/Makefile|   1 -
   src/sleep/sleep.c | 219 --
   10 files changed, 1131 insertions(+), 1105 deletions(-)
   delete mode 100644 src/core/shutdown.c
   create mode 100644 src/power/Makefile
   create mode 100644 src/power/shutdown.c
   create mode 100644 src/power/shutdownd.c
   create mode 100644 src/power/sleep.c
   delete mode 12 src/shutdownd/Makefile
   delete mode 100644 src/shutdownd/shutdownd.c
   delete mode 12 src/sleep/Makefile
   delete mode 100644 src/sleep/sleep.c
 It's better to use -M for such patches... Make it easier to see what is
 hapenning.

 Zbyszek
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel




-- 
Shawn Landden
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 3/8] power: refactor the three power management binaries to src/power

2015-02-27 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Feb 27, 2015 at 08:52:34AM -0800, Shawn Landden wrote:
 On Thu, Feb 26, 2015 at 6:26 PM, Zbigniew Jędrzejewski-Szmek 
 zbys...@in.waw.pl wrote:
 
  I'm not sure we want this... Can you add some justification? Do they share
  code?
 
 I found it confusing what parts each of these handled, and some code
 sharing is possible, but none is shared currently. This also eliminates one
 directory. All of these are handled by units:
 
 sleep.target
 shutdown.target
 etc...
 
 
  On Fri, Feb 20, 2015 at 02:31:00PM -0800, Shawn Landden wrote:
   ---
Makefile.am   |   6 +-
src/core/shutdown.c   | 420
  -
src/power/Makefile|  28 +++
  This should be a symlink.
 
  To make all of these symlinks would be a much larger patch, but I can send
 such a patch
You removed src/shutdownd/Makefile which was a symlink, and added
src/power/Makefile which is a real file.

Zbyszek

 
src/power/shutdown.c  | 420
  +
src/power/shutdownd.c | 461
  ++
src/power/sleep.c | 219 ++
src/shutdownd/Makefile|   1 -
src/shutdownd/shutdownd.c | 461
  --
src/sleep/Makefile|   1 -
src/sleep/sleep.c | 219 --
10 files changed, 1131 insertions(+), 1105 deletions(-)
delete mode 100644 src/core/shutdown.c
create mode 100644 src/power/Makefile
create mode 100644 src/power/shutdown.c
create mode 100644 src/power/shutdownd.c
create mode 100644 src/power/sleep.c
delete mode 12 src/shutdownd/Makefile
delete mode 100644 src/shutdownd/shutdownd.c
delete mode 12 src/sleep/Makefile
delete mode 100644 src/sleep/sleep.c
  It's better to use -M for such patches... Make it easier to see what is
  hapenning.
 
  Zbyszek
  ___
  systemd-devel mailing list
  systemd-devel@lists.freedesktop.org
  http://lists.freedesktop.org/mailman/listinfo/systemd-devel
 
 
 
 
 -- 
 Shawn Landden
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 3/8] power: refactor the three power management binaries to src/power

2015-02-26 Thread Zbigniew Jędrzejewski-Szmek
I'm not sure we want this... Can you add some justification? Do they share
code?

On Fri, Feb 20, 2015 at 02:31:00PM -0800, Shawn Landden wrote:
 ---
  Makefile.am   |   6 +-
  src/core/shutdown.c   | 420 -
  src/power/Makefile|  28 +++
This should be a symlink.

  src/power/shutdown.c  | 420 +
  src/power/shutdownd.c | 461 
 ++
  src/power/sleep.c | 219 ++
  src/shutdownd/Makefile|   1 -
  src/shutdownd/shutdownd.c | 461 
 --
  src/sleep/Makefile|   1 -
  src/sleep/sleep.c | 219 --
  10 files changed, 1131 insertions(+), 1105 deletions(-)
  delete mode 100644 src/core/shutdown.c
  create mode 100644 src/power/Makefile
  create mode 100644 src/power/shutdown.c
  create mode 100644 src/power/shutdownd.c
  create mode 100644 src/power/sleep.c
  delete mode 12 src/shutdownd/Makefile
  delete mode 100644 src/shutdownd/shutdownd.c
  delete mode 12 src/sleep/Makefile
  delete mode 100644 src/sleep/sleep.c
It's better to use -M for such patches... Make it easier to see what is
hapenning.

Zbyszek
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH 3/8] power: refactor the three power management binaries to src/power

2015-02-20 Thread Shawn Landden
---
 Makefile.am   |   6 +-
 src/core/shutdown.c   | 420 -
 src/power/Makefile|  28 +++
 src/power/shutdown.c  | 420 +
 src/power/shutdownd.c | 461 ++
 src/power/sleep.c | 219 ++
 src/shutdownd/Makefile|   1 -
 src/shutdownd/shutdownd.c | 461 --
 src/sleep/Makefile|   1 -
 src/sleep/sleep.c | 219 --
 10 files changed, 1131 insertions(+), 1105 deletions(-)
 delete mode 100644 src/core/shutdown.c
 create mode 100644 src/power/Makefile
 create mode 100644 src/power/shutdown.c
 create mode 100644 src/power/shutdownd.c
 create mode 100644 src/power/sleep.c
 delete mode 12 src/shutdownd/Makefile
 delete mode 100644 src/shutdownd/shutdownd.c
 delete mode 12 src/sleep/Makefile
 delete mode 100644 src/sleep/sleep.c

diff --git a/Makefile.am b/Makefile.am
index ba63f68..52ec7ef 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2122,7 +2122,7 @@ systemd_update_done_LDADD = \
 
 # 
--
 systemd_shutdownd_SOURCES = \
-   src/shutdownd/shutdownd.c
+   src/power/shutdownd.c
 
 systemd_shutdownd_LDADD = \
libsystemd-label.la \
@@ -2136,7 +2136,7 @@ dist_doc_DATA += \
 systemd_shutdown_SOURCES = \
src/core/umount.c \
src/core/umount.h \
-   src/core/shutdown.c \
+   src/power/shutdown.c \
src/core/mount-setup.c \
src/core/mount-setup.h \
src/core/killall.h \
@@ -2340,7 +2340,7 @@ systemd_sysctl_LDADD = \
 
 # 
--
 systemd_sleep_SOURCES = \
-   src/sleep/sleep.c
+   src/power/sleep.c
 
 systemd_sleep_LDADD = \
libsystemd-shared.la
diff --git a/src/core/shutdown.c b/src/core/shutdown.c
deleted file mode 100644
index 71f001a..000
--- a/src/core/shutdown.c
+++ /dev/null
@@ -1,420 +0,0 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
-/***
-  This file is part of systemd.
-
-  Copyright 2010 ProFUSION embedded systems
-
-  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 sys/mman.h
-#include sys/types.h
-#include sys/reboot.h
-#include linux/reboot.h
-#include sys/wait.h
-#include sys/stat.h
-#include sys/mount.h
-#include sys/syscall.h
-#include fcntl.h
-#include dirent.h
-#include errno.h
-#include unistd.h
-#include signal.h
-#include stdbool.h
-#include stdlib.h
-#include string.h
-#include getopt.h
-
-#include missing.h
-#include log.h
-#include fileio.h
-#include umount.h
-#include util.h
-#include mkdir.h
-#include virt.h
-#include watchdog.h
-#include killall.h
-#include cgroup-util.h
-#include def.h
-#include switch-root.h
-#include strv.h
-
-#define FINALIZE_ATTEMPTS 50
-
-static char* arg_verb;
-
-static int parse_argv(int argc, char *argv[]) {
-enum {
-ARG_LOG_LEVEL = 0x100,
-ARG_LOG_TARGET,
-ARG_LOG_COLOR,
-ARG_LOG_LOCATION,
-};
-
-static const struct option options[] = {
-{ log-level, required_argument, NULL, ARG_LOG_LEVEL},
-{ log-target,required_argument, NULL, ARG_LOG_TARGET   },
-{ log-color, optional_argument, NULL, ARG_LOG_COLOR},
-{ log-location,  optional_argument, NULL, ARG_LOG_LOCATION },
-{}
-};
-
-int c, r;
-
-assert(argc = 1);
-assert(argv);
-
-/* - prevents getopt from permuting argv[] and moving the verb away
- * from argv[1]. Our interface to initrd promises it'll be there. */
-while ((c = getopt_long(argc, argv, -, options, NULL)) = 0)
-switch (c) {
-
-case ARG_LOG_LEVEL:
-r = log_set_max_level_from_string(optarg);
-if (r  0)
-log_error(Failed to parse log level %s, 
ignoring., optarg);
-
-break;
-
-case ARG_LOG_TARGET:
-r = log_set_target_from_string(optarg);
-if (r  0)
-log_error(Failed to parse log target