b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH 1/2] batctl: restate missing sysfs folder error message
@ 2012-02-09 10:02 Marek Lindner
  2012-02-09 10:02 ` [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
  0 siblings, 2 replies; 4+ messages in thread
From: Marek Lindner @ 2012-02-09 10:02 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Marek Lindner

Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
 functions.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/functions.c b/functions.c
index 0729f15..69a1385 100644
--- a/functions.c
+++ b/functions.c
@@ -113,7 +113,8 @@ static int check_sys_dir(char *dir)
 		return EXIT_SUCCESS;
 
 	printf("Error - the folder '%s' was not found within the sys filesystem\n", dir);
-	printf("Please make sure that the batman-adv kernel module is loaded\n");
+	printf("Please make sure that the batman-adv kernel module is loaded and\n");
+	printf("that you have activated your mesh by adding interfaces to batman-adv\n");
 	return EXIT_FAILURE;
 }
 
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [B.A.T.M.A.N.] [PATCH 2/2] batctl: warn about options that are not compiled into batman-adv
  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
  2012-02-26  8:43   ` 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
  1 sibling, 1 reply; 4+ messages in thread
From: Marek Lindner @ 2012-02-09 10:02 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Marek Lindner

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 1/2] batctl: restate missing sysfs folder error message
  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 ` [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 ` Marek Lindner
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2012-02-26  8:39 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, February 09, 2012 18:02:13 Marek Lindner wrote:
> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
> ---
>  functions.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Applied in revision edf8d93.

Regards,
Marek

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [B.A.T.M.A.N.] [PATCH 2/2] batctl: warn about options that are not compiled into batman-adv
  2012-02-09 10:02 ` [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:43   ` Marek Lindner
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2012-02-26  8:43 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

On Thursday, February 09, 2012 18:02:14 Marek Lindner wrote:
> 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(-)

Applied in revision 2026933.

Regards,
Marek

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-26  8:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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:43   ` 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

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).