Re: [PATCH] Add libgsystem as a git submodule

2013-05-22 Thread Jirka Klimes
On Tuesday 21 of May 2013 11:07:02 Colin Walters wrote:
 On Tue, 2013-05-21 at 09:08 +0200, Jirka Klimes wrote:
CC libgsystem_la-gsystem-file-utils.lo
  
  libgsystem/gsystem-file-utils.c: In function 'linkcopy_internal_attempt':
  libgsystem/gsystem-file-utils.c:358:3: error: implicit declaration of
  function 'g_clear_pointer' [-Werror=implicit-function-declaration]
  cc1: all warnings being treated as errors
 
 Can you try with
 https://git.gnome.org/browse/libgsystem/commit/?id=759384420c1578bf399473440
 ab34af18fa46b8d

The patch misses terminating #endif:

diff --git a/gsystem-glib-compat.h b/gsystem-glib-compat.h
index edbdaab..70a9c1b 100644
--- a/gsystem-glib-compat.h
+++ b/gsystem-glib-compat.h
@@ -51,3 +51,4 @@ g_type_ensure (GType type)
 
 #endif
 
+#endif  /* __LIBGSYSTEM_GLIB_COMPAT__ */

Other than that it is good.

Thanks,
Jirka
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-22 Thread Colin Walters
On Wed, 2013-05-22 at 08:55 +0200, Jirka Klimes wrote:

 +#endif  /* __LIBGSYSTEM_GLIB_COMPAT__ */

Hum, I must have failed to actually apply the patch to NM's copy of
libgsystem.  Regardless, pushed, thanks!


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-21 Thread Jirka Klimes
On Friday 17 of May 2013 14:10:56 Colin Walters wrote:
 On Fri, 2013-05-17 at 08:04 -0400, Pavel Simerda wrote:
  Colin, do you have any ideas for the NetworkManager codebase apart from
  the cleanup functions?
 Possibly; the structured logging for example.  NM could tag e.g. DHCP
 log messages with the interface ID, and system management interfaces
 could then show log messages related to that interface.
 
   If not, why don't we remove the submodule and just copy in the
   header with the relevant macros for now?
  
  Or maybe we could make the build system only choose relevant parts from
  libgsystem.
 Let me try a patch.

Colin, thanks for the Build with GLib 2.32 as well patch.
But still, libgsystem doesn't compile due to g_clear_pointer():

  CC libgsystem_la-gsystem-file-utils.lo
libgsystem/gsystem-file-utils.c: In function 'linkcopy_internal_attempt':
libgsystem/gsystem-file-utils.c:358:3: error: implicit declaration of function 
'g_clear_pointer' [-Werror=implicit-function-declaration]
cc1: all warnings being treated as errors

We now use g_clear_pointer() as well, but define it for glib  2.34 in 
include/nm-glib-compat.h

Jirka

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-21 Thread Colin Walters
On Tue, 2013-05-21 at 09:08 +0200, Jirka Klimes wrote:

   CC libgsystem_la-gsystem-file-utils.lo
 libgsystem/gsystem-file-utils.c: In function 'linkcopy_internal_attempt':
 libgsystem/gsystem-file-utils.c:358:3: error: implicit declaration of 
 function 
 'g_clear_pointer' [-Werror=implicit-function-declaration]
 cc1: all warnings being treated as errors

Can you try with
https://git.gnome.org/browse/libgsystem/commit/?id=759384420c1578bf399473440ab34af18fa46b8d

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Jirka Klimes
On Thursday 16 of May 2013 14:09:32 Dan Williams wrote:
 On Thu, 2013-05-16 at 04:53 -0400, Pavel Simerda wrote:
   From: Colin Walters walt...@verbum.org
   
   On Mon, 2013-05-06 at 12:50 -0500, Dan Williams wrote:
