[PATCH 2/7] nwfilter: Fix return type of virNWFilterCanApplyBasicRules callback

Michal Privoznik via Devel posted 7 patches 3 months, 3 weeks ago
[PATCH 2/7] nwfilter: Fix return type of virNWFilterCanApplyBasicRules callback
Posted by Michal Privoznik via Devel 3 months, 3 weeks ago
From: Michal Privoznik <mprivozn@redhat.com>

The virNWFilterCanApplyBasicRules() callback returns an int but
in fact its return type is a boolean. Even its only
implementation (ebiptablesCanApplyBasicRules()) returns a
boolean. Switch the return type from integer to boolean.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/nwfilter/nwfilter_ebiptables_driver.c | 2 +-
 src/nwfilter/nwfilter_tech_driver.h       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 5082b62577..067df6e612 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -2797,7 +2797,7 @@ ebtablesRenameTmpSubAndRootChainsFW(virFirewall *fw,
  * run ebtablesApplyBasicRules and ebtablesApplyDHCPOnlyRules.
  * In case of this driver we need the ebtables tool available.
  */
-static int
+static bool
 ebiptablesCanApplyBasicRules(void)
 {
     return true;
diff --git a/src/nwfilter/nwfilter_tech_driver.h b/src/nwfilter/nwfilter_tech_driver.h
index 8de9eda947..a4af0bf6d5 100644
--- a/src/nwfilter/nwfilter_tech_driver.h
+++ b/src/nwfilter/nwfilter_tech_driver.h
@@ -51,7 +51,7 @@ typedef int (*virNWFilterRuleTeardownOldRules)(const char *ifname);
 
 typedef int (*virNWFilterRuleAllTeardown)(const char *ifname);
 
-typedef int (*virNWFilterCanApplyBasicRules)(void);
+typedef bool (*virNWFilterCanApplyBasicRules)(void);
 
 typedef int (*virNWFilterApplyBasicRules)(const char *ifname,
                                           const virMacAddr *macaddr);
-- 
2.49.0
Re: [PATCH 2/7] nwfilter: Fix return type of virNWFilterCanApplyBasicRules callback
Posted by Peter Krempa via Devel 3 months, 3 weeks ago
On Wed, May 14, 2025 at 16:24:11 +0200, Michal Privoznik via Devel wrote:
> From: Michal Privoznik <mprivozn@redhat.com>
> 
> The virNWFilterCanApplyBasicRules() callback returns an int but
> in fact its return type is a boolean. Even its only
> implementation (ebiptablesCanApplyBasicRules()) returns a
> boolean. Switch the return type from integer to boolean.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/nwfilter/nwfilter_ebiptables_driver.c | 2 +-
>  src/nwfilter/nwfilter_tech_driver.h       | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: Peter Krempa <pkrempa@redhat.com>