Re: [systemd-devel] [PATCH] Fix: can not pass configure by default kmod build option

2014-01-15 Thread Yang Chengwei
On Thu, Jan 16, 2014 at 02:56:27AM +0100, Zbigniew Jędrzejewski-Szmek wrote:
 On Wed, Jan 15, 2014 at 01:28:26PM +0800, Chengwei Yang wrote:
  The situation is: by default, we get a auto value for kmod compiling
  option, so if we found required kmod files, then we build it with kmod
  enabled, otherwise, just build without kmod and do not complain to user.
  
  However, currently, if kmod version  15 available in machine, and build
  with default option, say no explicitly with --enable/disable-kmod,
  then the configure will fail with
  
  ...
  checking for KMOD... no
  configure: error: *** kmod version = 15 not found
  ...
 This is on purpose.

I'm not sure if this is worth, given that kmod may not available in some
distro version, for example, ubuntu 12.04, so you're expecting us to
replace kmod from OS repo or upgrade our OS to do systemd development. A
little dominating to user I think.

--
Thanks,
Chengwei

 
 commit c4955740969d7ba8ba43b024bca1a0a5b56eb8e8
 Author: Tom Gundersen t...@jklm.no
 Date:   Tue Jul 9 00:12:35 2013 +0200
 
 configure: fail if out-of-date kmod found and kmod not disabled
 
 Almost everyone wants kmod support, so don't fail silently if the libs are
 out-of-date.
 
 kmod can still be explicitly disabled and if it is not found at all, we 
 still
 default to disabling it.
 
 Zbyszek


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


Re: [systemd-devel] [PATCH] Fix: can not pass configure by default kmod build option

2014-01-15 Thread Yang Chengwei
On Thu, Jan 16, 2014 at 10:05:23AM +0800, Yang Chengwei wrote:
 On Thu, Jan 16, 2014 at 02:56:27AM +0100, Zbigniew Jędrzejewski-Szmek wrote:
  On Wed, Jan 15, 2014 at 01:28:26PM +0800, Chengwei Yang wrote:
   The situation is: by default, we get a auto value for kmod compiling
   option, so if we found required kmod files, then we build it with kmod
   enabled, otherwise, just build without kmod and do not complain to user.
   
   However, currently, if kmod version  15 available in machine, and build
   with default option, say no explicitly with --enable/disable-kmod,
   then the configure will fail with
   
   ...
   checking for KMOD... no
   configure: error: *** kmod version = 15 not found
   ...
  This is on purpose.
 
 I'm not sure if this is worth, given that kmod may not available in some
 distro version, for example, ubuntu 12.04, so you're expecting us to
 replace kmod from OS repo or upgrade our OS to do systemd development. A
 little dominating to user I think.

I also found several cases which doesn't cry in kmod way, like
libcryptsetup, qrencode, microhttpd, python_devel and maybe more, I'm
not going to list all of them, so I think it's good to make kmod work in
the same way as others.

--
Thanks,
Chengwei

 
 --
 Thanks,
 Chengwei
 
  
  commit c4955740969d7ba8ba43b024bca1a0a5b56eb8e8
  Author: Tom Gundersen t...@jklm.no
  Date:   Tue Jul 9 00:12:35 2013 +0200
  
  configure: fail if out-of-date kmod found and kmod not disabled
  
  Almost everyone wants kmod support, so don't fail silently if the libs 
  are
  out-of-date.
  
  kmod can still be explicitly disabled and if it is not found at all, we 
  still
  default to disabling it.
  
  Zbyszek




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


Re: [systemd-devel] [PATCH] prioq: avoid to swap item index

2013-12-15 Thread Yang Chengwei
On Mon, Dec 16, 2013 at 04:57:39AM +0100, Lennart Poettering wrote:
 On Mon, 16.12.13 04:48, Lennart Poettering (lenn...@poettering.net) wrote:
 
  
  On Mon, 16.12.13 11:03, Chengwei Yang (chengwei.y...@intel.com) wrote:
  
   the swap() operation of prioq which in fact only swap item's data but
   keep idx untouched. However, current implement does first swap the idx
   and then swap back again.
  
  Sorry, I do understand? Can you elaborate, please? Is this supposed to
  wanted to say: I do *not* understand...

It's an optimization.

A condition of the queue is just like the assert says

assert(!q-items[j].idx || *(q-items[j].idx) == j);
assert(!q-items[k].idx || *(q-items[k].idx) == k);

This is true before and after swap. So in fact no need to swap idx and
then swap back again. Just do not touch idx, then item[j].idx is always
0 or j, so as item[k].

The deleted code does

1. first swap the idx regardless it's 0 or not

2. then, if idx isn't 0, swap back.

So this patch is a optimization for the case where item.idx isn't 0,
which avoid to swap idx and swap idx back.

I'm not sure this is clear enough. In simple, the fact is *before* and
*after* we need make sure item[j].idx == j or item[j].idx == 0, so why we
change it during swap? Because if it changed during swap, we need then
assign item[j].idx = j before the swap finish. So the simple way is keep
it untouched.

