Skip to content

Commit 3cd5eca

Browse files
author
Al Viro
committed
fsnotify: constify 'data' passed to ->handle_event()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 640eb7e commit 3cd5eca

9 files changed

Lines changed: 20 additions & 20 deletions

File tree

‎fs/notify/dnotify/dnotify.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int dnotify_handle_event(struct fsnotify_group *group,
8585
struct inode *inode,
8686
struct fsnotify_mark *inode_mark,
8787
struct fsnotify_mark *vfsmount_mark,
88-
u32 mask, void *data, int data_type,
88+
u32 mask, const void *data, int data_type,
8989
const unsigned char *file_name, u32 cookie)
9090
{
9191
struct dnotify_mark *dn_mark;

‎fs/notify/fanotify/fanotify.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ static int fanotify_get_response(struct fsnotify_group *group,
9090
static bool fanotify_should_send_event(struct fsnotify_mark *inode_mark,
9191
struct fsnotify_mark *vfsmnt_mark,
9292
u32 event_mask,
93-
void *data, int data_type)
93+
const void *data, int data_type)
9494
{
9595
__u32 marks_mask, marks_ignored_mask;
96-
struct path *path = data;
96+
const struct path *path = data;
9797

9898
pr_debug("%s: inode_mark=%p vfsmnt_mark=%p mask=%x data=%p"
9999
" data_type=%d\n", __func__, inode_mark, vfsmnt_mark,
@@ -140,7 +140,7 @@ static bool fanotify_should_send_event(struct fsnotify_mark *inode_mark,
140140
}
141141

142142
struct fanotify_event_info *fanotify_alloc_event(struct inode *inode, u32 mask,
143-
struct path *path)
143+
const struct path *path)
144144
{
145145
struct fanotify_event_info *event;
146146

@@ -177,7 +177,7 @@ static int fanotify_handle_event(struct fsnotify_group *group,
177177
struct inode *inode,
178178
struct fsnotify_mark *inode_mark,
179179
struct fsnotify_mark *fanotify_mark,
180-
u32 mask, void *data, int data_type,
180+
u32 mask, const void *data, int data_type,
181181
const unsigned char *file_name, u32 cookie)
182182
{
183183
int ret = 0;

‎fs/notify/fanotify/fanotify.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ static inline struct fanotify_event_info *FANOTIFY_E(struct fsnotify_event *fse)
4747
}
4848

4949
struct fanotify_event_info *fanotify_alloc_event(struct inode *inode, u32 mask,
50-
struct path *path);
50+
const struct path *path);

‎fs/notify/inotify/inotify.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ extern int inotify_handle_event(struct fsnotify_group *group,
2626
struct inode *inode,
2727
struct fsnotify_mark *inode_mark,
2828
struct fsnotify_mark *vfsmount_mark,
29-
u32 mask, void *data, int data_type,
29+
u32 mask, const void *data, int data_type,
3030
const unsigned char *file_name, u32 cookie);
3131

3232
extern const struct fsnotify_ops inotify_fsnotify_ops;

‎fs/notify/inotify/inotify_fsnotify.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ int inotify_handle_event(struct fsnotify_group *group,
6666
struct inode *inode,
6767
struct fsnotify_mark *inode_mark,
6868
struct fsnotify_mark *vfsmount_mark,
69-
u32 mask, void *data, int data_type,
69+
u32 mask, const void *data, int data_type,
7070
const unsigned char *file_name, u32 cookie)
7171
{
7272
struct inotify_inode_mark *i_mark;
@@ -80,7 +80,7 @@ int inotify_handle_event(struct fsnotify_group *group,
8080

8181
if ((inode_mark->mask & FS_EXCL_UNLINK) &&
8282
(data_type == FSNOTIFY_EVENT_PATH)) {
83-
struct path *path = data;
83+
const struct path *path = data;
8484

8585
if (d_unlinked(path->dentry))
8686
return 0;

‎include/linux/fsnotify_backend.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ struct fsnotify_ops {
9696
struct inode *inode,
9797
struct fsnotify_mark *inode_mark,
9898
struct fsnotify_mark *vfsmount_mark,
99-
u32 mask, void *data, int data_type,
99+
u32 mask, const void *data, int data_type,
100100
const unsigned char *file_name, u32 cookie);
101101
void (*free_group_priv)(struct fsnotify_group *group);
102102
void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);

‎kernel/audit_fsnotify.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ int audit_mark_compare(struct audit_fsnotify_mark *mark, unsigned long ino, dev_
7474
}
7575

7676
static void audit_update_mark(struct audit_fsnotify_mark *audit_mark,
77-
struct inode *inode)
77+
const struct inode *inode)
7878
{
7979
audit_mark->dev = inode ? inode->i_sb->s_dev : AUDIT_DEV_UNSET;
8080
audit_mark->ino = inode ? inode->i_ino : AUDIT_INO_UNSET;
@@ -168,22 +168,22 @@ static int audit_mark_handle_event(struct fsnotify_group *group,
168168
struct inode *to_tell,
169169
struct fsnotify_mark *inode_mark,
170170
struct fsnotify_mark *vfsmount_mark,
171-
u32 mask, void *data, int data_type,
171+
u32 mask, const void *data, int data_type,
172172
const unsigned char *dname, u32 cookie)
173173
{
174174
struct audit_fsnotify_mark *audit_mark;
175-
struct inode *inode = NULL;
175+
const struct inode *inode = NULL;
176176

177177
audit_mark = container_of(inode_mark, struct audit_fsnotify_mark, mark);
178178

179179
BUG_ON(group != audit_fsnotify_group);
180180

181181
switch (data_type) {
182182
case (FSNOTIFY_EVENT_PATH):
183-
inode = ((struct path *)data)->dentry->d_inode;
183+
inode = ((const struct path *)data)->dentry->d_inode;
184184
break;
185185
case (FSNOTIFY_EVENT_INODE):
186-
inode = (struct inode *)data;
186+
inode = (const struct inode *)data;
187187
break;
188188
default:
189189
BUG();

‎kernel/audit_tree.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ static int audit_tree_handle_event(struct fsnotify_group *group,
948948
struct inode *to_tell,
949949
struct fsnotify_mark *inode_mark,
950950
struct fsnotify_mark *vfsmount_mark,
951-
u32 mask, void *data, int data_type,
951+
u32 mask, const void *data, int data_type,
952952
const unsigned char *file_name, u32 cookie)
953953
{
954954
return 0;

‎kernel/audit_watch.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,10 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
472472
struct inode *to_tell,
473473
struct fsnotify_mark *inode_mark,
474474
struct fsnotify_mark *vfsmount_mark,
475-
u32 mask, void *data, int data_type,
475+
u32 mask, const void *data, int data_type,
476476
const unsigned char *dname, u32 cookie)
477477
{
478-
struct inode *inode;
478+
const struct inode *inode;
479479
struct audit_parent *parent;
480480

481481
parent = container_of(inode_mark, struct audit_parent, mark);
@@ -484,10 +484,10 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
484484

485485
switch (data_type) {
486486
case (FSNOTIFY_EVENT_PATH):
487-
inode = d_backing_inode(((struct path *)data)->dentry);
487+
inode = d_backing_inode(((const struct path *)data)->dentry);
488488
break;
489489
case (FSNOTIFY_EVENT_INODE):
490-
inode = (struct inode *)data;
490+
inode = (const struct inode *)data;
491491
break;
492492
default:
493493
BUG();

0 commit comments

Comments
 (0)