-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch will introduce a 6lowpan entry into the debugfs if enabled. Inside this 6lowpan directory we create a subdirectories of all 6lowpan interfaces to offer a per interface debugfs support. Reviewed-by: Stefan Schmidt <stefan@osg.samsung.com> Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
- Loading branch information
Alexander Aring
authored and
Marcel Holtmann
committed
Dec 10, 2015
1 parent
00f5931
commit b1815fd
Showing
6 changed files
with
120 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef __6LOWPAN_I_H | ||
#define __6LOWPAN_I_H | ||
|
||
#include <linux/netdevice.h> | ||
|
||
#ifdef CONFIG_6LOWPAN_DEBUGFS | ||
int lowpan_dev_debugfs_init(struct net_device *dev); | ||
void lowpan_dev_debugfs_exit(struct net_device *dev); | ||
|
||
int __init lowpan_debugfs_init(void); | ||
void lowpan_debugfs_exit(void); | ||
#else | ||
static inline int lowpan_dev_debugfs_init(struct net_device *dev) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline void lowpan_dev_debugfs_exit(struct net_device *dev) { } | ||
|
||
static inline int __init lowpan_debugfs_init(void) | ||
{ | ||
return 0; | ||
} | ||
|
||
static inline void lowpan_debugfs_exit(void) { } | ||
#endif /* CONFIG_6LOWPAN_DEBUGFS */ | ||
|
||
#endif /* __6LOWPAN_I_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* Authors: | ||
* (C) 2015 Pengutronix, Alexander Aring <aar@pengutronix.de> | ||
* Copyright (c) 2015 Nordic Semiconductor. All Rights Reserved. | ||
*/ | ||
|
||
#include <net/6lowpan.h> | ||
|
||
#include "6lowpan_i.h" | ||
|
||
static struct dentry *lowpan_debugfs; | ||
|
||
int lowpan_dev_debugfs_init(struct net_device *dev) | ||
{ | ||
struct lowpan_priv *lpriv = lowpan_priv(dev); | ||
|
||
/* creating the root */ | ||
lpriv->iface_debugfs = debugfs_create_dir(dev->name, lowpan_debugfs); | ||
if (!lpriv->iface_debugfs) | ||
goto fail; | ||
|
||
return 0; | ||
|
||
fail: | ||
return -EINVAL; | ||
} | ||
|
||
void lowpan_dev_debugfs_exit(struct net_device *dev) | ||
{ | ||
debugfs_remove_recursive(lowpan_priv(dev)->iface_debugfs); | ||
} | ||
|
||
int __init lowpan_debugfs_init(void) | ||
{ | ||
lowpan_debugfs = debugfs_create_dir("6lowpan", NULL); | ||
if (!lowpan_debugfs) | ||
return -EINVAL; | ||
|
||
return 0; | ||
} | ||
|
||
void lowpan_debugfs_exit(void) | ||
{ | ||
debugfs_remove_recursive(lowpan_debugfs); | ||
} |