提交 237fe904 编写于 作者: L Lin Ma 提交者: Michal Privoznik

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: NLin Ma <lma@suse.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 66d66081
......@@ -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;
......
......@@ -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 */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册