Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
1ded8942
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,发现更多精彩内容 >>
提交
1ded8942
编写于
1月 06, 2011
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
lxc: Use virDomainEventState helpers
v3: Adjust for new virDomainEventStateNew argument
上级
42a3687f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
22 addition
and
58 deletion
+22
-58
src/lxc/lxc_conf.h
src/lxc/lxc_conf.h
+1
-5
src/lxc/lxc_driver.c
src/lxc/lxc_driver.c
+21
-53
未找到文件。
src/lxc/lxc_conf.h
浏览文件 @
1ded8942
...
@@ -55,11 +55,7 @@ struct __lxc_driver {
...
@@ -55,11 +55,7 @@ struct __lxc_driver {
int
log_libvirtd
;
int
log_libvirtd
;
int
have_netns
;
int
have_netns
;
/* An array of callbacks */
virDomainEventStatePtr
domainEventState
;
virDomainEventCallbackListPtr
domainEventCallbacks
;
virDomainEventQueuePtr
domainEventQueue
;
int
domainEventTimer
;
int
domainEventDispatching
;
};
};
int
lxcLoadDriverConfig
(
lxc_driver_t
*
driver
);
int
lxcLoadDriverConfig
(
lxc_driver_t
*
driver
);
...
...
src/lxc/lxc_driver.c
浏览文件 @
1ded8942
...
@@ -159,7 +159,8 @@ static int lxcClose(virConnectPtr conn)
...
@@ -159,7 +159,8 @@ static int lxcClose(virConnectPtr conn)
lxc_driver_t
*
driver
=
conn
->
privateData
;
lxc_driver_t
*
driver
=
conn
->
privateData
;
lxcDriverLock
(
driver
);
lxcDriverLock
(
driver
);
virDomainEventCallbackListRemoveConn
(
conn
,
driver
->
domainEventCallbacks
);
virDomainEventCallbackListRemoveConn
(
conn
,
driver
->
domainEventState
->
callbacks
);
lxcDriverUnlock
(
driver
);
lxcDriverUnlock
(
driver
);
conn
->
privateData
=
NULL
;
conn
->
privateData
=
NULL
;
...
@@ -1648,7 +1649,8 @@ lxcDomainEventRegister(virConnectPtr conn,
...
@@ -1648,7 +1649,8 @@ lxcDomainEventRegister(virConnectPtr conn,
int
ret
;
int
ret
;
lxcDriverLock
(
driver
);
lxcDriverLock
(
driver
);
ret
=
virDomainEventCallbackListAdd
(
conn
,
driver
->
domainEventCallbacks
,
ret
=
virDomainEventCallbackListAdd
(
conn
,
driver
->
domainEventState
->
callbacks
,
callback
,
opaque
,
freecb
);
callback
,
opaque
,
freecb
);
lxcDriverUnlock
(
driver
);
lxcDriverUnlock
(
driver
);
...
@@ -1664,11 +1666,8 @@ lxcDomainEventDeregister(virConnectPtr conn,
...
@@ -1664,11 +1666,8 @@ lxcDomainEventDeregister(virConnectPtr conn,
int
ret
;
int
ret
;
lxcDriverLock
(
driver
);
lxcDriverLock
(
driver
);
if
(
driver
->
domainEventDispatching
)
ret
=
virDomainEventStateDeregister
(
conn
,
ret
=
virDomainEventCallbackListMarkDelete
(
conn
,
driver
->
domainEventCallbacks
,
driver
->
domainEventState
,
callback
);
else
ret
=
virDomainEventCallbackListRemove
(
conn
,
driver
->
domainEventCallbacks
,
callback
);
callback
);
lxcDriverUnlock
(
driver
);
lxcDriverUnlock
(
driver
);
...
@@ -1689,7 +1688,7 @@ lxcDomainEventRegisterAny(virConnectPtr conn,
...
@@ -1689,7 +1688,7 @@ lxcDomainEventRegisterAny(virConnectPtr conn,
lxcDriverLock
(
driver
);
lxcDriverLock
(
driver
);
ret
=
virDomainEventCallbackListAddID
(
conn
,
ret
=
virDomainEventCallbackListAddID
(
conn
,
driver
->
domainEvent
C
allbacks
,
driver
->
domainEvent
State
->
c
allbacks
,
dom
,
eventID
,
dom
,
eventID
,
callback
,
opaque
,
freecb
);
callback
,
opaque
,
freecb
);
lxcDriverUnlock
(
driver
);
lxcDriverUnlock
(
driver
);
...
@@ -1706,11 +1705,8 @@ lxcDomainEventDeregisterAny(virConnectPtr conn,
...
@@ -1706,11 +1705,8 @@ lxcDomainEventDeregisterAny(virConnectPtr conn,
int
ret
;
int
ret
;
lxcDriverLock
(
driver
);
lxcDriverLock
(
driver
);
if
(
driver
->
domainEventDispatching
)
ret
=
virDomainEventStateDeregisterAny
(
conn
,
ret
=
virDomainEventCallbackListMarkDeleteID
(
conn
,
driver
->
domainEventCallbacks
,
driver
->
domainEventState
,
callbackID
);
else
ret
=
virDomainEventCallbackListRemoveID
(
conn
,
driver
->
domainEventCallbacks
,
callbackID
);
callbackID
);
lxcDriverUnlock
(
driver
);
lxcDriverUnlock
(
driver
);
...
@@ -1736,28 +1732,11 @@ static void lxcDomainEventDispatchFunc(virConnectPtr conn,
...
@@ -1736,28 +1732,11 @@ static void lxcDomainEventDispatchFunc(virConnectPtr conn,
static
void
lxcDomainEventFlush
(
int
timer
ATTRIBUTE_UNUSED
,
void
*
opaque
)
static
void
lxcDomainEventFlush
(
int
timer
ATTRIBUTE_UNUSED
,
void
*
opaque
)
{
{
lxc_driver_t
*
driver
=
opaque
;
lxc_driver_t
*
driver
=
opaque
;
virDomainEventQueue
tempQueue
;
lxcDriverLock
(
driver
);
lxcDriverLock
(
driver
);
virDomainEventStateFlush
(
driver
->
domainEventState
,
driver
->
domainEventDispatching
=
1
;
/* Copy the queue, so we're reentrant safe */
tempQueue
.
count
=
driver
->
domainEventQueue
->
count
;
tempQueue
.
events
=
driver
->
domainEventQueue
->
events
;
driver
->
domainEventQueue
->
count
=
0
;
driver
->
domainEventQueue
->
events
=
NULL
;
virEventUpdateTimeout
(
driver
->
domainEventTimer
,
-
1
);
virDomainEventQueueDispatch
(
&
tempQueue
,
driver
->
domainEventCallbacks
,
lxcDomainEventDispatchFunc
,
lxcDomainEventDispatchFunc
,
driver
);
driver
);
/* Purge any deleted callbacks */
virDomainEventCallbackListPurgeMarked
(
driver
->
domainEventCallbacks
);
driver
->
domainEventDispatching
=
0
;
lxcDriverUnlock
(
driver
);
lxcDriverUnlock
(
driver
);
}
}
...
@@ -1766,11 +1745,7 @@ static void lxcDomainEventFlush(int timer ATTRIBUTE_UNUSED, void *opaque)
...
@@ -1766,11 +1745,7 @@ static void lxcDomainEventFlush(int timer ATTRIBUTE_UNUSED, void *opaque)
static
void
lxcDomainEventQueue
(
lxc_driver_t
*
driver
,
static
void
lxcDomainEventQueue
(
lxc_driver_t
*
driver
,
virDomainEventPtr
event
)
virDomainEventPtr
event
)
{
{
if
(
virDomainEventQueuePush
(
driver
->
domainEventQueue
,
virDomainEventStateQueue
(
driver
->
domainEventState
,
event
);
event
)
<
0
)
virDomainEventFree
(
event
);
if
(
lxc_driver
->
domainEventQueue
->
count
==
1
)
virEventUpdateTimeout
(
driver
->
domainEventTimer
,
0
);
}
}
/**
/**
...
@@ -1985,13 +1960,11 @@ static int lxcStartup(int privileged)
...
@@ -1985,13 +1960,11 @@ static int lxcStartup(int privileged)
if
(
virDomainObjListInit
(
&
lxc_driver
->
domains
)
<
0
)
if
(
virDomainObjListInit
(
&
lxc_driver
->
domains
)
<
0
)
goto
cleanup
;
goto
cleanup
;
if
(
VIR_ALLOC
(
lxc_driver
->
domainEventCallbacks
)
<
0
)
lxc_driver
->
domainEventState
=
virDomainEventStateNew
(
lxcDomainEventFlush
,
goto
cleanup
;
lxc_driver
,
if
(
!
(
lxc_driver
->
domainEventQueue
=
virDomainEventQueueNew
()))
NULL
,
goto
cleanup
;
true
);
if
(
!
lxc_driver
->
domainEventState
)
if
((
lxc_driver
->
domainEventTimer
=
virEventAddTimeout
(
-
1
,
lxcDomainEventFlush
,
lxc_driver
,
NULL
))
<
0
)
goto
cleanup
;
goto
cleanup
;
lxc_driver
->
log_libvirtd
=
0
;
/* by default log to container logfile */
lxc_driver
->
log_libvirtd
=
0
;
/* by default log to container logfile */
...
@@ -2083,12 +2056,7 @@ static int lxcShutdown(void)
...
@@ -2083,12 +2056,7 @@ static int lxcShutdown(void)
lxcDriverLock
(
lxc_driver
);
lxcDriverLock
(
lxc_driver
);
virDomainObjListDeinit
(
&
lxc_driver
->
domains
);
virDomainObjListDeinit
(
&
lxc_driver
->
domains
);
virDomainEventStateFree
(
lxc_driver
->
domainEventState
);
virDomainEventCallbackListFree
(
lxc_driver
->
domainEventCallbacks
);
virDomainEventQueueFree
(
lxc_driver
->
domainEventQueue
);
if
(
lxc_driver
->
domainEventTimer
!=
-
1
)
virEventRemoveTimeout
(
lxc_driver
->
domainEventTimer
);
virCapabilitiesFree
(
lxc_driver
->
caps
);
virCapabilitiesFree
(
lxc_driver
->
caps
);
VIR_FREE
(
lxc_driver
->
configDir
);
VIR_FREE
(
lxc_driver
->
configDir
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录