On Fri, 2013-04-26 at 16:42 -0400, Colin Walters wrote:
 And change src/main.c to use the local allocation macros.  This
 results in much cleaner code, as one can see from the diff.
 
 Because libgsystem is designed for nonrecursive make, it fits best
 in
 the current recursive setup if we build . first.  This will be a lot
 nicer when we switch NM to a nonrecursive setup.
 ---
 
  .gitmodules |3 +++
  Makefile.am |7 +++
  libgsystem  |1 +
  src/Makefile.am |2 ++
  src/main.c  |   50
  --
  5 files changed, 25 insertions(+), 38 deletions(-)
  create mode 100644 .gitmodules
  create mode 16 libgsystem

Patch looks good to me; Pavel, I'll assume you acked it too, given you
had objections last time?
   
   Any thoughts, Pavel?
  
  Patch looks good to me. It might be good to have Dan Winship's (Cc) ack
  too, as he recently modified the build system files and might have some
  comments or suggestions.
 libgsystem pushed; everyone re-run autogen.sh to get the new module
 bits.  Otherwise it'll fail pretty quick.
 
 Dan

autogen.sh properly gets libgsystem. However it seems libgsystem simply uses 
latest GLib bits. I guess it should not if it can be avoided, because it
spoils its usability.
And that is the case for NetworkManager (that is just happy with glib 2.32).

libgsystem now uses these symbols that require glib=2.34:
* g_mapped_file_get_bytes (GMappedFile *file)
* g_spawn_check_exit_status()
* and G_SPAWN_EXIT_ERROR, G_SPAWN_SEARCH_PATH_FROM_ENVP

Making a compatibility definition for them will allow compilation.

Jirka

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Pavel Simerda
- Original Message -
 From: Jirka Klimes jkli...@redhat.com
 To: Dan Williams d...@redhat.com
 Cc: Pavel Simerda psime...@redhat.com, Colin Walters 
 walt...@verbum.org, networkmanager-list@gnome.org,
 danw d...@gnome.org
 Sent: Friday, May 17, 2013 9:37:29 AM
 Subject: Re: [PATCH] Add libgsystem as a git submodule
 
 On Thursday 16 of May 2013 14:09:32 Dan Williams wrote:
  On Thu, 2013-05-16 at 04:53 -0400, Pavel Simerda wrote:
From: Colin Walters walt...@verbum.org

On Mon, 2013-05-06 at 12:50 -0500, Dan Williams wrote:
 On Fri, 2013-04-26 at 16:42 -0400, Colin Walters wrote:
  And change src/main.c to use the local allocation macros.  This
  results in much cleaner code, as one can see from the diff.
  
  Because libgsystem is designed for nonrecursive make, it fits best
  in
  the current recursive setup if we build . first.  This will be a
  lot
  nicer when we switch NM to a nonrecursive setup.
  ---
  
   .gitmodules |3 +++
   Makefile.am |7 +++
   libgsystem  |1 +
   src/Makefile.am |2 ++
   src/main.c  |   50
   --
   5 files changed, 25 insertions(+), 38 deletions(-)
   create mode 100644 .gitmodules
   create mode 16 libgsystem
 
 Patch looks good to me; Pavel, I'll assume you acked it too, given
 you
 had objections last time?

Any thoughts, Pavel?
   
   Patch looks good to me. It might be good to have Dan Winship's (Cc) ack
   too, as he recently modified the build system files and might have some
   comments or suggestions.
  libgsystem pushed; everyone re-run autogen.sh to get the new module
  bits.  Otherwise it'll fail pretty quick.
  
  Dan
 
 autogen.sh properly gets libgsystem. However it seems libgsystem simply uses
 latest GLib bits. I guess it should not if it can be avoided, because it
 spoils its usability.
 And that is the case for NetworkManager (that is just happy with glib 2.32).
 
 libgsystem now uses these symbols that require glib=2.34:
 * g_mapped_file_get_bytes (GMappedFile *file)
 * g_spawn_check_exit_status()
 * and G_SPAWN_EXIT_ERROR, G_SPAWN_SEARCH_PATH_FROM_ENVP
 
 Making a compatibility definition for them will allow compilation.

Would it be a problem to bump the requirement to 2.34?

