The introduced namespace support moved the BCM variables for procfs into a
per-net data structure. This leads to a build failure with disabled procfs:
on x86_64:
when CONFIG_PROC_FS is not enabled:
../net/can/bcm.c:1541:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
../net/can/bcm.c:1601:14: error: 'struct netns_can' has no member named 'bcmproc_dir'
../net/can/bcm.c:1696:11: error: 'struct netns_can' has no member named 'bcmproc_dir'
../net/can/bcm.c:1707:15: error: 'struct netns_can' has no member named 'bcmproc_dir'
http://marc.info/?l=linux-can&m=
149321842526524&w=2
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+#if IS_ENABLED(CONFIG_PROC_FS)
static char *bcm_proc_getifname(struct net *net, char *result, int ifindex)
{
struct net_device *dev;
static char *bcm_proc_getifname(struct net *net, char *result, int ifindex)
{
struct net_device *dev;
.llseek = seq_lseek,
.release = single_release,
};
.llseek = seq_lseek,
.release = single_release,
};
+#endif /* CONFIG_PROC_FS */
/*
* bcm_can_tx - send the (next) CAN frame to the appropriate CAN interface
/*
* bcm_can_tx - send the (next) CAN frame to the appropriate CAN interface
+#if IS_ENABLED(CONFIG_PROC_FS)
/* remove procfs entry */
if (net->can.bcmproc_dir && bo->bcm_proc_read)
remove_proc_entry(bo->procname, net->can.bcmproc_dir);
/* remove procfs entry */
if (net->can.bcmproc_dir && bo->bcm_proc_read)
remove_proc_entry(bo->procname, net->can.bcmproc_dir);
+#endif /* CONFIG_PROC_FS */
/* remove device reference */
if (bo->bound) {
/* remove device reference */
if (bo->bound) {
+#if IS_ENABLED(CONFIG_PROC_FS)
if (net->can.bcmproc_dir) {
/* unique socket address as filename */
sprintf(bo->procname, "%lu", sock_i_ino(sk));
if (net->can.bcmproc_dir) {
/* unique socket address as filename */
sprintf(bo->procname, "%lu", sock_i_ino(sk));
+#endif /* CONFIG_PROC_FS */
static int canbcm_pernet_init(struct net *net)
{
static int canbcm_pernet_init(struct net *net)
{
+#if IS_ENABLED(CONFIG_PROC_FS)
/* create /proc/net/can-bcm directory */
/* 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 /* CONFIG_PROC_FS */
return 0;
}
static void canbcm_pernet_exit(struct net *net)
{
return 0;
}
static void canbcm_pernet_exit(struct net *net)
{
+#if IS_ENABLED(CONFIG_PROC_FS)
/* remove /proc/net/can-bcm directory */
/* 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);
- }
+ if (net->can.bcmproc_dir)
+ remove_proc_entry("can-bcm", net->proc_net);
+#endif /* CONFIG_PROC_FS */
}
static struct pernet_operations canbcm_pernet_ops __read_mostly = {
}
static struct pernet_operations canbcm_pernet_ops __read_mostly = {