aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-07-24 23:36:12 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-03 22:55:02 -0500
commit5b91aca0bd462c80cf509cbc1014f803eabdc205 (patch)
tree7335736cbce8c6d83e9dd060a8e4996fee7aaa34 /drivers
parentfec0ebaed9ed074392551ea7324c6668f7d527fd (diff)
usbfs: propagate umode_t
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/core/inode.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 783fde7f44c8..2b60af2ce3ba 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -270,15 +270,13 @@ static int remount(struct super_block *sb, int *flags, char *data)
270 return 0; 270 return 0;
271} 271}
272 272
273static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t dev) 273static struct inode *usbfs_get_inode (struct super_block *sb, umode_t mode, dev_t dev)
274{ 274{
275 struct inode *inode = new_inode(sb); 275 struct inode *inode = new_inode(sb);
276 276
277 if (inode) { 277 if (inode) {
278 inode->i_ino = get_next_ino(); 278 inode->i_ino = get_next_ino();
279 inode->i_mode = mode; 279 inode_init_owner(inode, NULL, mode);
280 inode->i_uid = current_fsuid();
281 inode->i_gid = current_fsgid();
282 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 280 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
283 switch (mode & S_IFMT) { 281 switch (mode & S_IFMT) {
284 default: 282 default:
@@ -300,7 +298,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de
300} 298}
301 299
302/* SMP-safe */ 300/* SMP-safe */
303static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode, 301static int usbfs_mknod (struct inode *dir, struct dentry *dentry, umode_t mode,
304 dev_t dev) 302 dev_t dev)
305{ 303{
306 struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev); 304 struct inode *inode = usbfs_get_inode(dir->i_sb, mode, dev);
@@ -317,7 +315,7 @@ static int usbfs_mknod (struct inode *dir, struct dentry *dentry, int mode,
317 return error; 315 return error;
318} 316}
319 317
320static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode) 318static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, umode_t mode)
321{ 319{
322 int res; 320 int res;
323 321
@@ -328,7 +326,7 @@ static int usbfs_mkdir (struct inode *dir, struct dentry *dentry, int mode)
328 return res; 326 return res;
329} 327}
330 328
331static int usbfs_create (struct inode *dir, struct dentry *dentry, int mode) 329static int usbfs_create (struct inode *dir, struct dentry *dentry, umode_t mode)
332{ 330{
333 mode = (mode & S_IALLUGO) | S_IFREG; 331 mode = (mode & S_IALLUGO) | S_IFREG;
334 return usbfs_mknod (dir, dentry, mode, 0); 332 return usbfs_mknod (dir, dentry, mode, 0);
@@ -489,7 +487,7 @@ static int usbfs_fill_super(struct super_block *sb, void *data, int silent)
489 * 487 *
490 * This function handles both regular files and directories. 488 * This function handles both regular files and directories.
491 */ 489 */
492static int fs_create_by_name (const char *name, mode_t mode, 490static int fs_create_by_name (const char *name, umode_t mode,
493 struct dentry *parent, struct dentry **dentry) 491 struct dentry *parent, struct dentry **dentry)
494{ 492{
495 int error = 0; 493 int error = 0;
@@ -513,7 +511,7 @@ static int fs_create_by_name (const char *name, mode_t mode,
513 mutex_lock(&parent->d_inode->i_mutex); 511 mutex_lock(&parent->d_inode->i_mutex);
514 *dentry = lookup_one_len(name, parent, strlen(name)); 512 *dentry = lookup_one_len(name, parent, strlen(name));
515 if (!IS_ERR(*dentry)) { 513 if (!IS_ERR(*dentry)) {
516 if ((mode & S_IFMT) == S_IFDIR) 514 if (S_ISDIR(mode))
517 error = usbfs_mkdir (parent->d_inode, *dentry, mode); 515 error = usbfs_mkdir (parent->d_inode, *dentry, mode);
518 else 516 else
519 error = usbfs_create (parent->d_inode, *dentry, mode); 517 error = usbfs_create (parent->d_inode, *dentry, mode);
@@ -524,7 +522,7 @@ static int fs_create_by_name (const char *name, mode_t mode,
524 return error; 522 return error;
525} 523}
526 524
527static struct dentry *fs_create_file (const char *name, mode_t mode, 525static struct dentry *fs_create_file (const char *name, umode_t mode,
528 struct dentry *parent, void *data, 526 struct dentry *parent, void *data,
529 const struct file_operations *fops, 527 const struct file_operations *fops,
530 uid_t uid, gid_t gid) 528 uid_t uid, gid_t gid)