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

fsnotify: use unsigned char * for dentry->d_name.name

fsnotify was using char * when it passed around the d_name.name string
internally but it is actually an unsigned char *. This patch switches
fsnotify to use unsigned and should silence some pointer signess warnings
which have popped out of xfs. I do not add -Wpointer-sign to the fsnotify
code as there are still issues with kstrdup and strlen which would pop
out needless warnings.

Signed-off-by: Eric Paris <eparis@redhat.com>

+17 -15
+1 -1
fs/namei.c
··· 2635 2635 { 2636 2636 int error; 2637 2637 int is_dir = S_ISDIR(old_dentry->d_inode->i_mode); 2638 - const char *old_name; 2638 + const unsigned char *old_name; 2639 2639 2640 2640 if (old_dentry->d_inode == new_dentry->d_inode) 2641 2641 return 0;
+3 -2
fs/notify/fsnotify.c
··· 171 171 172 172 static void send_to_group(struct fsnotify_group *group, struct inode *to_tell, 173 173 struct vfsmount *mnt, __u32 mask, void *data, 174 - int data_is, u32 cookie, const char *file_name, 174 + int data_is, u32 cookie, const unsigned char *file_name, 175 175 struct fsnotify_event **event) 176 176 { 177 177 if (!group->ops->should_send_event(group, to_tell, mnt, mask, ··· 206 206 * out to all of the registered fsnotify_group. Those groups can then use the 207 207 * notification event in whatever means they feel necessary. 208 208 */ 209 - void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, const char *file_name, u32 cookie) 209 + void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 210 + const unsigned char *file_name, u32 cookie) 210 211 { 211 212 struct fsnotify_group *group; 212 213 struct fsnotify_event *event = NULL;
+2 -2
fs/notify/notification.c
··· 370 370 * @name the filename, if available 371 371 */ 372 372 struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, void *data, 373 - int data_type, const char *name, u32 cookie, 374 - gfp_t gfp) 373 + int data_type, const unsigned char *name, 374 + u32 cookie, gfp_t gfp) 375 375 { 376 376 struct fsnotify_event *event; 377 377
+6 -6
include/linux/fsnotify.h
··· 59 59 * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir 60 60 */ 61 61 static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, 62 - const char *old_name, 62 + const unsigned char *old_name, 63 63 int isdir, struct inode *target, struct dentry *moved) 64 64 { 65 65 struct inode *source = moved->d_inode; 66 66 u32 fs_cookie = fsnotify_get_cookie(); 67 67 __u32 old_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_FROM); 68 68 __u32 new_dir_mask = (FS_EVENT_ON_CHILD | FS_MOVED_TO); 69 - const char *new_name = moved->d_name.name; 69 + const unsigned char *new_name = moved->d_name.name; 70 70 71 71 if (old_dir == new_dir) 72 72 old_dir_mask |= FS_DN_RENAME; ··· 290 290 /* 291 291 * fsnotify_oldname_init - save off the old filename before we change it 292 292 */ 293 - static inline const char *fsnotify_oldname_init(const char *name) 293 + static inline const unsigned char *fsnotify_oldname_init(const unsigned char *name) 294 294 { 295 295 return kstrdup(name, GFP_KERNEL); 296 296 } ··· 298 298 /* 299 299 * fsnotify_oldname_free - free the name we got from fsnotify_oldname_init 300 300 */ 301 - static inline void fsnotify_oldname_free(const char *old_name) 301 + static inline void fsnotify_oldname_free(const unsigned char *old_name) 302 302 { 303 303 kfree(old_name); 304 304 } 305 305 306 306 #else /* CONFIG_FSNOTIFY */ 307 307 308 - static inline const char *fsnotify_oldname_init(const char *name) 308 + static inline const char *fsnotify_oldname_init(const unsigned char *name) 309 309 { 310 310 return NULL; 311 311 } 312 312 313 - static inline void fsnotify_oldname_free(const char *old_name) 313 + static inline void fsnotify_oldname_free(const unsigned char *old_name) 314 314 { 315 315 } 316 316
+5 -4
include/linux/fsnotify_backend.h
··· 220 220 __u32 mask; /* the type of access, bitwise OR for FS_* event types */ 221 221 222 222 u32 sync_cookie; /* used to corrolate events, namely inotify mv events */ 223 - char *file_name; 223 + const unsigned char *file_name; 224 224 size_t name_len; 225 225 struct pid *tgid; 226 226 ··· 283 283 284 284 /* main fsnotify call to send events */ 285 285 extern void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 286 - const char *name, u32 cookie); 286 + const unsigned char *name, u32 cookie); 287 287 extern void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask); 288 288 extern void __fsnotify_inode_delete(struct inode *inode); 289 289 extern void __fsnotify_vfsmount_delete(struct vfsmount *mnt); ··· 402 402 403 403 /* put here because inotify does some weird stuff when destroying watches */ 404 404 extern struct fsnotify_event *fsnotify_create_event(struct inode *to_tell, __u32 mask, 405 - void *data, int data_is, const char *name, 405 + void *data, int data_is, 406 + const unsigned char *name, 406 407 u32 cookie, gfp_t gfp); 407 408 408 409 /* fanotify likes to change events after they are on lists... */ ··· 414 413 #else 415 414 416 415 static inline void fsnotify(struct inode *to_tell, __u32 mask, void *data, int data_is, 417 - const char *name, u32 cookie) 416 + const unsigned char *name, u32 cookie) 418 417 {} 419 418 420 419 static inline void __fsnotify_parent(struct path *path, struct dentry *dentry, __u32 mask)