From patchwork Thu Feb 9 10:02:14 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 1509 Return-Path: Received: from nm25-vm6.bullet.mail.ukl.yahoo.com (nm25-vm6.bullet.mail.ukl.yahoo.com [217.146.177.150]) by open-mesh.org (Postfix) with SMTP id 29AA16008A2 for ; Thu, 9 Feb 2012 11:02:36 +0100 (CET) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key) header.i=@yahoo.de; dkim-adsp=none Received: from [217.146.183.180] by nm25.bullet.mail.ukl.yahoo.com with NNFMP; 09 Feb 2012 10:02:35 -0000 Received: from [77.238.184.75] by tm11.bullet.mail.ukl.yahoo.com with NNFMP; 09 Feb 2012 10:02:35 -0000 Received: from [127.0.0.1] by smtp144.mail.ukl.yahoo.com with NNFMP; 09 Feb 2012 10:02:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1328781755; bh=TOoVHzZymcGLfAylQ8zTd2CppMosCo6Cm5NkmKfspxs=; h=X-Yahoo-Newman-Id:X-Yahoo-Newman-Property:X-YMail-OSG:X-Yahoo-SMTP:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References; b=NfhJcOv52tyg4wnEXJPuxzctoRn2xqObWHUB/U8hwz2yWsrU3YU1+fjAGkATYoT5iCO3p01RgBnxYBhf4cx+3KCElUSx9ZMMSyXBtiU5wDheK6bbrR0sYr2I1Ny7ROziA2in5EyLDDyE5I8NLx1/uWJn+Vx43ZRlc0d3IfOR8U4= X-Yahoo-Newman-Id: 486212.76095.bm@smtp144.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: hD.4xWIVM1nvjncz7x8qn8CIXfLVLQ987eVPWzf.Faw8c2J NGW58pzQR.nLkOykIVFP5PDNZ5wf5bYsYhGE3Q9YgJOIr9wTaK7s7prq6s4W oh2yVGBVY4_xQBADzTWcVwHmTI0uGkCYXXphnQfQD.6ARoYfnVTs55zMa.Hz C89EIQJNRJRWZV5WyKN1PgU.Tu9_Fw0zefVtiUbBanRO_r73GbUfqTI.4yua Vx6AKs5gDty1HDzAXwMjmfuQcJHM44r2179JMLriRroK7ynvoL3UuLcJ5e94 FVXeXsI2.UWe_rCm9_.eDngYqI0Eku5nzo44dvhrA1QMtzvE.zrjhflbq8bK BGYkCPd4nbUgB6Rvi4pqCWhB6ki2gFinPJua3rYv7Lx4xLETgEbJCJ1Kbfql qow-- X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@210.177.7.38 with plain) by smtp144.mail.ukl.yahoo.com with SMTP; 09 Feb 2012 10:02:32 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 9 Feb 2012 18:02:14 +0800 Message-Id: <1328781734-2792-2-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1328781734-2792-1-git-send-email-lindner_marek@yahoo.de> References: <1328781734-2792-1-git-send-email-lindner_marek@yahoo.de> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH 2/2] batctl: warn about options that are not compiled into batman-adv X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Feb 2012 10:02:36 -0000 Signed-off-by: Marek Lindner --- 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; }