Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
libvirt
提交
2f02d292
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看板
提交
2f02d292
编写于
6月 26, 2007
作者:
D
Daniel P. Berrange
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move virBuffer functions into src/buf.c,h
上级
675ba317
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
24 addition
and
211 deletion
+24
-211
ChangeLog
ChangeLog
+11
-0
proxy/Makefile.am
proxy/Makefile.am
+1
-1
qemud/Makefile.am
qemud/Makefile.am
+1
-1
qemud/conf.c
qemud/conf.c
+1
-13
qemud/driver.c
qemud/driver.c
+1
-1
src/Makefile.am
src/Makefile.am
+1
-0
src/buf.c
src/buf.c
+0
-0
src/buf.h
src/buf.h
+0
-0
src/conf.c
src/conf.c
+1
-1
src/test.c
src/test.c
+1
-0
src/xen_internal.c
src/xen_internal.c
+1
-1
src/xend_internal.c
src/xend_internal.c
+1
-0
src/xm_internal.c
src/xm_internal.c
+1
-0
src/xml.c
src/xml.c
+1
-171
src/xml.h
src/xml.h
+0
-20
src/xmlrpc.h
src/xmlrpc.h
+1
-1
tests/xmlrpctest.c
tests/xmlrpctest.c
+1
-1
未找到文件。
ChangeLog
浏览文件 @
2f02d292
Tue Jun 26 18:30:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* qemud/buf.c, qemud/buf.h: Remove obsolete files
* src/xml.c: remove virBuffer functions
* src/buf.c, src/buf.c, src/Makefile.am: Re-add virBuffer functions
* proxy/Makefile.am, qemud/Makefile.am, qemud/conf.c,
qemud/driver.c, src/conf.c, src/test.c, src/xen_internal.c,
src/xend_internal.c, src/xm_internal.c, src/xmlrpc.h,
tests/xmlrpc.test: Adapt to deal with new location of headers
for virBuffer functions.
Tue Jun 26 18:21:00 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* qemud/conf.c, qemud/driver.c, qemud/buf.c, qemud/buf.h:
...
...
proxy/Makefile.am
浏览文件 @
2f02d292
...
...
@@ -10,7 +10,7 @@ libexec_PROGRAMS = libvirt_proxy
libvirt_proxy_SOURCES
=
libvirt_proxy.c @top_srcdir@/src/xend_internal.c
\
@top_srcdir@/src/xen_internal.c @top_srcdir@/src/virterror.c
\
@top_srcdir@/src/sexpr.c @top_srcdir@/src/xml.c
\
@top_srcdir@/src/xs_internal.c
@top_srcdir@/src/xs_internal.c
@top_srcdir@/src/buf.c
libvirt_proxy_LDFLAGS
=
$(WARN_CFLAGS)
libvirt_proxy_DEPENDENCIES
=
libvirt_proxy_LDADD
=
...
...
qemud/Makefile.am
浏览文件 @
2f02d292
...
...
@@ -13,7 +13,7 @@ libvirt_qemud_SOURCES = \
bridge.c bridge.h
\
iptables.c iptables.h
\
uuid.c uuid.h
\
buf.c buf.h
\
../src/buf.c
\
protocol.h protocol.c
\
remote_protocol.h remote_protocol.c
\
remote.c
\
...
...
qemud/conf.c
浏览文件 @
2f02d292
...
...
@@ -45,19 +45,7 @@
#include "internal.h"
#include "conf.h"
#include "uuid.h"
#include "buf.h"
extern
void
__virRaiseError
(
virConnectPtr
conn
,
virDomainPtr
dom
,
virNetworkPtr
net
,
int
domain
,
int
code
,
virErrorLevel
level
,
const
char
*
str1
,
const
char
*
str2
,
const
char
*
str3
,
int
int1
,
int
int2
,
const
char
*
msg
,
...)
ATTRIBUTE_FORMAT
(
printf
,
12
,
13
);
#include "../src/buf.h"
void
qemudReportError
(
virConnectPtr
conn
,
virDomainPtr
dom
,
...
...
qemud/driver.c
浏览文件 @
2f02d292
...
...
@@ -49,7 +49,7 @@
#include <libvirt/virterror.h>
#include "event.h"
#include "buf.h"
#include "
../src/
buf.h"
#include "driver.h"
static
int
qemudSetCloseExec
(
int
fd
)
{
...
...
src/Makefile.am
浏览文件 @
2f02d292
...
...
@@ -29,6 +29,7 @@ CLIENT_SOURCES = \
libvirt.c internal.h
\
hash.c hash.h
\
test.c test.h
\
buf.c buf.h
\
xml.c xml.h
\
xen_unified.c xen_unified.h
\
xen_internal.c xen_internal.h
\
...
...
qemud
/buf.c
→
src
/buf.c
浏览文件 @
2f02d292
文件已移动
qemud
/buf.h
→
src
/buf.h
浏览文件 @
2f02d292
文件已移动
src/conf.c
浏览文件 @
2f02d292
...
...
@@ -18,7 +18,7 @@
#include <fcntl.h>
#include "internal.h"
#include "
xml
.h"
#include "
buf
.h"
#include "conf.h"
/************************************************************************
...
...
src/test.c
浏览文件 @
2f02d292
...
...
@@ -39,6 +39,7 @@
#include "internal.h"
#include "test.h"
#include "xml.h"
#include "buf.h"
int
testOpen
(
virConnectPtr
conn
,
const
char
*
name
,
...
...
src/xen_internal.c
浏览文件 @
2f02d292
...
...
@@ -35,7 +35,7 @@
/* required for shutdown flags */
#include <xen/sched.h>
#include "
xml
.h"
#include "
buf
.h"
/* #define DEBUG */
/*
...
...
src/xend_internal.c
浏览文件 @
2f02d292
...
...
@@ -35,6 +35,7 @@
#include "internal.h"
#include "sexpr.h"
#include "xml.h"
#include "buf.h"
#include "xen_unified.h"
#include "xend_internal.h"
#include "xen_internal.h"
/* for DOM0_INTERFACE_VERSION */
...
...
src/xm_internal.c
浏览文件 @
2f02d292
...
...
@@ -47,6 +47,7 @@
#include "hash.h"
#include "internal.h"
#include "xml.h"
#include "buf.h"
typedef
struct
xenXMConfCache
*
xenXMConfCachePtr
;
typedef
struct
xenXMConfCache
{
...
...
src/xml.c
浏览文件 @
2f02d292
...
...
@@ -22,6 +22,7 @@
#include "hash.h"
#include "sexpr.h"
#include "xml.h"
#include "buf.h"
#include "xs_internal.h"
/* for xenStoreDomainGetNetworkID */
/**
...
...
@@ -268,177 +269,6 @@ virXPathNodeSet(const char *xpath, xmlXPathContextPtr ctxt, xmlNodePtr **list) {
}
#endif
/* !PROXY */
/**
* virBufferGrow:
* @buf: the buffer
* @len: the minimum free size to allocate on top of existing used space
*
* Grow the available space of an XML buffer to at least @len bytes.
*
* Returns the new available space or -1 in case of error
*/
static
int
virBufferGrow
(
virBufferPtr
buf
,
unsigned
int
len
)
{
int
size
;
char
*
newbuf
;
if
(
buf
==
NULL
)
return
(
-
1
);
if
(
len
+
buf
->
use
<
buf
->
size
)
return
(
0
);
size
=
buf
->
use
+
len
+
1000
;
newbuf
=
(
char
*
)
realloc
(
buf
->
content
,
size
);
if
(
newbuf
==
NULL
)
{
virXMLError
(
NULL
,
VIR_ERR_NO_MEMORY
,
_
(
"growing buffer"
),
size
);
return
(
-
1
);
}
buf
->
content
=
newbuf
;
buf
->
size
=
size
;
return
(
buf
->
size
-
buf
->
use
);
}
/**
* virBufferAdd:
* @buf: the buffer to dump
* @str: the string
* @len: the number of bytes to add
*
* Add a string range to an XML buffer. if len == -1, the length of
* str is recomputed to the full string.
*
* Returns 0 successful, -1 in case of internal or API error.
*/
int
virBufferAdd
(
virBufferPtr
buf
,
const
char
*
str
,
int
len
)
{
unsigned
int
needSize
;
if
((
str
==
NULL
)
||
(
buf
==
NULL
))
{
return
-
1
;
}
if
(
len
==
0
)
return
0
;
if
(
len
<
0
)
len
=
strlen
(
str
);
needSize
=
buf
->
use
+
len
+
2
;
if
(
needSize
>
buf
->
size
)
{
if
(
!
virBufferGrow
(
buf
,
needSize
-
buf
->
use
))
{
return
(
-
1
);
}
}
/* XXX: memmove() is 2x slower than memcpy(), do we really need it? */
memmove
(
&
buf
->
content
[
buf
->
use
],
str
,
len
);
buf
->
use
+=
len
;
buf
->
content
[
buf
->
use
]
=
0
;
return
(
0
);
}
virBufferPtr
virBufferNew
(
unsigned
int
size
)
{
virBufferPtr
buf
;
if
(
!
(
buf
=
malloc
(
sizeof
(
*
buf
))))
{
virXMLError
(
NULL
,
VIR_ERR_NO_MEMORY
,
_
(
"allocate new buffer"
),
sizeof
(
*
buf
));
return
NULL
;
}
if
(
size
&&
(
buf
->
content
=
malloc
(
size
))
==
NULL
)
{
virXMLError
(
NULL
,
VIR_ERR_NO_MEMORY
,
_
(
"allocate buffer content"
),
size
);
free
(
buf
);
return
NULL
;
}
buf
->
size
=
size
;
buf
->
use
=
0
;
return
buf
;
}
void
virBufferFree
(
virBufferPtr
buf
)
{
if
(
buf
)
{
if
(
buf
->
content
)
free
(
buf
->
content
);
free
(
buf
);
}
}
/**
* virBufferVSprintf:
* @buf: the buffer to dump
* @format: the format
* @argptr: the variable list of arguments
*
* Do a formatted print to an XML buffer.
*
* Returns 0 successful, -1 in case of internal or API error.
*/
int
virBufferVSprintf
(
virBufferPtr
buf
,
const
char
*
format
,
...)
{
int
size
,
count
;
va_list
locarg
,
argptr
;
if
((
format
==
NULL
)
||
(
buf
==
NULL
))
{
return
(
-
1
);
}
size
=
buf
->
size
-
buf
->
use
-
1
;
va_start
(
argptr
,
format
);
va_copy
(
locarg
,
argptr
);
while
(((
count
=
vsnprintf
(
&
buf
->
content
[
buf
->
use
],
size
,
format
,
locarg
))
<
0
)
||
(
count
>=
size
-
1
))
{
buf
->
content
[
buf
->
use
]
=
0
;
va_end
(
locarg
);
if
(
virBufferGrow
(
buf
,
1000
)
<
0
)
{
return
(
-
1
);
}
size
=
buf
->
size
-
buf
->
use
-
1
;
va_copy
(
locarg
,
argptr
);
}
va_end
(
locarg
);
buf
->
use
+=
count
;
buf
->
content
[
buf
->
use
]
=
0
;
return
(
0
);
}
/**
* virBufferStrcat:
* @buf: the buffer to dump
* @argptr: the variable list of strings, the last argument must be NULL
*
* Concatenate strings to an XML buffer.
*
* Returns 0 successful, -1 in case of internal or API error.
*/
int
virBufferStrcat
(
virBufferPtr
buf
,
...)
{
va_list
ap
;
char
*
str
;
va_start
(
ap
,
buf
);
while
((
str
=
va_arg
(
ap
,
char
*
))
!=
NULL
)
{
unsigned
int
len
=
strlen
(
str
);
unsigned
int
needSize
=
buf
->
use
+
len
+
2
;
if
(
needSize
>
buf
->
size
)
{
if
(
!
virBufferGrow
(
buf
,
needSize
-
buf
->
use
))
return
-
1
;
}
memcpy
(
&
buf
->
content
[
buf
->
use
],
str
,
len
);
buf
->
use
+=
len
;
buf
->
content
[
buf
->
use
]
=
0
;
}
va_end
(
ap
);
return
0
;
}
#ifndef PROXY
/**
...
...
src/xml.h
浏览文件 @
2f02d292
...
...
@@ -15,26 +15,6 @@
extern
"C"
{
#endif
/**
* virBuffer:
*
* A buffer structure.
*/
typedef
struct
_virBuffer
virBuffer
;
typedef
virBuffer
*
virBufferPtr
;
struct
_virBuffer
{
char
*
content
;
/* The buffer content UTF8 */
unsigned
int
use
;
/* The buffer size used */
unsigned
int
size
;
/* The buffer size */
};
virBufferPtr
virBufferNew
(
unsigned
int
size
);
void
virBufferFree
(
virBufferPtr
buf
);
int
virBufferAdd
(
virBufferPtr
buf
,
const
char
*
str
,
int
len
);
int
virBufferVSprintf
(
virBufferPtr
buf
,
const
char
*
format
,
...)
ATTRIBUTE_FORMAT
(
printf
,
2
,
3
);
int
virBufferStrcat
(
virBufferPtr
buf
,
...);
int
virXPathBoolean
(
const
char
*
xpath
,
xmlXPathContextPtr
ctxt
);
char
*
virXPathString
(
const
char
*
xpath
,
...
...
src/xmlrpc.h
浏览文件 @
2f02d292
...
...
@@ -19,7 +19,7 @@
#include <time.h>
#include <stdarg.h>
#include "
xml
.h"
#include "
buf
.h"
typedef
enum
_xmlRpcValueType
xmlRpcValueType
;
...
...
tests/xmlrpctest.c
浏览文件 @
2f02d292
...
...
@@ -20,7 +20,7 @@
#include <libxml/xpath.h>
#include "libvirt/libvirt.h"
#include "
xml
.h"
#include "
buf
.h"
#include "xmlrpc.h"
#include "testutils.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录