Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
b2232638
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,发现更多精彩内容 >>
提交
b2232638
编写于
11月 22, 2013
作者:
C
Cédric Bosdonnat
提交者:
Daniel P. Berrange
12月 10, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create virDomainEventIOError to get rid of the huge union
上级
b0440915
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
66 addition
and
39 deletion
+66
-39
src/conf/domain_event.c
src/conf/domain_event.c
+66
-39
未找到文件。
src/conf/domain_event.c
浏览文件 @
b2232638
...
...
@@ -88,11 +88,13 @@ static virClassPtr virDomainEventClass;
static
virClassPtr
virDomainEventLifecycleClass
;
static
virClassPtr
virDomainEventRTCChangeClass
;
static
virClassPtr
virDomainEventWatchdogClass
;
static
virClassPtr
virDomainEventIOErrorClass
;
static
void
virObjectEventDispose
(
void
*
obj
);
static
void
virDomainEventDispose
(
void
*
obj
);
static
void
virDomainEventLifecycleDispose
(
void
*
obj
);
static
void
virDomainEventRTCChangeDispose
(
void
*
obj
);
static
void
virDomainEventWatchdogDispose
(
void
*
obj
);
static
void
virDomainEventIOErrorDispose
(
void
*
obj
);
struct
_virObjectEvent
{
virObject
parent
;
...
...
@@ -105,12 +107,6 @@ struct _virDomainEvent {
virObjectMeta
meta
;
union
{
struct
{
char
*
srcPath
;
char
*
devAlias
;
int
action
;
char
*
reason
;
}
ioError
;
struct
{
int
phase
;
virDomainEventGraphicsAddressPtr
local
;
...
...
@@ -168,6 +164,17 @@ struct _virDomainEventWatchdog {
typedef
struct
_virDomainEventWatchdog
virDomainEventWatchdog
;
typedef
virDomainEventWatchdog
*
virDomainEventWatchdogPtr
;
struct
_virDomainEventIOError
{
virDomainEvent
parent
;
char
*
srcPath
;
char
*
devAlias
;
int
action
;
char
*
reason
;
};
typedef
struct
_virDomainEventIOError
virDomainEventIOError
;
typedef
virDomainEventIOError
*
virDomainEventIOErrorPtr
;
static
int
virObjectEventOnceInit
(
void
)
{
if
(
!
(
virObjectEventClass
=
...
...
@@ -200,6 +207,12 @@ static int virObjectEventOnceInit(void)
sizeof
(
virDomainEventWatchdog
),
virDomainEventWatchdogDispose
)))
return
-
1
;
if
(
!
(
virDomainEventIOErrorClass
=
virClassNew
(
virDomainEventClass
,
"virDomainEventIOError"
,
sizeof
(
virDomainEventIOError
),
virDomainEventIOErrorDispose
)))
return
-
1
;
return
0
;
}
...
...
@@ -231,12 +244,6 @@ static void virDomainEventDispose(void *obj)
VIR_DEBUG
(
"obj=%p"
,
event
);
switch
(
virObjectEventGetEventID
(
event
))
{
case
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
:
case
VIR_DOMAIN_EVENT_ID_IO_ERROR
:
VIR_FREE
(
event
->
data
.
ioError
.
srcPath
);
VIR_FREE
(
event
->
data
.
ioError
.
devAlias
);
VIR_FREE
(
event
->
data
.
ioError
.
reason
);
break
;
case
VIR_DOMAIN_EVENT_ID_GRAPHICS
:
if
(
event
->
data
.
graphics
.
local
)
{
...
...
@@ -298,6 +305,16 @@ static void virDomainEventWatchdogDispose(void *obj)
VIR_DEBUG
(
"obj=%p"
,
event
);
}
static
void
virDomainEventIOErrorDispose
(
void
*
obj
)
{
virDomainEventIOErrorPtr
event
=
obj
;
VIR_DEBUG
(
"obj=%p"
,
event
);
VIR_FREE
(
event
->
srcPath
);
VIR_FREE
(
event
->
devAlias
);
VIR_FREE
(
event
->
reason
);
}
/**
* virObjectEventCallbackListFree:
* @list: event callback list head
...
...
@@ -972,24 +989,24 @@ static virDomainEventPtr virDomainEventIOErrorNewFromDomImpl(int event,
int
action
,
const
char
*
reason
)
{
virDomainEventPtr
ev
;
virDomainEvent
IOError
Ptr
ev
;
if
(
virObjectEventInitialize
()
<
0
)
return
NULL
;
if
(
!
(
ev
=
virDomainEventNew
(
virDomainEventClass
,
event
,
if
(
!
(
ev
=
virDomainEventNew
(
virDomainEvent
IOError
Class
,
event
,
dom
->
id
,
dom
->
name
,
dom
->
uuid
)))
return
NULL
;
ev
->
data
.
ioError
.
action
=
action
;
if
(
VIR_STRDUP
(
ev
->
data
.
ioError
.
srcPath
,
srcPath
)
<
0
||
VIR_STRDUP
(
ev
->
d
ata
.
ioError
.
d
evAlias
,
devAlias
)
<
0
||
VIR_STRDUP
(
ev
->
data
.
ioError
.
reason
,
reason
)
<
0
)
{
ev
->
action
=
action
;
if
(
VIR_STRDUP
(
ev
->
srcPath
,
srcPath
)
<
0
||
VIR_STRDUP
(
ev
->
devAlias
,
devAlias
)
<
0
||
VIR_STRDUP
(
ev
->
reason
,
reason
)
<
0
)
{
virObjectUnref
(
ev
);
ev
=
NULL
;
}
return
ev
;
return
(
virDomainEventPtr
)
ev
;
}
static
virDomainEventPtr
virDomainEventIOErrorNewFromObjImpl
(
int
event
,
...
...
@@ -999,25 +1016,25 @@ static virDomainEventPtr virDomainEventIOErrorNewFromObjImpl(int event,
int
action
,
const
char
*
reason
)
{
virDomainEventPtr
ev
;
virDomainEvent
IOError
Ptr
ev
;
if
(
virObjectEventInitialize
()
<
0
)
return
NULL
;
if
(
!
(
ev
=
virDomainEventNew
(
virDomainEventClass
,
event
,
if
(
!
(
ev
=
virDomainEventNew
(
virDomainEvent
IOError
Class
,
event
,
obj
->
def
->
id
,
obj
->
def
->
name
,
obj
->
def
->
uuid
)))
return
NULL
;
ev
->
data
.
ioError
.
action
=
action
;
if
(
VIR_STRDUP
(
ev
->
data
.
ioError
.
srcPath
,
srcPath
)
<
0
||
VIR_STRDUP
(
ev
->
d
ata
.
ioError
.
d
evAlias
,
devAlias
)
<
0
||
VIR_STRDUP
(
ev
->
data
.
ioError
.
reason
,
reason
)
<
0
)
{
ev
->
action
=
action
;
if
(
VIR_STRDUP
(
ev
->
srcPath
,
srcPath
)
<
0
||
VIR_STRDUP
(
ev
->
devAlias
,
devAlias
)
<
0
||
VIR_STRDUP
(
ev
->
reason
,
reason
)
<
0
)
{
virObjectUnref
(
ev
);
ev
=
NULL
;
}
return
ev
;
return
(
virDomainEventPtr
)
ev
;
}
virDomainEventPtr
virDomainEventIOErrorNewFromDom
(
virDomainPtr
dom
,
...
...
@@ -1556,21 +1573,31 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
}
case
VIR_DOMAIN_EVENT_ID_IO_ERROR
:
((
virConnectDomainEventIOErrorCallback
)
cb
)(
conn
,
dom
,
event
->
data
.
ioError
.
srcPath
,
event
->
data
.
ioError
.
devAlias
,
event
->
data
.
ioError
.
action
,
cbopaque
);
goto
cleanup
;
{
virDomainEventIOErrorPtr
ioErrorEvent
;
ioErrorEvent
=
(
virDomainEventIOErrorPtr
)
event
;
((
virConnectDomainEventIOErrorCallback
)
cb
)(
conn
,
dom
,
ioErrorEvent
->
srcPath
,
ioErrorEvent
->
devAlias
,
ioErrorEvent
->
action
,
cbopaque
);
goto
cleanup
;
}
case
VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
:
((
virConnectDomainEventIOErrorReasonCallback
)
cb
)(
conn
,
dom
,
event
->
data
.
ioError
.
srcPath
,
event
->
data
.
ioError
.
devAlias
,
event
->
data
.
ioError
.
action
,
event
->
data
.
ioError
.
reason
,
cbopaque
);
goto
cleanup
;
{
virDomainEventIOErrorPtr
ioErrorEvent
;
ioErrorEvent
=
(
virDomainEventIOErrorPtr
)
event
;
((
virConnectDomainEventIOErrorReasonCallback
)
cb
)(
conn
,
dom
,
ioErrorEvent
->
srcPath
,
ioErrorEvent
->
devAlias
,
ioErrorEvent
->
action
,
ioErrorEvent
->
reason
,
cbopaque
);
goto
cleanup
;
}
case
VIR_DOMAIN_EVENT_ID_GRAPHICS
:
((
virConnectDomainEventGraphicsCallback
)
cb
)(
conn
,
dom
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录