--
Thanks,
Chengwei

  be a bug fix or an optimization?
  
   ---
src/shared/prioq.c |   10 --
1 file changed, 10 deletions(-)
   
   diff --git a/src/shared/prioq.c b/src/shared/prioq.c
   index 8af4c51..ef99c47 100644
   --- a/src/shared/prioq.c
   +++ b/src/shared/prioq.c
   @@ -68,7 +68,6 @@ int prioq_ensure_allocated(Prioq **q, compare_func_t 
   compare_func) {

static void swap(Prioq *q, unsigned j, unsigned k) {
void *saved_data;
   -unsigned *saved_idx;

assert(q);
assert(j  q-n_items);
   @@ -78,17 +77,8 @@ static void swap(Prioq *q, unsigned j, unsigned k) {
assert(!q-items[k].idx || *(q-items[k].idx) == k);

saved_data = q-items[j].data;
   -saved_idx = q-items[j].idx;
q-items[j].data = q-items[k].data;
   -q-items[j].idx = q-items[k].idx;
q-items[k].data = saved_data;
   -q-items[k].idx = saved_idx;
   -
   -if (q-items[j].idx)
   -*q-items[j].idx = j;
   -
   -if (q-items[k].idx)
   -*q-items[k].idx = k;
}

static unsigned shuffle_up(Prioq *q, unsigned idx) {
  
  
  Lennart
  
 
 
 Lennart
 
 -- 
 Lennart Poettering, Red Hat


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


Re: [systemd-devel] [PATCH] libsystemd-login.so: fix undefined reference to 'cg_create'

2013-09-11 Thread Yang Chengwei
On Wed, Sep 11, 2013 at 01:27:03PM +0200, Lennart Poettering wrote:
 On Wed, 11.09.13 13:28, Yang Chengwei (chengwei.y...@intel.com) wrote:
 
  On Tue, Sep 10, 2013 at 06:02:55PM +0200, Lennart Poettering wrote:
   On Mon, 26.08.13 13:48, Chengwei Yang (chengwei.y...@intel.com) wrote:
   
   Hmm, can you elaborate on this one? libsystemd-login should be mostly
  
  This error occurs while building dbus with systemd support like below
  
  $ make
  make  all-recursive
  make[1]: Entering directory `/home/chengwei/Upstream/dbus.git'
  Making all in dbus
  make[2]: Entering directory `/home/chengwei/Upstream/dbus.git/dbus'
  make  all-am
  make[3]: Entering directory `/home/chengwei/Upstream/dbus.git/dbus'
CCLD   dbus-test
/usr/lib/libsystemd-login.so: undefined reference to `cg_create'
collect2: ld returned 1 exit status
make[3]: *** [dbus-test] Error 1
make[3]: Leaving directory `/home/chengwei/Upstream/dbus.git/dbus'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/chengwei/Upstream/dbus.git/dbus'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/chengwei/Upstream/dbus.git'
make: *** [all] Error 2
  
  and cg_create referenced by libsystemd-login.so like below
  
  $ grep cg_create src/login/ -r
  Binary file src/login/systemd_logind-logind-session.o matches
  Binary file src/login/systemd_logind-logind-user.o matches
 
 But these files are not linked into libsystemd-login, but only into
 logind (the daemon)...

Yeah, just found that from Makefile.am, it's weird why the above error
happen.

--
Thanks,
Chengwei

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


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


Re: [systemd-devel] [PATCH] libsystemd-login.so: fix undefined reference to 'cg_create'

2013-09-11 Thread Yang Chengwei
On Wed, Sep 11, 2013 at 02:09:58PM +0200, Kay Sievers wrote:
 On Wed, Sep 11, 2013 at 1:27 PM, Lennart Poettering
 lenn...@poettering.net wrote:
  On Wed, 11.09.13 13:28, Yang Chengwei (chengwei.y...@intel.com) wrote:
 
  On Tue, Sep 10, 2013 at 06:02:55PM +0200, Lennart Poettering wrote:
   On Mon, 26.08.13 13:48, Chengwei Yang (chengwei.y...@intel.com) wrote:
  
   Hmm, can you elaborate on this one? libsystemd-login should be mostly
 
  This error occurs while building dbus with systemd support like below
 
  $ make
  make  all-recursive
  make[1]: Entering directory `/home/chengwei/Upstream/dbus.git'
  Making all in dbus
  make[2]: Entering directory `/home/chengwei/Upstream/dbus.git/dbus'
  make  all-am
  make[3]: Entering directory `/home/chengwei/Upstream/dbus.git/dbus'
CCLD   dbus-test
/usr/lib/libsystemd-login.so: undefined reference to `cg_create'
collect2: ld returned 1 exit status
make[3]: *** [dbus-test] Error 1
make[3]: Leaving directory `/home/chengwei/Upstream/dbus.git/dbus'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/chengwei/Upstream/dbus.git/dbus'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/chengwei/Upstream/dbus.git'
make: *** [all] Error 2
 
  and cg_create referenced by libsystemd-login.so like below
 
  $ grep cg_create src/login/ -r
  Binary file src/login/systemd_logind-logind-session.o matches
  Binary file src/login/systemd_logind-logind-user.o matches
 
  But these files are not linked into libsystemd-login, but only into
  logind (the daemon)...
 
 Does this print something when executed in the build tree?
   $ nm -D .libs/libsystemd-login.so | grep cg

$ nm -D /usr/lib/libsystemd-login.so | grep cg
 U tcgetattr

Seems irrelative with the problem.

--
Thanks,
Chengwei

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


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


Re: [systemd-devel] [PATCH] libsystemd-login.so: fix undefined reference to 'cg_create'

2013-09-10 Thread Yang Chengwei
On Tue, Sep 10, 2013 at 06:02:55PM +0200, Lennart Poettering wrote:
 On Mon, 26.08.13 13:48, Chengwei Yang (chengwei.y...@intel.com) wrote:
 
 Hmm, can you elaborate on this one? libsystemd-login should be mostly

This error occurs while building dbus with systemd support like below

$ make
make  all-recursive
make[1]: Entering directory `/home/chengwei/Upstream/dbus.git'
Making all in dbus
make[2]: Entering directory `/home/chengwei/Upstream/dbus.git/dbus'
make  all-am
make[3]: Entering directory `/home/chengwei/Upstream/dbus.git/dbus'
  CCLD   dbus-test
  /usr/lib/libsystemd-login.so: undefined reference to `cg_create'
  collect2: ld returned 1 exit status
  make[3]: *** [dbus-test] Error 1
  make[3]: Leaving directory `/home/chengwei/Upstream/dbus.git/dbus'
  make[2]: *** [all] Error 2
  make[2]: Leaving directory `/home/chengwei/Upstream/dbus.git/dbus'
  make[1]: *** [all-recursive] Error 1
  make[1]: Leaving directory `/home/chengwei/Upstream/dbus.git'
  make: *** [all] Error 2

and cg_create referenced by libsystemd-login.so like below

$ grep cg_create src/login/ -r
Binary file src/login/systemd_logind-logind-session.o matches
Binary file src/login/systemd_logind-logind-user.o matches

--
Thanks,
Chengwei

 passive, why would it need to change labels? What's the missing link
 here precisely?
 
  ---
   Makefile.am |1 +
   1 file changed, 1 insertion(+)
  
  diff --git a/Makefile.am b/Makefile.am
  index 5654ad3..dc5170a 100644
  --- a/Makefile.am
  +++ b/Makefile.am
  @@ -3870,6 +3870,7 @@ libsystemd_login_la_LDFLAGS = \
  -Wl,--version-script=$(top_srcdir)/src/login/libsystemd-login.sym
   
   libsystemd_login_la_LIBADD = \
  +   libsystemd-label.la \
  libsystemd-shared.la \
  libsystemd-daemon-internal.la \
  $(RT_LIBS)
 
 
 Lennart
 
 -- 
 Lennart Poettering - Red Hat, Inc.


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


Re: [systemd-devel] [PATCH] Delay dbus connection for user session

2013-05-28 Thread Yang Chengwei
On Tue, May 28, 2013 at 01:53:16PM -0700, Kok, Auke-jan H wrote:
 On Tue, May 28, 2013 at 3:00 AM, Chengwei Yang chengwei.y...@intel.com 
 wrote:
  Currently, if we have a user session, when systemd user session start,
  just like the situation for it as PID 1, dbus-daemon isn't ready at that
  moment, so it always failed with below error.
 
  Feb 06 16:50:10 localhost.localdomain systemd[417]: Failed to open
  private bus connection: Failed to connect to socket
  /run/user/app/dbus/user_bus_socket: No such file or directory
 
  Signed-off-by: Chengwei Yang chengwei.y...@intel.com
  ---
   src/core/manager.c |2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
 
  diff --git a/src/core/manager.c b/src/core/manager.c
  index 0508628..467b5ba 100644
  --- a/src/core/manager.c
  +++ b/src/core/manager.c
  @@ -503,7 +503,7 @@ int manager_new(SystemdRunningAs running_as, Manager 
  **_m) {
   goto fail;
 
   /* Try to connect to the busses, if possible. */
  -r = bus_init(m, running_as != SYSTEMD_SYSTEM);
  +r = bus_init(m, running_as != SYSTEMD_SYSTEM  running_as != 
  SYSTEMD_USER);
   if (r  0)
   goto fail;
 
 So, I've looked at this code again as I've spotted this problem over a
 year ago, and I'm wondering if this entire section should just be
 removed, since running_as only has 2 values (_SYSTEM and _USER)
 anyway...
 
 Would there be any objection to just dropping these 4 lines entirely?
 Lennart, Kay? I don't see how we'd have a 3rd manager type here.

Yes, just in that case. If all of you agreed, I'd like submit a V2 to
drop these lines.

--
Thanks,
Chengwei

 
 
 Auke


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