Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
5684680f
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,发现更多精彩内容 >>
提交
5684680f
编写于
6月 23, 2016
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
events: Rename argument uuid->key
Since it's not strictly a uuid anymore
上级
37d1c246
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
33 deletion
+30
-33
src/conf/object_event.c
src/conf/object_event.c
+29
-32
src/conf/object_event_private.h
src/conf/object_event_private.h
+1
-1
未找到文件。
src/conf/object_event.c
浏览文件 @
5684680f
...
@@ -44,8 +44,8 @@ struct _virObjectEventCallback {
...
@@ -44,8 +44,8 @@ struct _virObjectEventCallback {
int
eventID
;
int
eventID
;
virConnectPtr
conn
;
virConnectPtr
conn
;
int
remoteID
;
int
remoteID
;
bool
uuid
_filter
;
bool
key
_filter
;
char
*
uuid
;
char
*
key
;
virObjectEventCallbackFilter
filter
;
virObjectEventCallbackFilter
filter
;
void
*
filter_opaque
;
void
*
filter_opaque
;
virConnectObjectEventGenericCallback
cb
;
virConnectObjectEventGenericCallback
cb
;
...
@@ -139,7 +139,7 @@ virObjectEventCallbackFree(virObjectEventCallbackPtr cb)
...
@@ -139,7 +139,7 @@ virObjectEventCallbackFree(virObjectEventCallbackPtr cb)
return
;
return
;
virObjectUnref
(
cb
->
conn
);
virObjectUnref
(
cb
->
conn
);
VIR_FREE
(
cb
->
uuid
);
VIR_FREE
(
cb
->
key
);
VIR_FREE
(
cb
);
VIR_FREE
(
cb
);
}
}
...
@@ -173,17 +173,17 @@ virObjectEventCallbackListFree(virObjectEventCallbackListPtr list)
...
@@ -173,17 +173,17 @@ virObjectEventCallbackListFree(virObjectEventCallbackListPtr list)
* @cbList: the list
* @cbList: the list
* @klass: the base event class
* @klass: the base event class
* @eventID: the event ID
* @eventID: the event ID
* @
uuid: optional uuid
of per-object filtering
* @
key: optional key
of per-object filtering
* @serverFilter: true if server supports object filtering
* @serverFilter: true if server supports object filtering
*
*
* Internal function to count how many callbacks remain registered for
* Internal function to count how many callbacks remain registered for
* the given @eventID and @
uuid
; knowing this allows the client side
* the given @eventID and @
key
; knowing this allows the client side
* of the remote driver know when it must send an RPC to adjust the
* of the remote driver know when it must send an RPC to adjust the
* callbacks on the server. When @serverFilter is false, this function
* callbacks on the server. When @serverFilter is false, this function
* returns a count that includes both global and per-object callbacks,
* returns a count that includes both global and per-object callbacks,
* since the remote side will use a single global event to feed both.
* since the remote side will use a single global event to feed both.
* When true, the count is limited to the callbacks with the same
* When true, the count is limited to the callbacks with the same
* @
uuid
, and where a remoteID has already been set on the callback
* @
key
, and where a remoteID has already been set on the callback
* with virObjectEventStateSetRemote(). Note that this function
* with virObjectEventStateSetRemote(). Note that this function
* intentionally ignores the legacy field, since RPC calls use only a
* intentionally ignores the legacy field, since RPC calls use only a
* single callback on the server to manage both legacy and modern
* single callback on the server to manage both legacy and modern
...
@@ -194,7 +194,7 @@ virObjectEventCallbackListCount(virConnectPtr conn,
...
@@ -194,7 +194,7 @@ virObjectEventCallbackListCount(virConnectPtr conn,
virObjectEventCallbackListPtr
cbList
,
virObjectEventCallbackListPtr
cbList
,
virClassPtr
klass
,
virClassPtr
klass
,
int
eventID
,
int
eventID
,
const
char
*
uuid
,
const
char
*
key
,
bool
serverFilter
)
bool
serverFilter
)
{
{
size_t
i
;
size_t
i
;
...
@@ -211,8 +211,8 @@ virObjectEventCallbackListCount(virConnectPtr conn,
...
@@ -211,8 +211,8 @@ virObjectEventCallbackListCount(virConnectPtr conn,
!
cb
->
deleted
&&
!
cb
->
deleted
&&
(
!
serverFilter
||
(
!
serverFilter
||
(
cb
->
remoteID
>=
0
&&
(
cb
->
remoteID
>=
0
&&
((
uuid
&&
cb
->
uuid_filter
&&
STREQ
(
cb
->
uuid
,
uuid
))
||
((
key
&&
cb
->
key_filter
&&
STREQ
(
cb
->
key
,
key
))
||
(
!
uuid
&&
!
cb
->
uuid
_filter
)))))
(
!
key
&&
!
cb
->
key
_filter
)))))
ret
++
;
ret
++
;
}
}
return
ret
;
return
ret
;
...
@@ -242,7 +242,7 @@ virObjectEventCallbackListRemoveID(virConnectPtr conn,
...
@@ -242,7 +242,7 @@ virObjectEventCallbackListRemoveID(virConnectPtr conn,
ret
=
cb
->
filter
?
0
:
ret
=
cb
->
filter
?
0
:
(
virObjectEventCallbackListCount
(
conn
,
cbList
,
cb
->
klass
,
(
virObjectEventCallbackListCount
(
conn
,
cbList
,
cb
->
klass
,
cb
->
eventID
,
cb
->
eventID
,
cb
->
uuid_filter
?
cb
->
uuid
:
NULL
,
cb
->
key_filter
?
cb
->
key
:
NULL
,
cb
->
remoteID
>=
0
)
-
1
);
cb
->
remoteID
>=
0
)
-
1
);
if
(
cb
->
freecb
)
if
(
cb
->
freecb
)
...
@@ -275,7 +275,7 @@ virObjectEventCallbackListMarkDeleteID(virConnectPtr conn,
...
@@ -275,7 +275,7 @@ virObjectEventCallbackListMarkDeleteID(virConnectPtr conn,
return
cb
->
filter
?
0
:
return
cb
->
filter
?
0
:
virObjectEventCallbackListCount
(
conn
,
cbList
,
cb
->
klass
,
virObjectEventCallbackListCount
(
conn
,
cbList
,
cb
->
klass
,
cb
->
eventID
,
cb
->
eventID
,
cb
->
uuid_filter
?
cb
->
uuid
:
NULL
,
cb
->
key_filter
?
cb
->
key
:
NULL
,
cb
->
remoteID
>=
0
);
cb
->
remoteID
>=
0
);
}
}
}
}
...
@@ -310,7 +310,7 @@ virObjectEventCallbackListPurgeMarked(virObjectEventCallbackListPtr cbList)
...
@@ -310,7 +310,7 @@ virObjectEventCallbackListPurgeMarked(virObjectEventCallbackListPtr cbList)
* virObjectEventCallbackLookup:
* virObjectEventCallbackLookup:
* @conn: pointer to the connection
* @conn: pointer to the connection
* @cbList: the list
* @cbList: the list
* @
uuid: the uuid
of the object to filter on
* @
key: the key
of the object to filter on
* @klass: the base event class
* @klass: the base event class
* @eventID: the event ID
* @eventID: the event ID
* @callback: the callback to locate
* @callback: the callback to locate
...
@@ -327,7 +327,7 @@ virObjectEventCallbackListPurgeMarked(virObjectEventCallbackListPtr cbList)
...
@@ -327,7 +327,7 @@ virObjectEventCallbackListPurgeMarked(virObjectEventCallbackListPtr cbList)
static
int
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
static
int
ATTRIBUTE_NONNULL
(
1
)
ATTRIBUTE_NONNULL
(
2
)
virObjectEventCallbackLookup
(
virConnectPtr
conn
,
virObjectEventCallbackLookup
(
virConnectPtr
conn
,
virObjectEventCallbackListPtr
cbList
,
virObjectEventCallbackListPtr
cbList
,
const
char
*
uuid
,
const
char
*
key
,
virClassPtr
klass
,
virClassPtr
klass
,
int
eventID
,
int
eventID
,
virConnectObjectEventGenericCallback
callback
,
virConnectObjectEventGenericCallback
callback
,
...
@@ -347,8 +347,8 @@ virObjectEventCallbackLookup(virConnectPtr conn,
...
@@ -347,8 +347,8 @@ virObjectEventCallbackLookup(virConnectPtr conn,
if
(
cb
->
klass
==
klass
&&
if
(
cb
->
klass
==
klass
&&
cb
->
eventID
==
eventID
&&
cb
->
eventID
==
eventID
&&
cb
->
conn
==
conn
&&
cb
->
conn
==
conn
&&
((
uuid
&&
cb
->
uuid_filter
&&
STREQ
(
cb
->
uuid
,
uuid
))
||
((
key
&&
cb
->
key_filter
&&
STREQ
(
cb
->
key
,
key
))
||
(
!
uuid
&&
!
cb
->
uuid
_filter
)))
{
(
!
key
&&
!
cb
->
key
_filter
)))
{
if
(
remoteID
)
if
(
remoteID
)
*
remoteID
=
cb
->
remoteID
;
*
remoteID
=
cb
->
remoteID
;
if
(
cb
->
legacy
==
legacy
&&
if
(
cb
->
legacy
==
legacy
&&
...
@@ -364,7 +364,7 @@ virObjectEventCallbackLookup(virConnectPtr conn,
...
@@ -364,7 +364,7 @@ virObjectEventCallbackLookup(virConnectPtr conn,
* virObjectEventCallbackListAddID:
* virObjectEventCallbackListAddID:
* @conn: pointer to the connection
* @conn: pointer to the connection
* @cbList: the list
* @cbList: the list
* @
uuid: the optional uuid
of the object to filter on
* @
key: the optional key
of the object to filter on
* @filter: optional last-ditch filter callback
* @filter: optional last-ditch filter callback
* @filter_opaque: opaque data to pass to @filter
* @filter_opaque: opaque data to pass to @filter
* @klass: the base event class
* @klass: the base event class
...
@@ -381,7 +381,7 @@ virObjectEventCallbackLookup(virConnectPtr conn,
...
@@ -381,7 +381,7 @@ virObjectEventCallbackLookup(virConnectPtr conn,
static
int
static
int
virObjectEventCallbackListAddID
(
virConnectPtr
conn
,
virObjectEventCallbackListAddID
(
virConnectPtr
conn
,
virObjectEventCallbackListPtr
cbList
,
virObjectEventCallbackListPtr
cbList
,
const
char
*
uuid
,
const
char
*
key
,
virObjectEventCallbackFilter
filter
,
virObjectEventCallbackFilter
filter
,
void
*
filter_opaque
,
void
*
filter_opaque
,
virClassPtr
klass
,
virClassPtr
klass
,
...
@@ -397,10 +397,10 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
...
@@ -397,10 +397,10 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
int
ret
=
-
1
;
int
ret
=
-
1
;
int
remoteID
=
-
1
;
int
remoteID
=
-
1
;
VIR_DEBUG
(
"conn=%p cblist=%p
uuid
=%p filter=%p filter_opaque=%p "
VIR_DEBUG
(
"conn=%p cblist=%p
key
=%p filter=%p filter_opaque=%p "
"klass=%p eventID=%d callback=%p opaque=%p "
"klass=%p eventID=%d callback=%p opaque=%p "
"legacy=%d callbackID=%p serverFilter=%d"
,
"legacy=%d callbackID=%p serverFilter=%d"
,
conn
,
cbList
,
uuid
,
filter
,
filter_opaque
,
klass
,
eventID
,
conn
,
cbList
,
key
,
filter
,
filter_opaque
,
klass
,
eventID
,
callback
,
opaque
,
legacy
,
callbackID
,
serverFilter
);
callback
,
opaque
,
legacy
,
callbackID
,
serverFilter
);
/* Check incoming */
/* Check incoming */
...
@@ -410,7 +410,7 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
...
@@ -410,7 +410,7 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
/* If there is no additional filtering, then check if we already
/* If there is no additional filtering, then check if we already
* have this callback on our list. */
* have this callback on our list. */
if
(
!
filter
&&
if
(
!
filter
&&
virObjectEventCallbackLookup
(
conn
,
cbList
,
uuid
,
virObjectEventCallbackLookup
(
conn
,
cbList
,
key
,
klass
,
eventID
,
callback
,
legacy
,
klass
,
eventID
,
callback
,
legacy
,
serverFilter
?
&
remoteID
:
NULL
)
!=
-
1
)
{
serverFilter
?
&
remoteID
:
NULL
)
!=
-
1
)
{
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
virReportError
(
VIR_ERR_INVALID_ARG
,
"%s"
,
...
@@ -429,12 +429,9 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
...
@@ -429,12 +429,9 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
cb
->
freecb
=
freecb
;
cb
->
freecb
=
freecb
;
cb
->
remoteID
=
remoteID
;
cb
->
remoteID
=
remoteID
;
/* Only need 'uuid' for matching; 'id' can change as domain
if
(
key
)
{
* switches between running and shutoff, and 'name' can change in
cb
->
key_filter
=
true
;
* Xen migration. */
if
(
VIR_STRDUP
(
cb
->
key
,
key
)
<
0
)
if
(
uuid
)
{
cb
->
uuid_filter
=
true
;
if
(
VIR_STRDUP
(
cb
->
uuid
,
uuid
)
<
0
)
goto
cleanup
;
goto
cleanup
;
}
}
cb
->
filter
=
filter
;
cb
->
filter
=
filter
;
...
@@ -450,7 +447,7 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
...
@@ -450,7 +447,7 @@ virObjectEventCallbackListAddID(virConnectPtr conn,
ret
=
1
;
ret
=
1
;
}
else
{
}
else
{
ret
=
virObjectEventCallbackListCount
(
conn
,
cbList
,
klass
,
eventID
,
ret
=
virObjectEventCallbackListCount
(
conn
,
cbList
,
klass
,
eventID
,
uuid
,
serverFilter
);
key
,
serverFilter
);
if
(
serverFilter
&&
remoteID
<
0
)
if
(
serverFilter
&&
remoteID
<
0
)
ret
++
;
ret
++
;
}
}
...
@@ -709,8 +706,8 @@ virObjectEventDispatchMatchCallback(virObjectEventPtr event,
...
@@ -709,8 +706,8 @@ virObjectEventDispatchMatchCallback(virObjectEventPtr event,
if
(
cb
->
filter
&&
!
(
cb
->
filter
)(
cb
->
conn
,
event
,
cb
->
filter_opaque
))
if
(
cb
->
filter
&&
!
(
cb
->
filter
)(
cb
->
conn
,
event
,
cb
->
filter_opaque
))
return
false
;
return
false
;
if
(
cb
->
uuid
_filter
)
if
(
cb
->
key
_filter
)
return
STREQ
(
event
->
meta
.
key
,
cb
->
uuid
);
return
STREQ
(
event
->
meta
.
key
,
cb
->
key
);
return
true
;
return
true
;
}
}
...
@@ -842,7 +839,7 @@ virObjectEventStateFlush(virObjectEventStatePtr state)
...
@@ -842,7 +839,7 @@ virObjectEventStateFlush(virObjectEventStatePtr state)
* virObjectEventStateRegisterID:
* virObjectEventStateRegisterID:
* @conn: connection to associate with callback
* @conn: connection to associate with callback
* @state: domain event state
* @state: domain event state
* @
uuid: uuid
of the object for event filtering
* @
key: key
of the object for event filtering
* @klass: the base event class
* @klass: the base event class
* @eventID: ID of the event type to register for
* @eventID: ID of the event type to register for
* @cb: function to invoke when event occurs
* @cb: function to invoke when event occurs
...
@@ -875,7 +872,7 @@ virObjectEventStateFlush(virObjectEventStatePtr state)
...
@@ -875,7 +872,7 @@ virObjectEventStateFlush(virObjectEventStatePtr state)
int
int
virObjectEventStateRegisterID
(
virConnectPtr
conn
,
virObjectEventStateRegisterID
(
virConnectPtr
conn
,
virObjectEventStatePtr
state
,
virObjectEventStatePtr
state
,
const
char
*
uuid
,
const
char
*
key
,
virObjectEventCallbackFilter
filter
,
virObjectEventCallbackFilter
filter
,
void
*
filter_opaque
,
void
*
filter_opaque
,
virClassPtr
klass
,
virClassPtr
klass
,
...
@@ -903,7 +900,7 @@ virObjectEventStateRegisterID(virConnectPtr conn,
...
@@ -903,7 +900,7 @@ virObjectEventStateRegisterID(virConnectPtr conn,
}
}
ret
=
virObjectEventCallbackListAddID
(
conn
,
state
->
callbacks
,
ret
=
virObjectEventCallbackListAddID
(
conn
,
state
->
callbacks
,
uuid
,
filter
,
filter_opaque
,
key
,
filter
,
filter_opaque
,
klass
,
eventID
,
klass
,
eventID
,
cb
,
opaque
,
freecb
,
cb
,
opaque
,
freecb
,
legacy
,
callbackID
,
serverFilter
);
legacy
,
callbackID
,
serverFilter
);
...
...
src/conf/object_event_private.h
浏览文件 @
5684680f
...
@@ -73,7 +73,7 @@ virClassForObjectEvent(void);
...
@@ -73,7 +73,7 @@ virClassForObjectEvent(void);
int
int
virObjectEventStateRegisterID
(
virConnectPtr
conn
,
virObjectEventStateRegisterID
(
virConnectPtr
conn
,
virObjectEventStatePtr
state
,
virObjectEventStatePtr
state
,
const
char
*
uuid
,
const
char
*
key
,
virObjectEventCallbackFilter
filter
,
virObjectEventCallbackFilter
filter
,
void
*
filter_opaque
,
void
*
filter_opaque
,
virClassPtr
klass
,
virClassPtr
klass
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录