Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fsnotify: switch send_to_group() and ->handle_event to const struct qstr *

note that conditions surrounding accesses to dname in audit_watch_handle_event()
and audit_mark_handle_event() guarantee that dname won't have been NULL.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro e43e9c33 25b229df

+15 -15
+1 -1
fs/notify/dnotify/dnotify.c
··· 81 81 static int dnotify_handle_event(struct fsnotify_group *group, 82 82 struct inode *inode, 83 83 u32 mask, const void *data, int data_type, 84 - const unsigned char *file_name, u32 cookie, 84 + const struct qstr *file_name, u32 cookie, 85 85 struct fsnotify_iter_info *iter_info) 86 86 { 87 87 struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
+1 -1
fs/notify/fanotify/fanotify.c
··· 361 361 static int fanotify_handle_event(struct fsnotify_group *group, 362 362 struct inode *inode, 363 363 u32 mask, const void *data, int data_type, 364 - const unsigned char *file_name, u32 cookie, 364 + const struct qstr *file_name, u32 cookie, 365 365 struct fsnotify_iter_info *iter_info) 366 366 { 367 367 int ret = 0;
+2 -2
fs/notify/fsnotify.c
··· 195 195 static int send_to_group(struct inode *to_tell, 196 196 __u32 mask, const void *data, 197 197 int data_is, u32 cookie, 198 - const unsigned char *file_name, 198 + const struct qstr *file_name, 199 199 struct fsnotify_iter_info *iter_info) 200 200 { 201 201 struct fsnotify_group *group = NULL; ··· 379 379 */ 380 380 while (fsnotify_iter_select_report_types(&iter_info)) { 381 381 ret = send_to_group(to_tell, mask, data, data_is, cookie, 382 - file_name->name, &iter_info); 382 + file_name, &iter_info); 383 383 384 384 if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) 385 385 goto out;
+1 -1
fs/notify/inotify/inotify.h
··· 27 27 extern int inotify_handle_event(struct fsnotify_group *group, 28 28 struct inode *inode, 29 29 u32 mask, const void *data, int data_type, 30 - const unsigned char *file_name, u32 cookie, 30 + const struct qstr *file_name, u32 cookie, 31 31 struct fsnotify_iter_info *iter_info); 32 32 33 33 extern const struct fsnotify_ops inotify_fsnotify_ops;
+3 -3
fs/notify/inotify/inotify_fsnotify.c
··· 67 67 int inotify_handle_event(struct fsnotify_group *group, 68 68 struct inode *inode, 69 69 u32 mask, const void *data, int data_type, 70 - const unsigned char *file_name, u32 cookie, 70 + const struct qstr *file_name, u32 cookie, 71 71 struct fsnotify_iter_info *iter_info) 72 72 { 73 73 struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); ··· 89 89 return 0; 90 90 } 91 91 if (file_name) { 92 - len = strlen(file_name); 92 + len = strlen(file_name->name); 93 93 alloc_len += len + 1; 94 94 } 95 95 ··· 129 129 event->sync_cookie = cookie; 130 130 event->name_len = len; 131 131 if (len) 132 - strcpy(event->name, file_name); 132 + strcpy(event->name, file_name->name); 133 133 134 134 ret = fsnotify_add_event(group, fsn_event, inotify_merge); 135 135 if (ret) {
+1 -1
include/linux/fsnotify_backend.h
··· 117 117 int (*handle_event)(struct fsnotify_group *group, 118 118 struct inode *inode, 119 119 u32 mask, const void *data, int data_type, 120 - const unsigned char *file_name, u32 cookie, 120 + const struct qstr *file_name, u32 cookie, 121 121 struct fsnotify_iter_info *iter_info); 122 122 void (*free_group_priv)(struct fsnotify_group *group); 123 123 void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
+2 -2
kernel/audit_fsnotify.c
··· 164 164 static int audit_mark_handle_event(struct fsnotify_group *group, 165 165 struct inode *to_tell, 166 166 u32 mask, const void *data, int data_type, 167 - const unsigned char *dname, u32 cookie, 167 + const struct qstr *dname, u32 cookie, 168 168 struct fsnotify_iter_info *iter_info) 169 169 { 170 170 struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); ··· 188 188 } 189 189 190 190 if (mask & (FS_CREATE|FS_MOVED_TO|FS_DELETE|FS_MOVED_FROM)) { 191 - if (audit_compare_dname_path(dname, audit_mark->path, AUDIT_NAME_FULL)) 191 + if (audit_compare_dname_path(dname->name, audit_mark->path, AUDIT_NAME_FULL)) 192 192 return 0; 193 193 audit_update_mark(audit_mark, inode); 194 194 } else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
+1 -1
kernel/audit_tree.c
··· 1040 1040 static int audit_tree_handle_event(struct fsnotify_group *group, 1041 1041 struct inode *to_tell, 1042 1042 u32 mask, const void *data, int data_type, 1043 - const unsigned char *file_name, u32 cookie, 1043 + const struct qstr *file_name, u32 cookie, 1044 1044 struct fsnotify_iter_info *iter_info) 1045 1045 { 1046 1046 return 0;
+3 -3
kernel/audit_watch.c
··· 482 482 static int audit_watch_handle_event(struct fsnotify_group *group, 483 483 struct inode *to_tell, 484 484 u32 mask, const void *data, int data_type, 485 - const unsigned char *dname, u32 cookie, 485 + const struct qstr *dname, u32 cookie, 486 486 struct fsnotify_iter_info *iter_info) 487 487 { 488 488 struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); ··· 507 507 } 508 508 509 509 if (mask & (FS_CREATE|FS_MOVED_TO) && inode) 510 - audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0); 510 + audit_update_watch(parent, dname->name, inode->i_sb->s_dev, inode->i_ino, 0); 511 511 else if (mask & (FS_DELETE|FS_MOVED_FROM)) 512 - audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); 512 + audit_update_watch(parent, dname->name, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); 513 513 else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) 514 514 audit_remove_parent_watches(parent); 515 515