Skip to content

Commit

Permalink
make do_action static
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
  • Loading branch information
olsajiri committed May 18, 2024
1 parent 4d1f2e5 commit cd07f6d
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions bpf/process/types/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -2114,19 +2114,26 @@ FUNC_INLINE void do_action_notify_enforcer(int error, int signal)
#define do_action_notify_enforcer(error, signal)
#endif

FUNC_INLINE __u32
do_action(void *ctx, __u32 i, struct msg_generic_kprobe *e,
struct selector_action *actions, struct bpf_map_def *override_tasks, bool *post)
FUNC_LOCAL __u32
do_action(void *ctx, __u32 i, struct selector_action *actions,
struct generic_maps *maps, bool *post)
{
struct bpf_map_def *override_tasks = maps->override;
int signal __maybe_unused = FGS_SIGKILL;
int action = actions->act[i];
struct msg_generic_kprobe *e;
__s32 error, *error_p;
int fdi, namei;
int newfdi, oldfdi;
int socki;
int err = 0;
int zero = 0;
__u64 id;

e = map_lookup_elem(maps->heap, &zero);
if (!e)
return 0;

switch (action) {
case ACTION_NOPOST:
*post = false;
Expand Down Expand Up @@ -2229,8 +2236,7 @@ has_action(struct selector_action *actions, __u32 idx)

/* Currently supporting 2 actions for selector. */
FUNC_INLINE bool
do_actions(void *ctx, struct msg_generic_kprobe *e, struct selector_action *actions,
struct bpf_map_def *override_tasks)
do_actions(void *ctx, struct selector_action *actions, struct generic_maps *maps)
{
bool post = true;
__u32 l, i = 0;
Expand All @@ -2241,7 +2247,7 @@ do_actions(void *ctx, struct msg_generic_kprobe *e, struct selector_action *acti
for (l = 0; l < MAX_ACTIONS; l++) {
if (!has_action(actions, i))
break;
i = do_action(ctx, i, e, actions, override_tasks, &post);
i = do_action(ctx, i, actions, maps, &post);
}

return post;
Expand Down Expand Up @@ -2314,7 +2320,7 @@ generic_actions(void *ctx, struct generic_maps *maps)
:);
actions = (struct selector_action *)&f[actoff];

postit = do_actions(ctx, e, actions, maps->override);
postit = do_actions(ctx, actions, maps);
if (postit)
tail_call(ctx, maps->calls, TAIL_CALL_SEND);
return 0;
Expand Down

0 comments on commit cd07f6d

Please sign in to comment.