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.
Unified · Split
| @@ -341,7 +341,7 @@ static struct inode *fanotify_fid_inode(struct inode *to_tell, u32 event_mask, · 340 unmodified lines | |||
| 341 | if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS) | 341 | if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS) |
| 342 | return to_tell; | 342 | return to_tell; |
| 343 | 343 | ||
| 344 | return (struct inode *)fsnotify_data_inode(data, data_type); | 344 | return fsnotify_data_inode(data, data_type); |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group, | 347 | struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group, |
| @@ -220,12 +220,11 @@ enum fsnotify_data_type { · 219 unmodified lines | |||
| 220 | FSNOTIFY_EVENT_INODE, | 220 | FSNOTIFY_EVENT_INODE, |
| 221 | }; | 221 | }; |
| 222 | 222 | ||
| 223 | static inline const struct inode *fsnotify_data_inode(const void *data, | 223 | static inline struct inode *fsnotify_data_inode(const void *data, int data_type) |
| 224 | int data_type) | ||
| 225 | { | 224 | { |
| 226 | switch (data_type) { | 225 | switch (data_type) { |
| 227 | case FSNOTIFY_EVENT_INODE: | 226 | case FSNOTIFY_EVENT_INODE: |
| 228 | return data; | 227 | return (struct inode *)data; |
| 229 | case FSNOTIFY_EVENT_PATH: | 228 | case FSNOTIFY_EVENT_PATH: |
| 230 | return d_inode(((const struct path *)data)->dentry); | 229 | return d_inode(((const struct path *)data)->dentry); |
| 231 | default: | 230 | default: |