From: Antonio Quartulli <ordex@autistici.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Antonio Quartulli <ordex@autistici.org>,
Marek Lindner <lindner_marek@yahoo.de>
Subject: [PATCH 3/9] batman-adv: support array of debugfs general attributes
Date: Wed, 21 Nov 2012 13:11:53 +0100 [thread overview]
Message-ID: <1353499919-28596-4-git-send-email-ordex@autistici.org> (raw)
In-Reply-To: <1353499919-28596-1-git-send-email-ordex@autistici.org>
This patch adds support for an array of debugfs general (not soft_iface
specific) attributes. With this change it will be possible to add more general
attributes by simply appending them to the array without touching the rest of
the code.
Reported-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Acked-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
net/batman-adv/debugfs.c | 34 +++++++++++++++++++++++++---------
1 file changed, 25 insertions(+), 9 deletions(-)
diff --git a/net/batman-adv/debugfs.c b/net/batman-adv/debugfs.c
index 3f679cb..6f58ddd 100644
--- a/net/batman-adv/debugfs.c
+++ b/net/batman-adv/debugfs.c
@@ -323,7 +323,17 @@ struct batadv_debuginfo batadv_debuginfo_##_name = { \
} \
};
+/* the following attributes are general and therefore they will be directly
+ * placed in the BATADV_DEBUGFS_SUBDIR subdirectory of debugfs
+ */
static BATADV_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open);
+
+static struct batadv_debuginfo *batadv_general_debuginfos[] = {
+ &batadv_debuginfo_routing_algos,
+ NULL,
+};
+
+/* The following attributes are per soft interface */
static BATADV_DEBUGINFO(originators, S_IRUGO, batadv_originators_open);
static BATADV_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open);
static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
@@ -358,7 +368,7 @@ static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
void batadv_debugfs_init(void)
{
- struct batadv_debuginfo *bat_debug;
+ struct batadv_debuginfo **bat_debug;
struct dentry *file;
batadv_debugfs = debugfs_create_dir(BATADV_DEBUGFS_SUBDIR, NULL);
@@ -366,17 +376,23 @@ void batadv_debugfs_init(void)
batadv_debugfs = NULL;
if (!batadv_debugfs)
- goto out;
+ goto err;
- bat_debug = &batadv_debuginfo_routing_algos;
- file = debugfs_create_file(bat_debug->attr.name,
- S_IFREG | bat_debug->attr.mode,
- batadv_debugfs, NULL, &bat_debug->fops);
- if (!file)
- pr_err("Can't add debugfs file: %s\n", bat_debug->attr.name);
+ for (bat_debug = batadv_general_debuginfos; *bat_debug; ++bat_debug) {
+ file = debugfs_create_file(((*bat_debug)->attr).name,
+ S_IFREG | ((*bat_debug)->attr).mode,
+ batadv_debugfs, NULL,
+ &(*bat_debug)->fops);
+ if (!file) {
+ pr_err("Can't add general debugfs file: %s\n",
+ ((*bat_debug)->attr).name);
+ goto err;
+ }
+ }
-out:
return;
+err:
+ debugfs_remove_recursive(batadv_debugfs);
}
void batadv_debugfs_destroy(void)
--
1.8.0
next prev parent reply other threads:[~2012-11-21 12:12 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-21 12:11 pull request: batman-adv 2012-11-21 Antonio Quartulli
2012-11-21 12:11 ` [PATCH 1/9] batman-adv: Mark best gateway in transtable_global debugfs Antonio Quartulli
2012-11-21 12:11 ` [PATCH 2/9] batman-adv: fix bla compare function Antonio Quartulli
2012-11-21 12:11 ` Antonio Quartulli [this message]
2012-11-21 12:11 ` [PATCH 4/9] batman-adv: Add wrapper to look up neighbor and send skb Antonio Quartulli
2012-11-21 12:11 ` [PATCH 5/9] batman-adv: sysfs documentation should keep alphabetical order Antonio Quartulli
2012-11-21 12:11 ` [PATCH 6/9] batman-adv: Add function to calculate crc32c for the skb payload Antonio Quartulli
2012-11-21 12:11 ` [PATCH 7/9] batman-adv: Fix broadcast duplist for fragmentation Antonio Quartulli
2012-11-21 12:11 ` [PATCH 8/9] batman-adv: Start new development cycle Antonio Quartulli
2012-11-21 12:11 ` [PATCH 9/9] batman-adv: Use packing of 2 for all headers before an ethernet header Antonio Quartulli
2012-11-21 13:36 ` David Laight
[not found] ` <AE90C24D6B3A694183C094C60CF0A2F6026B70BB-CgBM+Bx2aUAnGFn1LkZF6NBPR1lH4CV8@public.gmane.org>
2012-11-21 13:51 ` Sven Eckelmann
2012-11-21 17:57 ` David Miller
2012-11-21 18:20 ` Sven Eckelmann
2012-11-21 20:31 ` David Miller
[not found] ` <8108710.8oNxxR0rRd-S/pmIDWWJIwhrEaHGRlFQnOel7F/LzPIcbWoRP8EXgk@public.gmane.org>
2012-11-22 8:12 ` Kevin Curtis
[not found] ` <E603DC592C92B54A89CEF6B0919A0B1CA7D5A6CC87-uLMF5YoEu3cpvdBnIIuIUrTzKHr1x449ALKb+EK9MtIAvxtiuMwx3w@public.gmane.org>
2012-11-22 8:28 ` Sven Eckelmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1353499919-28596-4-git-send-email-ordex@autistici.org \
--to=ordex@autistici.org \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=lindner_marek@yahoo.de \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox