b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven.eckelmann@gmx.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: Arnd Bergmann <arnd@arndb.de>
Subject: [B.A.T.M.A.N.] [PATCH] batctl: Mark debugfs files as nonseekable
Date: Thu, 16 Sep 2010 11:30:07 +0200	[thread overview]
Message-ID: <1284629407-20394-1-git-send-email-sven.eckelmann@gmx.de> (raw)
In-Reply-To: <1284589835-26617-1-git-send-email-sven.eckelmann@gmx.de>

We don't allow to seek in the debugfs socket and log files. Thus we
should mark the file descriptor as nonseekable.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
Cc: Arnd Bergmann <arnd@arndb.de>
---
I think it is according to Arnd's patch the cleanest version to say that
those files are nonseekable.

 batman-adv/bat_debugfs.c |    2 ++
 batman-adv/icmp_socket.c |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/batman-adv/bat_debugfs.c b/batman-adv/bat_debugfs.c
index c73ce4a..bd4a12e 100644
--- a/batman-adv/bat_debugfs.c
+++ b/batman-adv/bat_debugfs.c
@@ -93,6 +93,7 @@ int debug_log(struct bat_priv *bat_priv, char *fmt, ...)
 
 static int log_open(struct inode *inode, struct file *file)
 {
+	nonseekable_open(inode, file);
 	file->private_data = inode->i_private;
 	inc_module_count();
 	return 0;
@@ -177,6 +178,7 @@ static const struct file_operations log_fops = {
 	.release        = log_release,
 	.read           = log_read,
 	.poll           = log_poll,
+	.llseek         = no_llseek,
 };
 
 static int debug_log_setup(struct bat_priv *bat_priv)
diff --git a/batman-adv/icmp_socket.c b/batman-adv/icmp_socket.c
index 85c047b..aa64ff8 100644
--- a/batman-adv/icmp_socket.c
+++ b/batman-adv/icmp_socket.c
@@ -47,6 +47,8 @@ static int bat_socket_open(struct inode *inode, struct file *file)
 	unsigned int i;
 	struct socket_client *socket_client;
 
+	nonseekable_open(inode, file);
+
 	socket_client = kmalloc(sizeof(struct socket_client), GFP_KERNEL);
 
 	if (!socket_client)
@@ -285,6 +287,7 @@ static const struct file_operations fops = {
 	.read = bat_socket_read,
 	.write = bat_socket_write,
 	.poll = bat_socket_poll,
+	.llseek = no_llseek,
 };
 
 int bat_socket_setup(struct bat_priv *bat_priv)
-- 
1.7.2.3


  parent reply	other threads:[~2010-09-16  9:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15 22:30 [B.A.T.M.A.N.] [PATCH] batman-ad: automatically add .llseek fop Sven Eckelmann
2010-09-15 23:44 ` Andrew Lunn
2010-09-16  8:19   ` Sven Eckelmann
2010-09-16  9:30 ` Sven Eckelmann [this message]
2010-09-16  9:34   ` [B.A.T.M.A.N.] [PATCHv2] batman-adv: Mark debugfs files as nonseekable Sven Eckelmann
2010-09-16 12:51   ` [B.A.T.M.A.N.] [PATCH] batctl: " Arnd Bergmann
2010-09-16 13:16     ` [B.A.T.M.A.N.] [PATCH] batman-adv: " Sven Eckelmann
2010-09-18 11:14       ` 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=1284629407-20394-1-git-send-email-sven.eckelmann@gmx.de \
    --to=sven.eckelmann@gmx.de \
    --cc=arnd@arndb.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).