Skip to content

Commit cbcf47a

Browse files
amir73iljankara
authored andcommitted
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/[email protected] Signed-off-by: Amir Goldstein <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent c738fba commit cbcf47a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

fs/notify/fanotify/fanotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static struct inode *fanotify_fid_inode(struct inode *to_tell, u32 event_mask,
341341
if (event_mask & ALL_FSNOTIFY_DIRENT_EVENTS)
342342
return to_tell;
343343

344-
return (struct inode *)fsnotify_data_inode(data, data_type);
344+
return fsnotify_data_inode(data, data_type);
345345
}
346346

347347
struct fanotify_event *fanotify_alloc_event(struct fsnotify_group *group,

include/linux/fsnotify_backend.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,11 @@ enum fsnotify_data_type {
220220
FSNOTIFY_EVENT_INODE,
221221
};
222222

223-
static inline const struct inode *fsnotify_data_inode(const void *data,
224-
int data_type)
223+
static inline struct inode *fsnotify_data_inode(const void *data, int data_type)
225224
{
226225
switch (data_type) {
227226
case FSNOTIFY_EVENT_INODE:
228-
return data;
227+
return (struct inode *)data;
229228
case FSNOTIFY_EVENT_PATH:
230229
return d_inode(((const struct path *)data)->dentry);
231230
default:

0 commit comments

Comments
 (0)