Commit 1acf0af9 authored by David Howells's avatar David Howells Committed by Al Viro

VFS: Fix the banner comment on lookup_open()

Since commit 197e37d9, the banner comment on lookup_open() no longer matches
what the function returns.  It used to return a struct file pointer or NULL and
now it returns an integer and is passed the struct file pointer it is to use
amongst its arguments.  Update the comment to reflect this.

Also add a banner comment to atomic_open().
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 312b63fb
...@@ -2192,6 +2192,19 @@ static int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode) ...@@ -2192,6 +2192,19 @@ static int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode)
return security_inode_create(dir->dentry->d_inode, dentry, mode); return security_inode_create(dir->dentry->d_inode, dentry, mode);
} }
/*
* Attempt to atomically look up, create and open a file from a negative
* dentry.
*
* Returns 0 if successful. The file will have been created and attached to
* @file by the filesystem calling finish_open().
*
* Returns 1 if the file was looked up only or didn't need creating. The
* caller will need to perform the open themselves. @path will have been
* updated to point to the new dentry. This may be negative.
*
* Returns an error code otherwise.
*/
static int atomic_open(struct nameidata *nd, struct dentry *dentry, static int atomic_open(struct nameidata *nd, struct dentry *dentry,
struct path *path, struct file *file, struct path *path, struct file *file,
const struct open_flags *op, const struct open_flags *op,
...@@ -2336,12 +2349,22 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry, ...@@ -2336,12 +2349,22 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
} }
/* /*
* Lookup, maybe create and open the last component * Look up and maybe create and open the last component.
* *
* Must be called with i_mutex held on parent. * Must be called with i_mutex held on parent.
* *
* Returns open file or NULL on success, error otherwise. NULL means no open * Returns 0 if the file was successfully atomically created (if necessary) and
* was performed, only lookup. * opened. In this case the file will be returned attached to @file.
*
* Returns 1 if the file was not completely opened at this time, though lookups
* and creations will have been performed and the dentry returned in @path will
* be positive upon return if O_CREAT was specified. If O_CREAT wasn't
* specified then a negative dentry may be returned.
*
* An error code is returned otherwise.
*
* FILE_CREATE will be set in @*opened if the dentry was created and will be
* cleared otherwise prior to returning.
*/ */
static int lookup_open(struct nameidata *nd, struct path *path, static int lookup_open(struct nameidata *nd, struct path *path,
struct file *file, struct file *file,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment