Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2e0f3453
L
libvirt
项目概览
openeuler
/
libvirt
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
libvirt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2e0f3453
编写于
4月 13, 2016
作者:
P
Peter Krempa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
event-test: touch up coding style
Break long lines and format headers correctly.
上级
6e71d1e8
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
137 addition
and
90 deletion
+137
-90
examples/object-events/event-test.c
examples/object-events/event-test.c
+137
-90
未找到文件。
examples/object-events/event-test.c
浏览文件 @
2e0f3453
...
...
@@ -18,9 +18,8 @@
int
run
=
1
;
/* Callback functions */
static
void
connectClose
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
void
connectClose
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
int
reason
,
void
*
opaque
ATTRIBUTE_UNUSED
)
{
...
...
@@ -44,7 +43,10 @@ static void connectClose(virConnectPtr conn ATTRIBUTE_UNUSED,
run
=
0
;
}
const
char
*
eventToString
(
int
event
)
{
static
const
char
*
eventToString
(
int
event
)
{
const
char
*
ret
=
""
;
switch
((
virDomainEventType
)
event
)
{
case
VIR_DOMAIN_EVENT_DEFINED
:
...
...
@@ -78,7 +80,11 @@ const char *eventToString(int event) {
return
ret
;
}
static
const
char
*
eventDetailToString
(
int
event
,
int
detail
)
{
static
const
char
*
eventDetailToString
(
int
event
,
int
detail
)
{
const
char
*
ret
=
""
;
switch
((
virDomainEventType
)
event
)
{
case
VIR_DOMAIN_EVENT_DEFINED
:
...
...
@@ -216,6 +222,7 @@ static const char *eventDetailToString(int event, int detail) {
return
ret
;
}
static
const
char
*
networkEventToString
(
int
event
)
{
...
...
@@ -237,6 +244,7 @@ networkEventToString(int event)
return
ret
;
}
static
const
char
*
guestAgentLifecycleEventStateToString
(
int
event
)
{
...
...
@@ -255,6 +263,7 @@ guestAgentLifecycleEventStateToString(int event)
return
ret
;
}
static
const
char
*
guestAgentLifecycleEventReasonToString
(
int
event
)
{
...
...
@@ -278,7 +287,8 @@ guestAgentLifecycleEventReasonToString(int event)
}
static
int
myDomainEventCallback1
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventCallback1
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
int
event
,
int
detail
,
...
...
@@ -290,7 +300,9 @@ static int myDomainEventCallback1(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventCallback2
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventCallback2
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
int
event
,
int
detail
,
...
...
@@ -302,7 +314,9 @@ static int myDomainEventCallback2(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventRebootCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventRebootCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
void
*
opaque
ATTRIBUTE_UNUSED
)
{
...
...
@@ -312,7 +326,9 @@ static int myDomainEventRebootCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventRTCChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventRTCChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
long
long
offset
,
void
*
opaque
ATTRIBUTE_UNUSED
)
...
...
@@ -324,7 +340,9 @@ static int myDomainEventRTCChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventBalloonChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventBalloonChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
unsigned
long
long
actual
,
void
*
opaque
ATTRIBUTE_UNUSED
)
...
...
@@ -335,31 +353,38 @@ static int myDomainEventBalloonChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSE
return
0
;
}
static
int
myDomainEventWatchdogCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventWatchdogCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
int
action
,
void
*
opaque
ATTRIBUTE_UNUSED
)
{
printf
(
"%s EVENT: Domain %s(%d) watchdog action=%d
\n
"
,
__func__
,
virDomainGetName
(
dom
),
virDomainGetID
(
dom
),
action
);
printf
(
"%s EVENT: Domain %s(%d) watchdog action=%d
\n
"
,
__func__
,
virDomainGet
Name
(
dom
),
virDomainGet
ID
(
dom
),
action
);
return
0
;
}
static
int
myDomainEventIOErrorCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventIOErrorCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
const
char
*
srcPath
,
const
char
*
devAlias
,
int
action
,
void
*
opaque
ATTRIBUTE_UNUSED
)
{
printf
(
"%s EVENT: Domain %s(%d) io error path=%s alias=%s action=%d
\n
"
,
__func__
,
virDomainGetName
(
dom
),
virDomainGetID
(
dom
),
srcPath
,
devAlias
,
action
);
printf
(
"%s EVENT: Domain %s(%d) io error path=%s alias=%s action=%d
\n
"
,
__func__
,
virDomainGetName
(
dom
),
virDomainGetID
(
dom
),
srcPath
,
devAlias
,
action
);
return
0
;
}
static
int
myDomainEventGraphicsCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventGraphicsCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
int
phase
,
virDomainEventGraphicsAddressPtr
local
,
...
...
@@ -400,12 +425,14 @@ static int myDomainEventGraphicsCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventControlErrorCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventControlErrorCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
void
*
opaque
ATTRIBUTE_UNUSED
)
{
printf
(
"%s EVENT: Domain %s(%d) control error
\n
"
,
__func__
,
virDomainGetName
(
dom
),
virDomainGetID
(
dom
));
printf
(
"%s EVENT: Domain %s(%d) control error
\n
"
,
__func__
,
virDomainGet
Name
(
dom
),
virDomainGet
ID
(
dom
));
return
0
;
}
...
...
@@ -415,7 +442,8 @@ const char *diskChangeReasonStrings[] = {
"startupPolicy"
,
/* 0 */
/* add new reason here */
};
static
int
myDomainEventDiskChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventDiskChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
const
char
*
oldSrcPath
,
const
char
*
newSrcPath
,
...
...
@@ -423,7 +451,8 @@ static int myDomainEventDiskChangeCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
int
reason
,
void
*
opaque
ATTRIBUTE_UNUSED
)
{
printf
(
"%s EVENT: Domain %s(%d) disk change oldSrcPath: %s newSrcPath: %s devAlias: %s reason: %s
\n
"
,
printf
(
"%s EVENT: Domain %s(%d) disk change oldSrcPath: %s newSrcPath: %s "
"devAlias: %s reason: %s
\n
"
,
__func__
,
virDomainGetName
(
dom
),
virDomainGetID
(
dom
),
oldSrcPath
,
newSrcPath
,
devAlias
,
diskChangeReasonStrings
[
reason
]);
return
0
;
...
...
@@ -434,19 +463,24 @@ const char *trayChangeReasonStrings[] = {
"close"
,
};
static
int
myDomainEventTrayChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventTrayChangeCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
const
char
*
devAlias
,
int
reason
,
void
*
opaque
ATTRIBUTE_UNUSED
)
{
printf
(
"%s EVENT: Domain %s(%d) removable disk's tray change devAlias: %s reason: %s
\n
"
,
printf
(
"%s EVENT: Domain %s(%d) removable disk's tray change devAlias: %s "
"reason: %s
\n
"
,
__func__
,
virDomainGetName
(
dom
),
virDomainGetID
(
dom
),
devAlias
,
trayChangeReasonStrings
[
reason
]);
return
0
;
}
static
int
myDomainEventPMWakeupCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventPMWakeupCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
int
reason
ATTRIBUTE_UNUSED
,
void
*
opaque
ATTRIBUTE_UNUSED
)
...
...
@@ -456,7 +490,9 @@ static int myDomainEventPMWakeupCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventPMSuspendCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventPMSuspendCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
int
reason
ATTRIBUTE_UNUSED
,
void
*
opaque
ATTRIBUTE_UNUSED
)
...
...
@@ -466,7 +502,9 @@ static int myDomainEventPMSuspendCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventPMSuspendDiskCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myDomainEventPMSuspendDiskCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
int
reason
ATTRIBUTE_UNUSED
,
void
*
opaque
ATTRIBUTE_UNUSED
)
...
...
@@ -476,6 +514,7 @@ static int myDomainEventPMSuspendDiskCallback(virConnectPtr conn ATTRIBUTE_UNUSE
return
0
;
}
static
int
myDomainEventDeviceRemovedCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
...
...
@@ -487,7 +526,9 @@ myDomainEventDeviceRemovedCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myNetworkEventCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
static
int
myNetworkEventCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virNetworkPtr
dom
,
int
event
,
int
detail
,
...
...
@@ -498,6 +539,7 @@ static int myNetworkEventCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventTunableCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
...
...
@@ -543,6 +585,7 @@ myDomainEventTunableCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventAgentLifecycleCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
...
...
@@ -558,6 +601,7 @@ myDomainEventAgentLifecycleCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
int
myDomainEventDeviceAddedCallback
(
virConnectPtr
conn
ATTRIBUTE_UNUSED
,
virDomainPtr
dom
,
...
...
@@ -569,7 +613,9 @@ myDomainEventDeviceAddedCallback(virConnectPtr conn ATTRIBUTE_UNUSED,
return
0
;
}
static
void
myFreeFunc
(
void
*
opaque
)
static
void
myFreeFunc
(
void
*
opaque
)
{
char
*
str
=
opaque
;
printf
(
"%s: Freeing [%s]
\n
"
,
__func__
,
str
);
...
...
@@ -578,15 +624,16 @@ static void myFreeFunc(void *opaque)
/* main test functions */
st
atic
void
st
op
(
int
sig
)
static
void
stop
(
int
sig
)
{
printf
(
"Exiting on signal %d
\n
"
,
sig
);
run
=
0
;
}
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
int
ret
=
EXIT_FAILURE
;
virConnectPtr
dconn
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录