Skip to contentSkip to conversation

UBIFS: make debugfs files non-seekable

PATCH New Artem Bityutskiy 1 participant 1 message Mar 21, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 UBIFS: make debugfs files non-seekable

From: Artem Bityutskiy <[email protected]>

Turn the debufs files UBIFS maintains into non-seekable. Indeed, none of them is supposed to be seek'ed.

Do this by making the '.lseek()' handler to be 'no_llseek()' and by using 'nonseekable_open()' in the '.open()' operation.

This does mean an API break but this debugging API is only used by a couple of test scripts which do not rely in the 'llseek()' operation.

---
 fs/ubifs/debug.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/ubifs/debug.c +2 -2
index 01c2b02..32b93f3 100644
@@ -2753,7 +2753,7 @@ void dbg_debugfs_exit(void)
 static int open_debugfs_file(struct inode *inode, struct file *file)
 {
 	file->private_data = inode->i_private;
-	return 0;
+	return nonseekable_open(inode, file);
 }
 
 static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
@@ -2783,7 +2783,7 @@ static const struct file_operations dfs_fops = {
 	.open = open_debugfs_file,
 	.write = write_debugfs_file,
 	.owner = THIS_MODULE,
-	.llseek = default_llseek,
+	.llseek = no_llseek,
 };
 
 /**
Signature · 1 line
1.7.2.3