split poll.h into commonly-used and internals-related parts
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 6cc0816..461f273 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -27,7 +27,7 @@
#include <linux/stat.h>
#include <linux/mman.h>
#include <linux/shm.h>
-#include <linux/poll.h>
+#include <linux/poll_internals.h>
#include <linux/file.h>
#include <linux/types.h>
#include <linux/ipc.h>
diff --git a/drivers/misc/mic/scif/scif_api.c b/drivers/misc/mic/scif/scif_api.c
index 8a3e48e..c6a6325 100644
--- a/drivers/misc/mic/scif/scif_api.c
+++ b/drivers/misc/mic/scif/scif_api.c
@@ -16,6 +16,7 @@
*
*/
#include <linux/scif.h>
+#include <linux/poll_internals.h>
#include "scif_main.h"
#include "scif_map.h"
diff --git a/drivers/staging/comedi/drivers/serial2002.c b/drivers/staging/comedi/drivers/serial2002.c
index 7b890a2..698bafb 100644
--- a/drivers/staging/comedi/drivers/serial2002.c
+++ b/drivers/staging/comedi/drivers/serial2002.c
@@ -36,7 +36,7 @@
#include <linux/termios.h>
#include <asm/ioctls.h>
#include <linux/serial.h>
-#include <linux/poll.h>
+#include <linux/poll_internals.h>
#include <linux/fs.h>
struct serial2002_range_table_t {
diff --git a/fs/compat.c b/fs/compat.c
index 6fd272d..5cd3e41 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -42,7 +42,7 @@
#include <linux/security.h>
#include <linux/highmem.h>
#include <linux/signal.h>
-#include <linux/poll.h>
+#include <linux/poll_internals.h>
#include <linux/mm.h>
#include <linux/fs_struct.h>
#include <linux/slab.h>
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index e52ea8a..2b6479f 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -20,7 +20,7 @@
#include <linux/errno.h>
#include <linux/mm.h>
#include <linux/slab.h>
-#include <linux/poll.h>
+#include <linux/poll_internals.h>
#include <linux/string.h>
#include <linux/list.h>
#include <linux/hash.h>
diff --git a/fs/select.c b/fs/select.c
index b764439..15d0adc 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -19,7 +19,7 @@
#include <linux/syscalls.h>
#include <linux/export.h>
#include <linux/slab.h>
-#include <linux/poll.h>
+#include <linux/poll_internals.h>
#include <linux/personality.h> /* for STICKY_TIMEOUTS */
#include <linux/file.h>
#include <linux/fdtable.h>
diff --git a/include/linux/poll.h b/include/linux/poll.h
index 8941e8f..176b24a 100644
--- a/include/linux/poll.h
+++ b/include/linux/poll.h
@@ -1,25 +1,11 @@
#ifndef _LINUX_POLL_H
#define _LINUX_POLL_H
-
#include <linux/compiler.h>
-#include <linux/ktime.h>
#include <linux/wait.h>
-#include <linux/string.h>
-#include <linux/sysctl.h>
#include <asm/uaccess.h>
#include <uapi/linux/poll.h>
-extern struct ctl_table epoll_table[]; /* for sysctl */
-/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
- additional memory. */
-#define MAX_STACK_ALLOC 832
-#define FRONTEND_STACK_ALLOC 256
-#define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC
-#define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC
-#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC)
-#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry))
-
#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
struct poll_table_struct;
@@ -71,94 +57,4 @@
pt->_qproc = qproc;
pt->_key = (__force __poll_t)~0UL; /* all events enabled */
}
-
-struct poll_table_entry {
- struct file *filp;
- __poll_t key;
- wait_queue_t wait;
- wait_queue_head_t *wait_address;
-};
-
-/*
- * Structures and helpers for select/poll syscall
- */
-struct poll_wqueues {
- poll_table pt;
- struct poll_table_page *table;
- struct task_struct *polling_task;
- int triggered;
- int error;
- int inline_index;
- struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
-};
-
-extern void poll_initwait(struct poll_wqueues *pwq);
-extern void poll_freewait(struct poll_wqueues *pwq);
-extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
- ktime_t *expires, unsigned long slack);
-extern long select_estimate_accuracy(struct timespec *tv);
-
-
-static inline int poll_schedule(struct poll_wqueues *pwq, int state)
-{
- return poll_schedule_timeout(pwq, state, NULL, 0);
-}
-
-/*
- * Scalable version of the fd_set.
- */
-
-typedef struct {
- unsigned long *in, *out, *ex;
- unsigned long *res_in, *res_out, *res_ex;
-} fd_set_bits;
-
-/*
- * How many longwords for "nr" bits?
- */
-#define FDS_BITPERLONG (8*sizeof(long))
-#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
-#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
-
-/*
- * We do a VERIFY_WRITE here even though we are only reading this time:
- * we'll write to it eventually..
- *
- * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
- */
-static inline
-int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
-{
- nr = FDS_BYTES(nr);
- if (ufdset)
- return copy_from_user(fdset, ufdset, nr) ? -EFAULT : 0;
-
- memset(fdset, 0, nr);
- return 0;
-}
-
-static inline unsigned long __must_check
-set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
-{
- if (ufdset)
- return __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
- return 0;
-}
-
-static inline
-void zero_fd_set(unsigned long nr, unsigned long *fdset)
-{
- memset(fdset, 0, FDS_BYTES(nr));
-}
-
-#define MAX_INT64_SECONDS (((s64)(~((u64)0)>>1)/HZ)-1)
-
-extern int do_select(int n, fd_set_bits *fds, struct timespec *end_time);
-extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
- struct timespec *end_time);
-extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
- fd_set __user *exp, struct timespec *end_time);
-
-extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec);
-
#endif /* _LINUX_POLL_H */
diff --git a/include/linux/poll_internals.h b/include/linux/poll_internals.h
new file mode 100644
index 0000000..68f782f
--- /dev/null
+++ b/include/linux/poll_internals.h
@@ -0,0 +1,98 @@
+#ifndef _LINUX_POLL_INTERNALS_H
+#define _LINUX_POLL_INTERNALS_H
+
+#include <linux/ktime.h>
+#include <linux/poll.h>
+#include <asm/uaccess.h>
+
+/* ~832 bytes of stack space used max in sys_select/sys_poll before allocating
+ additional memory. */
+#define MAX_STACK_ALLOC 832
+#define FRONTEND_STACK_ALLOC 256
+#define SELECT_STACK_ALLOC FRONTEND_STACK_ALLOC
+#define POLL_STACK_ALLOC FRONTEND_STACK_ALLOC
+#define WQUEUES_STACK_ALLOC (MAX_STACK_ALLOC - FRONTEND_STACK_ALLOC)
+#define N_INLINE_POLL_ENTRIES (WQUEUES_STACK_ALLOC / sizeof(struct poll_table_entry))
+
+struct poll_table_entry {
+ struct file *filp;
+ __poll_t key;
+ wait_queue_t wait;
+ wait_queue_head_t *wait_address;
+};
+
+/*
+ * Structures and helpers for select/poll syscall
+ */
+struct poll_wqueues {
+ poll_table pt;
+ struct poll_table_page *table;
+ struct task_struct *polling_task;
+ int triggered;
+ int error;
+ int inline_index;
+ struct poll_table_entry inline_entries[N_INLINE_POLL_ENTRIES];
+};
+
+extern void poll_initwait(struct poll_wqueues *pwq);
+extern void poll_freewait(struct poll_wqueues *pwq);
+extern int poll_schedule_timeout(struct poll_wqueues *pwq, int state,
+ ktime_t *expires, unsigned long slack);
+extern long select_estimate_accuracy(struct timespec *tv);
+
+/*
+ * Scalable version of the fd_set.
+ */
+
+typedef struct {
+ unsigned long *in, *out, *ex;
+ unsigned long *res_in, *res_out, *res_ex;
+} fd_set_bits;
+
+/*
+ * How many longwords for "nr" bits?
+ */
+#define FDS_BITPERLONG (8*sizeof(long))
+#define FDS_LONGS(nr) (((nr)+FDS_BITPERLONG-1)/FDS_BITPERLONG)
+#define FDS_BYTES(nr) (FDS_LONGS(nr)*sizeof(long))
+
+/*
+ * We do a VERIFY_WRITE here even though we are only reading this time:
+ * we'll write to it eventually..
+ *
+ * Use "unsigned long" accesses to let user-mode fd_set's be long-aligned.
+ */
+static inline
+int get_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
+{
+ nr = FDS_BYTES(nr);
+ if (ufdset)
+ return copy_from_user(fdset, ufdset, nr) ? -EFAULT : 0;
+
+ memset(fdset, 0, nr);
+ return 0;
+}
+
+static inline unsigned long __must_check
+set_fd_set(unsigned long nr, void __user *ufdset, unsigned long *fdset)
+{
+ if (ufdset)
+ return __copy_to_user(ufdset, fdset, FDS_BYTES(nr));
+ return 0;
+}
+
+static inline
+void zero_fd_set(unsigned long nr, unsigned long *fdset)
+{
+ memset(fdset, 0, FDS_BYTES(nr));
+}
+
+extern int do_select(int n, fd_set_bits *fds, struct timespec *end_time);
+extern int do_sys_poll(struct pollfd __user * ufds, unsigned int nfds,
+ struct timespec *end_time);
+extern int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,
+ fd_set __user *exp, struct timespec *end_time);
+
+extern int poll_select_set_timeout(struct timespec *to, long sec, long nsec);
+
+#endif /* _LINUX_POLL_INTERNALS_H */
diff --git a/net/socket.c b/net/socket.c
index b7add59..0886971 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -74,7 +74,7 @@
#include <linux/if_vlan.h>
#include <linux/ptp_classify.h>
#include <linux/init.h>
-#include <linux/poll.h>
+#include <linux/poll_internals.h>
#include <linux/cache.h>
#include <linux/module.h>
#include <linux/highmem.h>