diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-08-28 12:52:22 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-26 22:20:08 -0400 |
commit | 2903ff019b346ab8d36ebbf54853c3aaf6590608 (patch) | |
tree | 962d94054765bb37bc00e977c3036e65c5fd91fe /fs/xattr.c | |
parent | a5b470ba06aa3f96999ede5feba178df6bdb134a (diff) |
switch simple cases of fget_light to fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xattr.c')
-rw-r--r-- | fs/xattr.c | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/fs/xattr.c b/fs/xattr.c index 4d45b7189e7e..14a7e2544fe3 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -399,22 +399,20 @@ SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname, | |||
399 | SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, | 399 | SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, |
400 | const void __user *,value, size_t, size, int, flags) | 400 | const void __user *,value, size_t, size, int, flags) |
401 | { | 401 | { |
402 | int fput_needed; | 402 | struct fd f = fdget(fd); |
403 | struct file *f; | ||
404 | struct dentry *dentry; | 403 | struct dentry *dentry; |
405 | int error = -EBADF; | 404 | int error = -EBADF; |
406 | 405 | ||
407 | f = fget_light(fd, &fput_needed); | 406 | if (!f.file) |
408 | if (!f) | ||
409 | return error; | 407 | return error; |
410 | dentry = f->f_path.dentry; | 408 | dentry = f.file->f_path.dentry; |
411 | audit_inode(NULL, dentry); | 409 | audit_inode(NULL, dentry); |
412 | error = mnt_want_write_file(f); | 410 | error = mnt_want_write_file(f.file); |
413 | if (!error) { | 411 | if (!error) { |
414 | error = setxattr(dentry, name, value, size, flags); | 412 | error = setxattr(dentry, name, value, size, flags); |
415 | mnt_drop_write_file(f); | 413 | mnt_drop_write_file(f.file); |
416 | } | 414 | } |
417 | fput_light(f, fput_needed); | 415 | fdput(f); |
418 | return error; | 416 | return error; |
419 | } | 417 | } |
420 | 418 | ||
@@ -495,16 +493,14 @@ SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname, | |||
495 | SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name, | 493 | SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name, |
496 | void __user *, value, size_t, size) | 494 | void __user *, value, size_t, size) |
497 | { | 495 | { |
498 | int fput_needed; | 496 | struct fd f = fdget(fd); |
499 | struct file *f; | ||
500 | ssize_t error = -EBADF; | 497 | ssize_t error = -EBADF; |
501 | 498 | ||
502 | f = fget_light(fd, &fput_needed); | 499 | if (!f.file) |
503 | if (!f) | ||
504 | return error; | 500 | return error; |
505 | audit_inode(NULL, f->f_path.dentry); | 501 | audit_inode(NULL, f.file->f_path.dentry); |
506 | error = getxattr(f->f_path.dentry, name, value, size); | 502 | error = getxattr(f.file->f_path.dentry, name, value, size); |
507 | fput_light(f, fput_needed); | 503 | fdput(f); |
508 | return error; | 504 | return error; |
509 | } | 505 | } |
510 | 506 | ||
@@ -576,16 +572,14 @@ SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list, | |||
576 | 572 | ||
577 | SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size) | 573 | SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size) |
578 | { | 574 | { |
579 | int fput_needed; | 575 | struct fd f = fdget(fd); |
580 | struct file *f; | ||
581 | ssize_t error = -EBADF; | 576 | ssize_t error = -EBADF; |
582 | 577 | ||
583 | f = fget_light(fd, &fput_needed); | 578 | if (!f.file) |
584 | if (!f) | ||
585 | return error; | 579 | return error; |
586 | audit_inode(NULL, f->f_path.dentry); | 580 | audit_inode(NULL, f.file->f_path.dentry); |
587 | error = listxattr(f->f_path.dentry, list, size); | 581 | error = listxattr(f.file->f_path.dentry, list, size); |
588 | fput_light(f, fput_needed); | 582 | fdput(f); |
589 | return error; | 583 | return error; |
590 | } | 584 | } |
591 | 585 | ||
@@ -645,22 +639,20 @@ SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname, | |||
645 | 639 | ||
646 | SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) | 640 | SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) |
647 | { | 641 | { |
648 | int fput_needed; | 642 | struct fd f = fdget(fd); |
649 | struct file *f; | ||
650 | struct dentry *dentry; | 643 | struct dentry *dentry; |
651 | int error = -EBADF; | 644 | int error = -EBADF; |
652 | 645 | ||
653 | f = fget_light(fd, &fput_needed); | 646 | if (!f.file) |
654 | if (!f) | ||
655 | return error; | 647 | return error; |
656 | dentry = f->f_path.dentry; | 648 | dentry = f.file->f_path.dentry; |
657 | audit_inode(NULL, dentry); | 649 | audit_inode(NULL, dentry); |
658 | error = mnt_want_write_file(f); | 650 | error = mnt_want_write_file(f.file); |
659 | if (!error) { | 651 | if (!error) { |
660 | error = removexattr(dentry, name); | 652 | error = removexattr(dentry, name); |
661 | mnt_drop_write_file(f); | 653 | mnt_drop_write_file(f.file); |
662 | } | 654 | } |
663 | fput_light(f, fput_needed); | 655 | fdput(f); |
664 | return error; | 656 | return error; |
665 | } | 657 | } |
666 | 658 | ||