mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
vfs: improve i_op->atomic_open() documentation
Fix documentation of ->atomic_open() and related functions: finish_open() and finish_no_open(). Also add details that seem to be unclear and a source of bugs (some of which are fixed in the following series). Cc-ing maintainers of all filesystems implementing ->atomic_open(). Signed-off-by: Miklos Szeredi <[email protected]> Cc: Eric Van Hensbergen <[email protected]> Cc: Sage Weil <[email protected]> Cc: Steve French <[email protected]> Cc: Steven Whitehouse <[email protected]> Cc: Trond Myklebust <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
606035e76e
commit
0854d450e2
2 changed files with 25 additions and 10 deletions
21
fs/open.c
21
fs/open.c
|
|
@ -744,14 +744,24 @@ cleanup_file:
|
|||
|
||||
/**
|
||||
* finish_open - finish opening a file
|
||||
* @od: opaque open data
|
||||
* @file: file pointer
|
||||
* @dentry: pointer to dentry
|
||||
* @open: open callback
|
||||
* @opened: state of open
|
||||
*
|
||||
* This can be used to finish opening a file passed to i_op->atomic_open().
|
||||
*
|
||||
* If the open callback is set to NULL, then the standard f_op->open()
|
||||
* filesystem callback is substituted.
|
||||
*
|
||||
* NB: the dentry reference is _not_ consumed. If, for example, the dentry is
|
||||
* the return value of d_splice_alias(), then the caller needs to perform dput()
|
||||
* on it after finish_open().
|
||||
*
|
||||
* On successful return @file is a fully instantiated open file. After this, if
|
||||
* an error occurs in ->atomic_open(), it needs to clean up with fput().
|
||||
*
|
||||
* Returns zero on success or -errno if the open failed.
|
||||
*/
|
||||
int finish_open(struct file *file, struct dentry *dentry,
|
||||
int (*open)(struct inode *, struct file *),
|
||||
|
|
@ -772,11 +782,16 @@ EXPORT_SYMBOL(finish_open);
|
|||
/**
|
||||
* finish_no_open - finish ->atomic_open() without opening the file
|
||||
*
|
||||
* @od: opaque open data
|
||||
* @file: file pointer
|
||||
* @dentry: dentry or NULL (as returned from ->lookup())
|
||||
*
|
||||
* This can be used to set the result of a successful lookup in ->atomic_open().
|
||||
* The filesystem's atomic_open() method shall return NULL after calling this.
|
||||
*
|
||||
* NB: unlike finish_open() this function does consume the dentry reference and
|
||||
* the caller need not dput() it.
|
||||
*
|
||||
* Returns "1" which must be the return value of ->atomic_open() after having
|
||||
* called this function.
|
||||
*/
|
||||
int finish_no_open(struct file *file, struct dentry *dentry)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue