Skip to content

Commit 1acf0af

Browse files
dhowellsAl Viro
authored andcommitted
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: David Howells <dhowells@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 312b63f commit 1acf0af

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

‎fs/namei.c‎

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,6 +2192,19 @@ static int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode)
21922192
return security_inode_create(dir->dentry->d_inode, dentry, mode);
21932193
}
21942194

2195+
/*
2196+
* Attempt to atomically look up, create and open a file from a negative
2197+
* dentry.
2198+
*
2199+
* Returns 0 if successful. The file will have been created and attached to
2200+
* @file by the filesystem calling finish_open().
2201+
*
2202+
* Returns 1 if the file was looked up only or didn't need creating. The
2203+
* caller will need to perform the open themselves. @path will have been
2204+
* updated to point to the new dentry. This may be negative.
2205+
*
2206+
* Returns an error code otherwise.
2207+
*/
21952208
static int atomic_open(struct nameidata *nd, struct dentry *dentry,
21962209
struct path *path, struct file *file,
21972210
const struct open_flags *op,
@@ -2336,12 +2349,22 @@ static int atomic_open(struct nameidata *nd, struct dentry *dentry,
23362349
}
23372350

23382351
/*
2339-
* Lookup, maybe create and open the last component
2352+
* Look up and maybe create and open the last component.
23402353
*
23412354
* Must be called with i_mutex held on parent.
23422355
*
2343-
* Returns open file or NULL on success, error otherwise. NULL means no open
2344-
* was performed, only lookup.
2356+
* Returns 0 if the file was successfully atomically created (if necessary) and
2357+
* opened. In this case the file will be returned attached to @file.
2358+
*
2359+
* Returns 1 if the file was not completely opened at this time, though lookups
2360+
* and creations will have been performed and the dentry returned in @path will
2361+
* be positive upon return if O_CREAT was specified. If O_CREAT wasn't
2362+
* specified then a negative dentry may be returned.
2363+
*
2364+
* An error code is returned otherwise.
2365+
*
2366+
* FILE_CREATE will be set in @*opened if the dentry was created and will be
2367+
* cleared otherwise prior to returning.
23452368
*/
23462369
static int lookup_open(struct nameidata *nd, struct path *path,
23472370
struct file *file,

0 commit comments

Comments
 (0)