[Openvpn-devel,3/7] Remove always enabled USE_64_BIT_COUNTERS define

Message ID 20210421134348.1950392-3-arne@rfc2549.org
State Accepted
Headers show
Series [Openvpn-devel,1/7] Remove --disable-multihome option | expand

Commit Message

Arne Schwabe April 21, 2021, 3:43 a.m. UTC
Also change the types to use C99 uint64_t and its printf u64 define.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
 src/openvpn/common.h  | 15 +++------------
 src/openvpn/syshead.h |  5 -----
 2 files changed, 3 insertions(+), 17 deletions(-)

Comments

Antonio Quartulli April 21, 2021, 2:13 p.m. UTC | #1
Hi,

On 21/04/2021 15:43, Arne Schwabe wrote:
> Also change the types to use C99 uint64_t and its printf u64 define.
> 
> Signed-off-by: Arne Schwabe <arne@rfc2549.org>

This patch looks good and compiles on my test rig.

As expected, it is basically removing a bunch of ifdefs always forced on
the "true-branch".

Since we recently confirmed that all our suppotred platforms also
support C99, I don't expect breakages on any *BSD either.

Acked-by: Antonio Quartulli <antonio@openvpn.net>
Gert Doering April 21, 2021, 8:35 p.m. UTC | #2
Your patch has been applied to the release/2.4 branch.

commit 1bdd09e7e019ac6d8fdc1b009bdec818b9183e76
Author: Arne Schwabe
Date:   Wed Apr 21 15:43:44 2021 +0200

     Remove always enabled USE_64_BIT_COUNTERS define

     Signed-off-by: Arne Schwabe <arne@rfc2549.org>
     Acked-by: Antonio Quartulli <antonio@openvpn.net>
     Message-Id: <20210421134348.1950392-3-arne@rfc2549.org>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22171.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
Gert Doering April 21, 2021, 10:27 p.m. UTC | #3
Hi,

On Thu, Apr 22, 2021 at 08:35:46AM +0200, Gert Doering wrote:
> Your patch has been applied to the release/2.4 branch.

Uh, that was not what I intended to do.  But that's what you get for
"try to get things done early in the morning" before coffee works.  *sigh*

I have force-pushed 2.4 without that commit (no tags set, so no harm done)
and applied it to master, where it was intended to go

commit 3a16a8678ded8df8e41c495bccc4e24ef0ce82f4 (master)
Author: Arne Schwabe <arne@rfc2549.org>
Date:   Wed Apr 21 15:43:44 2021 +0200

    Remove always enabled USE_64_BIT_COUNTERS define


sorry

gert
Gert Doering April 21, 2021, 10:35 p.m. UTC | #4
Hi,

On Thu, Apr 22, 2021 at 10:27:29AM +0200, Gert Doering wrote:
> I have force-pushed 2.4 without that commit (no tags set, so no harm done)
> and applied it to master, where it was intended to go

Well.  I tried that (though I should have known better) and neither sf
nor gitlab actually let me, and I think that's actually good :-)

So, release/2.4 has a erroneous commit + a revert commit now.

It hasn't been actually broken at any time (because the commit is okay),
it was just against our approach to "which commits go where".

$ git log release/2.4
commit 5e272a0196f3a9ac9423397079779ac8bbdf6159 (HEAD)
Author: Gert Doering <gert@greenie.muc.de>
Date:   Thu Apr 22 10:26:12 2021 +0200

    Revert "Remove always enabled USE_64_BIT_COUNTERS define"

commit 1bdd09e7e019ac6d8fdc1b009bdec818b9183e76
Author: Arne Schwabe <arne@rfc2549.org>
Date:   Wed Apr 21 15:43:44 2021 +0200

    Remove always enabled USE_64_BIT_COUNTERS define
        
commit 092734634796e9637920e029fea716afc146cd82 (tag: v2.4.11, vweb1/release/2.4)
Author: Gert Doering <gert@greenie.muc.de>
Date:   Tue Apr 20 15:31:32 2021 +0200

    Preparing release v2.4.11 (ChangeLog, version.m4, Changes.rst)


gert

Patch

diff --git a/src/openvpn/common.h b/src/openvpn/common.h
index 623b3e0d7..544fa238e 100644
--- a/src/openvpn/common.h
+++ b/src/openvpn/common.h
@@ -25,19 +25,10 @@ 
 #define COMMON_H
 
 /*
- * Statistics counters and associated printf formats.
+ * Statistics counters and associated printf format.
  */
-#ifdef USE_64_BIT_COUNTERS
-typedef unsigned long long int counter_type;
-#ifdef _WIN32
-#define counter_format  "%I64u"
-#else
-#define counter_format  "%llu"
-#endif
-#else  /* ifdef USE_64_BIT_COUNTERS */
-typedef unsigned int counter_type;
-#define counter_format   "%u"
-#endif
+typedef uint64_t counter_type;
+#define counter_format  "%" PRIu64
 
 /*
  * Time intervals
diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h
index cb9bf7dc7..f29c63c73 100644
--- a/src/openvpn/syshead.h
+++ b/src/openvpn/syshead.h
@@ -458,11 +458,6 @@  socket_defined(const socket_descriptor_t sd)
     return sd != SOCKET_UNDEFINED;
 }
 
-/*
- * Should statistics counters be 64 bits?
- */
-#define USE_64_BIT_COUNTERS
-
 /*
  * Should we enable the use of execve() for calling subprocesses,
  * instead of system()?