From 20bc724ca11ba23def116ea65c95d16159b5a543 Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Mon, 16 Sep 2019 17:32:56 +0530 Subject: [PATCH] qcacmn: Add qdf wrapper for hash_for_each_safe Add qdf wrapper API for hash_for_each_safe which iterates over a hashtable safe against removal of hash entry Change-Id: I89d8b6520a4bee583d44a771b4359ed287d0c2fa CRs-Fixed: 2528484 --- qdf/inc/qdf_hashtable.h | 12 ++++++++++++ qdf/linux/src/i_qdf_hashtable.h | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/qdf/inc/qdf_hashtable.h b/qdf/inc/qdf_hashtable.h index 098ee3961c9b..7bb09b4fd8b1 100644 --- a/qdf/inc/qdf_hashtable.h +++ b/qdf/inc/qdf_hashtable.h @@ -96,6 +96,18 @@ #define qdf_ht_for_each(table, i, cursor, entry_field) \ __qdf_ht_for_each(table, i, cursor, entry_field) +/** + * qdf_ht_for_each_safe() - iterate all entries in @table safe against removal + * of hash entry. + * @table: a non-pointer qdf_ht instance to iterate + * @i: int type cursor populated with the bucket index + * @tmp: a &struct used for temporary storage + * @cursor: container struct pointer populated with each iteration + * @entry_field: name of the entry field in the entry container struct + */ +#define qdf_ht_for_each_safe(table, i, tmp, cursor, entry_field) \ + __qdf_ht_for_each_safe(table, i, tmp, cursor, entry_field) + /** * qdf_ht_for_each_in_bucket() - iterate entries in the bucket for @key * @table: a non-pointer qdf_ht instance to iterate diff --git a/qdf/linux/src/i_qdf_hashtable.h b/qdf/linux/src/i_qdf_hashtable.h index f1806cbf1d76..f9ad3806e71b 100644 --- a/qdf/linux/src/i_qdf_hashtable.h +++ b/qdf/linux/src/i_qdf_hashtable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -47,4 +47,7 @@ do { \ break; \ } while (false) +#define __qdf_ht_for_each_safe(table, i, tmp, cursor, entry_field) \ + hash_for_each_safe(table, i, tmp, cursor, entry_field) + #endif /* __I_QDF_HASHTABLE_H */