Pavel
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Dan Winship
 autogen.sh properly gets libgsystem. However it seems libgsystem simply uses
 latest GLib bits. I guess it should not if it can be avoided, because it
 spoils its usability.
 And that is the case for NetworkManager (that is just happy with glib 2.32).

 libgsystem now uses these symbols that require glib=2.34:
 * g_mapped_file_get_bytes (GMappedFile *file)
 * g_spawn_check_exit_status()
 * and G_SPAWN_EXIT_ERROR, G_SPAWN_SEARCH_PATH_FROM_ENVP

 Making a compatibility definition for them will allow compilation.
 
 Would it be a problem to bump the requirement to 2.34?

Yes, we picked the current versions to work well with various distros.

Are we planning to use anything in libgsystem besides the auto-free
stuff? If not, why don't we remove the submodule and just copy in the
header with the relevant macros for now?

-- Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Pavel Simerda
 From: Dan Winship d...@gnome.org
 
  autogen.sh properly gets libgsystem. However it seems libgsystem simply
  uses
  latest GLib bits. I guess it should not if it can be avoided, because it
  spoils its usability.
  And that is the case for NetworkManager (that is just happy with glib
  2.32).
 
  libgsystem now uses these symbols that require glib=2.34:
  * g_mapped_file_get_bytes (GMappedFile *file)
  * g_spawn_check_exit_status()
  * and G_SPAWN_EXIT_ERROR, G_SPAWN_SEARCH_PATH_FROM_ENVP
 
  Making a compatibility definition for them will allow compilation.
  
  Would it be a problem to bump the requirement to 2.34?
 
 Yes, we picked the current versions to work well with various distros.

Thanks.

 Are we planning to use anything in libgsystem besides the auto-free
 stuff?

No idea.

Colin, do you have any ideas for the NetworkManager codebase apart from the 
cleanup functions?

 If not, why don't we remove the submodule and just copy in the
 header with the relevant macros for now?

Or maybe we could make the build system only choose relevant parts from 
libgsystem. I hope we don't have to revert it the second time and would rather 
have the bumped dependency for a couple of days. Maybe Colin comes up with some 
neat solution.

Cheers,

Pavel
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Pavel Simerda
- Original Message -
 From: Colin Walters walt...@verbum.org
 To: Pavel Simerda psime...@redhat.com
 Cc: Dan Winship d...@gnome.org, jkli...@redhat.com, Dan Williams 
 d...@redhat.com,
 networkmanager-list@gnome.org
 Sent: Friday, May 17, 2013 8:10:56 PM
 Subject: Re: [PATCH] Add libgsystem as a git submodule
 
 On Fri, 2013-05-17 at 08:04 -0400, Pavel Simerda wrote:
 
  Colin, do you have any ideas for the NetworkManager codebase apart from the
  cleanup functions?
 
 Possibly; the structured logging for example.  NM could tag e.g. DHCP
 log messages with the interface ID, and system management interfaces
 could then show log messages related to that interface.

Any more resources/documentation/posts for that? Sounds nice but I just can't 
imagine how it works, how NetworkManager could use it, whether it's somehow 
related to journald, etc...

   If not, why don't we remove the submodule and just copy in the
   header with the relevant macros for now?
  
  Or maybe we could make the build system only choose relevant parts from
  libgsystem.
 
 Let me try a patch.

Thanks!

As a side note, in future, I'll be adding a dependency on Jiří Pírko's libndp 
and we would most probably like to temporarily bundle it for distributions 
without libndp packages. As libgsystem is a dependency imported as a git 
submodule, it looks like you already did part of my work ;).

Pavel
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Colin Walters
On Fri, 2013-05-17 at 15:05 -0400, Pavel Simerda wrote:

 Any more resources/documentation/posts for that? 

Look at the attached patch as a demo.  Results:

bash-4.2# journalctl NM_IFACE=eth0
-- Logs begin at Mon 2013-03-25 18:35:24 EDT, end at Fri 2013-05-17 16:31:52 
EDT. --
May 17 16:31:18 qemux86-64 NetworkManager[327]: Bound interface eth0
bash-4.2# 

 As a side note, in future, I'll be adding a dependency on Jiří Pírko's libndp

