aboutsummaryrefslogtreecommitdiffstats
path: root/fs/select.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-28 12:52:22 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 22:20:08 -0400
commit2903ff019b346ab8d36ebbf54853c3aaf6590608 (patch)
tree962d94054765bb37bc00e977c3036e65c5fd91fe /fs/select.c
parenta5b470ba06aa3f96999ede5feba178df6bdb134a (diff)
switch simple cases of fget_light to fdget
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/select.c')
-rw-r--r--fs/select.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/select.c b/fs/select.c
index ffdd16d6e691..2ef72d965036 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -428,8 +428,6 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
428 for (i = 0; i < n; ++rinp, ++routp, ++rexp) { 428 for (i = 0; i < n; ++rinp, ++routp, ++rexp) {
429 unsigned long in, out, ex, all_bits, bit = 1, mask, j; 429 unsigned long in, out, ex, all_bits, bit = 1, mask, j;
430 unsigned long res_in = 0, res_out = 0, res_ex = 0; 430 unsigned long res_in = 0, res_out = 0, res_ex = 0;
431 const struct file_operations *f_op = NULL;
432 struct file *file = NULL;
433 431
434 in = *inp++; out = *outp++; ex = *exp++; 432 in = *inp++; out = *outp++; ex = *exp++;
435 all_bits = in | out | ex; 433 all_bits = in | out | ex;
@@ -439,20 +437,21 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
439 } 437 }
440 438
441 for (j = 0; j < BITS_PER_LONG; ++j, ++i, bit <<= 1) { 439 for (j = 0; j < BITS_PER_LONG; ++j, ++i, bit <<= 1) {
442 int fput_needed; 440 struct fd f;
443 if (i >= n) 441 if (i >= n)
444 break; 442 break;
445 if (!(bit & all_bits)) 443 if (!(bit & all_bits))
446 continue; 444 continue;
447 file = fget_light(i, &fput_needed); 445 f = fdget(i);
448 if (file) { 446 if (f.file) {
449 f_op = file->f_op; 447 const struct file_operations *f_op;
448 f_op = f.file->f_op;
450 mask = DEFAULT_POLLMASK; 449 mask = DEFAULT_POLLMASK;
451 if (f_op && f_op->poll) { 450 if (f_op && f_op->poll) {
452 wait_key_set(wait, in, out, bit); 451 wait_key_set(wait, in, out, bit);
453 mask = (*f_op->poll)(file, wait); 452 mask = (*f_op->poll)(f.file, wait);
454 } 453 }
455 fput_light(file, fput_needed); 454 fdput(f);
456 if ((mask & POLLIN_SET) && (in & bit)) { 455 if ((mask & POLLIN_SET) && (in & bit)) {
457 res_in |= bit; 456 res_in |= bit;
458 retval++; 457 retval++;
@@ -725,20 +724,17 @@ static inline unsigned int do_pollfd(struct pollfd *pollfd, poll_table *pwait)
725 mask = 0; 724 mask = 0;
726 fd = pollfd->fd; 725 fd = pollfd->fd;
727 if (fd >= 0) { 726 if (fd >= 0) {
728 int fput_needed; 727 struct fd f = fdget(fd);
729 struct file * file;
730
731 file = fget_light(fd, &fput_needed);
732 mask = POLLNVAL; 728 mask = POLLNVAL;
733 if (file != NULL) { 729 if (f.file) {
734 mask = DEFAULT_POLLMASK; 730 mask = DEFAULT_POLLMASK;
735 if (file->f_op && file->f_op->poll) { 731 if (f.file->f_op && f.file->f_op->poll) {
736 pwait->_key = pollfd->events|POLLERR|POLLHUP; 732 pwait->_key = pollfd->events|POLLERR|POLLHUP;
737 mask = file->f_op->poll(file, pwait); 733 mask = f.file->f_op->poll(f.file, pwait);
738 } 734 }
739 /* Mask out unneeded events. */ 735 /* Mask out unneeded events. */
740 mask &= pollfd->events | POLLERR | POLLHUP; 736 mask &= pollfd->events | POLLERR | POLLHUP;
741 fput_light(file, fput_needed); 737 fdput(f);
742 } 738 }
743 } 739 }
744 pollfd->revents = mask; 740 pollfd->revents = mask;