Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
b1ede4cf
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看板
提交
b1ede4cf
编写于
6月 14, 2011
作者:
C
Cole Robinson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
python: Implement bindings for virStreamEventAddCallback
v2: Don't generate virStreamFree
上级
eb3151b4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
100 addition
and
14 deletion
+100
-14
python/generator.py
python/generator.py
+4
-4
python/libvirt-override-virStream.py
python/libvirt-override-virStream.py
+15
-9
python/libvirt-override.c
python/libvirt-override.c
+81
-0
python/typewrappers.h
python/typewrappers.h
+0
-1
未找到文件。
python/generator.py
浏览文件 @
b1ede4cf
...
@@ -197,6 +197,7 @@ skipped_types = {
...
@@ -197,6 +197,7 @@ skipped_types = {
'virConnectDomainEventWatchdogCallback'
:
"No function types in python"
,
'virConnectDomainEventWatchdogCallback'
:
"No function types in python"
,
'virConnectDomainEventIOErrorCallback'
:
"No function types in python"
,
'virConnectDomainEventIOErrorCallback'
:
"No function types in python"
,
'virConnectDomainEventGraphicsCallback'
:
"No function types in python"
,
'virConnectDomainEventGraphicsCallback'
:
"No function types in python"
,
'virStreamEventCallback'
:
"No function types in python"
,
'virEventAddHandleFunc'
:
"No function types in python"
,
'virEventAddHandleFunc'
:
"No function types in python"
,
}
}
...
@@ -392,13 +393,11 @@ skip_function = (
...
@@ -392,13 +393,11 @@ skip_function = (
'virConnectDomainEventDeregisterAny'
,
# overridden in virConnect.py
'virConnectDomainEventDeregisterAny'
,
# overridden in virConnect.py
'virSaveLastError'
,
# We have our own python error wrapper
'virSaveLastError'
,
# We have our own python error wrapper
'virFreeError'
,
# Only needed if we use virSaveLastError
'virFreeError'
,
# Only needed if we use virSaveLastError
'virStream
EventAddCallback'
,
'virStream
Free'
,
# Overridden in libvirt-override-virStream.py
'virStreamRecvAll'
,
'virStreamRecvAll'
,
'virStreamSendAll'
,
'virStreamSendAll'
,
'virStreamRef'
,
'virStreamFree'
,
#
These
have no use for bindings users.
#
'Ref' functions
have no use for bindings users.
"virConnectRef"
,
"virConnectRef"
,
"virDomainRef"
,
"virDomainRef"
,
"virInterfaceRef"
,
"virInterfaceRef"
,
...
@@ -408,6 +407,7 @@ skip_function = (
...
@@ -408,6 +407,7 @@ skip_function = (
"virNWFilterRef"
,
"virNWFilterRef"
,
"virStoragePoolRef"
,
"virStoragePoolRef"
,
"virStorageVolRef"
,
"virStorageVolRef"
,
'virStreamRef'
,
# This functions shouldn't be called via the bindings (and even the docs
# This functions shouldn't be called via the bindings (and even the docs
# contain an explicit warning to that effect). The equivalent should be
# contain an explicit warning to that effect). The equivalent should be
...
...
python/libvirt-override-virStream.py
浏览文件 @
b1ede4cf
...
@@ -9,12 +9,18 @@
...
@@ -9,12 +9,18 @@
libvirtmod
.
virStreamFree
(
self
.
_o
)
libvirtmod
.
virStreamFree
(
self
.
_o
)
self
.
_o
=
None
self
.
_o
=
None
def
eventAddCallback
(
self
,
cb
,
opaque
):
def
dispatchStreamEventCallback
(
self
,
events
,
cbData
):
""" """
"""
try
:
Dispatches events to python user's stream event callbacks
self
.
cb
=
cb
"""
self
.
opaque
=
opaque
cb
=
cbData
[
"cb"
]
ret
=
libvirtmod
.
virStreamEventAddCallback
(
self
.
_o
,
self
)
opaque
=
cbData
[
"opaque"
]
if
ret
==
-
1
:
raise
libvirtError
(
'virStreamEventAddCallback() failed'
,
conn
=
self
.
_conn
)
except
AttributeError
:
cb
(
self
,
events
,
opaque
)
pass
return
0
def
eventAddCallback
(
self
,
events
,
cb
,
opaque
):
self
.
cb
=
cb
cbData
=
{
"stream"
:
self
,
"cb"
:
cb
,
"opaque"
:
opaque
}
ret
=
libvirtmod
.
virStreamEventAddCallback
(
self
.
_o
,
events
,
cbData
)
if
ret
==
-
1
:
raise
libvirtError
(
'virStreamEventAddCallback() failed'
)
python/libvirt-override.c
浏览文件 @
b1ede4cf
...
@@ -3616,6 +3616,86 @@ libvirt_virConnectDomainEventDeregisterAny(ATTRIBUTE_UNUSED PyObject * self,
...
@@ -3616,6 +3616,86 @@ libvirt_virConnectDomainEventDeregisterAny(ATTRIBUTE_UNUSED PyObject * self,
return
(
py_retval
);
return
(
py_retval
);
}
}
static
void
libvirt_virStreamEventFreeFunc
(
void
*
opaque
)
{
PyObject
*
pyobj_stream
=
(
PyObject
*
)
opaque
;
LIBVIRT_ENSURE_THREAD_STATE
;
Py_DECREF
(
pyobj_stream
);
LIBVIRT_RELEASE_THREAD_STATE
;
}
static
void
libvirt_virStreamEventCallback
(
virStreamPtr
st
ATTRIBUTE_UNUSED
,
int
events
,
void
*
opaque
)
{
PyObject
*
pyobj_cbData
=
(
PyObject
*
)
opaque
;
PyObject
*
pyobj_stream
;
PyObject
*
pyobj_ret
;
PyObject
*
dictKey
;
LIBVIRT_ENSURE_THREAD_STATE
;
Py_INCREF
(
pyobj_cbData
);
dictKey
=
libvirt_constcharPtrWrap
(
"stream"
);
pyobj_stream
=
PyDict_GetItem
(
pyobj_cbData
,
dictKey
);
Py_DECREF
(
dictKey
);
/* Call the pure python dispatcher */
pyobj_ret
=
PyObject_CallMethod
(
pyobj_stream
,
(
char
*
)
"dispatchStreamEventCallback"
,
(
char
*
)
"iO"
,
events
,
pyobj_cbData
);
Py_DECREF
(
pyobj_cbData
);
if
(
!
pyobj_ret
)
{
DEBUG
(
"%s - ret:%p
\n
"
,
__FUNCTION__
,
pyobj_ret
);
PyErr_Print
();
}
else
{
Py_DECREF
(
pyobj_ret
);
}
LIBVIRT_RELEASE_THREAD_STATE
;
}
static
PyObject
*
libvirt_virStreamEventAddCallback
(
PyObject
*
self
ATTRIBUTE_UNUSED
,
PyObject
*
args
)
{
PyObject
*
py_retval
;
PyObject
*
pyobj_stream
;
PyObject
*
pyobj_cbData
;
virStreamPtr
stream
;
virStreamEventCallback
cb
=
libvirt_virStreamEventCallback
;
int
ret
;
int
events
;
if
(
!
PyArg_ParseTuple
(
args
,
(
char
*
)
"OiO:virStreamEventAddCallback"
,
&
pyobj_stream
,
&
events
,
&
pyobj_cbData
))
{
DEBUG
(
"%s failed to parse tuple
\n
"
,
__FUNCTION__
);
return
VIR_PY_INT_FAIL
;
}
DEBUG
(
"libvirt_virStreamEventAddCallback(%p, %d, %p) called
\n
"
,
pyobj_stream
,
events
,
pyobj_cbData
);
stream
=
PyvirStream_Get
(
pyobj_stream
);
Py_INCREF
(
pyobj_cbData
);
LIBVIRT_BEGIN_ALLOW_THREADS
;
ret
=
virStreamEventAddCallback
(
stream
,
events
,
cb
,
pyobj_cbData
,
libvirt_virStreamEventFreeFunc
);
LIBVIRT_END_ALLOW_THREADS
;
if
(
ret
<
0
)
{
Py_DECREF
(
pyobj_cbData
);
}
py_retval
=
libvirt_intWrap
(
ret
);
return
py_retval
;
}
/************************************************************************
/************************************************************************
* *
* *
...
@@ -3634,6 +3714,7 @@ static PyMethodDef libvirtMethods[] = {
...
@@ -3634,6 +3714,7 @@ static PyMethodDef libvirtMethods[] = {
{(
char
*
)
"virConnectDomainEventDeregister"
,
libvirt_virConnectDomainEventDeregister
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virConnectDomainEventDeregister"
,
libvirt_virConnectDomainEventDeregister
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virConnectDomainEventRegisterAny"
,
libvirt_virConnectDomainEventRegisterAny
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virConnectDomainEventRegisterAny"
,
libvirt_virConnectDomainEventRegisterAny
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virConnectDomainEventDeregisterAny"
,
libvirt_virConnectDomainEventDeregisterAny
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virConnectDomainEventDeregisterAny"
,
libvirt_virConnectDomainEventDeregisterAny
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virStreamEventAddCallback"
,
libvirt_virStreamEventAddCallback
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetInfo"
,
libvirt_virDomainGetInfo
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetInfo"
,
libvirt_virDomainGetInfo
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetState"
,
libvirt_virDomainGetState
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetState"
,
libvirt_virDomainGetState
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetControlInfo"
,
libvirt_virDomainGetControlInfo
,
METH_VARARGS
,
NULL
},
{(
char
*
)
"virDomainGetControlInfo"
,
libvirt_virDomainGetControlInfo
,
METH_VARARGS
,
NULL
},
...
...
python/typewrappers.h
浏览文件 @
b1ede4cf
...
@@ -150,7 +150,6 @@ typedef struct {
...
@@ -150,7 +150,6 @@ typedef struct {
void
*
obj
;
void
*
obj
;
}
PyvirVoidPtr_Object
;
}
PyvirVoidPtr_Object
;
PyObject
*
libvirt_intWrap
(
int
val
);
PyObject
*
libvirt_intWrap
(
int
val
);
PyObject
*
libvirt_longWrap
(
long
val
);
PyObject
*
libvirt_longWrap
(
long
val
);
PyObject
*
libvirt_ulongWrap
(
unsigned
long
val
);
PyObject
*
libvirt_ulongWrap
(
unsigned
long
val
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录