提交 6c9b1de1 编写于 作者: A Al Viro

document ->atomic_open() changes

Acked-by: NLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 64e1ac4d
...@@ -64,7 +64,7 @@ prototypes: ...@@ -64,7 +64,7 @@ prototypes:
void (*update_time)(struct inode *, struct timespec *, int); void (*update_time)(struct inode *, struct timespec *, int);
int (*atomic_open)(struct inode *, struct dentry *, int (*atomic_open)(struct inode *, struct dentry *,
struct file *, unsigned open_flag, struct file *, unsigned open_flag,
umode_t create_mode, int *opened); umode_t create_mode);
int (*tmpfile) (struct inode *, struct dentry *, umode_t); int (*tmpfile) (struct inode *, struct dentry *, umode_t);
locking rules: locking rules:
......
...@@ -602,3 +602,11 @@ in your dentry operations instead. ...@@ -602,3 +602,11 @@ in your dentry operations instead.
dentry separately, and it now has request_mask and query_flags arguments dentry separately, and it now has request_mask and query_flags arguments
to specify the fields and sync type requested by statx. Filesystems not to specify the fields and sync type requested by statx. Filesystems not
supporting any statx-specific features may ignore the new arguments. supporting any statx-specific features may ignore the new arguments.
--
[mandatory]
->atomic_open() calling conventions have changed. Gone is int *opened,
along with FILE_OPENED/FILE_CREATED. In place of those we have
FMODE_OPENED/FMODE_CREATED, set in file->f_mode. Additionally, return
value for 'called finish_no_open(), open it yourself' case has become
0, not 1. Since finish_no_open() itself is returning 0 now, that part
does not need any changes in ->atomic_open() instances.
...@@ -386,7 +386,7 @@ struct inode_operations { ...@@ -386,7 +386,7 @@ struct inode_operations {
ssize_t (*listxattr) (struct dentry *, char *, size_t); ssize_t (*listxattr) (struct dentry *, char *, size_t);
void (*update_time)(struct inode *, struct timespec *, int); void (*update_time)(struct inode *, struct timespec *, int);
int (*atomic_open)(struct inode *, struct dentry *, struct file *, int (*atomic_open)(struct inode *, struct dentry *, struct file *,
unsigned open_flag, umode_t create_mode, int *opened); unsigned open_flag, umode_t create_mode);
int (*tmpfile) (struct inode *, struct dentry *, umode_t); int (*tmpfile) (struct inode *, struct dentry *, umode_t);
}; };
...@@ -496,13 +496,15 @@ otherwise noted. ...@@ -496,13 +496,15 @@ otherwise noted.
atomic_open: called on the last component of an open. Using this optional atomic_open: called on the last component of an open. Using this optional
method the filesystem can look up, possibly create and open the file in method the filesystem can look up, possibly create and open the file in
one atomic operation. If it cannot perform this (e.g. the file type one atomic operation. If it wants to leave actual opening to the
turned out to be wrong) it may signal this by returning 1 instead of caller (e.g. if the file turned out to be a symlink, device, or just
usual 0 or -ve . This method is only called if the last component is something filesystem won't do atomic open for), it may signal this by
negative or needs lookup. Cached positive dentries are still handled by returning finish_no_open(file, dentry). This method is only called if
f_op->open(). If the file was created, the FILE_CREATED flag should be the last component is negative or needs lookup. Cached positive dentries
set in "opened". In case of O_EXCL the method must only succeed if the are still handled by f_op->open(). If the file was created,
file didn't exist and hence FILE_CREATED shall always be set on success. FMODE_CREATED flag should be set in file->f_mode. In case of O_EXCL
the method must only succeed if the file didn't exist and hence FMODE_CREATED
shall always be set on success.
tmpfile: called in the end of O_TMPFILE open(). Optional, equivalent to tmpfile: called in the end of O_TMPFILE open(). Optional, equivalent to
atomically creating, opening and unlinking a file in given directory. atomically creating, opening and unlinking a file in given directory.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册