Skip to contentSkip to conversation

net/ipv4/inetpeer.c: make a struct static

PATCH In review Adrian Bunk 2 participants 5 messages Mar 15, 2005 – Mar 17, 2005

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

PATCH 1/1 net/ipv4/inetpeer.c: make a struct static

This patch makes a needlessly global struct static.

net/ipv4/inetpeer.c renamed from net/ipv4/inetpeer.c.old +2 -2
@@ -92,9 +92,9 @@
 int inet_peer_minttl = 120 * HZ;	/* TTL under high load: 120 sec */
 int inet_peer_maxttl = 10 * 60 * HZ;	/* usual time to live: 10 min */
 
+static struct inet_peer *inet_peer_unused_head;
 /* Exported for inet_putpeer inline function.  */
-struct inet_peer *inet_peer_unused_head,
-		**inet_peer_unused_tailp = &inet_peer_unused_head;
+struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head;
 DEFINE_SPINLOCK(inet_peer_unused_lock);
 #define PEER_MAX_CLEANUP_WORK 30
 
maintainer
#2 lore raw
Quoted 10 lines · On Wed, 16 Mar 2005 14:53:43 -0800 "David S. Miller" <[email protected]>…
Quoted 3 lines · On Tue, 15 Mar 2005 15:44:08 +0100 Adrian Bunk <[email protected]> wrote:

This patch makes a needlessly global struct static.

You need to also kill the externs in net/inetpeer.h

Please fix this up and resubmit.

Actually, Adrian, net/inetpeer.h makes use of
inet_peer_unused_tailp in inline functions.

How did you get a successful build after marking
it static?

#3 lore raw

PATCH 1/1 net/ipv4/inetpeer.c: make a struct static

Quoted 12 lines · David S. Miller
Quoted 9 lines · On Wed, 16 Mar 2005 14:53:43 -0800 "David S. Miller" <[email protected]>…
Quoted 3 lines · On Tue, 15 Mar 2005 15:44:08 +0100 Adrian Bunk <[email protected]> wrote:

This patch makes a needlessly global struct static.

You need to also kill the externs in net/inetpeer.h

Quoted 7 lines
Quoted 1 line

Please fix this up and resubmit.

Actually, Adrian, net/inetpeer.h makes use of
inet_peer_unused_tailp in inline functions.

How did you get a successful build after marking
it static?

I might be too dumb for reading the output of grep (inetpeer.h...), but I'm testing all my patches with two .config's that are roughly equivalent to allyesconfig and allmodconfig.

inet_peer_unused_tailp might be referenced from other files via inetpeer.h, but inet_peer_unused_head isn't referenced directly from other files.

cu
Adrian

<-- snip -->

This patch makes a needlessly global struct static.

---

 net/ipv4/inetpeer.c    |    4 ++--
 include/net/inetpeer.h |    1 -
 2 files changed, 2 insertions(+), 3 deletions(-)
net/ipv4/inetpeer.c renamed from net/ipv4/inetpeer.c.old +2 -2
@@ -92,9 +92,9 @@
 int inet_peer_minttl = 120 * HZ;	/* TTL under high load: 120 sec */
 int inet_peer_maxttl = 10 * 60 * HZ;	/* usual time to live: 10 min */
 
+static struct inet_peer *inet_peer_unused_head;
 /* Exported for inet_putpeer inline function.  */
-struct inet_peer *inet_peer_unused_head,
-		**inet_peer_unused_tailp = &inet_peer_unused_head;
+struct inet_peer **inet_peer_unused_tailp = &inet_peer_unused_head;
 DEFINE_SPINLOCK(inet_peer_unused_lock);
 #define PEER_MAX_CLEANUP_WORK 30
 
include/net/inetpeer.h renamed from include/net/inetpeer.h.old +0 -1
@@ -35,7 +35,6 @@
 struct inet_peer	*inet_getpeer(__u32 daddr, int create);
 
 extern spinlock_t inet_peer_unused_lock;
-extern struct inet_peer *inet_peer_unused_head;
 extern struct inet_peer **inet_peer_unused_tailp;
 /* can be called from BH context or outside */
 static inline void	inet_putpeer(struct inet_peer *p)
maintainer
#4 lore raw
Quoted 3 lines · On Thu, 17 Mar 2005 02:08:21 +0100 Adrian Bunk <[email protected]> wrote:

inet_peer_unused_tailp might be referenced from other files via inetpeer.h, but inet_peer_unused_head isn't referenced directly from other files.

I misread your patch, I thought you were marking both as static. My bad, sorry.

I'll apply your patch, thanks.