2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-29 13:27:59 +00:00

29 Commits

Author SHA1 Message Date
Ben Pfaff
cb22974d77 Replace most uses of assert by ovs_assert.
This is a straight search-and-replace, except that I also removed #include
<assert.h> from each file where there were no assert calls left.

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Ethan Jackson <ethan@nicira.com>
2013-01-16 16:03:37 -08:00
Ben Pfaff
ebc56baa41 util: New macro CONST_CAST.
Casts are sometimes necessary.  One common reason that they are necessary
is for discarding a "const" qualifier.  However, this can impede
maintenance: if the type of the expression being cast changes, then the
presence of the cast can hide a necessary change in the code that does the
cast.  Using CONST_CAST, instead of a bare cast, makes these changes
visible.

Inspired by my own work elsewhere:
http://git.savannah.gnu.org/cgit/pspp.git/tree/src/libpspp/cast.h#n80

Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-08-03 13:33:13 -07:00
Ethan Jackson
79f1cbe9f8 lib: New data structure - smap.
A smap is a string to string hash map.  It has a cleaner interface
than shash's which were traditionally used for the same purpose.
This patch implements the data structure, and changes netdev and
its providers to use it.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
2012-06-14 15:09:31 -07:00
Raju Subramanian
e0edde6fee Global replace of Nicira Networks.
Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc.

Feature #10593
Signed-off-by: Raju Subramanian <rsubramanian@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
2012-05-02 17:08:02 -07:00
Ben Pfaff
e74a239deb shash: New function shash_find_len().
This will acquire a user in an upcoming commit that uses it in parsing
without modifying the text being parsed or copying it.
2011-11-17 10:11:53 -08:00
Ben Pfaff
c56d226f8d shash: New "smap" functions for working with string-to-string maps.
An shash always has string keys and sometimes it hash string values as
well.  Usually the general-purpose shash functions are fine for working
with string-to-string maps, but this commit introduces a few more
specialized functions that only work with string-to-string maps.  It's not
clear yet to me whether this should actually be a new data structure, so
for now the new functions just work on shashes.

This commit also converts one user of shash_destroy() to use smap_destroy().
This is the only existing user of these functions that I spotted as a
trivial conversion candidate while grepping.

These new functions will see more use in the following commit.

Reviewed by Justin Pettit.
2011-01-27 09:26:06 -08:00
Ben Pfaff
4e8e4213a8 Switch many macros from using CONTAINER_OF to using OBJECT_CONTAINING.
These macros require one fewer argument by switching, which makes code
that uses them shorter and more readable.
2010-10-01 10:25:29 -07:00
Ben Pfaff
4f2226487d shash: New function shash_steal(). 2010-09-23 11:45:34 -07:00
Ben Pfaff
f2f7be8696 stream-ssl: Enable SSL session caching. 2010-08-11 10:24:40 -07:00
Ben Pfaff
79903dd171 shash: New function shash_replace().
To be used in an upcoming commit.
2010-06-30 16:49:01 -07:00
Ben Pfaff
1c6d8802c2 shash: Refactor shash_add_nocopy(), shash_find().
By breaking out the hash calculation we can enable operations that need
to do both to avoid duplicating the hash calculations.  A following commit
will add such an operation.
2010-06-30 16:49:00 -07:00
Ben Pfaff
a90b56b770 shash: New functions shash_destroy_free_data() and shash_clear_free_data(). 2010-06-17 10:30:19 -07:00
Ben Pfaff
ce5a3e38da ovs-vsctl: Support references among records at creation time.
This makes it easy to create a bunch of records that are all related to
each other in a single ovs-vsctl invocation.  It adds an example to the
ovs-vsctl manpage.
2010-06-17 10:30:18 -07:00
Ben Pfaff
4a1ee6ae82 bridge: Optimize iface_lookup() and port_lookup_iface() with a hash.
Before this commit and the following one, with 1000 interfaces strcmp()
took 36% and port_lookup() took 8% of total runtime when reconfiguring
bridges.  With these two commits the percentage is reduced to 3% and 0%,
respectively.
2010-05-05 14:00:47 -07:00
Ben Pfaff
baa8f41b24 New functions hmap_moved(), shash_moved().
To be used in ovs-vsctl in an upcoming commit.
2010-01-28 16:06:31 -08:00
Ben Pfaff
37e7f42772 Reimplement port mirroring configuration for database.
Tested only to the extent that it doesn't obviously break anything else.
2010-01-19 10:40:36 -08:00
Ben Pfaff
7634353824 vswitchd: Initial conversion to database-based configuration.
This has seen very little testing, so some features are almost certainly
busted.  Port mirroring is not yet converted, so it will definitely not
work.
2009-12-03 11:28:40 -08:00
Ben Pfaff
55213fd581 shash: Make it more convenient to store "const" objects in an shash. 2009-11-20 15:39:07 -08:00
Ben Pfaff
07423999f1 shash: New function shash_sort(). 2009-11-04 15:01:02 -08:00
Ben Pfaff
c01da22964 shash: New function shash_count(). 2009-11-04 15:01:02 -08:00
Ben Pfaff
837e80977c shash: New function shash_find_and_delete(). 2009-11-04 15:01:02 -08:00
Ben Pfaff
4d678233e9 Merge "citrix" branch into "master. 2009-10-05 10:29:07 -07:00
Ben Pfaff
d855aeadfd shash: Fix memory leak in shash_destroy().
hmap_destroy() has to be called so that sh->map.buckets gets freed.
2009-09-24 10:23:22 -07:00
Ben Pfaff
fd30311c87 shash: Introduce new macros SHASH_FOR_EACH, SHASH_FOR_EACH_SAFE.
This is both more convenient and cleaner than using HMAP_FOR_EACH(_SAFE)
directly.
2009-07-30 16:07:13 -07:00
Ben Pfaff
78299b0a68 shash: Make shash_add() return the new node. 2009-07-30 16:07:13 -07:00
Ben Pfaff
7efc68eb07 shash: New function shash_first(). 2009-07-06 09:07:23 -07:00
Ben Pfaff
732dcb37a8 shash: New function shash_is_empty(). 2009-07-06 09:07:23 -07:00
Ben Pfaff
a14bc59fb8 Update primary code license to Apache 2.0. 2009-06-15 15:11:30 -07:00
Ben Pfaff
064af42167 Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45. 2009-07-08 13:19:16 -07:00