diff options
author | Ben Pfaff <blp@nicira.com> | 2011-04-06 15:31:22 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-04-25 17:11:29 -0700 |
commit | 2a4ae6357eb447e185599ec1ca7c95b1e4183c19 (patch) | |
tree | 1de08f2031b6d30870ddab1dbc9ee2be179e4fa0 /lib/vlan-bitmap.h | |
parent | 0fb7b9156ac7d319a51890630857698ad1877335 (diff) |
mac-learning: Change mac_learning_set_flood_vlans() to not take ownership.
These new semantics are less efficient in the case where the flood_vlans
actually changed, but that should be very rare.
There are no advantages to this change on its own, but upcoming commits
will add multiple layers between the code supplying the flood_vlans and
actually calling mac_learning_set_flood_vlans(). Consistency in this
multilayered interface seems valuable, and the rest of it does not transfer
ownership from the caller to the callee.
Diffstat (limited to 'lib/vlan-bitmap.h')
-rw-r--r-- | lib/vlan-bitmap.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/vlan-bitmap.h b/lib/vlan-bitmap.h index eca42fea..6d74d400 100644 --- a/lib/vlan-bitmap.h +++ b/lib/vlan-bitmap.h @@ -37,4 +37,11 @@ vlan_bitmap_contains(const unsigned long *vlans, uint16_t vid) return !vlans || bitmap_is_set(vlans, vid); } +/* Returns a new copy of 'vlans'. */ +static inline unsigned long * +vlan_bitmap_clone(const unsigned long *vlans) +{ + return vlans ? bitmap_clone(vlans, 4096) : NULL; +} + #endif /* lib/vlan-bitmap.h */ |