Re: [systemd-devel] [PATCH] unit: make unit can start without instance
On Wed, 28.05.14 00:39, WaLyong Cho (walyong@samsung.com) wrote: Sorry for the late response! I'm not sure this could be patch for below TODO. * enabling an instance unit creates a pointless link, and the unit will be started with getty@getty.service: $ systemctl enable getty@.service ln -s '/usr/lib/systemd/system/getty@.service' '/etc/systemd/system/getty.target.wants/getty@.service' This specific issue is fixed now in git, with a different patch. If can be, when this can be used? And I couldn't avoid one of strdup in manager_load_unit_prepare(). And I wasn't able to make a suit name better than instanceless. I am not entirely sure what your patch is supposed to do? If it is still useful after the fix in git, can you elaborate, please? Thanks! WaLyong Cho (1): unit: make unit can start without instance src/core/manager.c | 10 ++ src/shared/unit-name.c | 12 src/shared/unit-name.h | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) 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] unit: make unit can start without instance
On Wed, May 28, 2014 at 12:39:17AM +0900, WaLyong Cho wrote: I'm not sure this could be patch for below TODO. * enabling an instance unit creates a pointless link, and the unit will be started with getty@getty.service: $ systemctl enable getty@.service ln -s '/usr/lib/systemd/system/getty@.service' '/etc/systemd/system/getty.target.wants/getty@.service' If can be, when this can be used? And I couldn't avoid one of strdup in manager_load_unit_prepare(). And I wasn't able to make a suit name better than instanceless. For the record, this is obsoleted by commit d54c4993699f4fa5feece43715aac3564c4dada6 Author: Lennart Poettering lenn...@poettering.net Date: Tue Jun 17 00:15:31 2014 +0200 install: introduce new DefaultInstance= field for [Install] sections Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] unit: make unit can start without instance
On 06/25/2014 06:22 AM, Zbigniew Jędrzejewski-Szmek wrote: On Wed, May 28, 2014 at 12:39:17AM +0900, WaLyong Cho wrote: I'm not sure this could be patch for below TODO. * enabling an instance unit creates a pointless link, and the unit will be started with getty@getty.service: $ systemctl enable getty@.service ln -s '/usr/lib/systemd/system/getty@.service' '/etc/systemd/system/getty.target.wants/getty@.service' If can be, when this can be used? And I couldn't avoid one of strdup in manager_load_unit_prepare(). And I wasn't able to make a suit name better than instanceless. For the record, this is obsoleted by commit d54c4993699f4fa5feece43715aac3564c4dada6 Author: Lennart Poettering lenn...@poettering.net Date: Tue Jun 17 00:15:31 2014 +0200 install: introduce new DefaultInstance= field for [Install] sections Looks more good better than me. I think the TODO item could be removed. ;) Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] unit: make unit can start without instance
On Wed, Jun 25, 2014 at 02:29:20PM +0900, WaLyong Cho wrote: On 06/25/2014 06:22 AM, Zbigniew Jędrzejewski-Szmek wrote: On Wed, May 28, 2014 at 12:39:17AM +0900, WaLyong Cho wrote: I'm not sure this could be patch for below TODO. * enabling an instance unit creates a pointless link, and the unit will be started with getty@getty.service: $ systemctl enable getty@.service ln -s '/usr/lib/systemd/system/getty@.service' '/etc/systemd/system/getty.target.wants/getty@.service' If can be, when this can be used? And I couldn't avoid one of strdup in manager_load_unit_prepare(). And I wasn't able to make a suit name better than instanceless. For the record, this is obsoleted by commit d54c4993699f4fa5feece43715aac3564c4dada6 Author: Lennart Poettering lenn...@poettering.net Date: Tue Jun 17 00:15:31 2014 +0200 install: introduce new DefaultInstance= field for [Install] sections Looks more good better than me. I think the TODO item could be removed. ;) Good point, removed. Zbyszek ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] unit: make unit can start without instance
I'm not sure this could be patch for below TODO. * enabling an instance unit creates a pointless link, and the unit will be started with getty@getty.service: $ systemctl enable getty@.service ln -s '/usr/lib/systemd/system/getty@.service' '/etc/systemd/system/getty.target.wants/getty@.service' If can be, when this can be used? And I couldn't avoid one of strdup in manager_load_unit_prepare(). And I wasn't able to make a suit name better than instanceless. WaLyong Cho (1): unit: make unit can start without instance src/core/manager.c | 10 ++ src/shared/unit-name.c | 12 src/shared/unit-name.h | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] unit: make unit can start without instance
--- src/core/manager.c | 10 ++ src/shared/unit-name.c | 12 src/shared/unit-name.h | 1 + 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/core/manager.c b/src/core/manager.c index 0cb2044..089df43 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1163,6 +1163,7 @@ int manager_load_unit_prepare( Unit *ret; UnitType t; int r; +_cleanup_free_ char *n = NULL; assert(m); assert(name || path); @@ -1177,11 +1178,12 @@ int manager_load_unit_prepare( name = basename(path); t = unit_name_to_type(name); +n = unit_name_from_instanceless(name); -if (t == _UNIT_TYPE_INVALID || !unit_name_is_valid(name, TEMPLATE_INVALID)) -return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, Unit name %s is not valid., name); +if (t == _UNIT_TYPE_INVALID || !unit_name_is_valid(n, TEMPLATE_INVALID)) +return sd_bus_error_setf(e, SD_BUS_ERROR_INVALID_ARGS, Unit name %s is not valid., n); -ret = manager_get_unit(m, name); +ret = manager_get_unit(m, n); if (ret) { *_ret = ret; return 1; @@ -1199,7 +1201,7 @@ int manager_load_unit_prepare( } } -r = unit_add_name(ret, name); +r = unit_add_name(ret, n); if (r 0) { unit_free(ret); return r; diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c index 6c167b4..c5584b5 100644 --- a/src/shared/unit-name.c +++ b/src/shared/unit-name.c @@ -431,6 +431,18 @@ char *unit_name_from_path_instance(const char *prefix, const char *path, const c return strjoin(prefix, @, p, suffix, NULL); } +char *unit_name_from_instanceless(const char *name) { +_cleanup_free_ char *i = NULL; + +assert(name); + +if (unit_name_is_template(name)) { +i = unit_name_to_prefix(name); +return unit_name_replace_instance(name, i); +} else +return strdup(name); +} + char *unit_name_to_path(const char *name) { _cleanup_free_ char *w = NULL; diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h index d06d2b2..1251b18 100644 --- a/src/shared/unit-name.h +++ b/src/shared/unit-name.h @@ -98,6 +98,7 @@ char *unit_name_template(const char *f); char *unit_name_from_path(const char *path, const char *suffix); char *unit_name_from_path_instance(const char *prefix, const char *path, const char *suffix); +char *unit_name_from_instanceless(const char *name); char *unit_name_to_path(const char *name); char *unit_dbus_path_from_name(const char *name); -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel