Note that in fnsotify_move() and fsnotify_link() we are guaranteed that dentry->d_name won't change during the fsnotify() evaluation (by having the parent directory locked exclusive), so we don't need to fetch dentry->d_name.name in the callers. In fsnotify_dirent() the same stability of dentry->d_name is also true, but it's a bit more convoluted - there is one callchain (devpts_pty_new() -> fsnotify_create() -> fsnotify_dirent()) where the parent is _not_ locked, but on devpts ->d_name of everything is unchanging; it has neither explicit nor implicit renames.
Showing the changes to include/linux (2 of 4 files). Show all
Unified · Split
| @@ -27,7 +27,7 @@ static inline int fsnotify_dirent(struct inode *dir, struct dentry *dentry, · 26 unmodified lines | ||
| 27 | 27 | __u32 mask) |
| 28 | 28 | { |
| 29 | 29 | return fsnotify(dir, mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, |
| 30 | − dentry->d_name.name, 0); | |
| 30 | + &dentry->d_name, 0); | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | /* Notify this dentry's parent about a child's events. */ |
| @@ -111,7 +111,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, · 77 unmodified lines | ||
| 111 | 111 | __u32 old_dir_mask = FS_MOVED_FROM; |
| 112 | 112 | __u32 new_dir_mask = FS_MOVED_TO; |
| 113 | 113 | __u32 mask = FS_MOVE_SELF; |
| 114 | − const unsigned char *new_name = moved->d_name.name; | |
| 114 | + const struct qstr *new_name = &moved->d_name; | |
| 115 | 115 | |
| 116 | 116 | if (old_dir == new_dir) |
| 117 | 117 | old_dir_mask |= FS_DN_RENAME; |
| @@ -122,7 +122,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, · 4 unmodified lines | ||
| 122 | 122 | mask |= FS_ISDIR; |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | − fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name->name, | |
| 125 | + fsnotify(old_dir, old_dir_mask, source, FSNOTIFY_EVENT_INODE, old_name, | |
| 126 | 126 | fs_cookie); |
| 127 | 127 | fsnotify(new_dir, new_dir_mask, source, FSNOTIFY_EVENT_INODE, new_name, |
| 128 | 128 | fs_cookie); |
| @@ -178,7 +178,7 @@ static inline void fsnotify_nameremove(struct dentry *dentry, int isdir) · 49 unmodified lines | ||
| 178 | 178 | take_dentry_name_snapshot(&name, dentry); |
| 179 | 179 | |
| 180 | 180 | fsnotify(d_inode(parent), mask, d_inode(dentry), FSNOTIFY_EVENT_INODE, |
| 181 | − name.name.name, 0); | |
| 181 | + &name.name, 0); | |
| 182 | 182 | |
| 183 | 183 | release_dentry_name_snapshot(&name); |
| 184 | 184 | dput(parent); |
| @@ -218,7 +218,7 @@ static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct · 33 unmodified lines | ||
| 218 | 218 | fsnotify_link_count(inode); |
| 219 | 219 | audit_inode_child(dir, new_dentry, AUDIT_TYPE_CHILD_CREATE); |
| 220 | 220 | |
| 221 | − fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); | |
| 221 | + fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, &new_dentry->d_name, 0); | |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /* |
| @@ -350,7 +350,7 @@ struct fsnotify_mark { · 349 unmodified lines | ||
| 350 | 350 | |
| 351 | 351 | /* main fsnotify call to send events */ |
| 352 | 352 | extern int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, |
| 353 | − const unsigned char *name, u32 cookie); | |
| 353 | + const struct qstr *name, u32 cookie); | |
| 354 | 354 | extern int __fsnotify_parent(const struct path *path, struct dentry *dentry, __u32 mask); |
| 355 | 355 | extern void __fsnotify_inode_delete(struct inode *inode); |
| 356 | 356 | extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); |
| @@ -505,7 +505,7 @@ static inline void fsnotify_init_event(struct fsnotify_event *event, · 148 unmodified lines | ||
| 505 | 505 | #else |
| 506 | 506 | |
| 507 | 507 | static inline int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, |
| 508 | − const unsigned char *name, u32 cookie) | |
| 508 | + const struct qstr *name, u32 cookie) | |
| 509 | 509 | { |
| 510 | 510 | return 0; |
| 511 | 511 | } |