[parisc-linux-cvs] HPUX fs cleanups

Matthew Wilcox willy@debian.org
Mon, 3 Sep 2001 23:57:32 +0100


Patch from Al Viro to make the hpux_getdents code work properly.  Nice
simplification.

Index: arch/parisc/hpux/fs.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/hpux/fs.c,v
retrieving revision 1.13
diff -u -p -r1.13 fs.c
--- fs.c	2001/08/17 06:09:41	1.13
+++ fs.c	2001/09/03 22:38:13
@@ -84,42 +84,21 @@ static int filldir(void * __buf, const c
 int hpux_getdents(unsigned int fd, struct hpux_dirent *dirent, unsigned int count)
 {
 	struct file * file;
-	struct dentry * dentry;
-	struct inode * inode;
 	struct hpux_dirent * lastdirent;
 	struct getdents_callback buf;
 	int error;
 
-	lock_kernel();
 	error = -EBADF;
 	file = fget(fd);
 	if (!file)
 		goto out;
 
-	dentry = file->f_dentry;
-	if (!dentry)
-		goto out_putf;
-
-	inode = dentry->d_inode;
-	if (!inode)
-		goto out_putf;
-
 	buf.current_dir = dirent;
 	buf.previous = NULL;
 	buf.count = count;
 	buf.error = 0;
-
-	error = -ENOTDIR;
-	if (!file->f_op || !file->f_op->readdir)
-		goto out_putf;
 
-	/*
-	 * Get the inode's semaphore to prevent changes
-	 * to the directory while we read it.
-	 */
-	down(&inode->i_sem);
-	error = file->f_op->readdir(file, &buf, filldir);
-	up(&inode->i_sem);
+	error = vfs_readdir(file, filldir, &buf);
 	if (error < 0)
 		goto out_putf;
 	error = buf.error;
@@ -132,7 +111,6 @@ int hpux_getdents(unsigned int fd, struc
 out_putf:
 	fput(file);
 out:
-	unlock_kernel();
 	return error;
 }
 

-- 
Revolutions do not require corporate support.