All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] can: fix build error without CONFIG_PROC_FS
@ 2017-04-27 14:21 Arnd Bergmann
  2017-04-27 14:29 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-04-27 14:21 UTC (permalink / raw)
  To: Oliver Hartkopp, Marc Kleine-Budde, David S. Miller
  Cc: Arnd Bergmann, Thomas Gleixner, Cong Wang, Mario Kicherer,
	Eric Dumazet, linux-can, netdev, linux-kernel

The procfs dir entry was added inside of an #ifdef, causing a build error
when we try to access it without CONFIG_PROC_FS set:

net/can/bcm.c:1541:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
net/can/bcm.c: In function 'bcm_connect':
net/can/bcm.c:1601:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
net/can/bcm.c: In function 'canbcm_pernet_init':
net/can/bcm.c:1696:11: error: 'struct netns_can' has no member named 'bcmproc_dir'
net/can/bcm.c: In function 'canbcm_pernet_exit':
net/can/bcm.c:1707:15: error: 'struct netns_can' has no member named 'bcmproc_dir'

This adds the same #ifdef around all users of the pointer. Alternatively
we could move the pointer outside of the #ifdef.

Fixes: 384317ef4187 ("can: network namespace support for CAN_BCM protocol")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 net/can/bcm.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/net/can/bcm.c b/net/can/bcm.c
index 0e855917b7e1..e6d9df27400b 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -1538,8 +1538,10 @@ static int bcm_release(struct socket *sock)
 	}
 
 	/* remove procfs entry */
+#ifdef CONFIG_PROC_FS
 	if (net->can.bcmproc_dir && bo->bcm_proc_read)
 		remove_proc_entry(bo->procname, net->can.bcmproc_dir);
+#endif
 
 	/* remove device reference */
 	if (bo->bound) {
@@ -1597,7 +1599,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
 		/* no interface reference for ifindex = 0 ('any' CAN device) */
 		bo->ifindex = 0;
 	}
-
+#ifdef CONFIG_PROC_FS
 	if (net->can.bcmproc_dir) {
 		/* unique socket address as filename */
 		sprintf(bo->procname, "%lu", sock_i_ino(sk));
@@ -1609,6 +1611,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
 			goto fail;
 		}
 	}
+#endif
 
 	bo->bound = 1;
 
@@ -1691,22 +1694,23 @@ static const struct can_proto bcm_can_proto = {
 
 static int canbcm_pernet_init(struct net *net)
 {
+#ifdef CONFIG_PROC_FS
 	/* create /proc/net/can-bcm directory */
-	if (IS_ENABLED(CONFIG_PROC_FS)) {
-		net->can.bcmproc_dir =
-			proc_net_mkdir(net, "can-bcm", net->proc_net);
-	}
+	net->can.bcmproc_dir = proc_net_mkdir(net, "can-bcm", net->proc_net);
+#endif
 
 	return 0;
 }
 
 static void canbcm_pernet_exit(struct net *net)
 {
+#ifdef CONFIG_PROC_FS
 	/* remove /proc/net/can-bcm directory */
 	if (IS_ENABLED(CONFIG_PROC_FS)) {
 		if (net->can.bcmproc_dir)
 			remove_proc_entry("can-bcm", net->proc_net);
 	}
+#endif
 }
 
 static struct pernet_operations canbcm_pernet_ops __read_mostly = {
-- 
2.9.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] can: fix build error without CONFIG_PROC_FS
  2017-04-27 14:21 [PATCH net-next] can: fix build error without CONFIG_PROC_FS Arnd Bergmann
@ 2017-04-27 14:29 ` Marc Kleine-Budde
  2017-04-27 16:11   ` Oliver Hartkopp
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2017-04-27 14:29 UTC (permalink / raw)
  To: Arnd Bergmann, Oliver Hartkopp, David S. Miller
  Cc: Thomas Gleixner, Cong Wang, Mario Kicherer, Eric Dumazet,
	linux-can, netdev, linux-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1409 bytes --]

