summaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-01-04 16:03:48 +0000
commit78c388aed2b7184182c08428db1de6c872d815f5 (patch)
tree4b2003b1b4ceb241a17faa995da8dd1004bb8e45 /fs/open.c
parenteb7a5bf93aaa4be1d7c6181100ab7639e74d67f7 (diff)
Merge with Linux 2.1.131 and more MIPS goodies.
(Did I mention that CVS is buggy ...)
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/fs/open.c b/fs/open.c
index e7e1e8246..05d8f9ea4 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -4,21 +4,11 @@
* Copyright (C) 1991, 1992 Linus Torvalds
*/
-#include <linux/vfs.h>
-#include <linux/types.h>
+#include <linux/mm.h>
#include <linux/utime.h>
-#include <linux/errno.h>
#include <linux/fcntl.h>
#include <linux/stat.h>
-#include <linux/string.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/tty.h>
-#include <linux/time.h>
-#include <linux/mm.h>
#include <linux/file.h>
-#include <linux/smp.h>
#include <linux/smp_lock.h>
#include <linux/quotaops.h>
@@ -626,7 +616,7 @@ out:
* for the internal routines (ie open_namei()/follow_link() etc). 00 is
* used by symlinks.
*/
-static int do_open(const char * filename, int flags, int mode, int fd)
+struct file *filp_open(const char * filename, int flags, int mode)
{
struct inode * inode;
struct dentry * dentry;
@@ -667,8 +657,7 @@ static int do_open(const char * filename, int flags, int mode, int fd)
}
f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC);
- fd_install(fd, f);
- return 0;
+ return f;
cleanup_all:
if (f->f_mode & FMODE_WRITE)
@@ -679,7 +668,19 @@ cleanup_dentry:
cleanup_file:
put_filp(f);
out:
- return error;
+ return ERR_PTR(error);
+}
+
+/* should probably go into sys_open() */
+static int do_open(const char * filename, int flags, int mode, int fd)
+{
+ struct file * f;
+
+ f = filp_open(filename, flags, mode);
+ if (IS_ERR(f))
+ return PTR_ERR(f);
+ fd_install(fd, f);
+ return 0;
}
/*
@@ -796,11 +797,11 @@ int close_fp(struct file *filp, fl_owner_t id)
printk("VFS: Close: file count is 0\n");
return 0;
}
- if (dentry->d_inode)
- locks_remove_posix(filp, id);
retval = 0;
if (filp->f_op && filp->f_op->flush)
retval = filp->f_op->flush(filp);
+ if (dentry->d_inode)
+ locks_remove_posix(filp, id);
fput(filp);
return retval;
}