Re: [systemd-devel] [RFC] mount: improve DefaultDependencies and use in generator

2013-08-23 Thread Tom Gundersen
On Wed, Aug 21, 2013 at 7:53 PM, Tom Gundersen t...@jklm.no wrote:
 I'd like to move some of the default dependency logic from the fstab generator
 to core. This should remove some redundancy and also improve consistency
 between mount units and fstab entries.

 The first patch simply enables default dependencies in the generator, and
 removes some things that are then made redundant.

 The second patch moves the handling of device dependencies from the generator
 to core's default dependencies.

 Lastly, we improve the Conflicts=umount.target logic by taking the mount 
 option
 x-initrd.mount into account: if something was mounted in the initrd we 
 should
 not try to stop the mount unit on shutdown.

Please disregard these patches, I'm reposting a new version of the
series after getting some feedback.

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


[systemd-devel] [PATCH 1/7] filesystem targets: disable default dependencies

2013-08-23 Thread Tom Gundersen
This means we can use default dependencies on mount units without having to get 
them automatically
ordered before the filesystem targets.

Reported-by: Thomas Baechler tho...@archlinux.org
---
 units/initrd-fs.target  | 2 ++
 units/initrd-root-fs.target | 2 ++
 units/local-fs.target   | 2 ++
 units/remote-fs.target  | 2 ++
 4 files changed, 8 insertions(+)

diff --git a/units/initrd-fs.target b/units/initrd-fs.target
index 7578b88..866f0d0 100644
--- a/units/initrd-fs.target
+++ b/units/initrd-fs.target
@@ -12,3 +12,5 @@ OnFailure=emergency.target
 OnFailureIsolate=yes
 ConditionPathExists=/etc/initrd-release
 After=initrd-parse-etc.service
+DefaultDependencies=no
+Conflicts=shutdown.target
diff --git a/units/initrd-root-fs.target b/units/initrd-root-fs.target
index cd189f0..d0b9863 100644
--- a/units/initrd-root-fs.target
+++ b/units/initrd-root-fs.target
@@ -11,3 +11,5 @@ Documentation=man:systemd.special(7)
 ConditionPathExists=/etc/initrd-release
 OnFailure=emergency.target
 OnFailureIsolate=yes
+DefaultDependencies=no
+Conflicts=shutdown.target
diff --git a/units/local-fs.target b/units/local-fs.target
index 18c3d74..8f06ed6 100644
--- a/units/local-fs.target
+++ b/units/local-fs.target
@@ -9,5 +9,7 @@
 Description=Local File Systems
 Documentation=man:systemd.special(7)
 After=local-fs-pre.target
+DefaultDependencies=no
+Conflicts=shutdown.target
 OnFailure=emergency.target
 OnFailureIsolate=no
diff --git a/units/remote-fs.target b/units/remote-fs.target
index 09213e8..43ffa5c 100644
--- a/units/remote-fs.target
+++ b/units/remote-fs.target
@@ -9,6 +9,8 @@
 Description=Remote File Systems
 Documentation=man:systemd.special(7)
 After=remote-fs-pre.target
+DefaultDependencies=no
+Conflicts=shutdown.target
 
 [Install]
 WantedBy=multi-user.target
-- 
1.8.3.4

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


[systemd-devel] [PATCH 3/7] fstab-generator: use DefaultDependencies=yes

2013-08-23 Thread Tom Gundersen
This removes some redundancy between the generator and the core mount handling.
---
 TODO  |  2 --
 src/fstab-generator/fstab-generator.c | 52 ---
 2 files changed, 6 insertions(+), 48 deletions(-)

diff --git a/TODO b/TODO
index 3800ce4..5e5f90b 100644
--- a/TODO
+++ b/TODO
@@ -219,8 +219,6 @@ Features:
   /etc should always override /run+/usr and also any symlink
   destination.
 
-* remove duplicate default deps logic from fstab-generator vs. mount.c
-
 * when isolating, try to figure out a way how we implicitly can order
   all units we stop before the isolating unit...
 
