aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2012-09-12 10:12:02 -0400
committerTejun Heo <tj@kernel.org>2012-09-14 12:57:25 -0400
commit8fb974c937570be38f944986456467b39a2dc252 (patch)
tree7da095ab6580e0649544799cf7ad0afb77733013
parentf3419807716be503c06f399b2bcbc68823be3a78 (diff)
cgroup: net_cls: Do not define task_cls_classid() when not selected
task_cls_classid() should not be defined in case the configuration is CONFIG_NET_CLS_CGROUP=n. The reason is that in a following patch the net_cls_subsys_id will only be defined if CONFIG_NET_CLS_CGROUP!=n. When net_cls is not built at all a callee should only get an empty task_cls_classid() without any references to net_cls_subsys_id. Signed-off-by: Daniel Wagner <daniel.wagner@bmw-carit.de> Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Li Zefan <lizefan@huawei.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Cc: Gao feng <gaofeng@cn.fujitsu.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: John Fastabend <john.r.fastabend@intel.com> Cc: netdev@vger.kernel.org Cc: cgroups@vger.kernel.org
-rw-r--r--include/net/cls_cgroup.h11
-rw-r--r--net/core/sock.c2
2 files changed, 8 insertions, 5 deletions
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index e88527a68454..9bd5db9e10ba 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -17,7 +17,7 @@
17#include <linux/hardirq.h> 17#include <linux/hardirq.h>
18#include <linux/rcupdate.h> 18#include <linux/rcupdate.h>
19 19
20#ifdef CONFIG_CGROUPS 20#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
21struct cgroup_cls_state 21struct cgroup_cls_state
22{ 22{
23 struct cgroup_subsys_state css; 23 struct cgroup_subsys_state css;
@@ -26,7 +26,7 @@ struct cgroup_cls_state
26 26
27extern void sock_update_classid(struct sock *sk); 27extern void sock_update_classid(struct sock *sk);
28 28
29#ifdef CONFIG_NET_CLS_CGROUP 29#if IS_BUILTIN(CONFIG_NET_CLS_CGROUP)
30static inline u32 task_cls_classid(struct task_struct *p) 30static inline u32 task_cls_classid(struct task_struct *p)
31{ 31{
32 int classid; 32 int classid;
@@ -41,7 +41,8 @@ static inline u32 task_cls_classid(struct task_struct *p)
41 41
42 return classid; 42 return classid;
43} 43}
44#else 44#elif IS_MODULE(CONFIG_NET_CLS_CGROUP)
45
45extern int net_cls_subsys_id; 46extern int net_cls_subsys_id;
46 47
47static inline u32 task_cls_classid(struct task_struct *p) 48static inline u32 task_cls_classid(struct task_struct *p)
@@ -63,7 +64,7 @@ static inline u32 task_cls_classid(struct task_struct *p)
63 return classid; 64 return classid;
64} 65}
65#endif 66#endif
66#else 67#else /* !CGROUP_NET_CLS_CGROUP */
67static inline void sock_update_classid(struct sock *sk) 68static inline void sock_update_classid(struct sock *sk)
68{ 69{
69} 70}
@@ -72,5 +73,5 @@ static inline u32 task_cls_classid(struct task_struct *p)
72{ 73{
73 return 0; 74 return 0;
74} 75}
75#endif 76#endif /* CGROUP_NET_CLS_CGROUP */
76#endif /* _NET_CLS_CGROUP_H */ 77#endif /* _NET_CLS_CGROUP_H */
diff --git a/net/core/sock.c b/net/core/sock.c
index 8f67ced8d6a8..82cadc62a872 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1223,6 +1223,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
1223} 1223}
1224 1224
1225#ifdef CONFIG_CGROUPS 1225#ifdef CONFIG_CGROUPS
1226#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
1226void sock_update_classid(struct sock *sk) 1227void sock_update_classid(struct sock *sk)
1227{ 1228{
1228 u32 classid; 1229 u32 classid;
@@ -1234,6 +1235,7 @@ void sock_update_classid(struct sock *sk)
1234 sk->sk_classid = classid; 1235 sk->sk_classid = classid;
1235} 1236}
1236EXPORT_SYMBOL(sock_update_classid); 1237EXPORT_SYMBOL(sock_update_classid);
1238#endif
1237 1239
1238void sock_update_netprioidx(struct sock *sk, struct task_struct *task) 1240void sock_update_netprioidx(struct sock *sk, struct task_struct *task)
1239{ 1241{