From: Jeff Layton <jlayton@kernel.org>
To: viro@zeniv.linux.org.uk
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
miklos@szeredi.hu, gregkh@linuxfoundation.org, tj@kernel.org,
jack@suse.cz, amir73il@gmail.com, paul@paul-moore.com,
eparis@redhat.com, linux-audit@redhat.com, rafael@kernel.org
Subject: [PATCH 3/5] fsnotify: have fsnotify() take a qstr instead of a string
Date: Fri, 26 Apr 2019 14:28:45 -0400 [thread overview]
Message-ID: <20190426182847.25088-4-jlayton@kernel.org> (raw)
In-Reply-To: <20190426182847.25088-1-jlayton@kernel.org>
This means that kernfs_notify_workfn has to grow a strlen as well.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/kernfs/file.c | 6 ++++--
fs/notify/fsnotify.c | 8 ++++----
include/linux/fsnotify.h | 10 +++++-----
include/linux/fsnotify_backend.h | 4 ++--
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index ae948aaa4c53..a43283c515f4 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -885,6 +885,8 @@ static void kernfs_notify_workfn(struct work_struct *work)
list_for_each_entry(info, &kernfs_root(kn)->supers, node) {
struct kernfs_node *parent;
struct inode *inode;
+ const struct qstr name = { .name = kn->name,
+ .len = strlen(kn->name) };
/*
* We want fsnotify_modify() on @kn but as the
@@ -903,7 +905,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
p_inode = ilookup(info->sb, parent->id.ino);
if (p_inode) {
fsnotify(p_inode, FS_MODIFY | FS_EVENT_ON_CHILD,
- inode, FSNOTIFY_EVENT_INODE, kn->name, 0);
+ inode, FSNOTIFY_EVENT_INODE, &name, 0);
iput(p_inode);
}
@@ -911,7 +913,7 @@ static void kernfs_notify_workfn(struct work_struct *work)
}
fsnotify(inode, FS_MODIFY, inode, FSNOTIFY_EVENT_INODE,
- kn->name, 0);
+ &name, 0);
iput(inode);
}
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c
index fb22f76329ae..9cbb5ae11d2f 100644
--- a/fs/notify/fsnotify.c
+++ b/fs/notify/fsnotify.c
@@ -179,10 +179,10 @@ int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask
take_dentry_name_snapshot(&name, dentry);
if (path)
ret = fsnotify(p_inode, mask, path, FSNOTIFY_EVENT_PATH,
- name.name.name, 0);
+ &name.name, 0);
else
ret = fsnotify(p_inode, mask, dentry->d_inode, FSNOTIFY_EVENT_INODE,
- name.name.name, 0);
+ &name.name, 0);
release_dentry_name_snapshot(&name);
}
@@ -325,7 +325,7 @@ static void fsnotify_iter_next(struct fsnotify_iter_info *iter_info)
* notification event in whatever means they feel necessary.
*/
int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
- const unsigned char *file_name, u32 cookie)
+ const struct qstr *file_name, u32 cookie)
{
struct fsnotify_iter_info iter_info = {};
struct super_block *sb = to_tell->i_sb;
@@ -379,7 +379,7 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
*/
while (fsnotify_iter_select_report_types(&iter_info)) {
ret = send_to_group(to_tell, mask, data, data_is, cookie,
- file_name, &iter_info);
+ file_name->name, &iter_info);
if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS))
goto out;
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h
index 2de90a7e388b..66e322df78a3 100644
--- a/include/linux/fsnotify.h
+++ b/include/linux/fsnotify.h
@@ -27,7 +27,7 @@ static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry,
__u32 mask)
{
return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,
- dentry->d_name.name, 0);
+ &dentry->d_name, 0);
}
/* Notify this dentry's parent about a child's events. */
@@ -122,9 +122,9 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir,
}
fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE,
- old_name->name, fs_cookie);
+ old_name, fs_cookie);
fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE,
- moved->d_name.name, fs_cookie);
+ &moved->d_name, fs_cookie);
if (target)
fsnotify_link_count(target);
@@ -177,7 +177,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir)
take_dentry_name_snapshot(&name, dentry);
fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE,
- name.name.name, 0);
+ &name.name, 0);
release_dentry_name_snapshot(&name);
dput(parent);
@@ -217,7 +217,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct
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.name, 0);
+ fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0);
}
/*
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h
index dfc28fcb4de8..7eb7821766d5 100644
--- a/include/linux/fsnotify_backend.h
+++ b/include/linux/fsnotify_backend.h
@@ -350,7 +350,7 @@ struct fsnotify_mark {
/* main fsnotify call to send events */
extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
- const unsigned char *name, u32 cookie);
+ const struct qstr *name, u32 cookie);
extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask);
extern void __fsnotify_inode_delete(struct inode *inode);
extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt);
@@ -505,7 +505,7 @@ static inline void fsnotify_init_event(struct fsnotify_event *event,
#else
static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
- const unsigned char *name, u32 cookie)
+ const struct qstr *name, u32 cookie)
{
return 0;
}
--
2.20.1
next prev parent reply other threads:[~2019-04-26 18:28 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 18:28 [PATCH 0/5] vfs: track the dentry name length in name_snapshot Jeff Layton
2019-04-26 18:28 ` [PATCH 1/5] dcache: track the length of the string in struct name_snapshot Jeff Layton
2019-04-26 18:28 ` [PATCH 2/5] fsnotify: have fsnotify_move take a struct qstr instead of a string Jeff Layton
2019-04-26 18:28 ` Jeff Layton [this message]
2019-04-26 18:28 ` [PATCH 4/5] fsnotify: change ->handle_event and send_to_group to take a qstr Jeff Layton
2019-04-26 18:28 ` [PATCH 5/5] audit: fix audit_compare_dname_path " Jeff Layton
2019-04-26 19:02 ` Paul Moore
2019-04-26 18:51 ` [PATCH 0/5] vfs: track the dentry name length in name_snapshot Al Viro
2019-04-26 18:59 ` Paul Moore
2019-04-26 19:03 ` Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190426182847.25088-4-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=amir73il@gmail.com \
--cc=eparis@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jack@suse.cz \
--cc=linux-audit@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=paul@paul-moore.com \
--cc=rafael@kernel.org \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.