Send connman mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."


Today's Topics:

   1. Re: [PATCH 1/1] build: Add --disable-stats option
      (Chris Novakovic)
   2. [PATCH v2] build: Add --disable-stats option (Chris Novakovic)


----------------------------------------------------------------------

Message: 1
Date: Mon, 26 Feb 2018 21:24:59 +0000
From: Chris Novakovic <[email protected]>
To: Jonas Bonn <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 1/1] build: Add --disable-stats option
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

On 16/02/18 13:15, Jonas Bonn wrote:
> On 02/16/2018 01:38 PM, Chris Novakovic wrote:
>> Generation of interface statistics files can now be controlled at
>> compile-time using the --{enable,disable}-stats configure options.
>> Statistics files remain enabled by default.
> 
> If this is Feng Wang's patch, then you should have him as the patch
> author... if you've massaged it into something unrecognizable, just
> mention him as your source of inspiration in the patch comment.

Sorry, that wasn't intentional: this is the first time I've submitted a
patch anywhere using "git format-patch" and when I wrote it my
impression was that the content of the cover letter (and therefore the
credit to Feng) would end up in the log. The patch is now substantially
different to Feng's original (see below), so I've credited him at the
end of the commit message.

>> ---
>> ? Makefile.am? |? 4 ++++
>> ? configure.ac |? 5 +++++
>> ? src/stats.c? | 36 ++++++++++++++++++++++++++++++++++++
>> ? 3 files changed, 45 insertions(+)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index 97f1c87d..030b5b8f 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -244,6 +244,10 @@ else
>> ? AM_CPPFLAGS = -I$(builddir)/include -I$(builddir)/src -I$(srcdir)/gdbus
>> ? endif
>> ? +if STATS
>> +AM_CPPFLAGS += -DCONNMAN_WITH_STATS
>> +endif
>> +
>> ? src_connmand_CFLAGS = @DBUS_CFLAGS@ @GLIB_CFLAGS@ \
>> ????????????????? @GNUTLS_CFLAGS@ $(builtin_cflags) \
>> ????????????????? -DCONNMAN_PLUGIN_BUILTIN \
>> diff --git a/configure.ac b/configure.ac
>> index 3cdf4b29..cb6512f5 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -380,6 +380,11 @@ AC_ARG_ENABLE(tools,
>> AC_HELP_STRING([--disable-tools],
>> ????????????????????? [enable_tools=${enableval}])
>> ? AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
>> ? +AC_ARG_ENABLE(stats, AC_HELP_STRING([--disable-stats],
>> +????????????? [disable statistics round robin file generation]),
>> +????????????????? [enable_stats=${enableval}])
>> +AM_CONDITIONAL(STATS, test "${enable_stats}" != "no")
> 
> Here you are setting a makefile variable in order to have your makefile
> pass a definition to the preprocessor.? This might be better done with
> AC_DEFINE(...) and making sure to #include "config.h" in src/stats.c.

I'm now instead using AC_DEFINE to define STATS, whose existence is
checked inside each relevant function in stats.c rather than defining a
whole new group of function stubs (which might become difficult to
maintain if more functions are added further down the line).


------------------------------

Message: 2
Date: Mon, 26 Feb 2018 21:38:32 +0000
From: Chris Novakovic <[email protected]>
To: [email protected]
Subject: [PATCH v2] build: Add --disable-stats option
Message-ID: <[email protected]>

Generation of interface statistics files can now be controlled at
compile-time using the --{enable,disable}-stats configure options.
Statistics files remain enabled by default.

Based on an idea by Feng Wang <[email protected]>.
---
 configure.ac |  6 ++++++
 src/stats.c  | 14 ++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/configure.ac b/configure.ac
index 3cdf4b29..33c494c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -380,6 +380,12 @@ AC_ARG_ENABLE(tools, AC_HELP_STRING([--disable-tools],
                                        [enable_tools=${enableval}])
 AM_CONDITIONAL(TOOLS, test "${enable_tools}" != "no")
 
+AC_ARG_ENABLE(stats, AC_HELP_STRING([--disable-stats],
+                               [disable statistics round robin file 
generation]),
+                                       [if test "${enableval}" != "no"; then
+                                               AC_DEFINE([STATS], [1], 
[Statistics round robin file support.]) fi],
+                                       [AC_DEFINE([STATS], [1], [Statistics 
round robin file support.])])
+
 if (test "${enable_tools}" != "no"); then
        AC_PATH_PROGS(IPTABLES_SAVE, [iptables-save], [],
                                                $PATH:/sbin:/usr/sbin)
diff --git a/src/stats.c b/src/stats.c
index 663bc382..94f2ec6f 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -671,6 +671,7 @@ static int stats_file_history_update(struct stats_file 
*data_file)
 
 int __connman_stats_service_register(struct connman_service *service)
 {
+#ifdef STATS
        struct stats_file *file;
        char *name, *dir;
        int err;
@@ -729,19 +730,25 @@ err:
        g_hash_table_remove(stats_hash, service);
 
        return err;
+#else
+       return -ENOTSUP;
+#endif /* ifdef STATS */
 }
 
 void __connman_stats_service_unregister(struct connman_service *service)
 {
+#ifdef STATS
        DBG("service %p", service);
 
        g_hash_table_remove(stats_hash, service);
+#endif /* ifdef STATS */
 }
 
 int  __connman_stats_update(struct connman_service *service,
                                bool roaming,
                                struct connman_stats_data *data)
 {
+#ifdef STATS
        struct stats_file *file;
        struct stats_record *next;
        int err;
@@ -780,6 +787,7 @@ int  __connman_stats_update(struct connman_service *service,
                set_roaming(file, next);
 
        set_end(file, next);
+#endif /* ifdef STATS */
 
        return 0;
 }
@@ -788,6 +796,7 @@ int __connman_stats_get(struct connman_service *service,
                                bool roaming,
                                struct connman_stats_data *data)
 {
+#ifdef STATS
        struct stats_file *file;
        struct stats_record *rec;
 
@@ -804,24 +813,29 @@ int __connman_stats_get(struct connman_service *service,
                memcpy(data, &rec->data,
                        sizeof(struct connman_stats_data));
        }
+#endif /* ifdef STATS */
 
        return 0;
 }
 
 int __connman_stats_init(void)
 {
+#ifdef STATS
        DBG("");
 
        stats_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal,
                                                        NULL, stats_free);
+#endif /* ifdef STATS */
 
        return 0;
 }
 
 void __connman_stats_cleanup(void)
 {
+#ifdef STATS
        DBG("");
 
        g_hash_table_destroy(stats_hash);
        stats_hash = NULL;
+#endif /* ifdef STATS */
 }
-- 
2.14.1



------------------------------

Subject: Digest Footer

_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman


------------------------------

End of connman Digest, Vol 28, Issue 22
***************************************

Reply via email to