Skip to content

Commit

Permalink
ipv4: fib: Add fib_info_hold() helper
Browse files Browse the repository at this point in the history
As explained in the previous commit, modules are going to need to take a
reference on fib info and then drop it using fib_info_put().

Add the fib_info_hold() helper to make the code more readable and also
symmetric with fib_info_put().

Signed-off-by: Ido Schimmel <[email protected]>
Suggested-by: Jiri Pirko <[email protected]>
Signed-off-by: Jiri Pirko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
idosch authored and davem330 committed Dec 4, 2016
1 parent b423cb1 commit 1c677b3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/net/ip_fib.h
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,11 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)

void free_fib_info(struct fib_info *fi);

static inline void fib_info_hold(struct fib_info *fi)
{
atomic_inc(&fi->fib_clntref);
}

static inline void fib_info_put(struct fib_info *fi)
{
if (atomic_dec_and_test(&fi->fib_clntref))
Expand Down

0 comments on commit 1c677b3

Please sign in to comment.