Skip to content

Commit

Permalink
netfilter: conntrack: un-export seq_print_acct
Browse files Browse the repository at this point in the history
Only one caller, just place it where its needed.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Florian Westphal authored and Pablo Neira Ayuso committed Dec 20, 2018
1 parent a0badcc commit 4b216e2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
3 changes: 0 additions & 3 deletions include/net/netfilter/nf_conntrack_acct.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ struct nf_conn_acct *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
return acct;
};

unsigned int seq_print_acct(struct seq_file *s, const struct nf_conn *ct,
int dir);

/* Check if connection tracking accounting is enabled */
static inline bool nf_ct_acct_enabled(struct net *net)
{
Expand Down
19 changes: 0 additions & 19 deletions net/netfilter/nf_conntrack_acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,6 @@ static struct ctl_table acct_sysctl_table[] = {
};
#endif /* CONFIG_SYSCTL */

unsigned int
seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir)
{
struct nf_conn_acct *acct;
struct nf_conn_counter *counter;

acct = nf_conn_acct_find(ct);
if (!acct)
return 0;

counter = acct->counter;
seq_printf(s, "packets=%llu bytes=%llu ",
(unsigned long long)atomic64_read(&counter[dir].packets),
(unsigned long long)atomic64_read(&counter[dir].bytes));

return 0;
};
EXPORT_SYMBOL_GPL(seq_print_acct);

static const struct nf_ct_ext_type acct_extend = {
.len = sizeof(struct nf_conn_acct),
.align = __alignof__(struct nf_conn_acct),
Expand Down
18 changes: 18 additions & 0 deletions net/netfilter/nf_conntrack_standalone.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,24 @@ static const char* l4proto_name(u16 proto)
return "unknown";
}

static unsigned int
seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir)
{
struct nf_conn_acct *acct;
struct nf_conn_counter *counter;

acct = nf_conn_acct_find(ct);
if (!acct)
return 0;

counter = acct->counter;
seq_printf(s, "packets=%llu bytes=%llu ",
(unsigned long long)atomic64_read(&counter[dir].packets),
(unsigned long long)atomic64_read(&counter[dir].bytes));

return 0;
}

/* return 0 on success, 1 in case of error */
static int ct_seq_show(struct seq_file *s, void *v)
{
Expand Down

0 comments on commit 4b216e2

Please sign in to comment.