From patchwork Sat Jun 23 09:49:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 2099 Return-Path: Received: from nm22.bullet.mail.ukl.yahoo.com (nm22.bullet.mail.ukl.yahoo.com [217.12.10.101]) by open-mesh.org (Postfix) with SMTP id A29FE600735 for ; Sat, 23 Jun 2012 11:49:56 +0200 (CEST) Authentication-Results: open-mesh.org; dkim=pass (1024-bit key; insecure key) header.i=@yahoo.de; dkim-adsp=pass Received: from [217.146.183.183] by nm22.bullet.mail.ukl.yahoo.com with NNFMP; 23 Jun 2012 09:49:56 -0000 Received: from [77.238.184.69] by tm14.bullet.mail.ukl.yahoo.com with NNFMP; 23 Jun 2012 09:49:56 -0000 Received: from [127.0.0.1] by smtp138.mail.ukl.yahoo.com with NNFMP; 23 Jun 2012 09:49:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.de; s=s1024; t=1340444996; bh=Hfhc2ihqtkO8TG60xEiXhBAtJgKIN1hLv7PxlYV63w0=; 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=qcOw4R4O0RwCcXxRXK3I31jr4yebhxAjyzxWfy+5VQkD/Dg9eqBwVqn+PV/aWF7/UUtnP5qIPnPnIRipKwVNqKU8Evfua3EALtQgN3eyoBNUXvNd4DVoKb2o0uDECYowV25VTNKMRlFbOkssfasiBskdNRJ7kh/+Hdqnc3s5niA= X-Yahoo-Newman-Id: 315280.31441.bm@smtp138.mail.ukl.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: xBcYdawVM1ltEnzLLZYu.fj0lKix9s8Qcj.Fe_I_t_RRALz TPr8U57rhp1gdlyu2Wn.rM6HDf_OYGHmpH22jVqppFCTDKjpgoFS9WlgCUqi BcgjbBpxVjbCWRnwNmII32XpSnFTibMTMnXsxe2QNpTdC2puXgrx0eG3nBwD HbfDcAnWqJsV5tLiYPc9oNZBuFgGsBJzrK0b40CPVCnfC47nXB9EDyDoc0s. tkkaSuigqaV8XfZ2bKFvlIIopI9R6SJzMGrk4xFNvReyvOUcG3P7VkWKa6X2 DLRl4bPFRljHhxuhvRq0ijKjVmrD66ieGBz.YMCiq.XEVrGEtpwIOuOFoNZ_ WH1iQK2RVRiYvhAMr7PKe2N8j4J9v8.AkhrHDano31GR5TMNzVqUiJNBif20 _ X-Yahoo-SMTP: tW.h3tiswBBMXO2coYcbPigGD5Lt6zY_.Zc- Received: from localhost (lindner_marek@80.214.1.31 with plain) by smtp138.mail.ukl.yahoo.com with SMTP; 23 Jun 2012 09:49:55 +0000 GMT From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 23 Jun 2012 11:49:50 +0200 Message-Id: <1340444990-5171-1-git-send-email-lindner_marek@yahoo.de> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1340444873-5063-1-git-send-email-lindner_marek@yahoo.de> References: <1340444873-5063-1-git-send-email-lindner_marek@yahoo.de> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH] batctl: purge redundant statistic code 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: Sat, 23 Jun 2012 09:49:56 -0000 Signed-off-by: Marek Lindner --- ioctl.c | 51 --------------------------------------------------- 1 files changed, 0 insertions(+), 51 deletions(-) diff --git a/ioctl.c b/ioctl.c index 92ffdb3..5056d2f 100644 --- a/ioctl.c +++ b/ioctl.c @@ -37,53 +37,6 @@ typedef unsigned long long u64; -const char proc_net_dev_path[] = "/proc/net/dev"; - -static int statistics_common_get(char *mesh_iface) -{ - FILE *fp; - char iface[IFNAMSIZ + 1], *line_ptr = NULL;; - unsigned long long rx_bytes, rx_packets, tx_bytes, tx_packets; - unsigned long tx_errors; - size_t len = 0; - int res, ret = EXIT_FAILURE; - - rx_bytes = rx_packets = tx_bytes = tx_packets = tx_errors = 0; - - fp = fopen(proc_net_dev_path, "r"); - if (!fp) { - printf("Error - can't open '%s' for read: %s\n", - proc_net_dev_path, strerror(errno)); - goto out; - } - - while (getline(&line_ptr, &len, fp) != -1) { - res = sscanf(line_ptr, " %" STR(IFNAMSIZ) "[^: \t]: %llu %llu %*d %*d %*d %*d %*d %*d %llu %llu %lu\n", - iface, &rx_bytes, &rx_packets, &tx_bytes, &tx_packets, &tx_errors); - - if (res != 6) - continue; - - if (strcmp(iface, mesh_iface) != 0) - continue; - - printf("\t%.*s: %llu\n", ETH_GSTRING_LEN, "tx", tx_packets); - printf("\t%.*s: %llu\n", ETH_GSTRING_LEN, "tx_bytes", tx_bytes); - printf("\t%.*s: %lu\n", ETH_GSTRING_LEN, "tx_errors", tx_errors); - printf("\t%.*s: %llu\n", ETH_GSTRING_LEN, "rx", rx_packets); - printf("\t%.*s: %llu\n", ETH_GSTRING_LEN, "rx_bytes", rx_bytes); - ret = EXIT_SUCCESS; - goto out; - } - - printf("Error - interface '%s' not found\n", mesh_iface); - -out: - fclose(fp); - free(line_ptr); - return ret; -} - /* code borrowed from ethtool */ static int statistics_custom_get(int fd, struct ifreq *ifr) { @@ -162,10 +115,6 @@ int ioctl_statistics_get(char *mesh_iface) goto out; } - ret = statistics_common_get(mesh_iface); - if (ret != EXIT_SUCCESS) - goto out; - ret = statistics_custom_get(fd, &ifr); out: