summaryrefslogtreecommitdiff
path: root/include/linux/codetag.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/codetag.h')
-rw-r--r--include/linux/codetag.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/include/linux/codetag.h b/include/linux/codetag.h
index c2a579ccd455..6aa8cf22d88b 100644
--- a/include/linux/codetag.h
+++ b/include/linux/codetag.h
@@ -7,7 +7,7 @@
#include <linux/types.h>
-struct codetag_iterator;
+struct codetag_iter;
struct codetag_type;
struct codetag_module;
struct seq_buf;
@@ -39,11 +39,10 @@ struct codetag_type_desc {
struct codetag_module *cmod);
};
-struct codetag_iterator {
+struct codetag_iter {
struct codetag_type *cttype;
struct codetag_module *cmod;
- unsigned long mod_id;
- struct codetag *ct;
+ unsigned idx;
};
#ifdef MODULE
@@ -60,10 +59,27 @@ struct codetag_iterator {
.flags = 0, \
}
+struct codetag *idx_to_codetag(struct codetag_type *cttype, unsigned idx);
+
void codetag_lock_module_list(struct codetag_type *cttype, bool lock);
bool codetag_trylock_module_list(struct codetag_type *cttype);
-struct codetag_iterator codetag_get_ct_iter(struct codetag_type *cttype);
-struct codetag *codetag_next_ct(struct codetag_iterator *iter);
+
+static inline struct codetag_iter codetag_iter_init(struct codetag_type *cttype, unsigned idx)
+{
+ return (struct codetag_iter) { .cttype = cttype, .idx = idx };
+}
+
+static inline void codetag_iter_advance(struct codetag_iter *iter)
+{
+ iter->idx++;
+}
+
+struct codetag *codetag_iter_peek(struct codetag_iter *);
+
+#define for_each_codetag(_cttype, _iter, _ct) \
+ for (struct codetag_iter _iter = codetag_iter_init(_cttype, 0); \
+ (_ct = codetag_iter_peek(&_iter)); \
+ codetag_iter_advance(&_iter))
void codetag_to_text(struct seq_buf *out, struct codetag *ct);