]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh-pool: Rename and move vshEventCallback to virshPoolEventCallback
authorLin Ma <lma@suse.com>
Thu, 24 May 2018 13:19:29 +0000 (15:19 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 24 May 2018 13:26:02 +0000 (15:26 +0200)
The next patch will use it in virsh-completer.c for returning the name
list of pool events.

Signed-off-by: Lin Ma <lma@suse.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
tools/virsh-pool.c
tools/virsh-pool.h

index 36bf8d9faacb7b0bf99210ba72e267d1535f2292..0145b4430b5e869d512b4b4e18489a14785e47fe 100644 (file)
@@ -1999,18 +1999,12 @@ virshPoolEventToString(int event)
     return str ? _(str) : _("unknown");
 }
 
-struct vshEventCallback {
-    const char *name;
-    virConnectStoragePoolEventGenericCallback cb;
-};
-typedef struct vshEventCallback vshEventCallback;
-
 struct virshPoolEventData {
     vshControl *ctl;
     bool loop;
     bool timestamp;
     int count;
-    vshEventCallback *cb;
+    virshPoolEventCallback *cb;
 };
 typedef struct virshPoolEventData virshPoolEventData;
 
@@ -2079,12 +2073,12 @@ vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
         vshEventDone(data->ctl);
 }
 
-static vshEventCallback vshEventCallbacks[] = {
+virshPoolEventCallback virshPoolEventCallbacks[] = {
     { "lifecycle",
       VIR_STORAGE_POOL_EVENT_CALLBACK(vshEventLifecyclePrint), },
     { "refresh", vshEventGenericPrint, }
 };
-verify(VIR_STORAGE_POOL_EVENT_ID_LAST == ARRAY_CARDINALITY(vshEventCallbacks));
+verify(VIR_STORAGE_POOL_EVENT_ID_LAST == ARRAY_CARDINALITY(virshPoolEventCallbacks));
 
 
 static const vshCmdInfo info_pool_event[] = {
@@ -2141,7 +2135,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
         size_t i;
 
         for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; i++)
-            vshPrint(ctl, "%s\n", vshEventCallbacks[i].name);
+            vshPrint(ctl, "%s\n", virshPoolEventCallbacks[i].name);
         return true;
     }
 
@@ -2153,7 +2147,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
     }
 
     for (event = 0; event < VIR_STORAGE_POOL_EVENT_ID_LAST; event++)
-        if (STREQ(eventName, vshEventCallbacks[event].name))
+        if (STREQ(eventName, virshPoolEventCallbacks[event].name))
             break;
     if (event == VIR_STORAGE_POOL_EVENT_ID_LAST) {
         vshError(ctl, _("unknown event type %s"), eventName);
@@ -2164,7 +2158,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
     data.loop = vshCommandOptBool(cmd, "loop");
     data.timestamp = vshCommandOptBool(cmd, "timestamp");
     data.count = 0;
-    data.cb = &vshEventCallbacks[event];
+    data.cb = &virshPoolEventCallbacks[event];
     if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
         return false;
 
index 5f2671ae63697ed4b18904106629586beee5eb47..0df7a2e18d6ce9fd8c703fdc4434bfe0ec2d3c90 100644 (file)
@@ -37,6 +37,14 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
     virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \
                           VIRSH_BYUUID | VIRSH_BYNAME)
 
+struct virshPoolEventCallback {
+    const char *name;
+    virConnectStoragePoolEventGenericCallback cb;
+};
+typedef struct virshPoolEventCallback virshPoolEventCallback;
+
+extern virshPoolEventCallback virshPoolEventCallbacks[];
+
 extern const vshCmdDef storagePoolCmds[];
 
 #endif /* VIRSH_POOL_H */