#include <linux/fs.h>
+#include <linux/file.h>
#include <linux/module.h>
#include <linux/smp_lock.h>
#include <linux/namei.h>
/* drat - I just cannot find anything acceptable */
dput(result);
- return ERR_PTR(-ESTALE);
+ /* It might be justifiable to return ESTALE here,
+ * but the filehandle at-least looks reasonable good
+ * and it just be a permission problem, so returning
+ * -EACCESS is safer
+ */
+ return ERR_PTR(-EACCES);
err_target:
dput(target_dir);
{
struct inode *dir = dentry->d_inode;
int error;
- struct file file;
+ struct file *file;
struct getdents_callback buffer;
error = -ENOTDIR;
/*
* Open the directory ...
*/
- error = open_private_file(&file, dentry, O_RDONLY);
- if (error)
+ file = dentry_open(dget(dentry), NULL, O_RDONLY);
+ error = PTR_ERR(file);
+ if (IS_ERR(file))
goto out;
+
error = -EINVAL;
- if (!file.f_op->readdir)
+ if (!file->f_op->readdir)
goto out_close;
buffer.name = name;
while (1) {
int old_seq = buffer.sequence;
- error = vfs_readdir(&file, filldir_one, &buffer);
+ error = vfs_readdir(file, filldir_one, &buffer);
if (error < 0)
break;
}
out_close:
- close_private_file(&file);
+ fput(file);
out:
return error;
}