Link?

From f5554e5371b27c564b0e248d6ccefd9da4176916 Mon Sep 17 00:00:00 2001
From: Colin Walters walt...@verbum.org
Date: Fri, 17 May 2013 16:35:14 -0400
Subject: [PATCH] Demo structured logging

---
 configure.ac  |   11 +++
 src/Makefile.am   |3 +++
 src/dhcp-manager/nm-dhcp-client.c |   10 ++
 3 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 43e420f..d7641fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -291,6 +291,17 @@ if test $with_session_tracking = consolekit; then
 fi
 AC_MSG_RESULT($with_session_tracking)
 
+AC_ARG_WITH(systemd-journal,
+	AS_HELP_STRING([--without-systemd-journal], [Use systemd @:@default=auto@:@]),
+	[], [with_systemd_journal=auto])
+AS_IF([test x$with_systemd_journal != xno], [
+  PKG_CHECK_MODULES([SYSTEMD_JOURNAL], [libsystemd-journal = 200], have_systemd_journal=yes, have_systemd_journal=no)
+  ])
+AM_CONDITIONAL(ENABLE_SYSTEMD_JOURNAL, test x$have_systemd_journal = xyes)
+AS_IF([test x$have_systemd_journal = xyes], [
+  AC_DEFINE([ENABLE_SYSTEMD_JOURNAL],[1],[Define if you want to build with systemd journal support])
+])
+
 AC_ARG_WITH(suspend-resume, AS_HELP_STRING([--with-suspend-resume=upower|systemd], [Build NetworkManager with specific suspend/resume support]))
 if test z$with_suspend_resume = z; then
 PKG_CHECK_EXISTS([libsystemd-login = 183], [have_systemd_inhibit=yes], [have_systemd_inhibit=no])
diff --git a/src/Makefile.am b/src/Makefile.am
index d34e911..b7b49ef 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -345,6 +345,7 @@ AM_CPPFLAGS = \
 	$(MM_GLIB_CFLAGS) \
 	$(POLKIT_CFLAGS) \
 	$(SYSTEMD_LOGIN_CFLAGS) \
+	$(SYSTEMD_JOURNAL_CFLAGS) \
 	\
 	-DBINDIR=\$(bindir)\ \
 	-DDATADIR=\$(datadir)\ \
@@ -375,6 +376,7 @@ libNetworkManager_la_SOURCES = \
 
 libNetworkManager_la_LIBADD = \
 	$(top_builddir)/libnm-util/libnm-util.la \
+	$(top_builddir)/libgsystem.la \
 	$(BLUEZ_LIBS) \
 	$(DBUS_LIBS) \
 	$(GLIB_LIBS) \
@@ -383,6 +385,7 @@ libNetworkManager_la_LIBADD = \
 	$(MM_GLIB_LIBS) \
 	$(POLKIT_LIBS) \
 	$(SYSTEMD_LOGIN_LIBS) \
+	$(SYSTEMD_JOURNAL_LIBS) \
 	$(LIBDL) \
 	$(LIBM)
 
diff --git a/src/dhcp-manager/nm-dhcp-client.c b/src/dhcp-manager/nm-dhcp-client.c
index e6c36e9..17d70e7 100644
--- a/src/dhcp-manager/nm-dhcp-client.c
+++ b/src/dhcp-manager/nm-dhcp-client.c
@@ -32,6 +32,7 @@
 #include nm-logging.h
 #include nm-dbus-glib-types.h
 #include nm-dhcp-client.h
