diff mbox series

[ovs-dev,v3,2/3] id_pool: add helper function to add id_node in hmap

Message ID 20230130164256.764534-3-simon.horman@corigine.com
State Changes Requested
Headers show
Series dpif-netlink: add revalidator for offload of meters | expand

Checks

Context Check Description
ovsrobot/apply-robot warning apply and check: warning
ovsrobot/github-robot-_Build_and_Test success github build: passed

Commit Message

Simon Horman Jan. 30, 2023, 4:42 p.m. UTC
From: Tianyu Yuan <tianyu.yuan@corigine.com>

Add helper function to add id_node in hmap directly and
expose this function for external use.

Signed-off-by: Tianyu Yuan <tianyu.yuan@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
---
 lib/id-pool.c | 12 ++++++++++--
 lib/id-pool.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

Comments

0-day Robot Jan. 30, 2023, 5:01 p.m. UTC | #1
References:  <20230130164256.764534-3-simon.horman@corigine.com>
 

Bleep bloop.  Greetings Simon Horman, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Unexpected sign-offs from developers who are not authors or co-authors or committers: Simon Horman <simon.horman@corigine.com>
Lines checked: 60, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/lib/id-pool.c b/lib/id-pool.c
index 97b7185ed538..5c6dab906922 100644
--- a/lib/id-pool.c
+++ b/lib/id-pool.c
@@ -87,14 +87,22 @@  id_pool_find(struct id_pool *pool, uint32_t id)
 }
 
 void
-id_pool_add(struct id_pool *pool, uint32_t id)
+id_hmap_add(struct hmap *map, uint32_t id)
 {
     struct id_node *id_node = xmalloc(sizeof *id_node);
     size_t hash;
 
     id_node->id = id;
     hash = hash_int(id, 0);
-    hmap_insert(&pool->map, &id_node->node, hash);
+    hmap_insert(map, &id_node->node, hash);
+}
+
+void
+id_pool_add(struct id_pool *pool, uint32_t id)
+{
+    struct hmap *map = &pool->map;
+
+    id_hmap_add(map, id);
 }
 
 bool
diff --git a/lib/id-pool.h b/lib/id-pool.h
index f71cc570f104..9fcd2c188666 100644
--- a/lib/id-pool.h
+++ b/lib/id-pool.h
@@ -35,6 +35,7 @@  struct id_pool *id_pool_create(uint32_t base, uint32_t n_ids);
 void id_pool_destroy(struct id_pool *);
 bool id_pool_alloc_id(struct id_pool *, uint32_t *id);
 void id_pool_free_id(struct id_pool *, uint32_t id);
+void id_hmap_add(struct hmap *map, uint32_t id);
 void id_pool_add(struct id_pool *, uint32_t id);
 
 /*