Hello Arnd,

On 04/27/2017 04:21 PM, Arnd Bergmann wrote:
> The procfs dir entry was added inside of an #ifdef, causing a build error
> when we try to access it without CONFIG_PROC_FS set:
> 
> net/can/bcm.c:1541:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
> net/can/bcm.c: In function 'bcm_connect':
> net/can/bcm.c:1601:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
> net/can/bcm.c: In function 'canbcm_pernet_init':
> net/can/bcm.c:1696:11: error: 'struct netns_can' has no member named 'bcmproc_dir'
> net/can/bcm.c: In function 'canbcm_pernet_exit':
> net/can/bcm.c:1707:15: error: 'struct netns_can' has no member named 'bcmproc_dir'
> 
> This adds the same #ifdef around all users of the pointer. Alternatively
> we could move the pointer outside of the #ifdef.
> 
> Fixes: 384317ef4187 ("can: network namespace support for CAN_BCM protocol")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

A fix for this problem is part of the pull request I send to David
earlier today:

    https://www.mail-archive.com/netdev@vger.kernel.org/msg165764.html

regards,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] can: fix build error without CONFIG_PROC_FS
  2017-04-27 14:29 ` Marc Kleine-Budde
@ 2017-04-27 16:11   ` Oliver Hartkopp
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Hartkopp @ 2017-04-27 16:11 UTC (permalink / raw)
  To: Marc Kleine-Budde, Arnd Bergmann, David S. Miller
  Cc: Thomas Gleixner, Cong Wang, Mario Kicherer, Eric Dumazet,
	linux-can, netdev, linux-kernel

Hello Arnd,

many thanks for your patch.

Btw

 >  static void canbcm_pernet_exit(struct net *net)
 >  {
 > +#ifdef CONFIG_PROC_FS
 >  	/* remove /proc/net/can-bcm directory */
 >  	if (IS_ENABLED(CONFIG_PROC_FS)) {
 >  		if (net->can.bcmproc_dir)
 >  			remove_proc_entry("can-bcm", net->proc_net);
 >  	}
 > +#endif
 >  }

"if (IS_ENABLED(CONFIG_PROC_FS))"

becomes obsolete too then ...

So I would suggest to take my patch to fix my fault ;-)

Best regards,
Oliver

On 04/27/2017 04:29 PM, Marc Kleine-Budde wrote:
> Hello Arnd,
>
> On 04/27/2017 04:21 PM, Arnd Bergmann wrote:
>> The procfs dir entry was added inside of an #ifdef, causing a build error
>> when we try to access it without CONFIG_PROC_FS set:
>>
>> net/can/bcm.c:1541:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
>> net/can/bcm.c: In function 'bcm_connect':
>> net/can/bcm.c:1601:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
>> net/can/bcm.c: In function 'canbcm_pernet_init':
>> net/can/bcm.c:1696:11: error: 'struct netns_can' has no member named 'bcmproc_dir'
>> net/can/bcm.c: In function 'canbcm_pernet_exit':
>> net/can/bcm.c:1707:15: error: 'struct netns_can' has no member named 'bcmproc_dir'
>>
>> This adds the same #ifdef around all users of the pointer. Alternatively
>> we could move the pointer outside of the #ifdef.
>>
>> Fixes: 384317ef4187 ("can: network namespace support for CAN_BCM protocol")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> A fix for this problem is part of the pull request I send to David
> earlier today:
>
>     https://www.mail-archive.com/netdev@vger.kernel.org/msg165764.html
>
> regards,
> Marc
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-04-27 16:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-27 14:21 [PATCH net-next] can: fix build error without CONFIG_PROC_FS Arnd Bergmann
2017-04-27 14:29 ` Marc Kleine-Budde
2017-04-27 16:11   ` Oliver Hartkopp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.