mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
fs/namei.c: update kerneldoc of atomic_open()
The comments above atomic_open() contain several errors: - atomic_open() does not return 0 if successful - @path is not updated Fix those and be more explicit about when FMODE_OPENED and FMODE_CREATED are set. Change to a full kerneldoc. Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl> Link: https://patch.msgid.link/20260710164233.827744-4-jkoolstra@xs4all.nl Reviewed-by: Paul Moore <paul@paul-moore.com> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
This commit is contained in:
parent
4886c80eef
commit
ba0e870266
26
fs/namei.c
26
fs/namei.c
|
|
@ -4336,18 +4336,26 @@ static int may_o_create(struct mnt_idmap *idmap,
|
||||||
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
|
* atomic_open() - attempt to atomically look up, create and open a file
|
||||||
* dentry.
|
* from a negative dentry.
|
||||||
|
* @path: parent directory path
|
||||||
|
* @dentry: child to ->atomic_open()
|
||||||
|
* @file: file to attach child to
|
||||||
|
* @open_flag: open flags
|
||||||
|
* @mode: create mode
|
||||||
|
* @create_error: return value from may_o_create()
|
||||||
*
|
*
|
||||||
* Returns 0 if successful. The file will have been created and attached to
|
* If a non-error dentry is returned then: when FMODE_OPENED is set,
|
||||||
* @file by the filesystem calling finish_open().
|
* the file will have been attached to @file by the filesystem calling
|
||||||
|
* finish_open(). If FMODE_OPENED isn't set, the filesystem instead called
|
||||||
|
* finish_no_open() and the caller will need to perform the open themselves.
|
||||||
*
|
*
|
||||||
* If the file was looked up only or didn't need creating, FMODE_OPENED won't
|
* FMODE_CREATED is set when the call to ->atomic_open() actually created
|
||||||
* be set. The caller will need to perform the open themselves. @path will
|
* the file.
|
||||||
* have been updated to point to the new dentry. This may be negative.
|
|
||||||
*
|
*
|
||||||
* Returns an error code otherwise.
|
* Returns the opened/looked-up dentry on success or ERR_PTR(-E) on failure.
|
||||||
|
* On error, atomic_open() consumes @dentry.
|
||||||
*/
|
*/
|
||||||
static struct dentry *atomic_open(const struct path *path, struct dentry *dentry,
|
static struct dentry *atomic_open(const struct path *path, struct dentry *dentry,
|
||||||
struct file *file,
|
struct file *file,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user