From: Marek Lindner <lindner_marek@yahoo.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Marek Lindner <lindner_marek@yahoo.de>
Subject: [B.A.T.M.A.N.] [PATCH 2/2] batctl: warn about options that are not compiled into batman-adv
Date: Thu, 9 Feb 2012 18:02:14 +0800 [thread overview]
Message-ID: <1328781734-2792-2-git-send-email-lindner_marek@yahoo.de> (raw)
In-Reply-To: <1328781734-2792-1-git-send-email-lindner_marek@yahoo.de>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
debug.c | 4 ----
functions.c | 24 +++++++++++++++++++++++-
sys.c | 3 ---
3 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/debug.c b/debug.c
index 155f499..928f81d 100644
--- a/debug.c
+++ b/debug.c
@@ -185,9 +185,5 @@ int log_print(char *mesh_iface, int argc, char **argv)
debugfs_make_path(DEBUG_BATIF_PATH_FMT "/", mesh_iface, full_path, sizeof(full_path));
res = read_file(full_path, DEBUG_LOG, read_opt, 0, 0);
-
- if ((res != EXIT_SUCCESS) && (errno == ENOENT))
- printf("To read the debug log you need to compile the module with debugging enabled (see the README)\n");
-
return res;
}
diff --git a/functions.c b/functions.c
index 69a1385..8ce2419 100644
--- a/functions.c
+++ b/functions.c
@@ -35,11 +35,19 @@
#include "main.h"
#include "functions.h"
#include "bat-hosts.h"
+#include "sys.h"
static struct timeval start_time;
static char *host_name;
char *line_ptr = NULL;
+const char *sysfs_compile_out_param[] = {
+ SYS_LOG,
+ SYS_LOG_LEVEL,
+ SYS_BRIDGE_LOOP_AVOIDANCE,
+ NULL,
+};
+
void start_timer(void)
{
gettimeofday(&start_time, NULL);
@@ -125,6 +133,7 @@ int read_file(char *dir, char *fname, int read_opt,
struct bat_host *bat_host;
int res = EXIT_FAILURE;
float last_seen;
+ const char **ptr;
char full_path[500], *buff_ptr, *space_ptr, extra_char;
size_t len = 0;
FILE *fp = NULL;
@@ -145,8 +154,21 @@ open:
fp = fopen(full_path, "r");
if (!fp) {
- if (!(read_opt & SILENCE_ERRORS))
+ if (!(read_opt & SILENCE_ERRORS)) {
+ for (ptr = sysfs_compile_out_param; *ptr; ptr++) {
+ if (strcmp(*ptr, fname) != 0)
+ continue;
+
+ break;
+ }
+
printf("Error - can't open file '%s': %s\n", full_path, strerror(errno));
+ if (*ptr) {
+ printf("The option you called seems not to be compiled into your batman-adv kernel module.\n");
+ printf("Consult the README if you wish to learn more about compiling options into batman-adv.\n");
+ }
+ }
+
goto out;
}
diff --git a/sys.c b/sys.c
index 6cf4714..fbc8762 100644
--- a/sys.c
+++ b/sys.c
@@ -255,9 +255,6 @@ int handle_loglevel(char *mesh_iface, int argc, char **argv)
"messages related to bridge loop avoidance", "bla");
out:
- if (errno == ENOENT)
- printf("To increase the log level you need to compile the module with debugging enabled (see the README)\n");
-
free(path_buff);
return res;
}
--
1.7.5.4
next prev parent reply other threads:[~2012-02-09 10:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-09 10:02 [B.A.T.M.A.N.] [PATCH 1/2] batctl: restate missing sysfs folder error message Marek Lindner
2012-02-09 10:02 ` Marek Lindner [this message]
2012-02-26 8:43 ` [B.A.T.M.A.N.] [PATCH 2/2] batctl: warn about options that are not compiled into batman-adv Marek Lindner
2012-02-26 8:39 ` [B.A.T.M.A.N.] [PATCH 1/2] batctl: restate missing sysfs folder error message Marek Lindner
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=1328781734-2792-2-git-send-email-lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.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).