[PATCH v3 6/7] virdnsmasq: Drop dnsmasqCapsNewFromBuffer()

Michal Privoznik posted 7 patches 4 years ago
There is a newer version of this series
[PATCH v3 6/7] virdnsmasq: Drop dnsmasqCapsNewFromBuffer()
Posted by Michal Privoznik 4 years ago
The function is no longer used. Remove it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/libvirt_private.syms |  1 -
 src/util/virdnsmasq.c    | 14 --------------
 src/util/virdnsmasq.h    |  1 -
 3 files changed, 16 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index ee14b99d88..aa23e8c0ec 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2114,7 +2114,6 @@ dnsmasqAddDhcpHost;
 dnsmasqAddHost;
 dnsmasqCapsGetBinaryPath;
 dnsmasqCapsNewFromBinary;
-dnsmasqCapsNewFromBuffer;
 dnsmasqContextFree;
 dnsmasqContextNew;
 dnsmasqDelete;
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 6d63e9e3c5..ca52bf7871 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -708,20 +708,6 @@ dnsmasqCapsNewEmpty(void)
     return g_steal_pointer(&caps);
 }
 
-dnsmasqCaps *
-dnsmasqCapsNewFromBuffer(const char *buf)
-{
-    g_autoptr(dnsmasqCaps) caps = dnsmasqCapsNewEmpty();
-
-    if (!caps)
-        return NULL;
-
-    if (dnsmasqCapsSetFromBuffer(caps, buf) < 0)
-        return NULL;
-
-    return g_steal_pointer(&caps);
-}
-
 dnsmasqCaps *
 dnsmasqCapsNewFromBinary(void)
 {
diff --git a/src/util/virdnsmasq.h b/src/util/virdnsmasq.h
index c74cc887f8..cc1c337d41 100644
--- a/src/util/virdnsmasq.h
+++ b/src/util/virdnsmasq.h
@@ -91,7 +91,6 @@ int              dnsmasqSave(const dnsmasqContext *ctx);
 int              dnsmasqDelete(const dnsmasqContext *ctx);
 int              dnsmasqReload(pid_t pid);
 
-dnsmasqCaps *dnsmasqCapsNewFromBuffer(const char *buf);
 dnsmasqCaps *dnsmasqCapsNewFromBinary(void);
 const char *dnsmasqCapsGetBinaryPath(dnsmasqCaps *caps);
 char *dnsmasqDhcpHostsToString(dnsmasqDhcpHost *hosts,
-- 
2.34.1

Re: [PATCH v3 6/7] virdnsmasq: Drop dnsmasqCapsNewFromBuffer()
Posted by Andrea Bolognani 4 years ago
On Wed, Jan 12, 2022 at 09:47:57AM +0100, Michal Privoznik wrote:
> The function is no longer used. Remove it.
>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/libvirt_private.syms |  1 -
>  src/util/virdnsmasq.c    | 14 --------------
>  src/util/virdnsmasq.h    |  1 -
>  3 files changed, 16 deletions(-)

Reviewed-by: Andrea Bolognani <abologna@redhat.com>

Further cleanup opportunities:

  * drop the 'force' argument of dnsmasqCapsRefreshInternal(), as the
    only caller always passes true;

  * drop the 'noRefresh' field of the dnsmasqCaps struct, which
    AFAICT doesn't really do anything even before your changes;

  * rework dnsmasqCapsSetFromBuffer() so that it takes the output of
    the two calls to dnsmasq as separate arguments, instead of doing
    the silly dance of joining the two in the caller only to have the
    function split them again immediately.

-- 
Andrea Bolognani / Red Hat / Virtualization

Re: [PATCH v3 6/7] virdnsmasq: Drop dnsmasqCapsNewFromBuffer()
Posted by Michal Prívozník 4 years ago
On 1/14/22 18:01, Andrea Bolognani wrote:
> On Wed, Jan 12, 2022 at 09:47:57AM +0100, Michal Privoznik wrote:
>> The function is no longer used. Remove it.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>> ---
>>  src/libvirt_private.syms |  1 -
>>  src/util/virdnsmasq.c    | 14 --------------
>>  src/util/virdnsmasq.h    |  1 -
>>  3 files changed, 16 deletions(-)
> 
> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
> 
> Further cleanup opportunities:
> 
>   * drop the 'force' argument of dnsmasqCapsRefreshInternal(), as the
>     only caller always passes true;
> 
>   * drop the 'noRefresh' field of the dnsmasqCaps struct, which
>     AFAICT doesn't really do anything even before your changes;
> 
>   * rework dnsmasqCapsSetFromBuffer() so that it takes the output of
>     the two calls to dnsmasq as separate arguments, instead of doing
>     the silly dance of joining the two in the caller only to have the
>     function split them again immediately.
> 

My reasoning to not do all of this was that one day we might want to
query capabilities. In which case we might need force/noRefresh. But
since we removed the caps enum I guess your suggestion makes more sense.
Will fix in v3.

Michal