Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
0ac4c9ed
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,发现更多精彩内容 >>
提交
0ac4c9ed
编写于
11月 22, 2013
作者:
C
Cédric Bosdonnat
提交者:
Daniel P. Berrange
12月 10, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Create virDomainEventBlockJob to get rid of the huge union
上级
e6b83046
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
36 deletion
+62
-36
src/conf/domain_event.c
src/conf/domain_event.c
+56
-30
src/conf/domain_event.h
src/conf/domain_event.h
+6
-6
未找到文件。
src/conf/domain_event.c
浏览文件 @
0ac4c9ed
...
...
@@ -90,6 +90,7 @@ static virClassPtr virDomainEventRTCChangeClass;
static
virClassPtr
virDomainEventWatchdogClass
;
static
virClassPtr
virDomainEventIOErrorClass
;
static
virClassPtr
virDomainEventGraphicsClass
;
static
virClassPtr
virDomainEventBlockJobClass
;
static
void
virObjectEventDispose
(
void
*
obj
);
static
void
virDomainEventDispose
(
void
*
obj
);
static
void
virDomainEventLifecycleDispose
(
void
*
obj
);
...
...
@@ -97,6 +98,7 @@ static void virDomainEventRTCChangeDispose(void *obj);
static
void
virDomainEventWatchdogDispose
(
void
*
obj
);
static
void
virDomainEventIOErrorDispose
(
void
*
obj
);
static
void
virDomainEventGraphicsDispose
(
void
*
obj
);
static
void
virDomainEventBlockJobDispose
(
void
*
obj
);
struct
_virObjectEvent
{
virObject
parent
;
...
...
@@ -109,11 +111,6 @@ struct _virDomainEvent {
virObjectMeta
meta
;
union
{
struct
{
char
*
path
;
int
type
;
int
status
;
}
blockJob
;
struct
{
char
*
oldSrcPath
;
char
*
newSrcPath
;
...
...
@@ -170,6 +167,16 @@ struct _virDomainEventIOError {
typedef
struct
_virDomainEventIOError
virDomainEventIOError
;
typedef
virDomainEventIOError
*
virDomainEventIOErrorPtr
;
struct
_virDomainEventBlockJob
{
virDomainEvent
parent
;
char
*
path
;
int
type
;
int
status
;
};
typedef
struct
_virDomainEventBlockJob
virDomainEventBlockJob
;
typedef
virDomainEventBlockJob
*
virDomainEventBlockJobPtr
;
struct
_virDomainEventGraphics
{
virDomainEvent
parent
;
...
...
@@ -226,6 +233,12 @@ static int virObjectEventOnceInit(void)
sizeof
(
virDomainEventGraphics
),
virDomainEventGraphicsDispose
)))
return
-
1
;
if
(
!
(
virDomainEventBlockJobClass
=
virClassNew
(
virDomainEventClass
,
"virDomainEventBlockJob"
,
sizeof
(
virDomainEventBlockJob
),
virDomainEventBlockJobDispose
)))
return
-
1
;
return
0
;
}
...
...
@@ -258,10 +271,6 @@ static void virDomainEventDispose(void *obj)
switch
(
virObjectEventGetEventID
(
event
))
{
case
VIR_DOMAIN_EVENT_ID_BLOCK_JOB
:
VIR_FREE
(
event
->
data
.
blockJob
.
path
);
break
;
case
VIR_DOMAIN_EVENT_ID_DISK_CHANGE
:
VIR_FREE
(
event
->
data
.
diskChange
.
oldSrcPath
);
VIR_FREE
(
event
->
data
.
diskChange
.
newSrcPath
);
...
...
@@ -332,6 +341,14 @@ static void virDomainEventGraphicsDispose(void *obj)
}
}
static
void
virDomainEventBlockJobDispose
(
void
*
obj
)
{
virDomainEventBlockJobPtr
event
=
obj
;
VIR_DEBUG
(
"obj=%p"
,
event
);
VIR_FREE
(
event
->
path
);
}
/**
* virObjectEventCallbackListFree:
* @list: event callback list head
...
...
@@ -1156,43 +1173,47 @@ virDomainEventPtr virDomainEventGraphicsNewFromObj(virDomainObjPtr obj,
return
(
virDomainEventPtr
)
ev
;
}
static
virDomainEventPtr
virDomainEventBlockJobNew
(
int
id
,
const
char
*
name
,
unsigned
char
*
uuid
,
const
char
*
path
,
int
type
,
int
status
)
static
virDomainEventPtr
virDomainEventBlockJobNew
(
int
id
,
const
char
*
name
,
unsigned
char
*
uuid
,
const
char
*
path
,
int
type
,
int
status
)
{
virDomainEventPtr
ev
;
virDomainEvent
BlockJob
Ptr
ev
;
if
(
virObjectEventInitialize
()
<
0
)
return
NULL
;
if
(
!
(
ev
=
virDomainEventNew
(
virDomainEventClass
,
if
(
!
(
ev
=
virDomainEventNew
(
virDomainEvent
BlockJob
Class
,
VIR_DOMAIN_EVENT_ID_BLOCK_JOB
,
id
,
name
,
uuid
)))
return
NULL
;
if
(
VIR_STRDUP
(
ev
->
data
.
blockJob
.
path
,
path
)
<
0
)
{
if
(
VIR_STRDUP
(
ev
->
path
,
path
)
<
0
)
{
virObjectUnref
(
ev
);
return
NULL
;
}
ev
->
data
.
blockJob
.
type
=
type
;
ev
->
data
.
blockJob
.
status
=
status
;
ev
->
type
=
type
;
ev
->
status
=
status
;
return
ev
;
return
(
virDomainEventPtr
)
ev
;
}
virDomainEventPtr
virDomainEventBlockJobNewFromObj
(
virDomainObjPtr
obj
,
const
char
*
path
,
int
type
,
int
status
)
const
char
*
path
,
int
type
,
int
status
)
{
return
virDomainEventBlockJobNew
(
obj
->
def
->
id
,
obj
->
def
->
name
,
obj
->
def
->
uuid
,
path
,
type
,
status
);
}
virDomainEventPtr
virDomainEventBlockJobNewFromDom
(
virDomainPtr
dom
,
const
char
*
path
,
int
type
,
int
status
)
const
char
*
path
,
int
type
,
int
status
)
{
return
virDomainEventBlockJobNew
(
dom
->
id
,
dom
->
name
,
dom
->
uuid
,
path
,
type
,
status
);
...
...
@@ -1637,12 +1658,17 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn,
goto
cleanup
;
case
VIR_DOMAIN_EVENT_ID_BLOCK_JOB
:
((
virConnectDomainEventBlockJobCallback
)
cb
)(
conn
,
dom
,
event
->
data
.
blockJob
.
path
,
event
->
data
.
blockJob
.
type
,
event
->
data
.
blockJob
.
status
,
cbopaque
);
goto
cleanup
;
{
virDomainEventBlockJobPtr
blockJobEvent
;
blockJobEvent
=
(
virDomainEventBlockJobPtr
)
event
;
((
virConnectDomainEventBlockJobCallback
)
cb
)(
conn
,
dom
,
blockJobEvent
->
path
,
blockJobEvent
->
type
,
blockJobEvent
->
status
,
cbopaque
);
goto
cleanup
;
}
case
VIR_DOMAIN_EVENT_ID_DISK_CHANGE
:
((
virConnectDomainEventDiskChangeCallback
)
cb
)(
conn
,
dom
,
...
...
src/conf/domain_event.h
浏览文件 @
0ac4c9ed
...
...
@@ -104,13 +104,13 @@ virDomainEventPtr virDomainEventControlErrorNewFromDom(virDomainPtr dom);
virDomainEventPtr
virDomainEventControlErrorNewFromObj
(
virDomainObjPtr
obj
);
virDomainEventPtr
virDomainEventBlockJobNewFromObj
(
virDomainObjPtr
obj
,
const
char
*
path
,
int
type
,
int
status
);
const
char
*
path
,
int
type
,
int
status
);
virDomainEventPtr
virDomainEventBlockJobNewFromDom
(
virDomainPtr
dom
,
const
char
*
path
,
int
type
,
int
status
);
const
char
*
path
,
int
type
,
int
status
);
virDomainEventPtr
virDomainEventDiskChangeNewFromObj
(
virDomainObjPtr
obj
,
const
char
*
oldSrcPath
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录