+#include libgsystem.h
 
 typedef struct {
 	char *   iface;
@@ -728,6 +729,15 @@ nm_dhcp_client_new_options (NMDHCPClient *self,
 	if (state_is_bound (new_state)) {
 		/* Cancel the timeout if the DHCP client is now bound */
 		timeout_cleanup (self);
+		{
+			#define BOUND_IFACE_MSGID bc498d9d08dfdda9432d74a6737ac73e
+			gs_free char *iface_key = g_strconcat (NM_IFACE=, priv-iface);
+			gs_free char *msg = g_strdup_printf (Bound interface %s, priv-iface);
+			char *keys[] = { MESSAGE_ID= BOUND_IFACE_MSGID,
+			 iface_key,
+			 NULL };
+			gs_log_structured (msg, keys);
+		}
 	}
 
 	if (priv-ipv6) {
-- 
1.7.1

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Pavel Simerda
 From: Colin Walters walt...@verbum.org
 On Fri, 2013-05-17 at 15:05 -0400, Pavel Simerda wrote:
 
  Any more resources/documentation/posts for that?
 
 Look at the attached patch as a demo.

Ah, interesting. Is it capable of working without systemd at least to the level 
of using syslog and/org stderr?

 Results:
 
 bash-4.2# journalctl NM_IFACE=eth0
 -- Logs begin at Mon 2013-03-25 18:35:24 EDT, end at Fri 2013-05-17 16:31:52
 EDT. --
 May 17 16:31:18 qemux86-64 NetworkManager[327]: Bound interface eth0
 bash-4.2#
 
  As a side note, in future, I'll be adding a dependency on Jiří Pírko's
  libndp
 
 Link?

https://github.com/jpirko/libndp
https://bugzilla.gnome.org/show_bug.cgi?id=699772#c1

Cheers,

Pavel
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Colin Walters
On Fri, 2013-05-17 at 19:44 -0400, Pavel Simerda wrote:
  From: Colin Walters walt...@verbum.org
  On Fri, 2013-05-17 at 15:05 -0400, Pavel Simerda wrote:
  
   Any more resources/documentation/posts for that?
  
  Look at the attached patch as a demo.
 
 Ah, interesting. Is it capable of working without systemd at least to the 
 level of using syslog and/org stderr?

Yes, it just prints to stdout on non-systemd, though I'd definitely
consider adding the ability to do syslog instead of stdout.


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-17 Thread Pavel Simerda
 From: Colin Walters walt...@verbum.org
 On Fri, 2013-05-17 at 19:44 -0400, Pavel Simerda wrote:
   From: Colin Walters walt...@verbum.org
   On Fri, 2013-05-17 at 15:05 -0400, Pavel Simerda wrote:
   
Any more resources/documentation/posts for that?
   
   Look at the attached patch as a demo.
  
  Ah, interesting. Is it capable of working without systemd at least to the
  level of using syslog and/org stderr?
 
 Yes, it just prints to stdout on non-systemd, though I'd definitely
 consider adding the ability to do syslog instead of stdout.

Works for me then.

Pavel
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-16 Thread Pavel Simerda
 From: Colin Walters walt...@verbum.org
 On Mon, 2013-05-06 at 12:50 -0500, Dan Williams wrote:
  On Fri, 2013-04-26 at 16:42 -0400, Colin Walters wrote:
   And change src/main.c to use the local allocation macros.  This
   results in much cleaner code, as one can see from the diff.
   
   Because libgsystem is designed for nonrecursive make, it fits best in
   the current recursive setup if we build . first.  This will be a lot
   nicer when we switch NM to a nonrecursive setup.
   ---
.gitmodules |3 +++
Makefile.am |7 +++
libgsystem  |1 +
src/Makefile.am |2 ++
src/main.c  |   50
--
5 files changed, 25 insertions(+), 38 deletions(-)
create mode 100644 .gitmodules
create mode 16 libgsystem
  
  Patch looks good to me; Pavel, I'll assume you acked it too, given you
  had objections last time?
 
 Any thoughts, Pavel?


Patch looks good to me. It might be good to have Dan Winship's (Cc) ack too, as 
he recently modified the build system files and might have some comments or 
suggestions.

Thanks!

Pavel
___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-13 Thread Colin Walters
On Mon, 2013-05-06 at 12:50 -0500, Dan Williams wrote:
 On Fri, 2013-04-26 at 16:42 -0400, Colin Walters wrote:
  And change src/main.c to use the local allocation macros.  This
  results in much cleaner code, as one can see from the diff.
  
  Because libgsystem is designed for nonrecursive make, it fits best in
  the current recursive setup if we build . first.  This will be a lot
  nicer when we switch NM to a nonrecursive setup.
  ---
   .gitmodules |3 +++
   Makefile.am |7 +++
   libgsystem  |1 +
   src/Makefile.am |2 ++
   src/main.c  |   50 --
   5 files changed, 25 insertions(+), 38 deletions(-)
   create mode 100644 .gitmodules
   create mode 16 libgsystem
 
 Patch looks good to me; Pavel, I'll assume you acked it too, given you
 had objections last time?

Any thoughts, Pavel?


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-05-06 Thread Dan Williams
On Fri, 2013-04-26 at 16:42 -0400, Colin Walters wrote:
 And change src/main.c to use the local allocation macros.  This
 results in much cleaner code, as one can see from the diff.
 
 Because libgsystem is designed for nonrecursive make, it fits best in
 the current recursive setup if we build . first.  This will be a lot
 nicer when we switch NM to a nonrecursive setup.
 ---
  .gitmodules |3 +++
  Makefile.am |7 +++
  libgsystem  |1 +
  src/Makefile.am |2 ++
  src/main.c  |   50 --
  5 files changed, 25 insertions(+), 38 deletions(-)
  create mode 100644 .gitmodules
  create mode 16 libgsystem

Patch looks good to me; Pavel, I'll assume you acked it too, given you
had objections last time?

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: [PATCH] Add libgsystem as a git submodule

2013-04-30 Thread Colin Walters
On Fri, 2013-04-26 at 16:42 -0400, Colin Walters wrote:
 And change src/main.c to use the local allocation macros.  This
 results in much cleaner code, as one can see from the diff.
 
 Because libgsystem is designed for nonrecursive make, it fits best in
 the current recursive setup if we build . first.  This will be a lot
 nicer when we switch NM to a nonrecursive setup.

Any opinions on this?


___
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list


[PATCH] Add libgsystem as a git submodule

2013-04-26 Thread Colin Walters
And change src/main.c to use the local allocation macros.  This
results in much cleaner code, as one can see from the diff.

Because libgsystem is designed for nonrecursive make, it fits best in
the current recursive setup if we build . first.  This will be a lot
nicer when we switch NM to a nonrecursive setup.
---
 .gitmodules |3 +++
 Makefile.am |7 +++
 libgsystem  |1 +
 src/Makefile.am |2 ++
 src/main.c  |   50 --
 5 files changed, 25 insertions(+), 38 deletions(-)
 create mode 100644 .gitmodules
 create mode 16 libgsystem


From 1bf944af8a321cebe2ddc45d0649f744c8828bab Mon Sep 17 00:00:00 2001
From: Colin Walters walt...@verbum.org
Date: Fri, 26 Apr 2013 16:20:22 -0400
Subject: [PATCH] Add libgsystem as a git submodule

And change src/main.c to use the local allocation macros.  This
results in much cleaner code, as one can see from the diff.

Because libgsystem is designed for nonrecursive make, it fits best in
the current recursive setup if we build . first.  This will be a lot
nicer when we switch NM to a nonrecursive setup.
---
 .gitmodules |3 +++
 Makefile.am |7 +++
 libgsystem  |1 +
 src/Makefile.am |2 ++
 src/main.c  |   50 --
 5 files changed, 25 insertions(+), 38 deletions(-)
 create mode 100644 .gitmodules
 create mode 16 libgsystem

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000..e93bbea
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule libgsystem]
+	path = libgsystem
+	url = git://git.gnome.org/libgsystem
diff --git a/Makefile.am b/Makefile.am
index 2847616..9419d35 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,7 @@
 include $(GLIB_MAKEFILE)
 
 SUBDIRS = \
+	. \
 	include \
 	libnm-util \
 	libnm-glib \
@@ -53,3 +54,9 @@ CLEANFILES = cscope.in.out cscope.out cscope.po.out
 .PHONY: cscope
 cscope:
 	cscope -b -q -R -Iinclude -ssrc -slibnm-glib -slibnm-util -scli/src;
+
+libgsystem_srcpath := libgsystem
+libgsystem_cflags := $(GLIB_CFLAGS) -I$(srcdir)/libgsystem
+libgsystem_libs = $(GLIB_LIBS)
+include libgsystem/Makefile-libgsystem.am
+noinst_LTLIBRARIES = libgsystem.la
diff --git a/libgsystem b/libgsystem
new file mode 16
index 000..51736db
--- /dev/null
+++ b/libgsystem
@@ -0,0 +1 @@
+Subproject commit 51736db5f49b4b798fd2f9d0ccb8eff453105162
diff --git a/src/Makefile.am b/src/Makefile.am
index 113b527..f81c37a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -26,6 +26,7 @@ endif
 SUBDIRS += . tests
 
 INCLUDES = -I${top_srcdir} \
+   -I${top_srcdir}/libgsystem \
-I${top_builddir}/include \
-I${top_srcdir}/include \
-I${top_builddir}/src/generated \
@@ -324,6 +325,7 @@ NetworkManager_CPPFLAGS += -DCKDB_PATH=\${CKDB_PATH}\
 endif
 
 NetworkManager_LDADD = \
+	$(top_builddir)/libgsystem.la \
 	./generated/libnm-generated.la \
 	./logging/libnm-logging.la \
 	./config/libnm-config.la \
diff --git a/src/main.c b/src/main.c
index ed71bb6..37e05c4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -38,6 +38,7 @@
 #include gmodule.h
 #include string.h
 
+#include gsystem-local-alloc.h
 #include NetworkManager.h
 #include NetworkManagerUtils.h
 #include nm-manager.h
@@ -305,18 +306,19 @@ main (int argc, char *argv[])
 	GOptionContext *opt_ctx = NULL;
 	gboolean become_daemon = FALSE;
 	gboolean g_fatal_warnings = FALSE;
-	char *pidfile = NULL, *state_file = NULL;
+	gs_free char *pidfile = NULL;
+	gs_free char *state_file = NULL;
 	gboolean wifi_enabled = TRUE, net_enabled = TRUE, wwan_enabled = TRUE, wimax_enabled = TRUE;
 	gboolean success, show_version = FALSE;
 	NMPolicy *policy = NULL;
-	NMVPNManager *vpn_manager = NULL;
-	NMDnsManager *dns_mgr = NULL;
-	NMDBusManager *dbus_mgr = NULL;
-	NMSupplicantManager *sup_mgr = NULL;
-	NMDHCPManager *dhcp_mgr = NULL;
-	NMFirewallManager *fw_mgr = NULL;
-	NMSettings *settings = NULL;
-	NMConfig *config;
+	gs_unref_object NMVPNManager *vpn_manager = NULL;
+	gs_unref_object NMDnsManager *dns_mgr = NULL;
+	gs_unref_object NMDBusManager *dbus_mgr = NULL;
+	gs_unref_object NMSupplicantManager *sup_mgr = NULL;
+	gs_unref_object NMDHCPManager *dhcp_mgr = NULL;
+	gs_unref_object NMFirewallManager *fw_mgr = NULL;
+	gs_unref_object NMSettings *settings = NULL;
+	gs_unref_object NMConfig *config = NULL;
 	GError *error = NULL;
 	gboolean wrote_pidfile = FALSE;
 
@@ -579,41 +581,13 @@ done:
 	if (policy)
 		nm_policy_destroy (policy);
 
-	if (manager)
-		g_object_unref (manager);
-
-	if (settings)
-		g_object_unref (settings);
-
-	if (vpn_manager)
-		g_object_unref (vpn_manager);
-
-	if (dns_mgr)
-		g_object_unref (dns_mgr);
-
-	if (dhcp_mgr)
-		g_object_unref (dhcp_mgr);
-
-	if (sup_mgr)
-		g_object_unref (sup_mgr);
-
-	if (fw_mgr)
-		g_object_unref (fw_mgr);
-
-	if (dbus_mgr)
-		g_object_unref (dbus_mgr);
+	g_clear_object (manager);
 
 	nm_logging_shutdown ();
 
 	if (pidfile  wrote_pidfile