b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Sven Eckelmann <sven@narfation.org>,
	Simon Wunderlich <sw@simonwunderlich.de>
Subject: [B.A.T.M.A.N.] [PATCH 05/16] batman-adv: Allow to use BATMAN_ADV_DEBUG without BATMAN_ADV_DEBUGFS
Date: Wed, 14 Nov 2018 15:07:53 +0100	[thread overview]
Message-ID: <20181114140804.18381-6-sw@simonwunderlich.de> (raw)
In-Reply-To: <20181114140804.18381-1-sw@simonwunderlich.de>

From: Sven Eckelmann <sven@narfation.org>

The BATMAN_ADV_DEBUGFS portion of batman-adv is marked as deprecated. Thus
all required functionality should be available without it. The debug log
was already modified to also output via the kernel tracing function but
still retained its BATMAN_ADV_DEBUGFS functionality.

Separate the entry point for the debug log from the debugfs portions to
make it possible to build with BATMAN_ADV_DEBUG and without
BATMAN_ADV_DEBUGFS.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/batman-adv/Kconfig |  2 +-
 net/batman-adv/log.c   | 60 +++++++++++++++++++++++++++-----------------------
 2 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/net/batman-adv/Kconfig b/net/batman-adv/Kconfig
index f75816f58107..7b0e1fcddfa7 100644
--- a/net/batman-adv/Kconfig
+++ b/net/batman-adv/Kconfig
@@ -100,7 +100,7 @@ config BATMAN_ADV_DEBUGFS
 
 config BATMAN_ADV_DEBUG
 	bool "B.A.T.M.A.N. debugging"
-	depends on BATMAN_ADV_DEBUGFS
+	depends on BATMAN_ADV
 	help
 	  This is an option for use by developers; most people should
 	  say N here. This enables compilation of support for
diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c
index 6beb5f067810..02e55b78132f 100644
--- a/net/batman-adv/log.c
+++ b/net/batman-adv/log.c
@@ -43,6 +43,8 @@
 #include "debugfs.h"
 #include "trace.h"
 
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
+
 #define BATADV_LOG_BUFF_MASK (batadv_log_buff_len - 1)
 
 static const int batadv_log_buff_len = BATADV_LOG_BUF_LEN;
@@ -92,33 +94,6 @@ static int batadv_fdebug_log(struct batadv_priv_debug_log *debug_log,
 	return 0;
 }
 
-/**
- * batadv_debug_log() - Add debug log entry
- * @bat_priv: the bat priv with all the soft interface information
- * @fmt: format string
- *
- * Return: 0 on success or negative error number in case of failure
- */
-int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
-{
-	struct va_format vaf;
-	va_list args;
-
-	va_start(args, fmt);
-
-	vaf.fmt = fmt;
-	vaf.va = &args;
-
-	batadv_fdebug_log(bat_priv->debug_log, "[%10u] %pV",
-			  jiffies_to_msecs(jiffies), &vaf);
-
-	trace_batadv_dbg(bat_priv, &vaf);
-
-	va_end(args);
-
-	return 0;
-}
-
 static int batadv_log_open(struct inode *inode, struct file *file)
 {
 	if (!try_module_get(THIS_MODULE))
@@ -259,3 +234,34 @@ void batadv_debug_log_cleanup(struct batadv_priv *bat_priv)
 	kfree(bat_priv->debug_log);
 	bat_priv->debug_log = NULL;
 }
+
+#endif /* CONFIG_BATMAN_ADV_DEBUGFS */
+
+/**
+ * batadv_debug_log() - Add debug log entry
+ * @bat_priv: the bat priv with all the soft interface information
+ * @fmt: format string
+ *
+ * Return: 0 on success or negative error number in case of failure
+ */
+int batadv_debug_log(struct batadv_priv *bat_priv, const char *fmt, ...)
+{
+	struct va_format vaf;
+	va_list args;
+
+	va_start(args, fmt);
+
+	vaf.fmt = fmt;
+	vaf.va = &args;
+
+#ifdef CONFIG_BATMAN_ADV_DEBUGFS
+	batadv_fdebug_log(bat_priv->debug_log, "[%10u] %pV",
+			  jiffies_to_msecs(jiffies), &vaf);
+#endif
+
+	trace_batadv_dbg(bat_priv, &vaf);
+
+	va_end(args);
+
+	return 0;
+}
-- 
2.11.0


  parent reply	other threads:[~2018-11-14 14:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14 14:07 [B.A.T.M.A.N.] [PATCH 00/16] pull request for net-next: batman-adv 2018-11-14 Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 01/16] batman-adv: Start new development cycle Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 02/16] batman-adv: Drop unused lockdep include Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 03/16] batman-adv: Add includes for deprecation warning Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 04/16] batman-adv: Improve includes for trace functionality Simon Wunderlich
2018-11-14 14:07 ` Simon Wunderlich [this message]
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 06/16] batman-adv: Fix description for BATMAN_ADV_DEBUG Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 07/16] batman-adv: Add inconsistent gateway netlink dump detection Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 08/16] batman-adv: Add inconsistent hardif " Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 09/16] batman-adv: Store modification counter via hash helpers Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 10/16] batman-adv: Add inconsistent backbone netlink dump detection Simon Wunderlich
2018-11-14 14:07 ` [B.A.T.M.A.N.] [PATCH 11/16] batman-adv: Add inconsistent claim " Simon Wunderlich
2018-11-14 14:08 ` [B.A.T.M.A.N.] [PATCH 12/16] batman-adv: Add inconsistent dat " Simon Wunderlich
2018-11-14 14:08 ` [B.A.T.M.A.N.] [PATCH 13/16] batman-adv: Add inconsistent local TT " Simon Wunderlich
2018-11-14 14:08 ` [B.A.T.M.A.N.] [PATCH 14/16] batman-adv: Add inconsistent multicast " Simon Wunderlich
2018-11-14 14:08 ` [B.A.T.M.A.N.] [PATCH 15/16] batman-adv: Move CRC16 dependency to BATMAN_ADV_BLA Simon Wunderlich
2018-11-14 14:08 ` [B.A.T.M.A.N.] [PATCH 16/16] batman-adv: enable MCAST by default at compile time Simon Wunderlich
2018-11-16  0:14 ` [B.A.T.M.A.N.] [PATCH 00/16] pull request for net-next: batman-adv 2018-11-14 David Miller

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=20181114140804.18381-6-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=sven@narfation.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;
as well as URLs for NNTP newsgroup(s).