Skip to contentSkip to conversation

net: netprio_cgroup: make net_prio_subsys static

PATCH Applied John Fastabend 4 participants 6 messages Dec 8, 2011 – Dec 9, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: netprio_cgroup: make net_prio_subsys static

net_prio_subsys can be made static this removes the sparse warning it was throwing.

---

 net/core/netprio_cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/core/netprio_cgroup.c +1 -1
index 3a9fd48..ea16c8f 100644
@@ -28,7 +28,7 @@ static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss,
 static void cgrp_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp);
 static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp);
 
-struct cgroup_subsys net_prio_subsys = {
+static struct cgroup_subsys net_prio_subsys = {
 	.name		= "net_prio",
 	.create		= cgrp_create,
 	.destroy	= cgrp_destroy,
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · John Fastabend

net_prio_subsys can be made static this removes the sparse warning it was throwing.

---

 net/core/netprio_cgroup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/core/netprio_cgroup.c +0 -0
index 3a9fd48..ea16c8f 100644

net/core/netprio_cgroup.c static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss, · line 34

Quoted 8 lines
net/core/netprio_cgroup.c +1 -1
@@ -28,7 +28,7 @@ static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss,
 static void cgrp_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp);
 static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp);
 
-struct cgroup_subsys net_prio_subsys = {
+static struct cgroup_subsys net_prio_subsys = {
 	.name		= "net_prio",
 	.create		= cgrp_create,
 	.destroy	= cgrp_destroy,

Thanks John.

#3 lore raw
Quoted 7 lines · David Miller

From: Neil Horman <[email protected]>
Date: Thu, 8 Dec 2011 06:45:55 -0500

Quoted 4 lines · John Fastabend
Quoted 3 lines

net_prio_subsys can be made static this removes the sparse warning it was throwing.

Quoted 6 lines
Quoted 1 line
Quoted 1 line

...

Quoted 1 line

Applied.
--

But it trivialy breaks the build ? Or am I mistaken ?

$ grep CONFIG_NETPRIO_CGROUP .config
CONFIG_NETPRIO_CGROUP=y
$ make net/core/netprio_cgroup.o
  CC      net/core/netprio_cgroup.o
net/core/netprio_cgroup.c:31:29: error: static declaration of ‘net_prio_subsys’ follows non-static declaration
include/linux/cgroup_subsys.h:71:1: note: previous declaration of ‘net_prio_subsys’ was here
make[1]: *** [net/core/netprio_cgroup.o] Error 1
make: *** [net/core/netprio_cgroup.o] Error 2
#4 lore raw
Quoted 8 lines · Eric Dumazet
Quoted 7 lines · David Miller

From: Neil Horman <[email protected]>
Date: Thu, 8 Dec 2011 06:45:55 -0500

Quoted 4 lines · John Fastabend
Quoted 3 lines

net_prio_subsys can be made static this removes the sparse warning it was throwing.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line
Quoted 1 line

...

Quoted 1 line

Applied.
--

But it trivialy breaks the build ? Or am I mistaken ?

Dang. No your right. When its not built as a module it breaks. Sorry I'll revert it.

Quoted 13 lines
$ grep CONFIG_NETPRIO_CGROUP .config
CONFIG_NETPRIO_CGROUP=y
$ make net/core/netprio_cgroup.o
  CC      net/core/netprio_cgroup.o
net/core/netprio_cgroup.c:31:29: error: static declaration of ‘net_prio_subsys’ follows non-static declaration
include/linux/cgroup_subsys.h:71:1: note: previous declaration of ‘net_prio_subsys’ was here
make[1]: *** [net/core/netprio_cgroup.o] Error 1
make: *** [net/core/netprio_cgroup.o] Error 2
#5 lore raw
Quoted 13 lines · John Fastabend
Quoted 12 lines · Eric Dumazet
Quoted 11 lines · David Miller

From: Neil Horman <[email protected]>
Date: Thu, 8 Dec 2011 06:45:55 -0500

Quoted 5 lines · John Fastabend
Quoted 4 lines

net_prio_subsys can be made static this removes the sparse warning it was throwing.

...

Quoted 1 line
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Applied.
--

But it trivialy breaks the build ? Or am I mistaken ?

Dang. No your right. When its not built as a module it breaks. Sorry I'll revert it.

Yeah, I'd say revert it for now, but I think the real problem is that the SUBSYS macro in the cgroup core code automatically defines a subsys structure as extern. We should look into fixing that properly instead long term.

Quoted 15 lines
Quoted 13 lines
$ grep CONFIG_NETPRIO_CGROUP .config
CONFIG_NETPRIO_CGROUP=y
$ make net/core/netprio_cgroup.o
  CC      net/core/netprio_cgroup.o
net/core/netprio_cgroup.c:31:29: error: static declaration of ‘net_prio_subsys’ follows non-static declaration
include/linux/cgroup_subsys.h:71:1: note: previous declaration of ‘net_prio_subsys’ was here
make[1]: *** [net/core/netprio_cgroup.o] Error 1
make: *** [net/core/netprio_cgroup.o] Error 2