aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/kernel/kspd.c2
-rw-r--r--fs/exec.c2
-rw-r--r--fs/select.c10
-rw-r--r--include/linux/posix_types.h18
-rw-r--r--include/linux/time.h8
-rw-r--r--kernel/exit.c2
-rw-r--r--security/selinux/hooks.c2
7 files changed, 12 insertions, 32 deletions
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 84d0639e4580..b77f56bbb477 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -323,7 +323,7 @@ static void sp_cleanup(void)
323 fdt = files_fdtable(files); 323 fdt = files_fdtable(files);
324 for (;;) { 324 for (;;) {
325 unsigned long set; 325 unsigned long set;
326 i = j * __NFDBITS; 326 i = j * BITS_PER_LONG;
327 if (i >= fdt->max_fds) 327 if (i >= fdt->max_fds)
328 break; 328 break;
329 set = fdt->open_fds[j++]; 329 set = fdt->open_fds[j++];
diff --git a/fs/exec.c b/fs/exec.c
index da27b91ff1e8..e95aeeddd25c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1020,7 +1020,7 @@ static void flush_old_files(struct files_struct * files)
1020 unsigned long set, i; 1020 unsigned long set, i;
1021 1021
1022 j++; 1022 j++;
1023 i = j * __NFDBITS; 1023 i = j * BITS_PER_LONG;
1024 fdt = files_fdtable(files); 1024 fdt = files_fdtable(files);
1025 if (i >= fdt->max_fds) 1025 if (i >= fdt->max_fds)
1026 break; 1026 break;
diff --git a/fs/select.c b/fs/select.c
index bae321569dfa..db14c781335e 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -345,8 +345,8 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
345 struct fdtable *fdt; 345 struct fdtable *fdt;
346 346
347 /* handle last in-complete long-word first */ 347 /* handle last in-complete long-word first */
348 set = ~(~0UL << (n & (__NFDBITS-1))); 348 set = ~(~0UL << (n & (BITS_PER_LONG-1)));
349 n /= __NFDBITS; 349 n /= BITS_PER_LONG;
350 fdt = files_fdtable(current->files); 350 fdt = files_fdtable(current->files);
351 open_fds = fdt->open_fds + n; 351 open_fds = fdt->open_fds + n;
352 max = 0; 352 max = 0;
@@ -373,7 +373,7 @@ get_max:
373 max++; 373 max++;
374 set >>= 1; 374 set >>= 1;
375 } while (set); 375 } while (set);
376 max += n * __NFDBITS; 376 max += n * BITS_PER_LONG;
377 } 377 }
378 378
379 return max; 379 return max;
@@ -435,11 +435,11 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
435 in = *inp++; out = *outp++; ex = *exp++; 435 in = *inp++; out = *outp++; ex = *exp++;
436 all_bits = in | out | ex; 436 all_bits = in | out | ex;
437 if (all_bits == 0) { 437 if (all_bits == 0) {
438 i += __NFDBITS; 438 i += BITS_PER_LONG;
439 continue; 439 continue;
440 } 440 }
441 441
442 for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) { 442 for (j = 0; j < BITS_PER_LONG; ++j, ++i, bit <<= 1) {
443 int fput_needed; 443 int fput_needed;
444 if (i >= n) 444 if (i >= n)
445 break; 445 break;
diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h
index f04c98cf44f3..988f76e636e3 100644
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -15,26 +15,14 @@
15 */ 15 */
16 16
17/* 17/*
18 * Those macros may have been defined in <gnu/types.h>. But we always 18 * This macro may have been defined in <gnu/types.h>. But we always
19 * use the ones here. 19 * use the one here.
20 */ 20 */
21#undef __NFDBITS
22#define __NFDBITS (8 * sizeof(unsigned long))
23
24#undef __FD_SETSIZE 21#undef __FD_SETSIZE
25#define __FD_SETSIZE 1024 22#define __FD_SETSIZE 1024
26 23
27#undef __FDSET_LONGS
28#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS)
29
30#undef __FDELT
31#define __FDELT(d) ((d) / __NFDBITS)
32
33#undef __FDMASK
34#define __FDMASK(d) (1UL << ((d) % __NFDBITS))
35
36typedef struct { 24typedef struct {
37 unsigned long fds_bits [__FDSET_LONGS]; 25 unsigned long fds_bits[__FD_SETSIZE / (8 * sizeof(long))];
38} __kernel_fd_set; 26} __kernel_fd_set;
39 27
40/* Type of a signal handler. */ 28/* Type of a signal handler. */
diff --git a/include/linux/time.h b/include/linux/time.h
index 179f4d6755fc..c81c5e40fcb5 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -257,14 +257,6 @@ static __always_inline void timespec_add_ns(struct timespec *a, u64 ns)
257 257
258#endif /* __KERNEL__ */ 258#endif /* __KERNEL__ */
259 259
260#define NFDBITS __NFDBITS
261
262#define FD_SETSIZE __FD_SETSIZE
263#define FD_SET(fd,fdsetp) __FD_SET(fd,fdsetp)
264#define FD_CLR(fd,fdsetp) __FD_CLR(fd,fdsetp)
265#define FD_ISSET(fd,fdsetp) __FD_ISSET(fd,fdsetp)
266#define FD_ZERO(fdsetp) __FD_ZERO(fdsetp)
267
268/* 260/*
269 * Names of the interval timers, and structure 261 * Names of the interval timers, and structure
270 * defining a timer setting: 262 * defining a timer setting:
diff --git a/kernel/exit.c b/kernel/exit.c
index d17f6c4ddfa9..f65345f9e5bb 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -483,7 +483,7 @@ static void close_files(struct files_struct * files)
483 rcu_read_unlock(); 483 rcu_read_unlock();
484 for (;;) { 484 for (;;) {
485 unsigned long set; 485 unsigned long set;
486 i = j * __NFDBITS; 486 i = j * BITS_PER_LONG;
487 if (i >= fdt->max_fds) 487 if (i >= fdt->max_fds)
488 break; 488 break;
489 set = fdt->open_fds[j++]; 489 set = fdt->open_fds[j++];
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 689fe2d22165..94c45a1531a4 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2129,7 +2129,7 @@ static inline void flush_unauthorized_files(const struct cred *cred,
2129 int fd; 2129 int fd;
2130 2130
2131 j++; 2131 j++;
2132 i = j * __NFDBITS; 2132 i = j * BITS_PER_LONG;
2133 fdt = files_fdtable(files); 2133 fdt = files_fdtable(files);
2134 if (i >= fdt->max_fds) 2134 if (i >= fdt->max_fds)
2135 break; 2135 break;