- 20 7月, 2017 1 次提交
-
-
由 Pavel Hrdina 提交于
While searching for an element using a function it may be desirable to know the element key for future operation. Signed-off-by: NPavel Hrdina <phrdina@redhat.com> Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
-
- 17 2月, 2016 2 次提交
-
-
由 Erik Skultety 提交于
The method will now return 0 on success and -1 on error, rather than number of items which it iterated over before it returned back to the caller. Since the only place where we actually check the number of elements iterated is in virhashtest, return value of 0 and -1 can be a pretty accurate hint that it iterated over all the items. However, if we really want to know the number of items iterated over (like virhashtest does), a counter has to be provided through opaque data to each iterator call. This patch adjusts return value of virHashForEach, refactors the body, so it returns as soon as one of the iterators fail and adjusts virhashtest to reflect these changes. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
由 Erik Skultety 提交于
Our existing virHashForEach method iterates through all items disregarding the fact, that some of the iterators might have actually failed. Errors are usually dispatched through an error element in opaque data which then causes the original caller of virHashForEach to return -1. In that case, virHashForEach could return as soon as one of the iterators fail. This patch changes the iterator return type and adjusts all of its instances accordingly, so the actual refactor of virHashForEach method can be dealt with later. Signed-off-by: NErik Skultety <eskultet@redhat.com>
-
- 10 7月, 2015 1 次提交
-
-
由 Jiri Denemark 提交于
This is a self-locking wrapper around virHashTable. Only a limited set of APIs are implemented now (the ones which are used in the following patch) as more can be added on demand. Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 07 4月, 2014 1 次提交
-
-
由 Eric Blake 提交于
I almost wrote a hash value free function that just called VIR_FREE, then realized I couldn't be the first person to do that. Sure enough, it was worth factoring into a common helper routine. * src/util/virhash.h (virHashValueFree): New function. * src/util/virhash.c (virHashValueFree): Implement it. * src/util/virobject.h (virObjectFreeHashData): New function. * src/libvirt_private.syms (virhash.h, virobject.h): Export them. * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit): Use common function. * src/qemu/qemu_capabilities.c (virQEMUCapsCacheNew): Likewise. * src/qemu/qemu_command.c (qemuDomainCCWAddressSetCreate): Likewise. * src/qemu/qemu_monitor.c (qemuMonitorGetBlockInfo): Likewise. * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise. * src/util/virclosecallbacks.c (virCloseCallbacksNew): Likewise. * src/util/virkeyfile.c (virKeyFileParseGroup): Likewise. * tests/qemumonitorjsontest.c (testQemuMonitorJSONqemuMonitorJSONGetBlockInfo): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 15 10月, 2013 1 次提交
-
-
由 Eric Blake 提交于
'const fooPtr' is the same as 'foo * const' (the pointer won't change, but it's contents can). But in general, if an interface is trying to be const-correct, it should be using 'const foo *' (the pointer is to data that can't be changed). Fix up virhash to provide a const-correct interface: all actions that don't modify the table take a const table. Note that in one case (virHashSearch), we actually strip const away - we aren't modifying the contents of the table, so much as associated data for ensuring that the code uses the table correctly (if this were C++, it would be a case for the 'mutable' keyword). * src/util/virhash.h (virHashKeyComparator, virHashEqual): Use intended type. (virHashSize, virHashTableSize, virHashLookup, virHashSearch): Make const-correct. * src/util/virhash.c (virHashEqualData, virHashEqual) (virHashLookup, virHashSize, virHashTableSize, virHashSearch) (virHashComputeKey): Fix fallout. * src/conf/nwfilter_params.c (virNWFilterFormatParameterNameSorter): Likewise. * src/nwfilter/nwfilter_ebiptables_driver.c (ebiptablesFilterOrderSort): Likewise. * tests/virhashtest.c (testHashGetItemsCompKey) (testHashGetItemsCompValue): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 19 4月, 2012 1 次提交
-
-
由 Stefan Berger 提交于
Implement function to remove all entries of a hash table.
-
- 27 1月, 2012 1 次提交
-
-
由 Michal Privoznik 提交于
Some files are using uint32_t or int64_t without including stdint.h which defines them. Fix this.
-
- 26 1月, 2012 3 次提交
-
-
由 Daniel P. Berrange 提交于
Recent discussions have illustrated the potential for DOS attacks with the hash table implementations used by most languages and libraries. https://lwn.net/Articles/474912/ libvirt has an internal hash table impl, and uses hash tables for a variety of purposes. The hash key generation code is pretty simple and thus not strongly collision resistant. This patch replaces the current libvirt hash key generator with the (public domain) Murmurhash3 code. In addition every hash table now gets a random seed value which is used to perturb the hashing code. This should make it impossible to mount any practical attack against libvirt hashing code. * bootstrap.conf: Import bitrotate module * src/Makefile.am: Add virhashcode.[ch] * src/util/util.c: Make virRandom() return a fixed 32 bit integer value. * src/util/hash.c, src/util/hash.h, src/util/cgroup.c: Replace hash code generation with a call to virHashCodeGen() * src/util/virhashcode.h, src/util/virhashcode.c: Add a new virHashCodeGen() API using the Murmurhash3 algorithm.
-
由 Daniel P. Berrange 提交于
In preparation for the patch to include Murmurhash3, which introduces a virhashcode.h and virhashcode.c files, rename the existing hash.h and hash.c to virhash.h and virhash.c respectively.
-
由 Daniel P. Berrange 提交于
In preparation for conversion over to use the Murmurhash3 algorithm, convert various virHash APIs to use size_t or uint32 for their return values/parameters, instead of the variable size 'unsigned long' or 'int' types
-
- 24 1月, 2012 1 次提交
-
-
由 Stefan Berger 提交于
Add function to compare two hash tables for equality.
-
- 19 11月, 2011 1 次提交
-
-
由 Stefan Berger 提交于
Add a function to the virHashTable for getting an array of the hash table's key-value pairs and have the keys (optionally) sorted. Signed-off-by: NStefan Berger <stefanb@linux.vnet.ibm.com>
-
- 27 4月, 2011 1 次提交
-
-
由 Jiri Denemark 提交于
This adds several tests for remaining hash APIs (custom hasher/comparator functions are not covered yet, though). All tests pass both before and after the "Simplify hash implementation".
-
- 25 2月, 2011 2 次提交
-
-
由 Daniel P. Berrange 提交于
Relax the restriction that the hash table key must be a string by allowing an arbitrary hash code generator + comparison func to be provided * util/hash.c, util/hash.h: Allow any pointer as a key * internal.h: Include stdbool.h as standard. * conf/domain_conf.c, conf/domain_conf.c, conf/nwfilter_params.c, nwfilter/nwfilter_gentech_driver.c, nwfilter/nwfilter_gentech_driver.h, nwfilter/nwfilter_learnipaddr.c, qemu/qemu_command.c, qemu/qemu_driver.c, qemu/qemu_process.c, uml/uml_driver.c, xen/xm_internal.c: s/char */void */ in hash callbacks
-
由 Daniel P. Berrange 提交于
Since the deallocator is passed into the constructor of a hash table it is not desirable to pass it into each function again. Remove it from all functions, but provide a virHashSteal to allow a item to be removed from a hash table without deleteing it. * src/util/hash.c, src/util/hash.h: Remove deallocator param from all functions. Add virHashSteal * src/libvirt_private.syms: Add virHashSteal * src/conf/domain_conf.c, src/conf/nwfilter_params.c, src/nwfilter/nwfilter_learnipaddr.c, src/qemu/qemu_command.c, src/xen/xm_internal.c: Update for changed hash API
-
- 21 2月, 2011 1 次提交
-
-
由 Eric Blake 提交于
Two-argument free functions are uncommon; match the style elsewhere by caching the callback at creation. * src/util/hash.h (virHashCreate, virHashFree): Move deallocator argument to creation. * cfg.mk (useless_free_options): Add virHashFree. * src/util/hash.c (_virHashTable): Track deallocator. (virHashCreate, virHashFree): Update to new signature. * src/conf/domain_conf.c (virDomainObjListDeinit) (virDomainObjListInit, virDomainDiskDefForeachPath) (virDomainSnapshotObjListDeinit, virDomainSnapshotObjListInit): Update callers. * src/conf/nwfilter_params.c (virNWFilterHashTableFree) (virNWFilterHashTableCreate): Likewise. * src/conf/nwfilter_conf.c (virNWFilterTriggerVMFilterRebuild): Likewise. * src/cpu/cpu_generic.c (genericHashFeatures, genericBaseline): Likewise. * src/xen/xm_internal.c (xenXMOpen, xenXMClose): Likewise. * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnInit) (virNWFilterLearnShutdown): Likewise. * src/qemu/qemu_command.c (qemuDomainPCIAddressSetCreate) (qemuDomainPCIAddressSetFree): Likewise. * src/qemu/qemu_process.c (qemuProcessWaitForMonitor): Likewise.
-
- 10 3月, 2010 1 次提交
-
-
由 Eric Blake 提交于
* global: patch created by running: for f in $(git ls-files '*.[ch]') ; do cppi $f > $f.t && mv $f.t $f done
-
- 19 10月, 2009 1 次提交
-
-
由 Daniel P. Berrange 提交于
Most of the hash iterators need to modify either payload of data args. The const annotation prevents this. * src/util/hash.h, src/util/hash.c: Remove const-ness from virHashForEach/Iterator * src/xen/xm_internal.c: Remove bogus casts
-
- 21 9月, 2009 1 次提交
-
-
由 Daniel P. Berrange 提交于
* src/bridge.c, src/bridge.h, src/buf.c, src/buf.h, src/cgroup.c, src/cgroup.h, src/conf.c, src/conf.h, src/event.c, src/event.h, src/hash.c, src/hash.h, src/hostusb.c, src/hostusb.h, src/iptables.c, src/iptables.h, src/logging.c, src/logging.h, src/memory.c, src/memory.h, src/pci.c, src/pci.h, src/qparams.c, src/qparams.h, src/stats_linux.c, src/stats_linux.h, src/threads-pthread.c, src/threads-pthread.h, src/threads-win32.c, src/threads-win32.h, src/threads.c, src/threads.h, src/util.c, src/util.h, src/uuid.c, src/uuid.h, src/virterror.c, src/virterror_internal.h, src/xml.c, src/xml.h: Move all files into src/util/ * daemon/Makefile.am: Add -Isrc/util/ to build flags * src/Makefile.am: Add -Isrc/util/ to build flags and update for moved files * src/libvirt_private.syms: Export cgroup APIs since they're now in util rather than linking directly to drivers * src/xen/xs_internal.c: Disable bogus virEventRemoveHandle call when built under PROXY * proxy/Makefile.am: Update for changed file locations. Remove bogus build of event.c * tools/Makefile.am, tests/Makefile.am: Add -Isrc/util/ to build flags
-
- 21 8月, 2008 1 次提交
-
-
由 Daniel P. Berrange 提交于
-
- 11 4月, 2008 1 次提交
-
-
由 Jim Meyering 提交于
Done using this command (also includes .c.in and .h.in files): for i in $(g ls-files|grep -E '\.[ch](\.in)?$'|grep -v gnulib); do expand -i $i > j && mv j $i;done
-
- 16 11月, 2006 1 次提交
-
-
由 Daniel P. Berrange 提交于
-
- 09 4月, 2006 1 次提交
-
-
由 Daniel Veillard 提交于
src/xs_internal.c: implementing domain pointers unification, thread safety and reference counting for domain and connections, this was the last critical change needed before making further progresses at the API level. Still a couple fo things TODO for this, unification at the Python level and adding UUID to hash. All domain/connect alloc and free routines are now centralized in hash.c * docs/APIchunk1.html docs/libvirt-api.xml docs/libvirt-refs.xml docs/html/libvirt-libvirt.html: regenerated the docs, that doesn't change the API. Daniel
-
- 15 3月, 2006 1 次提交
-
-
由 Daniel Veillard 提交于
src/sexpr.h src/virsh.c src/virterror.c src/xen_internal.c src/xen_internal.h src/xend_internal.c src/xend_internal.h src/xml.c src/xml.h: applied cb/indent to homogenize the source style, as a first pass. Daniel
-
- 20 12月, 2005 1 次提交
-
-
由 Daniel Veillard 提交于
version for python bindings, heavilly based on libxml2/libxslt way of doing things, maybe this need to be revisited. Added packaging too. * src/hash.h: fixed the Copyright notice. Daniel
-
- 05 12月, 2005 1 次提交
-
-
由 Daniel Veillard 提交于
libvir.spec.in docs/Makefile.am docs/apibuild.py docs/structures.fig include/Makefile.am include/libvir.h src/Makefile.am src/hash.c src/hash.h src/internal.h src/libvir.c src/libvir_sym.version src/virsh.c: renamed to libvir Daniel
-
- 30 11月, 2005 1 次提交
-
-
由 Daniel Veillard 提交于
-