mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh-pool: Rename and move vshEventCallback to virshPoolEventCallback
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>
This commit is contained in:
@@ -1999,18 +1999,12 @@ virshPoolEventToString(int event)
|
|||||||
return str ? _(str) : _("unknown");
|
return str ? _(str) : _("unknown");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct vshEventCallback {
|
|
||||||
const char *name;
|
|
||||||
virConnectStoragePoolEventGenericCallback cb;
|
|
||||||
};
|
|
||||||
typedef struct vshEventCallback vshEventCallback;
|
|
||||||
|
|
||||||
struct virshPoolEventData {
|
struct virshPoolEventData {
|
||||||
vshControl *ctl;
|
vshControl *ctl;
|
||||||
bool loop;
|
bool loop;
|
||||||
bool timestamp;
|
bool timestamp;
|
||||||
int count;
|
int count;
|
||||||
vshEventCallback *cb;
|
virshPoolEventCallback *cb;
|
||||||
};
|
};
|
||||||
typedef struct virshPoolEventData virshPoolEventData;
|
typedef struct virshPoolEventData virshPoolEventData;
|
||||||
|
|
||||||
@@ -2079,12 +2073,12 @@ vshEventGenericPrint(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|||||||
vshEventDone(data->ctl);
|
vshEventDone(data->ctl);
|
||||||
}
|
}
|
||||||
|
|
||||||
static vshEventCallback vshEventCallbacks[] = {
|
virshPoolEventCallback virshPoolEventCallbacks[] = {
|
||||||
{ "lifecycle",
|
{ "lifecycle",
|
||||||
VIR_STORAGE_POOL_EVENT_CALLBACK(vshEventLifecyclePrint), },
|
VIR_STORAGE_POOL_EVENT_CALLBACK(vshEventLifecyclePrint), },
|
||||||
{ "refresh", vshEventGenericPrint, }
|
{ "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[] = {
|
static const vshCmdInfo info_pool_event[] = {
|
||||||
@@ -2141,7 +2135,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0; i < VIR_STORAGE_POOL_EVENT_ID_LAST; 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2153,7 +2147,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (event = 0; event < VIR_STORAGE_POOL_EVENT_ID_LAST; event++)
|
for (event = 0; event < VIR_STORAGE_POOL_EVENT_ID_LAST; event++)
|
||||||
if (STREQ(eventName, vshEventCallbacks[event].name))
|
if (STREQ(eventName, virshPoolEventCallbacks[event].name))
|
||||||
break;
|
break;
|
||||||
if (event == VIR_STORAGE_POOL_EVENT_ID_LAST) {
|
if (event == VIR_STORAGE_POOL_EVENT_ID_LAST) {
|
||||||
vshError(ctl, _("unknown event type %s"), eventName);
|
vshError(ctl, _("unknown event type %s"), eventName);
|
||||||
@@ -2164,7 +2158,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd)
|
|||||||
data.loop = vshCommandOptBool(cmd, "loop");
|
data.loop = vshCommandOptBool(cmd, "loop");
|
||||||
data.timestamp = vshCommandOptBool(cmd, "timestamp");
|
data.timestamp = vshCommandOptBool(cmd, "timestamp");
|
||||||
data.count = 0;
|
data.count = 0;
|
||||||
data.cb = &vshEventCallbacks[event];
|
data.cb = &virshPoolEventCallbacks[event];
|
||||||
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
if (vshCommandOptTimeoutToMs(ctl, cmd, &timeout) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,14 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
|
|||||||
virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \
|
virshCommandOptPoolBy(_ctl, _cmd, _optname, _name, \
|
||||||
VIRSH_BYUUID | VIRSH_BYNAME)
|
VIRSH_BYUUID | VIRSH_BYNAME)
|
||||||
|
|
||||||
|
struct virshPoolEventCallback {
|
||||||
|
const char *name;
|
||||||
|
virConnectStoragePoolEventGenericCallback cb;
|
||||||
|
};
|
||||||
|
typedef struct virshPoolEventCallback virshPoolEventCallback;
|
||||||
|
|
||||||
|
extern virshPoolEventCallback virshPoolEventCallbacks[];
|
||||||
|
|
||||||
extern const vshCmdDef storagePoolCmds[];
|
extern const vshCmdDef storagePoolCmds[];
|
||||||
|
|
||||||
#endif /* VIRSH_POOL_H */
|
#endif /* VIRSH_POOL_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user