* [RFC][PATCH] kill do_filp_open()
@ 2007-09-27 19:08 Dave Hansen
2007-09-27 19:10 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Dave Hansen @ 2007-09-27 19:08 UTC (permalink / raw)
To: linux-kernel; +Cc: miklos, hch, Dave Hansen
This kills off the almost empty do_filp_open(). However,
let's keep filp_open() around. It does the nameidata allocation
on the stack, and also adds the AT_FDCWD argument. I think
that's enough to keep it around.
---
lxc-dave/fs/open.c | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff -puN fs/open.c~kill-do_filp_open fs/open.c
--- lxc/fs/open.c~kill-do_filp_open 2007-09-27 12:03:24.000000000 -0700
+++ lxc-dave/fs/open.c 2007-09-27 12:05:31.000000000 -0700
@@ -840,18 +840,10 @@ cleanup_file:
return ERR_PTR(error);
}
-static struct file *do_filp_open(int dfd, const char *filename, int flags,
- int mode)
-{
- int error;
- struct nameidata nd;
-
- return open_namei(dfd, filename, flags, mode, &nd);
-}
-
struct file *filp_open(const char *filename, int flags, int mode)
{
- return do_filp_open(AT_FDCWD, filename, flags, mode);
+ struct nameidata nd;
+ return open_namei(AT_FDCWD, filename, flags, mode, &nd);
}
EXPORT_SYMBOL(filp_open);
@@ -1050,20 +1042,24 @@ long do_sys_open(int dfd, const char __u
char *tmp = getname(filename);
int fd = PTR_ERR(tmp);
- if (!IS_ERR(tmp)) {
- fd = get_unused_fd_flags(flags);
- if (fd >= 0) {
- struct file *f = do_filp_open(dfd, tmp, flags, mode);
- if (IS_ERR(f)) {
- put_unused_fd(fd);
- fd = PTR_ERR(f);
- } else {
- fsnotify_open(f->f_path.dentry);
- fd_install(fd, f);
- }
+ if (IS_ERR(tmp))
+ goto out;
+
+ fd = get_unused_fd_flags(flags);
+ if (fd >= 0) {
+ struct nameidata nd;
+ struct file *f = open_namei(dfd, tmp, flags, mode, &nd);
+
+ if (IS_ERR(f)) {
+ put_unused_fd(fd);
+ fd = PTR_ERR(f);
+ } else {
+ fsnotify_open(f->f_path.dentry);
+ fd_install(fd, f);
}
- putname(tmp);
}
+ putname(tmp);
+out:
return fd;
}
_
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC][PATCH] kill do_filp_open()
2007-09-27 19:08 [RFC][PATCH] kill do_filp_open() Dave Hansen
@ 2007-09-27 19:10 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2007-09-27 19:10 UTC (permalink / raw)
To: Dave Hansen; +Cc: linux-kernel, miklos, hch
On Thu, Sep 27, 2007 at 12:08:23PM -0700, Dave Hansen wrote:
>
> This kills off the almost empty do_filp_open(). However,
> let's keep filp_open() around. It does the nameidata allocation
> on the stack, and also adds the AT_FDCWD argument. I think
> that's enough to keep it around.
So why would we not want to allocate the nameidata in open_namei?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-09-27 19:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-27 19:08 [RFC][PATCH] kill do_filp_open() Dave Hansen
2007-09-27 19:10 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®