patch-2.3.50 linux/arch/sparc64/kernel/sys_sunos32.c
Next file: linux/arch/sparc64/lib/blockops.S
Previous file: linux/arch/sparc64/kernel/sys_sparc32.c
Back to the patch index
Back to the overall index
- Lines: 95
- Date:
Mon Mar 6 15:49:21 2000
- Orig file:
v2.3.49/linux/arch/sparc64/kernel/sys_sunos32.c
- Orig date:
Sun Feb 20 21:12:38 2000
diff -u --recursive --new-file v2.3.49/linux/arch/sparc64/kernel/sys_sunos32.c linux/arch/sparc64/kernel/sys_sunos32.c
@@ -388,13 +388,11 @@
asmlinkage int sunos_getdents(unsigned int fd, u32 u_dirent, int cnt)
{
struct file * file;
- struct inode * inode;
struct sunos_dirent * lastdirent;
struct sunos_dirent_callback buf;
int error = -EBADF;
void *dirent = (void *)A(u_dirent);
- lock_kernel();
if(fd >= SUNOS_NR_OPEN)
goto out;
@@ -402,9 +400,7 @@
if(!file)
goto out;
- error = -ENOTDIR;
- if (!file->f_op || !file->f_op->readdir)
- goto out_putf;
+ lock_kernel();
error = -EINVAL;
if(cnt < (sizeof(struct sunos_dirent) + 255))
@@ -415,10 +411,7 @@
buf.count = cnt;
buf.error = 0;
- inode = file->f_dentry->d_inode;
- down(&inode->i_sem);
- error = file->f_op->readdir(file, &buf, sunos_filldir);
- up(&inode->i_sem);
+ error = vfs_readdir(file, sunos_filldir, &buf);
if (error < 0)
goto out_putf;
@@ -430,9 +423,9 @@
}
out_putf:
+ unlock_kernel();
fput(file);
out:
- unlock_kernel();
return error;
}
@@ -481,12 +474,10 @@
void *dirent = (void *) A(u_dirent);
unsigned int *basep = (unsigned int *)A(u_basep);
struct file * file;
- struct inode * inode;
struct sunos_direntry * lastdirent;
int error = -EBADF;
struct sunos_direntry_callback buf;
- lock_kernel();
if(fd >= SUNOS_NR_OPEN)
goto out;
@@ -494,9 +485,7 @@
if(!file)
goto out;
- error = -ENOTDIR;
- if (!file->f_op || !file->f_op->readdir)
- goto out_putf;
+ lock_kernel();
error = -EINVAL;
if(cnt < (sizeof(struct sunos_direntry) + 255))
@@ -507,10 +496,7 @@
buf.count = cnt;
buf.error = 0;
- inode = file->f_dentry->d_inode;
- down(&inode->i_sem);
- error = file->f_op->readdir(file, &buf, sunos_filldirentry);
- up(&inode->i_sem);
+ error = vfs_readdir(file, sunos_filldirentry, &buf);
if (error < 0)
goto out_putf;
@@ -522,9 +508,9 @@
}
out_putf:
+ unlock_kernel();
fput(file);
out:
- unlock_kernel();
return error;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)