Commit 5b91aca0bd462c80cf509cbc1014f803eabdc205
1 parent
fec0ebaed9
Exists in
master
and in
6 other branches
usbfs: propagate umode_t
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 8 additions and 10 deletions Side-by-side Diff
drivers/usb/core/inode.c
... | ... | @@ -270,15 +270,13 @@ |
270 | 270 | return 0; |
271 | 271 | } |
272 | 272 | |
273 | -static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t dev) | |
273 | +static struct inode *usbfs_get_inode (struct super_block *sb, umode_t mode, dev_t dev) | |
274 | 274 | { |
275 | 275 | struct inode *inode = new_inode(sb); |
276 | 276 | |
277 | 277 | if (inode) { |
278 | 278 | inode->i_ino = get_next_ino(); |
279 | - inode->i_mode = mode; | |
280 | - inode->i_uid = current_fsuid(); | |
281 | - inode->i_gid = current_fsgid(); | |
279 | + inode_init_owner(inode, NULL, mode); | |
282 | 280 | inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; |
283 | 281 | switch (mode & S_IFMT) { |
284 | 282 | default: |
... | ... | @@ -300,7 +298,7 @@ |
300 | 298 | } |
301 | 299 | |
302 | 300 | /* SMP-safe */ |
303 | -static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode, | |
301 | +static int usbfs_mknod (struct inode *dir, struct dentry *dentry, umode_t mode, | |
304 | 302 | dev_t dev) |
305 | 303 | { |
306 | 304 | struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev); |
... | ... | @@ -317,7 +315,7 @@ |
317 | 315 | return error; |
318 | 316 | } |
319 | 317 | |
320 | -static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode) | |
318 | +static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, umode_t mode) | |
321 | 319 | { |
322 | 320 | int res; |
323 | 321 | |
... | ... | @@ -328,7 +326,7 @@ |
328 | 326 | return res; |
329 | 327 | } |
330 | 328 | |
331 | -static int usbfs_create (struct inode *dir, struct dentry *dentry, int mode) | |
329 | +static int usbfs_create (struct inode *dir, struct dentry *dentry, umode_t mode) | |
332 | 330 | { |
333 | 331 | mode = (mode & S_IALLUGO) | S_IFREG; |
334 | 332 | return usbfs_mknod (dir, dentry, mode, 0); |
... | ... | @@ -489,7 +487,7 @@ |
489 | 487 | * |
490 | 488 | * This function handles both regular files and directories. |
491 | 489 | */ |
492 | -static int fs_create_by_name (const char *name, mode_t mode, | |
490 | +static int fs_create_by_name (const char *name, umode_t mode, | |
493 | 491 | struct dentry *parent, struct dentry **dentry) |
494 | 492 | { |
495 | 493 | int error = 0; |
... | ... | @@ -513,7 +511,7 @@ |
513 | 511 | mutex_lock(&parent->d_inode->i_mutex); |
514 | 512 | *dentry = lookup_one_len(name, parent, strlen(name)); |
515 | 513 | if (!IS_ERR(*dentry)) { |
516 | - if ((mode & S_IFMT) == S_IFDIR) | |
514 | + if (S_ISDIR(mode)) | |
517 | 515 | error = usbfs_mkdir (parent->d_inode, *dentry, mode); |
518 | 516 | else |
519 | 517 | error = usbfs_create (parent->d_inode, *dentry, mode); |
... | ... | @@ -524,7 +522,7 @@ |
524 | 522 | return error; |
525 | 523 | } |
526 | 524 | |
527 | -static struct dentry *fs_create_file (const char *name, mode_t mode, | |
525 | +static struct dentry *fs_create_file (const char *name, umode_t mode, | |
528 | 526 | struct dentry *parent, void *data, |
529 | 527 | const struct file_operations *fops, |
530 | 528 | uid_t uid, gid_t gid) |