[PATCH 02/20] network: Separate private APIs declaration to bridge_driver_priv.h

Michal Privoznik via Devel posted 20 patches 4 days, 15 hours ago
[PATCH 02/20] network: Separate private APIs declaration to bridge_driver_priv.h
Posted by Michal Privoznik via Devel 4 days, 15 hours ago
From: Michal Privoznik <mprivozn@redhat.com>

There are two functions implemented in bridge_driver.c that are
used in tests (networkDnsmasqCreateXMLConf() and
networkDnsmasqConfContents()) but are declared in
bridge_driver.h. This goes against our current practice where
such APIs are declared in $name_priv.h.

Therefore, move those APIs to bridge_driver_priv.h

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/network/bridge_driver.c                   |  2 ++
 src/network/bridge_driver.h                   | 15 -----------
 .../{bridge_driver.h => bridge_driver_priv.h} | 27 +++++--------------
 tests/networkxml2conftest.c                   |  2 ++
 tests/networkxml2xmltest.c                    |  2 ++
 5 files changed, 12 insertions(+), 36 deletions(-)
 copy src/network/{bridge_driver.h => bridge_driver_priv.h} (32%)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 8b5dbb3ab7..d7004771b7 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -39,6 +39,8 @@
 #include "virerror.h"
 #include "datatypes.h"
 #include "bridge_driver.h"
+#define LIBVIRT_BRIDGE_DRIVER_PRIV_H_ALLOW
+#include "bridge_driver_priv.h"
 #include "bridge_driver_platform.h"
 #include "driver.h"
 #include "virbuffer.h"
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver.h
index fddc3dc8cf..64af68c1e0 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver.h
@@ -21,20 +21,5 @@
 
 #pragma once
 
-#include "internal.h"
-#include "virdnsmasq.h"
-#include "virnetworkobj.h"
-
-virNetworkXMLOption *
-networkDnsmasqCreateXMLConf(void);
-
 int
 networkRegister(void);
-
-int
-networkDnsmasqConfContents(virNetworkObj *obj,
-                           const char *pidfile,
-                           char **configstr,
-                           char **hostsfilestr,
-                           dnsmasqContext *dctx,
-                           dnsmasqCaps *caps);
diff --git a/src/network/bridge_driver.h b/src/network/bridge_driver_priv.h
similarity index 32%
copy from src/network/bridge_driver.h
copy to src/network/bridge_driver_priv.h
index fddc3dc8cf..7f21ed7ad6 100644
--- a/src/network/bridge_driver.h
+++ b/src/network/bridge_driver_priv.h
@@ -1,36 +1,21 @@
 /*
- * bridge_driver.h: core driver methods for managing networks
+ * bridge_driver_priv.h: private declarations for network driver
  *
- * Copyright (C) 2006-2016 Red Hat, Inc.
- * Copyright (C) 2006 Daniel P. Berrange
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library.  If not, see
- * <http://www.gnu.org/licenses/>.
+ * SPDX-License-Identifier: LGPL-2.1-or-later
  */
 
+#ifndef LIBVIRT_BRIDGE_DRIVER_PRIV_H_ALLOW
+# error "bridge_driver_priv.h may only be included by bridge_driver.c or test suites"
+#endif /* LIBVIRT_BRIDGE_DRIVER_PRIV_H_ALLOW */
+
 #pragma once
 
-#include "internal.h"
 #include "virdnsmasq.h"
 #include "virnetworkobj.h"
 
 virNetworkXMLOption *
 networkDnsmasqCreateXMLConf(void);
 
-int
-networkRegister(void);
-
 int
 networkDnsmasqConfContents(virNetworkObj *obj,
                            const char *pidfile,
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 40b9d07d31..70fb3a37b9 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -10,6 +10,8 @@
 #include "network_conf.h"
 #include "viralloc.h"
 #include "bridge_driver.h"
+#define LIBVIRT_BRIDGE_DRIVER_PRIV_H_ALLOW
+#include "bridge_driver_priv.h"
 #define LIBVIRT_VIRCOMMANDPRIV_H_ALLOW
 #include "vircommandpriv.h"
 
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 59266defb6..840bcaa83f 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -9,6 +9,8 @@
 #include "testutils.h"
 #include "network_conf.h"
 #include "bridge_driver.h"
+#define LIBVIRT_BRIDGE_DRIVER_PRIV_H_ALLOW
+#include "bridge_driver_priv.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
-- 
2.52.0