From: Stephen Hemminger <shemminger@vyatta.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 1/6] socket: sk_filter minor cleanups
Date: Mon, 31 Mar 2008 17:47:09 -0700 [thread overview]
Message-ID: <20080401004724.454784783@vyatta.com> (raw)
In-Reply-To: 20080401004708.009204033@vyatta.com
[-- Attachment #1: sk-filter-cleanup --]
[-- Type: text/plain, Size: 2328 bytes --]
Some minor style cleanups:
* Move __KERNEL__ definitions to one place in filter.h
* Use const for sk_filter_len
* Line wrapping
* Put EXPORT_SYMBOL next to function definition
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/include/linux/filter.h 2008-03-31 10:23:28.000000000 -0700
+++ b/include/linux/filter.h 2008-03-31 10:24:40.000000000 -0700
@@ -37,21 +37,6 @@ struct sock_fprog /* Required for SO_ATT
struct sock_filter __user *filter;
};
-#ifdef __KERNEL__
-struct sk_filter
-{
- atomic_t refcnt;
- unsigned int len; /* Number of filter blocks */
- struct rcu_head rcu;
- struct sock_filter insns[0];
-};
-
-static inline unsigned int sk_filter_len(struct sk_filter *fp)
-{
- return fp->len*sizeof(struct sock_filter) + sizeof(*fp);
-}
-#endif
-
/*
* Instruction classes
*/
@@ -141,10 +126,24 @@ static inline unsigned int sk_filter_len
#define SKF_LL_OFF (-0x200000)
#ifdef __KERNEL__
+struct sk_filter
+{
+ atomic_t refcnt;
+ unsigned int len; /* Number of filter blocks */
+ struct rcu_head rcu;
+ struct sock_filter insns[0];
+};
+
+static inline unsigned int sk_filter_len(const struct sk_filter *fp)
+{
+ return fp->len * sizeof(struct sock_filter) + sizeof(*fp);
+}
+
struct sk_buff;
struct sock;
-extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen);
+extern unsigned int sk_run_filter(struct sk_buff *skb,
+ struct sock_filter *filter, int flen);
extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
extern int sk_detach_filter(struct sock *sk);
extern int sk_chk_filter(struct sock_filter *filter, int flen);
--- a/net/core/filter.c 2008-03-31 10:24:56.000000000 -0700
+++ b/net/core/filter.c 2008-03-31 10:25:29.000000000 -0700
@@ -275,6 +275,7 @@ load_b:
return 0;
}
+EXPORT_SYMBOL(sk_run_filter);
/**
* sk_chk_filter - verify socket filter code
@@ -385,6 +386,7 @@ int sk_chk_filter(struct sock_filter *fi
return (BPF_CLASS(filter[flen - 1].code) == BPF_RET) ? 0 : -EINVAL;
}
+EXPORT_SYMBOL(sk_chk_filter);
/**
* sk_filter_rcu_release: Release a socket filter by rcu_head
@@ -467,6 +469,3 @@ int sk_detach_filter(struct sock *sk)
rcu_read_unlock_bh();
return ret;
}
-
-EXPORT_SYMBOL(sk_chk_filter);
-EXPORT_SYMBOL(sk_run_filter);
--
next parent reply other threads:[~2008-04-01 2:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080401004708.009204033@vyatta.com>
2008-04-01 0:47 ` Stephen Hemminger [this message]
2008-04-10 8:39 ` [PATCH 1/6] socket: sk_filter minor cleanups David Miller
2008-04-01 0:47 ` [PATCH 2/6] socket: sk_filter deinline Stephen Hemminger
2008-04-10 8:49 ` David Miller
2008-04-01 0:47 ` [PATCH 3/6] IPV4 : use xor rather than multiple ands for route compare Stephen Hemminger
2008-04-01 5:52 ` Eric Dumazet
2008-04-01 20:08 ` Stephen Hemminger
2008-04-10 8:51 ` David Miller
2008-04-10 9:01 ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-10 10:56 ` David Miller
2008-04-10 12:17 ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-10 9:26 ` Eric Dumazet
2008-04-10 11:00 ` David Miller
2008-04-01 0:47 ` [PATCH 4/6] IPV4: route inline changes Stephen Hemminger
2008-04-10 8:53 ` David Miller
2008-04-01 0:47 ` [PATCH 5/6] IPV4: route use jhash3 Stephen Hemminger
2008-04-10 8:54 ` David Miller
2008-04-01 0:47 ` [PATCH 6/6] IPV4: route rekey timer can be deferrable Stephen Hemminger
2008-04-10 8:55 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080401004724.454784783@vyatta.com \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).