diff --git a/src/fstab-generator/fstab-generator.c 
b/src/fstab-generator/fstab-generator.c
index 2a779bb..6f352d1 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -116,10 +116,7 @@ static int add_swap(const char *what, struct mntent *me) {
 
 fputs(# Automatically generated by systemd-fstab-generator\n\n
   [Unit]\n
-  SourcePath=/etc/fstab\n
-  DefaultDependencies=no\n
-  Conflicts= SPECIAL_UMOUNT_TARGET \n
-  Before= SPECIAL_UMOUNT_TARGET \n, f);
+  SourcePath=/etc/fstab\n, f);
 
 if (!noauto  !nofail)
 fputs(Before= SPECIAL_SWAP_TARGET \n, f);
@@ -209,9 +206,6 @@ static int add_mount(
 bool nofail,
 bool automount,
 bool isbind,
-const char *pre,
-const char *pre2,
-const char *online,
 const char *post,
 const char *source) {
 _cleanup_free_ char
@@ -258,33 +252,9 @@ static int add_mount(
 fprintf(f,
   # Automatically generated by systemd-fstab-generator\n\n
   [Unit]\n
-  SourcePath=%s\n
-  DefaultDependencies=no\n,
+  SourcePath=%s\n,
   source);
 
-if (!path_equal(where, /)) {
-if (pre)
-fprintf(f,
-After=%s\n,
-pre);
-
-if (pre2)
-fprintf(f,
-After=%s\n,
-pre2);
-
-if (online)
-fprintf(f,
-After=%s\n
-Wants=%s\n,
-online,
-online);
-
-fprintf(f,
-Conflicts= SPECIAL_UMOUNT_TARGET \n
-Before= SPECIAL_UMOUNT_TARGET \n);
-}
-
 if (post  !noauto  !nofail  !automount)
 fprintf(f,
 Before=%s\n,
@@ -368,10 +338,7 @@ static int add_mount(
 fprintf(f,
 # Automatically generated by 
systemd-fstab-generator\n\n
 [Unit]\n
-SourcePath=%s\n
-DefaultDependencies=no\n
-Conflicts= SPECIAL_UMOUNT_TARGET \n
-Before= SPECIAL_UMOUNT_TARGET \n,
+SourcePath=%s\n,
 source);
 
 if (post)
@@ -447,7 +414,7 @@ static int parse_fstab(const char *prefix, bool initrd) {
 k = add_swap(what, me);
 else {
 bool noauto, nofail, automount, isbind;
-const char *pre, *pre2, *post, *online;
+const char *post;
 
 noauto = !!hasmntopt(me, noauto);
 nofail = !!hasmntopt(me, nofail);
@@ -457,25 +424,18 @@ static int parse_fstab(const char *prefix, bool initrd) {
 isbind = mount_is_bind(me);
 
 if (initrd) {
-pre = pre2 = online = NULL;
 post = SPECIAL_INITRD_FS_TARGET;
 } else if (mount_in_initrd(me)) {
-pre = pre2 = online = NULL;
 post = SPECIAL_INITRD_ROOT_FS_TARGET;
 } else if (mount_is_network(me)) {
-pre = SPECIAL_REMOTE_FS_PRE_TARGET;
-pre2 = SPECIAL_NETWORK_TARGET;
-online = SPECIAL_NETWORK_ONLINE_TARGET;
 post = SPECIAL_REMOTE_FS_TARGET;
 } else {
-pre = SPECIAL_LOCAL_FS_PRE_TARGET;
-pre2 = online = NULL;
 post = SPECIAL_LOCAL_FS_TARGET;
 }
 
 k = add_mount(what, where, me-mnt_type, me-mnt_opts,
   me-mnt_passno, 

[systemd-devel] [PATCH 4/7] swap: backing device should unconditionally want swap unit

2013-08-23 Thread Tom Gundersen
There is no need to restrict this to only the 'nofail' case. In the '!nofail'
case the unit is already wanted by swap.target, so this is not a functional 
change.
---
 src/core/swap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/core/swap.c b/src/core/swap.c
index 825503f..f0e19ad 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -187,8 +187,7 @@ static int swap_add_device_links(Swap *s) {
 return 0;
 
 if (is_device_path(s-what))
-return unit_add_node_link(UNIT(s), s-what,
-  !p-noauto  p-nofail 
+return unit_add_node_link(UNIT(s), s-what, !p-noauto 
   UNIT(s)-manager-running_as == 
SYSTEMD_SYSTEM);
 else
 /* File based swap devices need to be ordered after
-- 
1.8.3.4

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


[systemd-devel] [PATCH 5/7] mount: move device links handling from generator

2013-08-23 Thread Tom Gundersen
This makes mount units work like swap units: when the backing device appears
the mount unit will be started.

v2: the device should want the mount unconditionally, not only for 
DefaultDependencies=yes
---
 src/core/mount.c  | 12 ++-
 src/fstab-generator/fstab-generator.c | 40 +++
 2 files changed, 14 insertions(+), 38 deletions(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index 7838e60..84801e9 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -338,6 +338,12 @@ static bool mount_is_bind(MountParameters *p) {
 return false;
 }
 
+static bool mount_is_auto(MountParameters *p) {
+assert(p);
+
+return !mount_test_option(p-options, noauto);
+}
+
 static bool needs_quota(MountParameters *p) {
 assert(p);
 
@@ -356,6 +362,7 @@ static bool needs_quota(MountParameters *p) {
 
 static int mount_add_device_links(Mount *m) {
 MountParameters *p;
+bool device_wants_mount = false;
 int r;
 
 assert(m);
@@ -376,7 +383,10 @@ static int mount_add_device_links(Mount *m) {
 if (path_equal(m-where, /))
 return 0;
 
-r = unit_add_node_link(UNIT(m), p-what, false);
+if (mount_is_auto(p)  UNIT(m)-manager-running_as == SYSTEMD_SYSTEM)
+device_wants_mount = true;
+
+r = unit_add_node_link(UNIT(m), p-what, device_wants_mount);
 if (r  0)
 return r;
 
diff --git a/src/fstab-generator/fstab-generator.c 
b/src/fstab-generator/fstab-generator.c
index 6f352d1..e780018 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -170,16 +170,6 @@ static int add_swap(const char *what, struct mntent *me) {
 return 0;
 }
 
-static bool mount_is_bind(struct mntent *me) {
-assert(me);
-
-return
-hasmntopt(me, bind) ||
-streq(me-mnt_type, bind) ||
-hasmntopt(me, rbind) ||
-streq(me-mnt_type, rbind);
-}
-
 static bool mount_is_network(struct mntent *me) {
 assert(me);
 
@@ -205,14 +195,12 @@ static int add_mount(
 bool noauto,
 bool nofail,
 bool automount,
-bool isbind,
 const char *post,
 const char *source) {
 _cleanup_free_ char
 *name = NULL, *unit = NULL, *lnk = NULL, *device = NULL,
 *automount_name = NULL, *automount_unit = NULL;
 _cleanup_fclose_ FILE *f = NULL;
-int r;
 
 assert(what);
 assert(where);
@@ -296,27 +284,6 @@ static int add_mount(
 return -errno;
 }
 }
-
-if (!isbind 
-!path_equal(where, /)) {
-
-r = device_name(what, device);
-if (r  0)
-return r;
-
-if (r  0) {
-free(lnk);
-lnk = strjoin(arg_dest, /, device, 
.wants/, name, NULL);
-if (!lnk)
-return log_oom();
-
-mkdir_parents_label(lnk, 0755);
-if (symlink(unit, lnk)  0) {
-log_error(Failed to create symlink 
%s: %m, lnk);
-return -errno;
-}
-}
-}
 }
 
 if (automount  !path_equal(where, /)) {
@@ -413,7 +380,7 @@ static int parse_fstab(const char *prefix, bool initrd) {
 if (streq(me-mnt_type, swap))
 k = add_swap(what, me);
 else {
-bool noauto, nofail, automount, isbind;
+bool noauto, nofail, automount;
 const char *post;
 
 noauto = !!hasmntopt(me, noauto);
@@ -421,7 +388,6 @@ static int parse_fstab(const char *prefix, bool initrd) {
 automount =
   hasmntopt(me, comment=systemd.automount) ||
   hasmntopt(me, x-systemd.automount);
-isbind = mount_is_bind(me);
 
 if (initrd) {
 post = SPECIAL_INITRD_FS_TARGET;
@@ -435,7 +401,7 @@ static int parse_fstab(const char *prefix, bool initrd) {
 
 k = add_mount(what, where, me-mnt_type, me-mnt_opts,
   me-mnt_passno, noauto, nofail, 
automount,
-  isbind, post, fstab_path);
+  post, fstab_path);
 }
 
 if (k  0)
@@ -523,7 +489,7 @@ static int 

[systemd-devel] [PATCH 6/7] mount: filesystems mounted in the initrd should not conflict with umount.target in the real root

2013-08-23 Thread Tom Gundersen
These mounts should be kept around and unmounted in the shutdown ramfs.

Currently, we will still attempt to umount these in the final kill spree, but
we should consider avoiding that too.
---
 src/core/mount.c | 26 +-
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/src/core/mount.c b/src/core/mount.c
index 84801e9..369823d 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -447,6 +447,21 @@ static int mount_add_quota_links(Mount *m) {
 return 0;
 }
 
+static bool should_umount(Mount *m) {
+MountParameters *p;
+
+if (path_equal(m-where, /) ||
+path_equal(m-where, /usr))
+return false;
+
+p = get_mount_parameters(m);
+if (p  mount_test_option(p-options, x-initrd.mount) 
+!in_initrd())
+return false;
+
+return true;
+}
+
 static int mount_add_default_dependencies(Mount *m) {
 const char *after, *after2, *online;
 MountParameters *p;
@@ -491,9 +506,11 @@ static int mount_add_default_dependencies(Mount *m) {
 return r;
 }
 
-r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, 
UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
-if (r  0)
-return r;
+if (should_umount(m)) {
+r = unit_add_two_dependencies_by_name(UNIT(m), UNIT_BEFORE, 
UNIT_CONFLICTS, SPECIAL_UMOUNT_TARGET, NULL, true);
+if (r  0)
+return r;
+}
 
 return 0;
 }
@@ -1553,8 +1570,7 @@ static int mount_add_one(
 if (r  0)
 goto fail;
 
-if (!path_equal(where, /) 
-!path_equal(where, /usr)) {
+if (should_umount(MOUNT(u))) {
 r = unit_add_dependency_by_name(u, UNIT_CONFLICTS, 
SPECIAL_UMOUNT_TARGET, NULL, true);
 if (r  0)
 goto fail;
-- 
1.8.3.4

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


[systemd-devel] [PATCH 7/7] swap: handle nofail/noauto in core

2013-08-23 Thread Tom Gundersen
---
 src/core/swap.c   | 15 +
 src/fstab-generator/fstab-generator.c | 59 ++-
 2 files changed, 18 insertions(+), 56 deletions(-)

diff --git a/src/core/swap.c b/src/core/swap.c
index f0e19ad..57d15eb 100644
--- a/src/core/swap.c
+++ b/src/core/swap.c
@@ -197,6 +197,7 @@ static int swap_add_device_links(Swap *s) {
 }
 
 static int swap_add_default_dependencies(Swap *s) {
+bool nofail = false, noauto = false;
 int r;
 
 assert(s);
@@ -211,6 +212,20 @@ static int swap_add_default_dependencies(Swap *s) {
 if (r  0)
 return r;
 
+if (s-from_fragment) {
+SwapParameters *p = s-parameters_fragment;
+
+nofail = p-nofail;
+noauto = p-noauto;
+}
+
+if (!noauto) {
+r = unit_add_two_dependencies_by_name(UNIT(s), UNIT_BEFORE, 
(nofail ? UNIT_WANTED_BY : UNIT_REQUIRED_BY),
+  SPECIAL_SWAP_TARGET, 
NULL, true);
+if (r  0)
+return r;
+}
+
 return 0;
 }
 
diff --git a/src/fstab-generator/fstab-generator.c 
b/src/fstab-generator/fstab-generator.c
index e780018..6ebe8aa 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -38,22 +38,6 @@
 static const char *arg_dest = /tmp;
 static bool arg_enabled = true;
 
-static int device_name(const char *path, char **unit) {
-char *p;
-
-assert(path);
-
-if (!is_device_path(path))
-return 0;
-
-p = unit_name_from_path(path, .device);
-if (!p)
-return log_oom();
-
-*unit = p;
-return 1;
-}
-
 static int mount_find_pri(struct mntent *me, int *ret) {
 char *end, *pri;
 unsigned long r;
@@ -82,7 +66,6 @@ static int mount_find_pri(struct mntent *me, int *ret) {
 static int add_swap(const char *what, struct mntent *me) {
 _cleanup_free_ char *name = NULL, *unit = NULL, *lnk = NULL, *device = 
NULL;
 _cleanup_fclose_ FILE *f = NULL;
-bool noauto, nofail;
 int r, pri = -1;
 
 assert(what);
@@ -94,9 +77,6 @@ static int add_swap(const char *what, struct mntent *me) {
 return pri;
 }
 
-noauto = !!hasmntopt(me, noauto);
-nofail = !!hasmntopt(me, nofail);
-
 name = unit_name_from_path(what, .swap);
 if (!name)
 return log_oom();
@@ -114,14 +94,10 @@ static int add_swap(const char *what, struct mntent *me) {
 return -errno;
 }
 
-fputs(# Automatically generated by systemd-fstab-generator\n\n
-  [Unit]\n
-  SourcePath=/etc/fstab\n, f);
-
-if (!noauto  !nofail)
-fputs(Before= SPECIAL_SWAP_TARGET \n, f);
-
 fprintf(f,
+# Automatically generated by systemd-fstab-generator\n\n
+[Unit]\n
+SourcePath=/etc/fstab\n
 \n
 [Swap]\n
 What=%s\n,
@@ -138,35 +114,6 @@ static int add_swap(const char *what, struct mntent *me) {
 return -errno;
 }
 
-if (!noauto) {
-lnk = strjoin(arg_dest, / SPECIAL_SWAP_TARGET .wants/, 
name, NULL);
-if (!lnk)
-return log_oom();
-
-mkdir_parents_label(lnk, 0755);
-if (symlink(unit, lnk)  0) {
-log_error(Failed to create symlink %s: %m, lnk);
-return -errno;
-}
-
-r = device_name(what, device);
-if (r  0)
-return r;
-
-if (r  0) {
-free(lnk);
-lnk = strjoin(arg_dest, /, device, .wants/, name, 
NULL);
-if (!lnk)
-return log_oom();
-
-mkdir_parents_label(lnk, 0755);
-if (symlink(unit, lnk)  0) {
-log_error(Failed to create symlink %s: %m, 
lnk);
-return -errno;
-}
-}
-}
-
 return 0;
 }
 
-- 
1.8.3.4

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


[systemd-devel] [PATCH] inline static endswith()

2013-08-23 Thread WANG Chao
---
 src/shared/util.c | 21 -
 src/shared/util.h |  9 -
 2 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/src/shared/util.c b/src/shared/util.c
index 1dde8af..3a22000 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -107,27 +107,6 @@ bool streq_ptr(const char *a, const char *b) {
 return false;
 }
 
-char* endswith(const char *s, const char *postfix) {
-size_t sl, pl;
-
-assert(s);
-assert(postfix);
-
-sl = strlen(s);
-pl = strlen(postfix);
-
-if (pl == 0)
-return (char*) s + sl;
-
-if (sl  pl)
-return NULL;
-
-if (memcmp(s + sl - pl, postfix, pl) != 0)
-return NULL;
-
-return (char*) s + sl - pl;
-}
-
 bool first_word(const char *s, const char *word) {
 size_t sl, wl;
 
diff --git a/src/shared/util.h b/src/shared/util.h
index 63f4e3d..0dab4cb 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -118,7 +118,14 @@ static inline const char *startswith_no_case(const char 
*s, const char *prefix)
 return NULL;
 }
 
-char *endswith(const char *s, const char *postfix) _pure_;
+static inline char *endswith(const char *s, const char *postfix) {
+size_t sl = strlen(s);
+size_t pl = strlen(postfix);
+
+if (sl  pl  strncmp(s + sl -pl, postfix, pl) == 0)
+return (char *) s + sl -pl;
+return NULL;
+}
 
 bool first_word(const char *s, const char *word) _pure_;
 
-- 
1.8.3.1

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


[systemd-devel] [PATCH] blkio: fix incorrect setting of cpu_shares

2013-08-23 Thread Gao feng
We should set up blockio_weight not cpu_shares.

Signed-off-by: Gao feng gaof...@cn.fujitsu.com
---
 src/core/dbus-cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
index 8ad3d11..9e97b20 100644
--- a/src/core/dbus-cgroup.c
+++ b/src/core/dbus-cgroup.c
@@ -216,7 +216,7 @@ int bus_cgroup_set_property(
 return -EINVAL;
 
 if (mode != UNIT_CHECK) {
-c-cpu_shares = ul;
+c-blockio_weight = ul;
 unit_write_drop_in_private_format(u, mode, name, 
BlockIOWeight=%lu, ul);
 }
 
-- 
1.8.3.1

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


[systemd-devel] Keyboard map for Samsung NP700Z3C

2013-08-23 Thread Herczeg Zsolt
Greetings,

I'm using Ubuntu 13.04 on a Samsung Series 5 computer and found that that
Fn hotkeys does not work.

I made a keymap for this computer and wanted to post it upstream. (Find
attached: samsung-700z) I'm sure it works fine becaouse I'm using it now.
All the Fn keys needs force-releasing.

I found that the database type of keyboard are changed since my distro's
version, so I tryed to convert my keymap to the new format.
I look through it, and there weren't any lines related to my computer so I
made a patch in hope it could be help adding support for the Samsung Series
5.
Please note that I wasn't able to test this patch! (Find attached:
0001-udev-add-samsung-700Z-keymap.patch)

Please let me know if I can help in any way.

Sorry for disturbing.

Herczeg Zsolt


samsung-700z
Description: Binary data


0001-udev-add-samsung-700Z-keymap.patch
Description: Binary data
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] inline static endswith()

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Aug 23, 2013 at 03:36:51PM +0800, WANG Chao wrote:
 ---
  src/shared/util.c | 21 -
  src/shared/util.h |  9 -
  2 files changed, 8 insertions(+), 22 deletions(-)
 
 diff --git a/src/shared/util.c b/src/shared/util.c
 index 1dde8af..3a22000 100644
 --- a/src/shared/util.c
 +++ b/src/shared/util.c
 @@ -107,27 +107,6 @@ bool streq_ptr(const char *a, const char *b) {
  return false;
  }
  
 -char* endswith(const char *s, const char *postfix) {
 -size_t sl, pl;
 -
 -assert(s);
 -assert(postfix);
 -
 -sl = strlen(s);
 -pl = strlen(postfix);
 -
 -if (pl == 0)
 -return (char*) s + sl;
 -
 -if (sl  pl)
 -return NULL;
 -
 -if (memcmp(s + sl - pl, postfix, pl) != 0)
 -return NULL;
 -
 -return (char*) s + sl - pl;
 -}
 -
  bool first_word(const char *s, const char *word) {
  size_t sl, wl;
  
 diff --git a/src/shared/util.h b/src/shared/util.h
 index 63f4e3d..0dab4cb 100644
 --- a/src/shared/util.h
 +++ b/src/shared/util.h
 @@ -118,7 +118,14 @@ static inline const char *startswith_no_case(const char 
 *s, const char *prefix)
  return NULL;
  }
  
 -char *endswith(const char *s, const char *postfix) _pure_;
 +static inline char *endswith(const char *s, const char *postfix) {
 +size_t sl = strlen(s);
 +size_t pl = strlen(postfix);
 +
 +if (sl  pl  strncmp(s + sl -pl, postfix, pl) == 0)
 +return (char *) s + sl -pl;
 +return NULL;
 +}
Hm, you're replacing a memcmp with strncmp. memcmp is actually faster,
because strncmp does check for '\0', which memcmp doesn't have to do,
and can thus e.g. compare from the end, which is faster on some
architectures.

Also, endswith is not that trivial — three function calls and
some arithmetic, and it's used in many places. So in the end,
I don't think that this patch will *increase* our footprint.

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


Re: [systemd-devel] Keyboard map for Samsung NP700Z3C

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Aug 23, 2013 at 04:18:36PM +0200, Herczeg Zsolt wrote:
 Greetings,
 
 I'm using Ubuntu 13.04 on a Samsung Series 5 computer and found that that
 Fn hotkeys does not work.
 
 I made a keymap for this computer and wanted to post it upstream. (Find
 attached: samsung-700z) I'm sure it works fine becaouse I'm using it now.
 All the Fn keys needs force-releasing.

 Please note that I wasn't able to test this patch! (Find attached:
 0001-udev-add-samsung-700Z-keymap.patch)
Patch looks OK. Why are some of the lines commented out?

 Please let me know if I can help in any way.
 
 Sorry for disturbing.
Thank you for taking the time to write a patch, especially one that you can't
use right now.

 Herczeg Zsolt

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


Re: [systemd-devel] Keyboard map for Samsung NP700Z3C

2013-08-23 Thread Herczeg Zsolt

 Please note that I wasn't able to test this patch! (Find attached:
 0001-udev-add-samsung-700Z-keymap.patch)


Patch looks OK. Why are some of the lines commented out?


The patch contains the full Fn layout of this notebook.

The lines commented out were already set up in the general keyboard 
mappings so they are kind of duplicates.


I tought it's useful to have them there, but you can either omit or 
uncomment them.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH] [RFC] Make reboot to support additional command

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Aug 13, 2013 at 03:01:25AM +0900, WaLyong Cho wrote:
 From: WaLyong Cho walyong@samsung.com
 
 reboot syscall can be performed with additional argument. In some of
 system, this functionality can be useful to ask next boot mode to
 bootloader.
What are the possible values of this additional argument?
What systems support it?

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


Re: [systemd-devel] [PATCH] blkio: fix incorrect setting of cpu_shares

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Fri, Aug 23, 2013 at 05:53:23PM +0800, Gao feng wrote:
 We should set up blockio_weight not cpu_shares.
 
 Signed-off-by: Gao feng gaof...@cn.fujitsu.com
No need for signed-of-by.

 ---
  src/core/dbus-cgroup.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c
 index 8ad3d11..9e97b20 100644
 --- a/src/core/dbus-cgroup.c
 +++ b/src/core/dbus-cgroup.c
 @@ -216,7 +216,7 @@ int bus_cgroup_set_property(
  return -EINVAL;
  
  if (mode != UNIT_CHECK) {
 -c-cpu_shares = ul;
 +c-blockio_weight = ul;
  unit_write_drop_in_private_format(u, mode, name, 
 BlockIOWeight=%lu, ul);
  }
Ooops, applied.

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


Re: [systemd-devel] [PATCH] udev: fix printf(3) type specifier

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Thu, Aug 22, 2013 at 09:17:16PM -0700, Shawn Landden wrote:
 From: Shawn Landden shawnland...@gmail.com
 
 src/udev/udev-rules.c: In function 'add_rule':
 src/udev/udev-rules.c:1078:33: warning: format '%lu' expects argument of type 
 'long unsigned int', but argument 8 has type 'int' [-Wformat=]
  log_error(invalid key/value pair in file %s 
 on line %u,
  ^

Applied.

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


Re: [systemd-devel] [PATCH] man: make reference to bind(2) explicit

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Wed, Aug 21, 2013 at 09:56:58AM -0700, Shawn Landden wrote:
 ---
  man/systemd.socket.xml | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
 index 852010b..1fc28c5 100644
 --- a/man/systemd.socket.xml
 +++ b/man/systemd.socket.xml
 @@ -510,7 +510,7 @@
  varlistentry
  termvarnameReusePort=/varname/term
  listitemparaTakes a boolean
 -value. If true, allows multiple bind()s
 +value. If true, allows multiple 
 citerefentryrefentrytitlebind/refentrytitlemanvolnum2/manvolnum/citerefentrys
  to this TCP or UDP port.  This
  controls the SO_REUSEPORT socket
  option.  See
Applied.

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


Re: [systemd-devel] [PATCH] zsh_completion: Fix single letter args

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Aug 20, 2013 at 10:06:54PM -0500, William Giokas wrote:
 Things like -n to specify the lines to show with systemctl and
 journalctl accepts syntax like:
 
   journalctl -n4
   systemctl -n14
 
 Previously, typing `-nXX tab` where XX is a number, zsh would try to
 complete an integer. Now it will see the XX and use the _journalctl_none
 completion. This is also how any of the single letter options that take
 arguments work as well.
Nice, applied.

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


Re: [systemd-devel] [PATCH 2/2] man: Small grammar fix

2013-08-23 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Jul 23, 2013 at 09:41:45AM -0500, William Giokas wrote:
 '... or ... or ...' should be '..., ... or ...'
 ---
  man/systemctl.xml | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
 diff --git a/man/systemctl.xml b/man/systemctl.xml
 index ee13a70..0a90202 100644
 --- a/man/systemctl.xml
 +++ b/man/systemctl.xml
 @@ -111,8 +111,8 @@ along with systemd; If not, see 
 http://www.gnu.org/licenses/.
  termoption--state=/option/term
  
  listitem
 -paraThe argument should be a comma-separated list of unit LOAD
 -or SUB or ACTIVE states. When listing units, show only those
 +paraThe argument should be a comma-separated list of unit LOAD,
 +SUB or ACTIVE states. When listing units, show only those
  with specified LOAD or SUB or ACTIVE state./para
  /listitem
/varlistentry
Hm, this patch series slipped through the cracks completely. I pushed my own
patch based on this patch, because the whole paragraph was awkward and we use
the oxford comma, ie. word, word, and word.

I think the rest of the series has been merged after you resent it rebased.
I not, please holler.

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


Re: [systemd-devel] [RFC v2] mount: improve DefaultDependencies and use in generator

2013-08-23 Thread Colin Walters
On Fri, 2013-08-23 at 15:09 +0800, Tom Gundersen wrote:
 This moves reduces redundancy between systemd core and the fstab-generator, by
 improving and relying on the DefaultDependencies logic.

It's also worth pointing out that conceptually Lennart has been
obsoleting a lot of this stuff with:

http://cgit.freedesktop.org/systemd/systemd/commit/?id=1a14a53cfded6e78c6e8dfb73fdff0039971d642

Your work is of course still useful for those of us who still
use /etc/fstab =)



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


Re: [systemd-devel] [RFC v2] mount: improve DefaultDependencies and use in generator

2013-08-23 Thread Tom Gundersen
On Sat, Aug 24, 2013 at 3:56 AM, Colin Walters walt...@verbum.org wrote:
 On Fri, 2013-08-23 at 15:09 +0800, Tom Gundersen wrote:
 This moves reduces redundancy between systemd core and the fstab-generator, 
 by
 improving and relying on the DefaultDependencies logic.

 It's also worth pointing out that conceptually Lennart has been
 obsoleting a lot of this stuff with:

 http://cgit.freedesktop.org/systemd/systemd/commit/?id=1a14a53cfded6e78c6e8dfb73fdff0039971d642

I haven't yet looked at that in detail, but my intention was to move
that too over to DefaultDependencies=yes, so we get the same behavior
across all the generators.

-t

 Your work is of course still useful for those of us who still
 use /etc/fstab =)



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


Re: [systemd-devel] [RFC v2] mount: improve DefaultDependencies and use in generator

2013-08-23 Thread Kay Sievers
On Sat, Aug 24, 2013 at 4:55 AM, Andrey Borzenkov arvidj...@gmail.com wrote:
 В Sat, 24 Aug 2013 04:34:09 +0200
 Kay Sievers k...@vrfy.org пишет:

 On Fri, Aug 23, 2013 at 9:56 PM, Colin Walters walt...@verbum.org wrote:
  On Fri, 2013-08-23 at 15:09 +0800, Tom Gundersen wrote:
  This moves reduces redundancy between systemd core and the 
  fstab-generator, by
  improving and relying on the DefaultDependencies logic.
 
  It's also worth pointing out that conceptually Lennart has been
  obsoleting a lot of this stuff with:
 
  http://cgit.freedesktop.org/systemd/systemd/commit/?id=1a14a53cfded6e78c6e8dfb73fdff0039971d642

 This is still work-in-progress and we will also do the same thing for
 the rootfs.

 In the long-run we want *all* stuff to work automatically, just with
 GPT, and no local config, no fstab at all for the common case; not
 even with a anything in the kernel command line ...


 How are you going to distinguish between multiple installations? Which
 of 10 homes or roots is the right one for this specific OS instance?

We will just use the *first* one we find, like finding the UEFI ESP
(/boot) works with the firmware.

Mounting /home and / should be non-dangerous, nothing should choke
really if things go wrong.

We will not try to mount machine-local/specific stuff like /var or
/usr automatically, that would really end up in a mess if things get
mixed up.

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