[PATCH 07/11] qemu_hotplug.h: Expose less functions

Michal Privoznik posted 11 patches 1 year, 7 months ago
[PATCH 07/11] qemu_hotplug.h: Expose less functions
Posted by Michal Privoznik 1 year, 7 months ago
After previous cleanups a lot of functions from qemu_hotplug.c
are called only within the file. Make them static and drop their
declaration from the header file.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_hotplug.c | 56 +++++++++++++++++++++----------------
 src/qemu/qemu_hotplug.h | 61 -----------------------------------------
 2 files changed, 32 insertions(+), 85 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index f72bb7722d..13b1872ea3 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -75,6 +75,11 @@ VIR_LOG_INIT("qemu.qemu_hotplug");
 static void
 qemuDomainResetDeviceRemoval(virDomainObj *vm);
 
+static int
+qemuDomainAttachHostDevice(virQEMUDriver *driver,
+                           virDomainObj *vm,
+                           virDomainHostdevDef *hostdev);
+
 /**
  * qemuDomainDeleteDevice:
  * @vm: domain object
@@ -546,7 +551,7 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm,
  *
  * Returns 0 on success, -1 on error and reports libvirt error
  */
-int
+static int
 qemuDomainChangeEjectableMedia(virQEMUDriver *driver,
                                virDomainObj *vm,
                                virDomainDiskDef *disk,
@@ -754,8 +759,9 @@ qemuDomainAttachDiskGeneric(virDomainObj *vm,
 }
 
 
-int qemuDomainAttachControllerDevice(virDomainObj *vm,
-                                     virDomainControllerDef *controller)
+static int
+qemuDomainAttachControllerDevice(virDomainObj *vm,
+                                 virDomainControllerDef *controller)
 {
     int ret = -1;
     const char* type = virDomainControllerTypeToString(controller->type);
@@ -1033,7 +1039,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
  * This function handles all the necessary steps to attach a new storage source
  * to the VM.
  */
-int
+static int
 qemuDomainAttachDeviceDiskLive(virQEMUDriver *driver,
                                virDomainObj *vm,
                                virDomainDeviceDef *dev)
@@ -1077,7 +1083,7 @@ qemuDomainNetDeviceVportRemove(virDomainNetDef *net)
 }
 
 
-int
+static int
 qemuDomainAttachNetDevice(virQEMUDriver *driver,
                           virDomainObj *vm,
                           virDomainNetDef *net)
@@ -1768,9 +1774,10 @@ qemuDomainDelChardevTLSObjects(virQEMUDriver *driver,
 }
 
 
-int qemuDomainAttachRedirdevDevice(virQEMUDriver *driver,
-                                   virDomainObj *vm,
-                                   virDomainRedirdevDef *redirdev)
+static int
+qemuDomainAttachRedirdevDevice(virQEMUDriver *driver,
+                               virDomainObj *vm,
+                               virDomainRedirdevDef *redirdev)
 {
     int ret = -1;
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -1995,7 +2002,7 @@ qemuDomainAttachChrDeviceAssignAddr(virDomainObj *vm,
 }
 
 
-int
+static int
 qemuDomainAttachChrDevice(virQEMUDriver *driver,
                           virDomainObj *vm,
                           virDomainDeviceDef *dev)
@@ -2125,7 +2132,7 @@ qemuDomainAttachChrDevice(virQEMUDriver *driver,
 }
 
 
-int
+static int
 qemuDomainAttachRNGDevice(virQEMUDriver *driver,
                           virDomainObj *vm,
                           virDomainRNGDef *rng)
@@ -2240,7 +2247,7 @@ qemuDomainAttachRNGDevice(virQEMUDriver *driver,
  *
  * Returns 0 on success -1 on error.
  */
-int
+static int
 qemuDomainAttachMemory(virQEMUDriver *driver,
                        virDomainObj *vm,
                        virDomainMemoryDef *mem)
@@ -2757,7 +2764,7 @@ qemuDomainAttachMediatedDevice(virQEMUDriver *driver,
 }
 
 
-int
+static int
 qemuDomainAttachHostDevice(virQEMUDriver *driver,
                            virDomainObj *vm,
                            virDomainHostdevDef *hostdev)
@@ -2808,7 +2815,7 @@ qemuDomainAttachHostDevice(virQEMUDriver *driver,
 }
 
 
-int
+static int
 qemuDomainAttachShmemDevice(virDomainObj *vm,
                             virDomainShmemDef *shmem)
 {
@@ -2914,7 +2921,7 @@ qemuDomainAttachShmemDevice(virDomainObj *vm,
 }
 
 
-int
+static int
 qemuDomainAttachWatchdog(virDomainObj *vm,
                          virDomainWatchdogDef *watchdog)
 {
@@ -3017,7 +3024,7 @@ qemuDomainAttachWatchdog(virDomainObj *vm,
 }
 
 
-int
+static int
 qemuDomainAttachInputDevice(virDomainObj *vm,
                             virDomainInputDef *input)
 {
@@ -3118,7 +3125,7 @@ qemuDomainAttachInputDevice(virDomainObj *vm,
 }
 
 
-int
+static int
 qemuDomainAttachVsockDevice(virDomainObj *vm,
                             virDomainVsockDef *vsock)
 {
@@ -3195,7 +3202,7 @@ qemuDomainAttachVsockDevice(virDomainObj *vm,
 }
 
 
-int
+static int
 qemuDomainAttachFSDevice(virQEMUDriver *driver,
                          virDomainObj *vm,
                          virDomainFSDef *fs)
@@ -3288,7 +3295,7 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver,
 }
 
 
-int
+static int
 qemuDomainAttachLease(virQEMUDriver *driver,
                       virDomainObj *vm,
                       virDomainLeaseDef *lease)
@@ -3596,9 +3603,10 @@ qemuDomainChangeNetFilter(virDomainObj *vm,
     return 0;
 }
 
-int qemuDomainChangeNetLinkState(virDomainObj *vm,
-                                 virDomainNetDef *dev,
-                                 int linkstate)
+static int
+qemuDomainChangeNetLinkState(virDomainObj *vm,
+                             virDomainNetDef *dev,
+                             int linkstate)
 {
     int ret = -1;
     qemuDomainObjPrivate *priv = vm->privateData;
@@ -3626,7 +3634,7 @@ int qemuDomainChangeNetLinkState(virDomainObj *vm,
     return ret;
 }
 
-int
+static int
 qemuDomainChangeNet(virQEMUDriver *driver,
                     virDomainObj *vm,
                     virDomainDeviceDef *dev)
@@ -4232,7 +4240,7 @@ qemuDomainChangeGraphicsPasswords(virDomainObj *vm,
 }
 
 
-int
+static int
 qemuDomainChangeGraphics(virQEMUDriver *driver,
                          virDomainObj *vm,
                          virDomainGraphicsDef *dev)
@@ -6896,7 +6904,7 @@ qemuDomainSetVcpuInternal(virQEMUDriver *driver,
 }
 
 
-int
+static int
 qemuDomainChangeMemoryRequestedSize(virDomainObj *vm,
                                     const char *alias,
                                     unsigned long long requestedsize)
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index d9a5ac1164..4fe7f4923e 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -24,12 +24,6 @@
 #include "qemu_conf.h"
 #include "qemu_domain.h"
 
-int qemuDomainChangeEjectableMedia(virQEMUDriver *driver,
-                                   virDomainObj *vm,
-                                   virDomainDiskDef *disk,
-                                   virStorageSource *newsrc,
-                                   bool force);
-
 void qemuDomainDelTLSObjects(virDomainObj *vm,
                              virDomainAsyncJob asyncJob,
                              const char *secAlias,
@@ -48,68 +42,17 @@ int qemuDomainGetTLSObjects(qemuDomainSecretInfo *secinfo,
                             virJSONValue **tlsProps,
                             virJSONValue **secProps);
 
-int qemuDomainAttachControllerDevice(virDomainObj *vm,
-                                     virDomainControllerDef *controller);
-int qemuDomainAttachDeviceDiskLive(virQEMUDriver *driver,
-                                   virDomainObj *vm,
-                                   virDomainDeviceDef *dev);
-
 int qemuDomainAttachDiskGeneric(virDomainObj *vm,
                                 virDomainDiskDef *disk,
                                 virDomainAsyncJob asyncJob);
 
-int qemuDomainAttachNetDevice(virQEMUDriver *driver,
-                              virDomainObj *vm,
-                              virDomainNetDef *net);
-int qemuDomainAttachRedirdevDevice(virQEMUDriver *driver,
-                                   virDomainObj *vm,
-                                   virDomainRedirdevDef *hostdev);
-int qemuDomainAttachHostDevice(virQEMUDriver *driver,
-                               virDomainObj *vm,
-                               virDomainHostdevDef *hostdev);
-int qemuDomainAttachShmemDevice(virDomainObj *vm,
-                                virDomainShmemDef *shmem);
-int qemuDomainAttachWatchdog(virDomainObj *vm,
-                             virDomainWatchdogDef *watchdog);
 int qemuDomainFindGraphicsIndex(virDomainDef *def,
                                 virDomainGraphicsDef *dev);
-int qemuDomainAttachMemory(virQEMUDriver *driver,
-                           virDomainObj *vm,
-                           virDomainMemoryDef *mem);
-int qemuDomainChangeGraphics(virQEMUDriver *driver,
-                             virDomainObj *vm,
-                             virDomainGraphicsDef *dev);
 int qemuDomainChangeGraphicsPasswords(virDomainObj *vm,
                                       int type,
                                       virDomainGraphicsAuthDef *auth,
                                       const char *defaultPasswd,
                                       int asyncJob);
-int qemuDomainChangeNet(virQEMUDriver *driver,
-                        virDomainObj *vm,
-                        virDomainDeviceDef *dev);
-int qemuDomainChangeNetLinkState(virDomainObj *vm,
-                                 virDomainNetDef *dev,
-                                 int linkstate);
-
-int qemuDomainAttachInputDevice(virDomainObj *vm,
-                                virDomainInputDef *input);
-
-int qemuDomainAttachVsockDevice(virDomainObj *vm,
-                                virDomainVsockDef *vsock);
-int
-qemuDomainAttachFSDevice(virQEMUDriver *driver,
-                         virDomainObj *vm,
-                         virDomainFSDef *fs);
-
-int qemuDomainAttachLease(virQEMUDriver *driver,
-                          virDomainObj *vm,
-                          virDomainLeaseDef *lease);
-int qemuDomainAttachChrDevice(virQEMUDriver *driver,
-                              virDomainObj *vm,
-                              virDomainDeviceDef *dev);
-int qemuDomainAttachRNGDevice(virQEMUDriver *driver,
-                              virDomainObj *vm,
-                              virDomainRNGDef *rng);
 
 int qemuDomainAttachDeviceLive(virDomainObj *vm,
                                virDomainDeviceDef *dev,
@@ -165,7 +108,3 @@ int qemuHotplugAttachDBusVMState(virQEMUDriver *driver,
 
 int qemuHotplugRemoveDBusVMState(virDomainObj *vm,
                                  virDomainAsyncJob asyncJob);
-
-int qemuDomainChangeMemoryRequestedSize(virDomainObj *vm,
-                                        const char *alias,
-                                        unsigned long long requestedsize);
-- 
2.39.2
Re: [PATCH 07/11] qemu_hotplug.h: Expose less functions
Posted by Kristina Hanicova 1 year, 7 months ago
On Fri, Apr 21, 2023 at 10:25 AM Michal Privoznik <mprivozn@redhat.com>
wrote:

> After previous cleanups a lot of functions from qemu_hotplug.c
> are called only within the file. Make them static and drop their
> declaration from the header file.
>
*declarations

>
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_hotplug.c | 56 +++++++++++++++++++++----------------
>  src/qemu/qemu_hotplug.h | 61 -----------------------------------------
>  2 files changed, 32 insertions(+), 85 deletions(-)
>
> Reviewed-by: Kristina Hanicova <khanicov@redhat.com>

Kristina