Commit cbcf47ad authored by Amir Goldstein's avatar Amir Goldstein Committed by Jan Kara

fsnotify: return non const from fsnotify_data_inode()

Return non const inode pointer from fsnotify_data_inode().
None of the fsnotify hooks pass const inode pointer as data and
callers often need to cast to a non const pointer.

Link: https://lore.kernel.org/r/20200708111156.24659-3-amir73il@gmail.comSigned-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent c738fbab
...@@ -341,7 +341,7 @@ static struct inode *fanotify_fid_inode(struct inode *to_tell, u32 event_mask, ...@@ -341,7 +341,7 @@ static struct inode *fanotify_fid_inode(struct inode *to_tell, u32 event_mask,
if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS) if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS)
return to_tell; return to_tell;
return (struct inode *)fsnotify_data_inode(data, data_type); return fsnotify_data_inode(data, data_type);
} }
struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group, struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,
......
...@@ -220,12 +220,11 @@ enum fsnotify_data_type { ...@@ -220,12 +220,11 @@ enum fsnotify_data_type {
FSNOTIFY_EVENT_INODE, FSNOTIFY_EVENT_INODE,
}; };
static inline const struct inode *fsnotify_data_inode(const void *data, static inline struct inode *fsnotify_data_inode(const void *data, int data_type)
int data_type)
{ {
switch (data_type) { switch (data_type) {
case FSNOTIFY_EVENT_INODE: case FSNOTIFY_EVENT_INODE:
return data; return (struct inode *)data;
case FSNOTIFY_EVENT_PATH: case FSNOTIFY_EVENT_PATH:
return d_inode(((const struct path *)data)->dentry); return d_inode(((const struct path *)data)->dentry);
default: default:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment