ANDROID: Remove out-of-tree difference in fsnotify.h

commit dd5c936967 ("Merge 7e63420847 ("Merge tag 'acpi-5.7-rc1-2' of
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm") into
android-mainline") introduced a difference to the upstream tree by
discarding all changes done in include/linux/fsnotify.h.

This can be seen when comparing the difference that should have been
introduced by the merge (diff between the upstream merges)

  $ git diff 5364abc57993..7e63420847ae -- include/linux/fsnotify.h
    1 file changed, 58 insertions(+), 80 deletions(-)

... and the actual difference introduced ...

  $ git diff dd5c9369672e^1..dd5c9369672e -- include/linux/fsnotify.h
    <empty>

This reverts the out-of-tree difference.

Fixes: dd5c936967 ("Merge 7e63420847 ("Merge tag 'acpi-5.7-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm") into android-mainline")
Signed-off-by: Matthias Maennich <maennich@google.com>
Change-Id: Ia213ac6464adf95644e572c734edd7c728140a45
This commit is contained in:
Matthias Maennich
2020-05-04 11:53:53 +02:00
parent 5ff417aa55
commit 58dc0ef35a

View File

@@ -18,29 +18,63 @@
#include <linux/bug.h>
/*
* Notify this @dir inode about a change in the directory entry @dentry.
* Notify this @dir inode about a change in a child directory entry.
* The directory entry may have turned positive or negative or its inode may
* have changed (i.e. renamed over).
*
* Unlike fsnotify_parent(), the event will be reported regardless of the
* FS_EVENT_ON_CHILD mask on the parent inode.
*/
static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry,
__u32 mask)
static inline void fsnotify_name(struct inode *dir, __u32 mask,
struct inode *child,
const struct qstr *name, u32 cookie)
{
return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,
&dentry->d_name, 0);
fsnotify(dir, mask, child, FSNOTIFY_EVENT_INODE, name, cookie);
/*
* Send another flavor of the event without child inode data and
* without the specific event type (e.g. FS_CREATE|FS_IS_DIR).
* The name is relative to the dir inode the event is reported to.
*/
fsnotify(dir, FS_DIR_MODIFY, dir, FSNOTIFY_EVENT_INODE, name, 0);
}
static inline void fsnotify_dirent(struct inode *dir, struct dentry *dentry,
__u32 mask)
{
fsnotify_name(dir, mask, d_inode(dentry), &dentry->d_name, 0);
}
/*
* Simple wrapper to consolidate calls fsnotify_parent()/fsnotify() when
* an event is on a path.
* Simple wrappers to consolidate calls fsnotify_parent()/fsnotify() when
* an event is on a file/dentry.
*/
static inline int fsnotify_path(struct inode *inode, const struct path *path,
__u32 mask)
static inline void fsnotify_dentry(struct dentry *dentry, __u32 mask)
{
int ret = fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH);
struct inode *inode = d_inode(dentry);
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
fsnotify_parent(dentry, mask, inode, FSNOTIFY_EVENT_INODE);
fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
}
static inline int fsnotify_file(struct file *file, __u32 mask)
{
const struct path *path = &file->f_path;
struct inode *inode = file_inode(file);
int ret;
if (file->f_mode & FMODE_NONOTIFY)
return 0;
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
ret = fsnotify_parent(path->dentry, mask, path, FSNOTIFY_EVENT_PATH);
if (ret)
return ret;
return fsnotify(inode, mask, path, FSNOTIFY_EVENT_PATH, NULL, 0);
}
@@ -48,19 +82,16 @@ static inline int fsnotify_path(struct inode *inode, const struct path *path,
static inline int fsnotify_perm(struct file *file, int mask)
{
int ret;
const struct path *path = &file->f_path;
struct inode *inode = file_inode(file);
__u32 fsnotify_mask = 0;
if (file->f_mode & FMODE_NONOTIFY)
return 0;
if (!(mask & (MAY_READ | MAY_OPEN)))
return 0;
if (mask & MAY_OPEN) {
fsnotify_mask = FS_OPEN_PERM;
if (file->f_flags & __FMODE_EXEC) {
ret = fsnotify_path(inode, path, FS_OPEN_EXEC_PERM);
ret = fsnotify_file(file, FS_OPEN_EXEC_PERM);
if (ret)
return ret;
@@ -69,10 +100,7 @@ static inline int fsnotify_perm(struct file *file, int mask)
fsnotify_mask = FS_ACCESS_PERM;
}
if (S_ISDIR(inode->i_mode))
fsnotify_mask |= FS_ISDIR;
return fsnotify_path(inode, path, fsnotify_mask);
return fsnotify_file(file, fsnotify_mask);
}
/*
@@ -112,10 +140,8 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
mask |= FS_ISDIR;
}
fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name,
fs_cookie);
fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name,
fs_cookie);
fsnotify_name(old_dir, old_dir_mask, source, old_name, fs_cookie);
fsnotify_name(new_dir, new_dir_mask, source, new_name, fs_cookie);
if (target)
fsnotify_link_count(target);
@@ -170,12 +196,13 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry)
* Note: We have to pass also the linked inode ptr as some filesystems leave
* new_dentry->d_inode NULL and instantiate inode pointer later
*/
static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry)
static inline void fsnotify_link(struct inode *dir, struct inode *inode,
struct dentry *new_dentry)
{
fsnotify_link_count(inode);
audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE);
fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0);
fsnotify_name(dir, FS_CREATE, inode, &new_dentry->d_name, 0);
}
/*
@@ -219,15 +246,7 @@ static inline void fsnotify_rmdir(struct inode *dir, struct dentry *dentry)
*/
static inline void fsnotify_access(struct file *file)
{
const struct path *path = &file->f_path;
struct inode *inode = file_inode(file);
__u32 mask = FS_ACCESS;
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
if (!(file->f_mode & FMODE_NONOTIFY))
fsnotify_path(inode, path, mask);
fsnotify_file(file, FS_ACCESS);
}
/*
@@ -235,15 +254,7 @@ static inline void fsnotify_access(struct file *file)
*/
static inline void fsnotify_modify(struct file *file)
{
const struct path *path = &file->f_path;
struct inode *inode = file_inode(file);
__u32 mask = FS_MODIFY;
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
if (!(file->f_mode & FMODE_NONOTIFY))
fsnotify_path(inode, path, mask);
fsnotify_file(file, FS_MODIFY);
}
/*
@@ -253,21 +264,18 @@ static inline void fsnotify_open(struct file *file)
{
const struct path *path = &file->f_path;
struct path lower_path;
struct inode *inode = file_inode(file);
__u32 mask = FS_OPEN;
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
if (file->f_flags & __FMODE_EXEC)
mask |= FS_OPEN_EXEC;
if (path->dentry->d_op && path->dentry->d_op->d_canonical_path) {
path->dentry->d_op->d_canonical_path(path, &lower_path);
fsnotify_parent(lower_path.dentry, mask, &lower_path, FSNOTIFY_EVENT_PATH);
fsnotify_parent(lower_path.dentry, mask, NULL, FSNOTIFY_EVENT_PATH);
fsnotify(lower_path.dentry->d_inode, mask, &lower_path, FSNOTIFY_EVENT_PATH, NULL, 0);
path_put(&lower_path);
}
fsnotify_path(inode, path, mask);
fsnotify_file(file, mask);
}
/*
@@ -275,16 +283,10 @@ static inline void fsnotify_open(struct file *file)
*/
static inline void fsnotify_close(struct file *file)
{
const struct path *path = &file->f_path;
struct inode *inode = file_inode(file);
fmode_t mode = file->f_mode;
__u32 mask = (mode & FMODE_WRITE) ? FS_CLOSE_WRITE : FS_CLOSE_NOWRITE;
__u32 mask = (file->f_mode & FMODE_WRITE) ? FS_CLOSE_WRITE :
FS_CLOSE_NOWRITE;
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
if (!(file->f_mode & FMODE_NONOTIFY))
fsnotify_path(inode, path, mask);
fsnotify_file(file, mask);
}
/*
@@ -292,14 +294,7 @@ static inline void fsnotify_close(struct file *file)
*/
static inline void fsnotify_xattr(struct dentry *dentry)
{
struct inode *inode = dentry->d_inode;
__u32 mask = FS_ATTRIB;
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
fsnotify_parent(dentry, mask, inode, FSNOTIFY_EVENT_INODE);
fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
fsnotify_dentry(dentry, FS_ATTRIB);
}
/*
@@ -308,7 +303,6 @@ static inline void fsnotify_xattr(struct dentry *dentry)
*/
static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
{
struct inode *inode = dentry->d_inode;
__u32 mask = 0;
if (ia_valid & ATTR_UID)
@@ -329,13 +323,8 @@ static inline void fsnotify_change(struct dentry *dentry, unsigned int ia_valid)
if (ia_valid & ATTR_MODE)
mask |= FS_ATTRIB;
if (mask) {
if (S_ISDIR(inode->i_mode))
mask |= FS_ISDIR;
fsnotify_parent(dentry, mask, inode, FSNOTIFY_EVENT_INODE);
fsnotify(inode, mask, inode, FSNOTIFY_EVENT_INODE, NULL, 0);
}
if (mask)
fsnotify_dentry(dentry, mask);
}
#endif /* _LINUX_FS_NOTIFY_H */