[libvirt] [PATCH v2] spec: Fix minor changelog issues
by Jiri Denemark
When a changelog entry references an RPM macro, % needs to be escaped so
that it does not appear expanded in package changelog.
Fri Mar 4 2009 is incorrect since Mar 4 was Wednesday. Since
libvirt-0.6.1 was released on Mar 4 2009, we should change Fri to Wed.
---
libvirt.spec.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 8df908d..c2da6ec 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -2309,7 +2309,7 @@ fi
* Fri Apr 3 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.2-1
- release of 0.6.2
-* Fri Mar 4 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.1-1
+* Wed Mar 4 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.1-1
- release of 0.6.1
* Sat Jan 31 2009 Daniel Veillard <veillard(a)redhat.com> - 0.6.0-1
@@ -2448,7 +2448,7 @@ fi
- it's pkgconfig not pgkconfig !
* Mon Nov 6 2006 Daniel Veillard <veillard(a)redhat.com> 0.1.8-2
-- fixing spec file, added %dist, -devel requires pkgconfig and xen-devel
+- fixing spec file, added %%dist, -devel requires pkgconfig and xen-devel
- Resolves: rhbz#202320
* Mon Oct 16 2006 Daniel Veillard <veillard(a)redhat.com> 0.1.8-1
--
1.8.1.2
11 years, 9 months
[libvirt] [PATCH] fix build erro when building with --without-libvirtd
by Hu Tao
---
src/driver.h | 4 ---
src/libvirt.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++-
src/libvirt_internal.h | 2 --
3 files changed, 69 insertions(+), 7 deletions(-)
diff --git a/src/driver.h b/src/driver.h
index 02ddd83..dab7495 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -1512,7 +1512,6 @@ struct _virStorageDriver {
virDrvStoragePoolIsPersistent poolIsPersistent;
};
-# ifdef WITH_LIBVIRTD
typedef int (*virDrvStateInitialize) (bool privileged,
virStateInhibitCallback callback,
@@ -1531,7 +1530,6 @@ struct _virStateDriver {
virDrvStateReload reload;
virDrvStateStop stop;
};
-# endif
typedef struct _virDeviceMonitor virDeviceMonitor;
@@ -1768,9 +1766,7 @@ int virRegisterStorageDriver(virStorageDriverPtr);
int virRegisterDeviceMonitor(virDeviceMonitorPtr);
int virRegisterSecretDriver(virSecretDriverPtr);
int virRegisterNWFilterDriver(virNWFilterDriverPtr);
-# ifdef WITH_LIBVIRTD
int virRegisterStateDriver(virStateDriverPtr);
-# endif
void virDriverModuleInitialize(const char *defmoddir);
void *virDriverLoadModule(const char *name);
diff --git a/src/libvirt.c b/src/libvirt.c
index f81a3de..38e4f6e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -885,8 +885,76 @@ int virStateStop(void) {
return ret;
}
-#endif
+#else /* WITH_LIBVIRTD */
+
+/**
+ * virRegisterStateDriver:
+ * @driver: pointer to a driver block
+ *
+ * Register a virtualization driver
+ *
+ * Returns the driver priority or -1 in case of error.
+ */
+int
+virRegisterStateDriver(virStateDriverPtr driver ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+/**
+ * virStateInitialize:
+ * @privileged: set to true if running with root privilege, false otherwise
+ * @callback: callback to invoke to inhibit shutdown of the daemon
+ * @opaque: data to pass to @callback
+ *
+ * Initialize all virtualization drivers.
+ *
+ * Returns 0 if all succeed, -1 upon any failure.
+ */
+int virStateInitialize(bool privileged ATTRIBUTE_UNUSED,
+ virStateInhibitCallback callback ATTRIBUTE_UNUSED,
+ void *opaque ATTRIBUTE_UNUSED)
+{
+ return 0;
+}
+
+/**
+ * virStateCleanup:
+ *
+ * Run each virtualization driver's cleanup method.
+ *
+ * Returns 0 if all succeed, -1 upon any failure.
+ */
+int virStateCleanup(void)
+{
+ return 0;
+}
+
+/**
+ * virStateReload:
+ *
+ * Run each virtualization driver's reload method.
+ *
+ * Returns 0 if all succeed, -1 upon any failure.
+ */
+int virStateReload(void)
+{
+ return 0;
+}
+
+/**
+ * virStateStop:
+ *
+ * Run each virtualization driver's "stop" method.
+ *
+ * Returns 0 if successful, -1 on failure
+ */
+int virStateStop(void)
+{
+ return 0;
+}
+#endif /* WITH_LIBVIRTD */
/**
diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
index 595d2db..b82f6b9 100644
--- a/src/libvirt_internal.h
+++ b/src/libvirt_internal.h
@@ -27,7 +27,6 @@
# include "internal.h"
-# ifdef WITH_LIBVIRTD
typedef void (*virStateInhibitCallback)(bool inhibit,
void *opaque);
@@ -37,7 +36,6 @@ int virStateInitialize(bool privileged,
int virStateCleanup(void);
int virStateReload(void);
int virStateStop(void);
-# endif
/* Feature detection. This is a libvirt-private interface for determining
* what features are supported by the driver.
--
1.8.0.1.240.ge8a1f5a
11 years, 9 months
[libvirt] A question about booting from the snapshot image by specifying snapshot id in Libvirt
by harryxiyou
Hi all,
I test libvirt boots QEMU VM from Sheepdog snapshot image by specify
snapshot id like following.
1, $ collie vdi list
Name Id Size Used Shared Creation time VDI id Copies Tag
Alice 1 10 GB 1.3 GB 0.0 MB 2013-02-01 18:59 15d167
2
s testvdi 1 20 MB 20 MB 0.0 MB 2013-02-02 11:45 f348ba
2 name
s testvdi 2 20 MB 0.0 MB 20 MB 2013-02-03 17:56 f348bb
2
testvdi 3 20 MB 12 MB 8.0 MB 2013-02-03 17:58 f348bc 2
2, $ cat > sheepdog_vm1.xml
<domain type='qemu'>
<name>testvm</name>
<memory>1048576</memory>
<os>
<type arch='x86_64'>hvm</type>
</os>
<devices>
<disk type='network'>
<source protocol="sheepdog" name="testvdi:1"/>
<target dev='hda' bus='ide'/>
</disk>
<graphics type='vnc' port='-1' autoport='yes'/>
</devices>
</domain>
3, $ virsh create sheepdog_vm1.xml
domain testvm is created ( from sheepdog_vm1.xml)
4, $ virsh destroy testvm
domain testvm is deleted
5, $ collie vdi list
Name Id Size Used Shared Creation time VDI id Copies Tag
Alice 1 10 GB 1.3 GB 0.0 MB 2013-02-01 18:59 15d167
2
s testvdi 1 20 MB 20 MB 0.0 MB 2013-02-02 11:45 f348ba
2 name
s testvdi 2 20 MB 0.0 MB 20 MB 2013-02-03 17:56 f348bb
2
s testvdi 3 20 MB 12 MB 8.0 MB 2013-02-03 17:58 f348bc
2
testvdi 4 20 MB 12 MB 8.0 MB 2013-02-04 13:15 f348bd 2
My question is before i boot VM from sheepdog:testvdi:1, my vdi list like
Name Id Size Used Shared Creation time VDI id Copies Tag
Alice 1 10 GB 1.3 GB 0.0 MB 2013-02-01 18:59 15d167
2
s testvdi 1 20 MB 20 MB 0.0 MB 2013-02-02 11:45 f348ba
2 name
s testvdi 2 20 MB 0.0 MB 20 MB 2013-02-03 17:56 f348bb
2
testvdi 3 20 MB 12 MB 8.0 MB 2013-02-03 17:58 f348bc 2
However, after VM is destroied, my vdi list like
Name Id Size Used Shared Creation time VDI id Copies Tag
Alice 1 10 GB 1.3 GB 0.0 MB 2013-02-01 18:59 15d167
2
s testvdi 1 20 MB 20 MB 0.0 MB 2013-02-02 11:45 f348ba
2 name
s testvdi 2 20 MB 0.0 MB 20 MB 2013-02-03 17:56 f348bb
2
s testvdi 3 20 MB 12 MB 8.0 MB 2013-02-03 17:58 f348bc
2
testvdi 4 20 MB 12 MB 8.0 MB 2013-02-04 13:15 f348bd 2
There is another snapshot of testvdi created. I am not clear about why another
one is created? I just boot a VM from snapshot testvdi, which id is 1.
Could anyone please give me some suggestions? Thanks in advance ;-)
--
Thanks
Harry Wei
11 years, 9 months
[libvirt] How to start a snapshot of Sheepdog volume in Libvirt
by harryxiyou
Hi all,
I wanna test start a snapshot of Sheepdog volume in Libvirt. However, i
cannot find a test description from
https://github.com/collie/sheepdog/wiki/Libvirt.
>From http://libvirt.org/formatsnapshot.html, i can find some snapshot operations
in Libvirt, which may be different from Sheepdog volume snapshot, right? Now,
i have some questions like following.
1, What are the differences between Libvirt snapshot operations and Sheepdog
Volume snapshot operations? The object of Libvirt snapshot is a file
and Sheepdog
volume is a block device, right?
2, Can we use Libvirt XML layout from http://libvirt.org/formatsnapshot.html
to create a Sheepdog volume snapshot and start from it? If not, which
Libvirt XML
form should we use to create&start from this snapshot?
3, Is following XML layout right?
<domain type='qemu'>
<name>testvm</name>
<memory>1048576</memory>
<os>
<type arch='x86_64'>hvm</type>
</os>
<devices>
<disk type='network'>
<source protocol="sheepdog" name="Alice:1"/>
<target dev='hda' bus='ide'/>
</disk>
<graphics type='vnc' port='-1' autoport='yes'/>
</devices>
</domain>
NOTE: Alice:1 is a snapshot of Alice.
$ collie vdi list
name id size used shared creation time object id
--------------------------------------------------------------------
Bob 0 2.0 GB 1.6 GB 0.0 MB 2010-03-23 16:16 80000
Alice 0 256 GB 0.0 MB 0.0 MB 2010-03-23 16:21 c0000
s Alice 1 256 GB 0.0 MB 0.0 MB 2010-03-23 16:16 40000
Could anyone please give me some suggestions? Thanks in advance ;-)
--
Thanks
Harry Wei
11 years, 9 months
[libvirt] [PATCH 0/4] FreeBSD: netdev support
by Roman Bogorodskiy
Add support for some essential netdev functions.
Roman Bogorodskiy (4):
FreeBSD: implement virNetDevExists() and virNetDevSetName()
FreeBSD: implement virNetDevTapCreate() and virNetDevTapDelete().
FreeBSD: implement virNetDevSetMAC().
FreeBSD: implement virNetDevGetMTU().
src/util/virnetdev.c | 113 ++++++++++++++++++++++++++++++++++++--
src/util/virnetdevtap.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 247 insertions(+), 6 deletions(-)
--
1.8.0
11 years, 9 months
[libvirt] [PATCH 00/10] -numa option parsing fixes & improvements
by Eduardo Habkost
This series contains the following:
* Patches 1-7 are multiple bug fixes to the current code
* Patch 8 introduce a feature that libvirt requires since a long time,
and even tries to use it today (in a way that doesn't work,
using the "-numa node,cpus=1,2,3,4" format): having non-contiguous CPU
ranges assigned to a NUMA node.
The last 2 patches I am sending as RFCs:
* Patch 9 makes the "-numa" option deprecated and introduces a "-numa-node"
command-line and config file option.
* Patch 10 adds a small hack to the (now deprecated) "-numa" option, that
makes the "cpus=1,2,3,4" format currently used by libvirt work.
Eduardo Habkost (10):
vl.c: Fix off-by-one bug when handling "-numa node" argument
vl.c: Abort on unknown -numa option type
vl.c: Isolate code specific to "-numa node" option type
vl.c: Check for NUMA node limit inside numa_node_add()
vl.c: Extract -numa "cpus" parsing to separate function
vl.c: handle invalid NUMA CPU ranges properly
vl.c: numa_add_node(): Validate nodeid before using it
vl.c: Support multiple CPU ranges on -numa option
vl.c: Introduce QemuOpts-friendly "-numa-node" config option
vl.c: Handle legacy "-numa node,cpus=A,B,C,D" format
qemu-config.c | 25 +++++++
qemu-options.hx | 50 +++++++++++++-
vl.c | 204 ++++++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 240 insertions(+), 39 deletions(-)
--
1.7.11.7
11 years, 9 months
[libvirt] [PATCH] Add basic support for VDI images
by Martin Kletzander
QEMU is fully capable of handling VDI images and we just refuse to
work with them. As qemu-img knows and supports this, there should be
no problem with this addition.
This is of course, just basic functionality, without searching for any
backing files, etc.
---
It's very much possible that I missed something when adding this
"functionality", I just tested running a machine and creating a volume
using 'virsh vol-create-as'. So feel free to point out mymistakes.
---
src/util/virstoragefile.c | 9 +++++++--
src/util/virstoragefile.h | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index cdac5b1..33e72c9 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1,7 +1,7 @@
/*
* virstoragefile.c: file utility functions for FS storage backend
*
- * Copyright (C) 2007-2012 Red Hat, Inc.
+ * Copyright (C) 2007-2013 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -51,7 +51,7 @@ VIR_ENUM_IMPL(virStorageFileFormat,
"raw", "dir", "bochs",
"cloop", "cow", "dmg", "iso",
"qcow", "qcow2", "qed", "vmdk", "vpc",
- "fat", "vhd")
+ "fat", "vhd", "vdi")
enum lv_endian {
LV_LITTLE_ENDIAN = 1, /* 1234 */
@@ -193,6 +193,11 @@ static struct FileTypeInfo const fileTypeInfo[] = {
-1, 0, 0, 0, 0, 0, NULL },
[VIR_STORAGE_FILE_VHD] = { NULL, NULL, LV_LITTLE_ENDIAN,
-1, 0, 0, 0, 0, 0, NULL },
+
+ /* not fully supported, but qemu knows it, so we should be able to
+ * handle this at least basically */
+ [VIR_STORAGE_FILE_VDI] = { NULL, ".vdi", LV_LITTLE_ENDIAN,
+ -2, 0, 0, 0, 0, -1, NULL},
};
verify(ARRAY_CARDINALITY(fileTypeInfo) == VIR_STORAGE_FILE_LAST);
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 618b028..83dc3f2 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -1,7 +1,7 @@
/*
* virstoragefile.h: file utility functions for FS storage backend
*
- * Copyright (C) 2007-2009, 2012 Red Hat, Inc.
+ * Copyright (C) 2007-2009, 2012, 2013 Red Hat, Inc.
* Copyright (C) 2007-2008 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -44,6 +44,7 @@ enum virStorageFileFormat {
VIR_STORAGE_FILE_VPC,
VIR_STORAGE_FILE_FAT,
VIR_STORAGE_FILE_VHD,
+ VIR_STORAGE_FILE_VDI,
VIR_STORAGE_FILE_LAST,
};
--
1.8.1.2
11 years, 9 months
[libvirt] [RFC][PATCH] Growable bitmap implementation
by Stefan Berger
Add a growable bitmap implementation building on top of the 'regular'
bitmap implementation. (no doubt, this could also be done differently...)
This patch also adds a test virgbitmaptest.c that is largely a copy of
virbitmaptest.c with some minor modifications to test for growth of the
bitmap.
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
---
PS: This patch builds on top of a patch with a virBitmapNextClearBit
implementation.
---
src/Makefile.am | 1
src/libvirt_private.syms | 22 ++
src/util/virbitmap.c | 17 +
src/util/virbitmap.h | 6
src/util/virgbitmap.c | 348 ++++++++++++++++++++++++++++++++
src/util/virgbitmap.h | 95 ++++++++
tests/Makefile.am | 5
tests/virgbitmaptest.c | 499
+++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 993 insertions(+)
Index: libvirt/src/Makefile.am
===================================================================
--- libvirt.orig/src/Makefile.am
+++ libvirt/src/Makefile.am
@@ -71,6 +71,7 @@ UTIL_SOURCES = \
util/virevent.c util/virevent.h \
util/vireventpoll.c util/vireventpoll.h \
util/virfile.c util/virfile.h \
+ util/virgbitmap.c util/virgbitmap.h \
util/virhash.c util/virhash.h \
util/virhashcode.c util/virhashcode.h \
util/virhook.c util/virhook.h \
Index: libvirt/src/util/virbitmap.c
===================================================================
--- libvirt.orig/src/util/virbitmap.c
+++ libvirt/src/util/virbitmap.c
@@ -111,6 +111,23 @@ int virBitmapCopy(virBitmapPtr dst, virB
return 0;
}
+/*
+ * virBitmapCopyResize:
+ * @dst: Destination bitmap
+ * @src: Source bitmap
+ *
+ * Copy bits from source bitmap @src into destination bitmap @dst
+ * where the source and destination bitmaps may be of different size.
+ * Any bits not found in the source bitmap will remain untouched
+ * in the destination bitmap.
+ */
+void virBitmapCopyResize(virBitmapPtr dst, virBitmapPtr src)
+{
+ size_t tocopy = MIN(src->map_len, dst->map_len);
+
+ memcpy(dst->map, src->map,
+ tocopy * sizeof(src->map[0]));
+}
/**
* virBitmapSetBit:
Index: libvirt/src/util/virbitmap.h
===================================================================
--- libvirt.orig/src/util/virbitmap.h
+++ libvirt/src/util/virbitmap.h
@@ -49,6 +49,12 @@ void virBitmapFree(virBitmapPtr bitmap);
int virBitmapCopy(virBitmapPtr dst, virBitmapPtr src);
/*
+ * Copy bits from @src to @dst. The bitmap sizes
+ * need not be the same
+ */
+void virBitmapCopyResize(virBitmapPtr dst, virBitmapPtr src);
+
+/*
* Set bit position @b in @bitmap
*/
int virBitmapSetBit(virBitmapPtr bitmap, size_t b)
Index: libvirt/src/util/virgbitmap.c
===================================================================
--- /dev/null
+++ libvirt/src/util/virgbitmap.c
@@ -0,0 +1,348 @@
+/*
+ * virgbitmap.c: Growable bitmap operations
+ *
+ * Copyright (C) 2013 IBM Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Author: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
+ */
+
+#include <config.h>
+
+#include "virgbitmap.h"
+#include "viralloc.h"
+
+struct _virGBitmap {
+ virBitmapPtr bitmap;
+};
+
+/**
+ * virGBitmapNew:
+ * @size: number of bits
+ *
+ * Allocate a growable bitmap capable of initially containing @size bits.
+ *
+ * Returns a pointer to the allocated bitmap or NULL if
+ * memory cannot be allocated.
+ */
+virGBitmapPtr virGBitmapNew(size_t size)
+{
+ virGBitmapPtr bitmap;
+
+ if (VIR_ALLOC(bitmap) < 0)
+ return NULL;
+
+ bitmap->bitmap = virBitmapNew(size);
+
+ if (!bitmap->bitmap) {
+ virGBitmapFree(bitmap);
+ return NULL;
+ }
+
+ return bitmap;
+}
+
+/**
+ * virGBitmapFree:
+ * @bitmap: previously allocated bitmap
+ *
+ * Free @bitmap previously allocated by virBitmapNew.
+ */
+void virGBitmapFree(virGBitmapPtr bitmap)
+{
+ if (bitmap) {
+ virBitmapFree(bitmap->bitmap);
+ VIR_FREE(bitmap);
+ }
+}
+
+/**
+ * virGBitmapResize:
+ * @bitmap: previously allocated bitmap
+ * @new_size: new size of the bitmap
+ *
+ * Resize the @bitmap to the given @new_size. Old bits are copied
+ * into the new
+ */
+static int virGBitmapResize(virGBitmapPtr bitmap, size_t new_size)
+{
+ virBitmapPtr bm;
+
+ if (!(bm = virBitmapNew(new_size)))
+ return -1;
+
+ virBitmapCopyResize(bm, bitmap->bitmap);
+
+ virBitmapFree(bitmap->bitmap);
+ bitmap->bitmap = bm;
+
+ return 0;
+}
+
+/**
+ * virGBitmapSetBit:
+ * @bitmap: Pointer to growable bitmap
+ * @b: bit position to set
+ *
+ * Set bit position @b in @bitmap. Grow the @bitmap if necessary
+ * filling newly allocated bits with zeros.
+ *
+ * Returns 0 on if bit is successfully set, -1 on error.
+ */
+int virGBitmapSetBit(virGBitmapPtr bitmap, ssize_t b)
+{
+ if (virBitmapSize(bitmap->bitmap) <= b &&
+ virGBitmapResize(bitmap,
+ ((unsigned long long)b * 120) / 100) < 0)
+ return -1;
+
+ return virBitmapSetBit(bitmap->bitmap, b);
+}
+
+/**
+ * virBitmapGetBit:
+ * @bitmap: Pointer to bitmap
+ * @b: bit position to get
+ * @result: bool pointer to receive bit setting
+ *
+ * Get setting of bit position @b in @bitmap and store in @result.
+ * Note: If the bitmap is not currently large enough, it will grow
+ * to at least the size of the bit position @b.
+ *
+ * On success, @result will contain the setting of @b and 0 is
+ * returned. On failure, -1 is returned and @result is unchanged.
+ */
+int virGBitmapGetBit(virGBitmapPtr bitmap, size_t b, bool *result)
+{
+ if (virBitmapSize(bitmap->bitmap) <= b) {
+ if (virGBitmapResize(bitmap,
+ ((unsigned long long)b * 120) / 100) < 0)
+ return -1;
+ *result = 0;
+ return 0;
+ }
+
+ return virBitmapGetBit(bitmap->bitmap, b, result);
+}
+
+/**
+ * virGBitmapFormat:
+ * @bitmap: the bitmap
+ *
+ * This function is the counterpart of virGBitmapParse. This function
creates
+ * a human-readable string representing the bits in bitmap.
+ *
+ * See virGBitmapParse for the format of @str.
+ *
+ * Returns the string on success or NULL otherwise. Caller should call
+ * VIR_FREE to free the string.
+ */
+char *virGBitmapFormat(virGBitmapPtr bitmap)
+{
+ return virBitmapFormat(bitmap->bitmap);
+}
+
+size_t virGBitmapSize(virGBitmapPtr bitmap)
+{
+ return virBitmapSize(bitmap->bitmap);
+}
+
+/**
+ * virGBitmapSetAll:
+ * @bitmap: the bitmap
+ *
+ * set all bits in @bitmap.
+ */
+void virGBitmapSetAll(virGBitmapPtr bitmap)
+{
+ virBitmapSetAll(bitmap->bitmap);
+}
+
+/**
+ * virGBitmapClearAll:
+ * @bitmap: the bitmap
+ *
+ * clear all bits in @bitmap.
+ */
+void virGBitmapClearAll(virGBitmapPtr bitmap)
+{
+ virBitmapClearAll(bitmap->bitmap);
+}
+
+/**
+ * virGBitmapIsAllSet:
+ * @bitmap: the bitmap to check
+ *
+ * check if all bits in @bitmap are set.
+ */
+bool virGBitmapIsAllSet(virGBitmapPtr bitmap)
+{
+ return virBitmapIsAllSet(bitmap->bitmap);
+}
+
+/**
+ * virGBitmapParse:
+ * @str: points to a string representing a human-readable bitmap
+ * @terminator: character separating the bitmap to parse
+ * @bitmap: a bitmap created from @str
+ * @bitmapSize: the upper limit of num of bits in created bitmap
+ *
+ * This function is the counterpart of virBitmapFormat. This function
creates
+ * a bitmap, in which bits are set according to the content of @str.
+ *
+ * @str is a comma separated string of fields N, which means a number
of bit
+ * to set, and ^N, which means to unset the bit, and N-M for ranges of bits
+ * to set.
+ *
+ * To allow parsing of bitmaps within larger strings it is possible to set
+ * a termination character in the argument @terminator. When the character
+ * in @terminator is encountered in @str, the parsing of the bitmap stops.
+ * Pass 0 as @terminator if it is not needed. Whitespace characters may not
+ * be used as terminators.
+ *
+ * Returns the number of bits set in @bitmap, or -1 in case of error.
+ */
+int
+virGBitmapParse(const char *str,
+ char terminator,
+ virGBitmapPtr *bitmap,
+ size_t bitmapSize)
+{
+ virGBitmapPtr res;
+
+ if (VIR_ALLOC(res) < 0)
+ return -1;
+
+ if (virBitmapParse(str, terminator, &res->bitmap, bitmapSize) < 0) {
+ VIR_FREE(res);
+ return -1;
+ }
+
+ *bitmap = res;
+
+ return 0;
+}
+
+
+/**
+ * virGBitmapNewData:
+ * @data: the data
+ * @len: length of @data in bytes
+ *
+ * Allocate a bitmap from a chunk of data containing bits
+ * information
+ *
+ * Returns a pointer to the allocated bitmap or NULL if
+ * memory cannot be allocated.
+ */
+virGBitmapPtr virGBitmapNewData(void *data, int len)
+{
+ virGBitmapPtr res;
+
+ if (VIR_ALLOC(res) < 0)
+ return NULL;
+
+ res->bitmap = virBitmapNewData(data, len);
+ if (!res->bitmap) {
+ VIR_FREE(res);
+ return NULL;
+ }
+
+ return res;
+}
+
+/**
+ * virGBitmapToData:
+ * @data: the data
+ * @len: len of @data in byte
+ *
+ * Convert a bitmap to a chunk of data containing bits information.
+ * Data consists of sequential bytes, with lower bytes containing
+ * lower bits.
+ *
+ * Returns 0 on success, -1 otherwise.
+ */
+int virGBitmapToData(virGBitmapPtr bitmap, unsigned char **data, int
*dataLen)
+{
+ return virBitmapToData(bitmap->bitmap, data, dataLen);
+}
+
+
+/**
+ * virGBitmapNextSetBit:
+ * @bitmap: the bitmap
+ * @pos: the position after which to search for a set bit
+ *
+ * Search the first set bit after position @pos in bitmap @bitmap.
+ * @pos can be -1 to search for the first set bit. Position starts
+ * at 0. This function will never grow the bitmap.
+ *
+ * returns the position of the found bit, or -1 if no bit found.
+ */
+ssize_t virGBitmapNextSetBit(virGBitmapPtr bitmap, ssize_t pos)
+{
+ /* never grow since we won't find set bits there */
+ return virBitmapNextSetBit(bitmap->bitmap, pos);
+}
+
+/**
+ * virGBitmapNextClearBit:
+ * @bitmap: the bitmap
+ * @pos: the position after which to search for a set bit
+ *
+ * Search the first clear bit after position @pos in bitmap @bitmap.
+ * @pos can be -1 to search for the first set bit. Position starts
+ * at 0. This function will grow the bitmap if the currently allocated
+ * bitmap has all bits set.
+ *
+ * returns the position of the found bit, or -1 if no bit found.
+ */
+ssize_t virGBitmapNextClearBit(virGBitmapPtr bitmap, ssize_t pos)
+{
+ size_t lastpos, newsize, max_bit;
+ ssize_t res;
+
+ if (pos < 0)
+ pos = -1;
+
+ if (pos < (ssize_t)virBitmapSize(bitmap->bitmap)) {
+ res = virBitmapNextClearBit(bitmap->bitmap, pos);
+
+ if (res >= 0)
+ return res;
+ }
+
+ max_bit = virBitmapSize(bitmap->bitmap);
+
+ lastpos = max_bit - 1;
+ if (pos > lastpos)
+ lastpos = pos;
+
+ newsize = (max_bit > 80)
+ ? ((unsigned long long)max_bit * 120) / 100 /* 20 % growth */
+ : max_bit + 24;
+ if (virGBitmapResize(bitmap, newsize) < 0)
+ return -1;
+
+ return virBitmapNextClearBit(bitmap->bitmap, lastpos);
+}
+
+/* Return the number of bits currently set in the map. */
+size_t
+virGBitmapCountBits(virGBitmapPtr bitmap)
+{
+ return virBitmapCountBits(bitmap->bitmap);
+}
Index: libvirt/src/util/virgbitmap.h
===================================================================
--- /dev/null
+++ libvirt/src/util/virgbitmap.h
@@ -0,0 +1,95 @@
+/*
+ * virgbitmap.h: Growable bitmap operations
+ *
+ * Copyright (C) 2013 IBM Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Derived from virbitmap.h.
+ *
+ * Author: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
+ */
+
+#ifndef __GBITMAP_H__
+# define __GBITMAP_H__
+
+# include "internal.h"
+
+# include <sys/types.h>
+
+# include "virbitmap.h"
+
+typedef struct _virGBitmap virGBitmap;
+typedef virGBitmap *virGBitmapPtr;
+
+/*
+ * Allocate a bitmap capable of initially containing @size bits.
+ */
+virGBitmapPtr virGBitmapNew(size_t size) ATTRIBUTE_RETURN_CHECK;
+
+/*
+ * Free previously allocated bitmap
+ */
+void virGBitmapFree(virGBitmapPtr bitmap);
+
+/*
+ * Set bit position @b in @bitmap
+ */
+int virGBitmapSetBit(virGBitmapPtr bitmap, ssize_t pos)
+ ATTRIBUTE_NONNULL(1);
+
+/*
+ * Get setting of bit position @b in @bitmap and store in @result
+ */
+int virGBitmapGetBit(virGBitmapPtr bitmap, size_t b, bool *result)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
+
+char *virGBitmapFormat(virGBitmapPtr bitmap)
+ ATTRIBUTE_NONNULL(1);
+
+int virGBitmapParse(const char *str,
+ char sep,
+ virGBitmapPtr *bitmap,
+ size_t bitmapSize);
+
+virGBitmapPtr virGBitmapNewData(void *data, int len) ATTRIBUTE_NONNULL(1);
+
+int virGBitmapToData(virGBitmapPtr bitmap, unsigned char **data, int
*dataLen)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+
+size_t virGBitmapSize(virGBitmapPtr bitmap)
+ ATTRIBUTE_NONNULL(1);
+
+void virGBitmapSetAll(virGBitmapPtr bitmap)
+ ATTRIBUTE_NONNULL(1);
+
+void virGBitmapClearAll(virGBitmapPtr bitmap)
+ ATTRIBUTE_NONNULL(1);
+
+bool virGBitmapIsAllSet(virGBitmapPtr bitmap)
+ ATTRIBUTE_NONNULL(1);
+
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+
+ssize_t virGBitmapNextSetBit(virGBitmapPtr bitmap, ssize_t pos)
+ ATTRIBUTE_NONNULL(1);
+
+ssize_t virGBitmapNextClearBit(virGBitmapPtr bitmap, ssize_t pos)
+ ATTRIBUTE_NONNULL(1);
+
+size_t virGBitmapCountBits(virGBitmapPtr bitmap)
+ ATTRIBUTE_NONNULL(1);
+
+#endif
Index: libvirt/tests/Makefile.am
===================================================================
--- libvirt.orig/tests/Makefile.am
+++ libvirt/tests/Makefile.am
@@ -96,6 +96,7 @@ test_programs = virshtest sockettest \
virtimetest viruritest virkeyfiletest \
virauthconfigtest \
virbitmaptest \
+ virgbitmaptest \
virlockspacetest \
virstringtest \
virportallocatortest \
@@ -649,6 +650,10 @@ virbitmaptest_SOURCES = \
virbitmaptest.c testutils.h testutils.c
virbitmaptest_LDADD = $(LDADDS)
+virgbitmaptest_SOURCES = \
+ virgbitmaptest.c testutils.h testutils.c
+virgbitmaptest_LDADD = $(LDADDS)
+
jsontest_SOURCES = \
jsontest.c testutils.h testutils.c
jsontest_LDADD = $(LDADDS)
Index: libvirt/tests/virgbitmaptest.c
===================================================================
--- /dev/null
+++ libvirt/tests/virgbitmaptest.c
@@ -0,0 +1,499 @@
+/*
+ * Copyright (C) 2012 Fujitsu.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <config.h>
+
+#include "testutils.h"
+
+#include "virgbitmap.h"
+
+static int test1(const void *data ATTRIBUTE_UNUSED)
+{
+ virGBitmapPtr bitmap;
+ int size;
+ int bit;
+ bool result;
+ int ret = -1;
+
+ size = 1024;
+ bit = 100;
+ if (!(bitmap = virGBitmapNew(size)))
+ goto error;
+
+ if (virGBitmapSetBit(bitmap, bit) < 0)
+ goto error;
+
+ if (virGBitmapGetBit(bitmap, bit, &result) < 0)
+ goto error;
+
+ if (!result)
+ goto error;
+
+ if (virGBitmapGetBit(bitmap, bit + 1, &result) < 0)
+ goto error;
+
+ if (result)
+ goto error;
+
+ ret = 0;
+
+error:
+ virGBitmapFree(bitmap);
+ return ret;
+}
+
+static int
+testBit(virGBitmapPtr bitmap,
+ unsigned int start,
+ unsigned int end,
+ bool expected)
+{
+ int i;
+ bool result;
+
+ for (i = start; i <= end; i++) {
+ if (virGBitmapGetBit(bitmap, i, &result) < 0)
+ return -1;
+ if (result == expected)
+ return 0;
+ }
+
+ return -1;
+}
+
+static int test2(const void *data ATTRIBUTE_UNUSED)
+{
+ const char *bitsString1 = "1-32,50,88-99,1021-1023";
+ const char *bitsStringAfter = "1-32,50,88-99,1021-1023,1111";
+ char *bitsString2 = NULL, *bitsString3 = NULL;
+ virGBitmapPtr bitmap = NULL;
+ int ret = -1;
+ int size = 1025;
+
+ if (virGBitmapParse(bitsString1, 0, &bitmap, size) < 0)
+ goto error;
+
+ if (testBit(bitmap, 1, 32, true) < 0)
+ goto error;
+ if (testBit(bitmap, 50, 50, true) < 0)
+ goto error;
+ if (testBit(bitmap, 88, 99, true) < 0)
+ goto error;
+ if (testBit(bitmap, 1021, 1023, true) < 0)
+ goto error;
+
+ if (testBit(bitmap, 0, 0, false) < 0)
+ goto error;
+ if (testBit(bitmap, 33, 49, false) < 0)
+ goto error;
+ if (testBit(bitmap, 51, 87, false) < 0)
+ goto error;
+ if (testBit(bitmap, 100, 1020, false) < 0)
+ goto error;
+
+ if (virGBitmapCountBits(bitmap) != 48)
+ goto error;
+
+ if (!(bitsString2 = virGBitmapFormat(bitmap)))
+ goto error;
+ if (strcmp(bitsString1, bitsString2))
+ goto error;
+
+ if (virGBitmapSetBit(bitmap, 1111) < 0)
+ goto error;
+
+ if (!(bitsString3 = virGBitmapFormat(bitmap)))
+ goto error;
+ if (strcmp(bitsStringAfter, bitsString3))
+ goto error;
+
+ size = 1111;
+ virGBitmapSetAll(bitmap);
+ if (testBit(bitmap, 0, size - 1, true) < 0)
+ goto error;
+ if (virGBitmapCountBits(bitmap) < size)
+ goto error;
+
+ if (!virGBitmapIsAllSet(bitmap))
+ goto error;
+
+ virGBitmapClearAll(bitmap);
+ if (testBit(bitmap, 0, size - 1, false) < 0)
+ goto error;
+ if (virGBitmapCountBits(bitmap) != 0)
+ goto error;
+
+ ret = 0;
+
+error:
+ virGBitmapFree(bitmap);
+ VIR_FREE(bitsString2);
+ VIR_FREE(bitsString3);
+ return ret;
+}
+
+static int test3(const void *data ATTRIBUTE_UNUSED)
+{
+ virGBitmapPtr bitmap = NULL;
+ int ret = -1;
+ int size = 5;
+ int i;
+
+ if ((bitmap = virGBitmapNew(size)) == NULL)
+ goto error;
+
+ for (i = 0; i < size * 2; i++)
+ ignore_value(virGBitmapSetBit(bitmap, i));
+
+ if (virGBitmapSize(bitmap) < (2 * size))
+ goto error;
+
+ if (!virGBitmapIsAllSet(bitmap))
+ goto error;
+
+ ret = 0;
+
+error:
+ virGBitmapFree(bitmap);
+ return ret;
+}
+
+/* test for virGBitmapNextSetBit */
+static int test4(const void *data ATTRIBUTE_UNUSED)
+{
+ const char *bitsString = "0, 2-4, 6-10, 12, 14-18, 20, 22, 25";
+ int size = 40;
+ int bitsPos[] = {
+ 0, 2, 3, 4, 6, 7, 8, 9, 10, 12,
+ 14, 15, 16, 17, 18, 20, 22, 25
+ };
+ int npos = 18;
+ virGBitmapPtr bitmap = NULL;
+ int i, j;
+
+ /* 1. zero set */
+
+ bitmap = virGBitmapNew(size);
+ if (!bitmap)
+ goto error;
+
+ if (virGBitmapNextSetBit(bitmap, -1) >= 0)
+ goto error;
+
+ virGBitmapFree(bitmap);
+ bitmap = NULL;
+
+ /* 2. partial set */
+
+ if (virGBitmapParse(bitsString, 0, &bitmap, size) < 0)
+ goto error;
+ if (!bitmap)
+ goto error;
+
+ j = 0;
+ i = -1;
+
+ while (j < npos) {
+ i = virGBitmapNextSetBit(bitmap, i);
+ if (i != bitsPos[j++])
+ goto error;
+ }
+
+ if (virGBitmapNextSetBit(bitmap, i) > 0)
+ goto error;
+
+ /* 3. full set */
+
+ i = -1;
+ virGBitmapSetAll(bitmap);
+
+ for (j = 0; j < size; j++) {
+ i = virGBitmapNextSetBit(bitmap, i);
+ if (i != j)
+ goto error;
+ }
+
+ if (virGBitmapNextSetBit(bitmap, i) > 0)
+ goto error;
+
+ virGBitmapFree(bitmap);
+ return 0;
+
+error:
+ virGBitmapFree(bitmap);
+ return -1;
+}
+
+/* test for virGBitmapNewData/ToData */
+static int test5(const void *v ATTRIBUTE_UNUSED)
+{
+ char data[] = {0x01, 0x02, 0x00, 0x00, 0x04};
+ unsigned char *data2 = NULL;
+ int len2;
+ int bits[] = {0, 9, 34};
+ virGBitmapPtr bitmap;
+ int i, j;
+ int ret = -1;
+
+ bitmap = virGBitmapNewData(data, sizeof(data));
+ if (!bitmap)
+ goto error;
+
+ i = 0;
+ j = -1;
+ while (i < sizeof(bits)/sizeof(int) &&
+ (j = virGBitmapNextSetBit(bitmap, j)) >= 0) {
+ if (j != bits[i++])
+ goto error;
+ }
+ if (virGBitmapNextSetBit(bitmap, j) > 0)
+ goto error;
+
+ ignore_value(virGBitmapSetBit(bitmap, 2));
+ ignore_value(virGBitmapSetBit(bitmap, 15));
+
+ if (virGBitmapToData(bitmap, &data2, &len2) < 0)
+ goto error;
+
+ if (len2 != sizeof(data) ||
+ data2[0] != 0x05 ||
+ data2[1] != 0x82 ||
+ data2[2] != 0x00 ||
+ data2[3] != 0x00 ||
+ data2[4] != 0x04)
+ goto error;
+
+ ret = 0;
+error:
+ virGBitmapFree(bitmap);
+ VIR_FREE(data2);
+ return ret;
+}
+
+/* test for virGBitmapFormat */
+static int test6(const void *v ATTRIBUTE_UNUSED)
+{
+ virGBitmapPtr bitmap = NULL;
+ char *str = NULL;
+ int size = 64;
+ int ret = -1;
+
+ bitmap = virGBitmapNew(size);
+ if (!bitmap)
+ goto error;
+
+ str = virGBitmapFormat(bitmap);
+ if (!str)
+ goto error;
+
+ if (!STREQ(str, ""))
+ goto error;
+
+ VIR_FREE(str);
+
+ ignore_value(virGBitmapSetBit(bitmap, 0));
+ str = virGBitmapFormat(bitmap);
+ if (!str)
+ goto error;
+
+ if (!STREQ(str, "0"))
+ goto error;
+
+ VIR_FREE(str);
+
+ ignore_value(virGBitmapSetBit(bitmap, 4));
+ ignore_value(virGBitmapSetBit(bitmap, 5));
+ str = virGBitmapFormat(bitmap);
+ if (!str)
+ goto error;
+
+ if (!STREQ(str, "0,4-5"))
+ goto error;
+
+ VIR_FREE(str);
+
+ ignore_value(virGBitmapSetBit(bitmap, 6));
+ str = virGBitmapFormat(bitmap);
+ if (!str)
+ goto error;
+
+ if (!STREQ(str, "0,4-6"))
+ goto error;
+
+ VIR_FREE(str);
+
+ ignore_value(virGBitmapSetBit(bitmap, 13));
+ ignore_value(virGBitmapSetBit(bitmap, 14));
+ ignore_value(virGBitmapSetBit(bitmap, 15));
+ ignore_value(virGBitmapSetBit(bitmap, 16));
+ str = virGBitmapFormat(bitmap);
+ if (!str)
+ goto error;
+
+ if (!STREQ(str, "0,4-6,13-16"))
+ goto error;
+
+ VIR_FREE(str);
+
+ ignore_value(virGBitmapSetBit(bitmap, 62));
+ ignore_value(virGBitmapSetBit(bitmap, 63));
+ str = virGBitmapFormat(bitmap);
+ if (!str)
+ goto error;
+
+ if (!STREQ(str, "0,4-6,13-16,62-63"))
+ goto error;
+
+
+ ret = 0;
+error:
+ virGBitmapFree(bitmap);
+ VIR_FREE(str);
+ return ret;
+}
+
+static int test7(const void *v ATTRIBUTE_UNUSED)
+{
+ virGBitmapPtr bitmap;
+ size_t i;
+ size_t maxBit[] = {
+ 1, 8, 31, 32, 63, 64, 95, 96, 127, 128, 159, 160
+ };
+ size_t nmaxBit = 12;
+
+ for (i = 0; i < nmaxBit; i++) {
+ bitmap = virGBitmapNew(maxBit[i]);
+ if (!bitmap)
+ goto error;
+
+ if (virGBitmapIsAllSet(bitmap))
+ goto error;
+
+ ignore_value(virGBitmapSetBit(bitmap, 1));
+ if (virGBitmapIsAllSet(bitmap))
+ goto error;
+
+ virGBitmapSetAll(bitmap);
+ if (!virGBitmapIsAllSet(bitmap))
+ goto error;
+
+ virGBitmapFree(bitmap);
+ }
+
+ return 0;
+
+error:
+ virGBitmapFree(bitmap);
+ return -1;
+}
+
+/* test for virGBitmapNextClearBit */
+static int test8(const void *data ATTRIBUTE_UNUSED)
+{
+ const char *bitsString = "0, 2-4, 6-10, 12, 14-18, 20, 22, 25,
28-33, 35, "
+ "41-42, 45-46";
+ int size = 48;
+ int noBitsPos[] = {
+ 1, 5, 11, 13, 19, 21, 23, 24,
+ 26, 27, 34, 36, 37, 38, 39, 40,
+ 43, 44, 47
+ };
+ int npos = 19;
+ virGBitmapPtr bitmap = NULL;
+ int i, j;
+
+ /* 1. zero set */
+
+ bitmap = virGBitmapNew(size);
+ if (!bitmap)
+ goto error;
+
+ if (virGBitmapNextClearBit(bitmap, -1) != 0)
+ goto error;
+
+ virGBitmapFree(bitmap);
+ bitmap = NULL;
+
+ /* 2. partial set */
+
+ if (virGBitmapParse(bitsString, 0, &bitmap, size) < 0)
+ goto error;
+ if (!bitmap)
+ goto error;
+
+ j = 0;
+ i = -1;
+
+ while (j < npos) {
+ i = virGBitmapNextClearBit(bitmap, i);
+ if (i != noBitsPos[j++])
+ goto error;
+ }
+
+ if (virGBitmapNextSetBit(bitmap, i) > 0)
+ goto error;
+
+ /* 3. full set */
+
+ i = -1;
+ virGBitmapSetAll(bitmap);
+
+ for (j = 0; j < size; j++) {
+ i = virGBitmapNextSetBit(bitmap, i);
+ if (i != j)
+ goto error;
+ }
+
+ if (virGBitmapNextClearBit(bitmap, i) != i + 1)
+ goto error;
+
+ virGBitmapFree(bitmap);
+ return 0;
+
+error:
+ virGBitmapFree(bitmap);
+ return -1;
+}
+
+static int
+mymain(void)
+{
+ int ret = 0;
+
+ if (virtTestRun("test1", 1, test1, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("test2", 1, test2, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("test3", 1, test3, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("test4", 1, test4, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("test5", 1, test5, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("test6", 1, test6, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("test7", 1, test7, NULL) < 0)
+ ret = -1;
+ if (virtTestRun("test8", 1, test8, NULL) < 0)
+ ret = -1;
+
+ return ret;
+}
+
+VIRT_TEST_MAIN(mymain)
Index: libvirt/src/libvirt_private.syms
===================================================================
--- libvirt.orig/src/libvirt_private.syms
+++ libvirt/src/libvirt_private.syms
@@ -9,6 +9,7 @@
virBitmapClearAll;
virBitmapClearBit;
virBitmapCopy;
+virBitmapCopyResize;
virBitmapCountBits;
virBitmapEqual;
virBitmapFormat;
@@ -1390,6 +1391,27 @@ virFileWrapperFdFree;
virFileWrapperFdNew;
+# virbitmap.h
+virGBitmapClearAll;
+virGBitmapClearBit;
+virGBitmapCopy;
+virGBitmapCountBits;
+virGBitmapFormat;
+virGBitmapFree;
+virGBitmapGetBit;
+virGBitmapIsAllSet;
+virGBitmapNew;
+virGBitmapNewData;
+virGBitmapNextClearBit;
+virGBitmapNextSetBit;
+virGBitmapParse;
+virGBitmapSetAll;
+virGBitmapSetBit;
+virGBitmapSize;
+virGBitmapString;
+virGBitmapToData;
+
+
# virinitctl.h
virInitctlSetRunLevel;
11 years, 9 months
[libvirt] [PATCH] complete virterror->virerror name change
by Serge Hallyn
Without these two string changes in generator.py, the
virGetLastError wrapper does not get created in
/usr/share/pyshared/libvirt.py. Noticed when running
tests with virt-install.
Signed-off-by: Serge Hallyn <serge.hallyn(a)ubuntu.com>
---
python/generator.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/python/generator.py b/python/generator.py
index 5d27f66..71ca883 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -123,7 +123,7 @@ class docParser(xml.sax.handler.ContentHandler):
self.function_return_field = attrs['field']
elif tag == 'enum':
if (attrs['file'] == "libvirt" or
- attrs['file'] == "virterror"):
+ attrs['file'] == "virerror"):
enum(attrs['type'],attrs['name'],attrs['value'])
elif attrs['file'] == "libvirt-lxc":
lxc_enum(attrs['type'],attrs['name'],attrs['value'])
@@ -137,7 +137,7 @@ class docParser(xml.sax.handler.ContentHandler):
if self.function != None:
if (self.function_module == "libvirt" or
self.function_module == "virevent" or
- self.function_module == "virterror"):
+ self.function_module == "virerror"):
function(self.function, self.function_descr,
self.function_return, self.function_args,
self.function_file, self.function_module,
--
1.8.0
11 years, 9 months