From bd6e0786d09d712068cae8b6fccf1105b88e28e6 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 17 Oct 2017 16:00:08 +0300 Subject: [PATCH] container_of: export get_param/offset_from_container_of() I want the concept of container_of() to be an important way to describe code so let's export these. Signed-off-by: Dan Carpenter --- smatch.h | 4 ++++ smatch_container_of.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/smatch.h b/smatch.h index 9893cdd6..99133ffa 100644 --- a/smatch.h +++ b/smatch.h @@ -1011,6 +1011,10 @@ struct constraint_list *get_constraints(struct expression *expr); char *unmet_constraint(struct expression *data, struct expression *offset); char *get_required_constraint(const char *data_str); +/* smatch_container_of.c */ +int get_param_from_container_of(struct expression *expr); +int get_offset_from_container_of(struct expression *expr); + static inline int type_bits(struct symbol *type) { if (!type) diff --git a/smatch_container_of.c b/smatch_container_of.c index c4bdf9c6..7b6685cf 100644 --- a/smatch_container_of.c +++ b/smatch_container_of.c @@ -25,7 +25,7 @@ static struct stree_stack *saved_stack; STATE(used); -static int get_param_from_container_of(struct expression *expr) +int get_param_from_container_of(struct expression *expr) { struct expression *param_expr; struct symbol *type; @@ -56,7 +56,7 @@ static int get_param_from_container_of(struct expression *expr) return param; } -static int get_offset_from_container_of(struct expression *expr) +int get_offset_from_container_of(struct expression *expr) { struct expression *param_expr; struct symbol *type; -- 2.11.4.GIT