All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Linus Lüssing" <linus.luessing@web.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.net>
Subject: Re: [B.A.T.M.A.N.] /proc vis rework
Date: Sun, 13 Dec 2009 21:02:18 +0100	[thread overview]
Message-ID: <20091213200218.GA4933@Linus-Debian> (raw)
In-Reply-To: <20091213161151.GW29768@lunn.ch>


[-- Attachment #1.1: Type: text/plain, Size: 254 bytes --]

Hmm, everything related to vis-format can be removed from the
kernel(-module) as well, can't it?
This patch applying on top of your batman-adv patch should remove
the vis-format-proc entry and all this dead code if I didn't miss
anything.

Cheers, Linus

[-- Attachment #1.2: batman-adv-vis-format-rm.patch --]
[-- Type: text/x-diff, Size: 3859 bytes --]

diff -ru batman-adv-kernelland/proc.c batman-adv-kernelland2/proc.c
--- batman-adv-kernelland/proc.c	2009-12-13 20:53:50.000000000 +0100
+++ batman-adv-kernelland2/proc.c	2009-12-13 20:53:07.000000000 +0100
@@ -29,8 +29,6 @@
 #include "vis.h"
 #include "compat.h"
 
-static uint8_t vis_format = DOT_DRAW;
-
 static struct proc_dir_entry *proc_batman_dir, *proc_interface_file;
 static struct proc_dir_entry *proc_orig_interval_file, *proc_originators_file;
 static struct proc_dir_entry *proc_transt_local_file;
@@ -403,11 +401,8 @@
 	struct vis_info_entry *entries;
 	HLIST_HEAD(vis_if_list);
 	int i;
-	uint8_t current_format;
 	char tmp_addr_str[ETH_STR_LEN];
 
-	current_format = vis_format;
-
 	rcu_read_lock();
 	if (list_empty(&if_list) || (!is_vis_server())) {
 		rcu_read_unlock();
@@ -473,55 +468,6 @@
 	return single_open(file, proc_vis_read, NULL);
 }
 
-static int proc_vis_format_read(struct seq_file *seq, void *offset)
-{
-	uint8_t current_format = vis_format;
-
-	seq_printf(seq, "[%c] %s\n",
-		   (current_format == DOT_DRAW) ? 'x' : ' ',
-		   VIS_FORMAT_DD_NAME);
-	seq_printf(seq, "[%c] %s\n",
-		   (current_format == JSON) ? 'x' : ' ',
-		   VIS_FORMAT_JSON_NAME);
-	return 0;
-}
-
-static int proc_vis_format_open(struct inode *inode, struct file *file)
-{
-	return single_open(file, proc_vis_format_read, NULL);
-}
-
-static ssize_t proc_vis_format_write(struct file *file,
-				     const char __user *buffer,
-				     size_t count, loff_t *ppos)
-{
-	char *vis_format_string;
-	int not_copied = 0;
-
-	vis_format_string = kmalloc(count, GFP_KERNEL);
-
-	if (!vis_format_string)
-		return -ENOMEM;
-
-	not_copied = copy_from_user(vis_format_string, buffer, count);
-	vis_format_string[count - not_copied - 1] = 0;
-
-	if (strcmp(vis_format_string, VIS_FORMAT_DD_NAME) == 0) {
-		printk(KERN_INFO "batman-adv:Setting VIS output format to: %s\n",
-		       VIS_FORMAT_DD_NAME);
-		vis_format = DOT_DRAW;
-	} else if (strcmp(vis_format_string, VIS_FORMAT_JSON_NAME) == 0) {
-		printk(KERN_INFO "batman-adv:Setting VIS output format to: %s\n",
-		       VIS_FORMAT_JSON_NAME);
-		vis_format = JSON;
-	} else
-		printk(KERN_ERR "batman-adv:Unknown VIS output format: %s\n",
-		       vis_format_string);
-
-	kfree(vis_format_string);
-	return count;
-}
-
 static int proc_aggr_read(struct seq_file *seq, void *offset)
 {
 	seq_printf(seq, "%i\n", atomic_read(&aggregation_enabled));
@@ -585,15 +531,6 @@
 	.release	= single_release,
 };
 
-static const struct file_operations proc_vis_format_fops = {
-	.owner		= THIS_MODULE,
-	.open		= proc_vis_format_open,
-	.read		= seq_read,
-	.write		= proc_vis_format_write,
-	.llseek		= seq_lseek,
-	.release	= single_release,
-};
-
 static const struct file_operations proc_vis_fops = {
 	.owner		= THIS_MODULE,
 	.open		= proc_vis_open,
@@ -757,17 +694,6 @@
 		return -EFAULT;
 	}
 
-	proc_vis_format_file = create_proc_entry(PROC_FILE_VIS_FORMAT,
-						 S_IWUSR | S_IRUGO,
-						 proc_batman_dir);
-	if (proc_vis_format_file) {
-		proc_vis_format_file->proc_fops = &proc_vis_format_fops;
-	} else {
-		printk(KERN_ERR "batman-adv: Registering the '/proc/net/%s/%s' file failed\n", PROC_ROOT_DIR, PROC_FILE_VIS_FORMAT);
-		cleanup_procfs();
-		return -EFAULT;
-	}
-
 	proc_aggr_file = create_proc_entry(PROC_FILE_AGGR, S_IWUSR | S_IRUGO,
 					   proc_batman_dir);
 	if (proc_aggr_file) {
diff -ru batman-adv-kernelland/vis.h batman-adv-kernelland2/vis.h
--- batman-adv-kernelland/vis.h	2009-12-13 20:53:26.000000000 +0100
+++ batman-adv-kernelland2/vis.h	2009-12-13 20:53:07.000000000 +0100
@@ -45,11 +45,6 @@
 	uint8_t mac[ETH_ALEN];
 };
 
-enum vis_formats {
-	DOT_DRAW,
-	JSON,
-};
-
 extern struct hashtable_t *vis_hash;
 extern spinlock_t vis_hash_lock;
 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2009-12-13 20:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-30 21:14 [B.A.T.M.A.N.] /proc vis rework Andrew Lunn
2009-12-11 22:58 ` Linus Lüssing
2009-12-11 23:20   ` Linus Lüssing
2009-12-12 10:43   ` Andrew Lunn
2009-12-13 16:14   ` Andrew Lunn
2009-12-13 16:11 ` Andrew Lunn
2009-12-13 20:02   ` Linus Lüssing [this message]
2009-12-19 17:01 ` Marek Lindner
2009-12-19 17:11   ` [B.A.T.M.A.N.] [PATCH 1/5] batman-adv: moving vis output formats out of the kernel land Marek Lindner
2009-12-19 17:11     ` [B.A.T.M.A.N.] [PATCH 2/5] batctl: Parse the new /proc vis format Marek Lindner
2009-12-19 17:11       ` [B.A.T.M.A.N.] [PATCH 3/5] batman-adv: remove obsoleted vis_format /proc file Marek Lindner
2009-12-19 17:11         ` [B.A.T.M.A.N.] [PATCH 4/5] batman-adv: splitting /proc vis file into vis_server and vis_data Marek Lindner
2009-12-19 17:11           ` [B.A.T.M.A.N.] [PATCH 5/5] batctl: adjust vis data file path 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=20091213200218.GA4933@Linus-Debian \
    --to=linus.luessing@web.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.