Replace the fd_sets in struct fdtable with an array of unsigned longs
[linux-2.6-block.git] / include / linux / fdtable.h
index 7675da2c18f724c5d6c23de05635d30cb2e467b9..158a41eed3140b9b2870f419b8ca3c95ed3a4763 100644 (file)
  */
 #define NR_OPEN_DEFAULT BITS_PER_LONG
 
-/*
- * The embedded_fd_set is a small fd_set,
- * suitable for most tasks (which open <= BITS_PER_LONG files)
- */
-struct embedded_fd_set {
-       unsigned long fds_bits[1];
-};
-
 struct fdtable {
        unsigned int max_fds;
        struct file __rcu **fd;      /* current fd array */
-       fd_set *close_on_exec;
-       fd_set *open_fds;
+       unsigned long *close_on_exec;
+       unsigned long *open_fds;
        struct rcu_head rcu;
        struct fdtable *next;
 };
 
 static inline void __set_close_on_exec(int fd, struct fdtable *fdt)
 {
-       FD_SET(fd, fdt->close_on_exec);
+       __set_bit(fd, fdt->close_on_exec);
 }
 
 static inline void __clear_close_on_exec(int fd, struct fdtable *fdt)
 {
-       FD_CLR(fd, fdt->close_on_exec);
+       __clear_bit(fd, fdt->close_on_exec);
 }
 
 static inline bool close_on_exec(int fd, const struct fdtable *fdt)
 {
-       return FD_ISSET(fd, fdt->close_on_exec);
+       return test_bit(fd, fdt->close_on_exec);
 }
 
 static inline void __set_open_fd(int fd, struct fdtable *fdt)
 {
-       FD_SET(fd, fdt->open_fds);
+       __set_bit(fd, fdt->open_fds);
 }
 
 static inline void __clear_open_fd(int fd, struct fdtable *fdt)
 {
-       FD_CLR(fd, fdt->open_fds);
+       __clear_bit(fd, fdt->open_fds);
 }
 
 static inline bool fd_is_open(int fd, const struct fdtable *fdt)
 {
-       return FD_ISSET(fd, fdt->open_fds);
+       return test_bit(fd, fdt->open_fds);
 }
 
 /*
@@ -83,8 +75,8 @@ struct files_struct {
    */
        spinlock_t file_lock ____cacheline_aligned_in_smp;
        int next_fd;
-       struct embedded_fd_set close_on_exec_init;
-       struct embedded_fd_set open_fds_init;
+       unsigned long close_on_exec_init[1];
+       unsigned long open_fds_init[1];
        struct file __rcu * fd_array[NR_OPEN_DEFAULT];
 };