[PATCH 3/3] Unionfs: use vfs_ioctl

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <hch@...>, <viro@...>, <akpm@...>
Cc: <linux-kernel@...>, <linux-fsdevel@...>, Erez Zadok <ezk@...>
Date: Saturday, October 27, 2007 - 7:10 pm

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
---
 fs/unionfs/commonfops.c |   32 ++++++--------------------------
 1 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/fs/unionfs/commonfops.c b/fs/unionfs/commonfops.c
index 50e5775..c99b519 100644
--- a/fs/unionfs/commonfops.c
+++ b/fs/unionfs/commonfops.c
@@ -661,31 +661,6 @@ out:
 	return err;
 }
 
-/* pass the ioctl to the lower fs */
-static long do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-{
-	struct file *lower_file;
-	int err;
-
-	lower_file = unionfs_lower_file(file);
-
-	err = -ENOTTY;
-	if (!lower_file || !lower_file->f_op)
-		goto out;
-	if (lower_file->f_op->unlocked_ioctl) {
-		err = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
-	} else if (lower_file->f_op->ioctl) {
-		lock_kernel();
-		err = lower_file->f_op->ioctl(
-			lower_file->f_path.dentry->d_inode,
-			lower_file, cmd, arg);
-		unlock_kernel();
-	}
-
-out:
-	return err;
-}
-
 /*
  * return to user-space the branch indices containing the file in question
  *
@@ -752,6 +727,7 @@ out:
 long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	long err;
+	struct file *lower_file;
 
 	unionfs_read_lock(file->f_path.dentry->d_sb);
 
@@ -775,7 +751,11 @@ long unionfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 	default:
 		/* pass the ioctl down */
-		err = do_ioctl(file, cmd, arg);
+		lower_file = unionfs_lower_file(file);
+		if (lower_file)
+			err = vfs_ioctl(lower_file, cmd, arg);
+		else
+			err = -ENOTTY;
 		break;
 	}
 
-- 
1.5.2.2

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/3] VFS: swap do_ioctl and vfs_ioctl names, Erez Zadok, (Sat Oct 27, 7:10 pm)
Re: [PATCH 2/3] VFS: swap do_ioctl and vfs_ioctl names, Christoph Hellwig, (Sun Oct 28, 10:14 am)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c, Christoph Hellwig, (Sun Oct 28, 10:12 am)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c, Daniel Phillips, (Sun Oct 28, 10:57 pm)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c, Christoph Hellwig, (Tue Oct 30, 5:55 am)
Re: [PATCH 1/3] VFS: apply coding standards to fs/ioctl.c, Christoph Hellwig, (Tue Oct 30, 5:54 am)
[PATCH 3/3] Unionfs: use vfs_ioctl, Erez Zadok, (Sat Oct 27, 7:10 pm)