From d3f5ce7613848b361ec06b8f2d44ad34c6022628 Mon Sep 17 00:00:00 2001 From: visa Date: Mon, 20 Jun 2022 01:39:44 +0000 Subject: [PATCH] Remove unused struct fileops field fo_poll and callbacks. OK mpi@ --- sys/dev/pci/drm/drm_linux.c | 16 +------------ sys/kern/kern_event.c | 24 +------------------- sys/kern/sys_pipe.c | 45 +------------------------------------ sys/kern/sys_socket.c | 40 +-------------------------------- sys/kern/vfs_vnops.c | 14 +----------- sys/sys/eventvar.h | 3 +-- sys/sys/file.h | 3 +-- sys/sys/pipe.h | 3 +-- sys/sys/socketvar.h | 3 +-- usr.bin/fstat/fstat.c | 5 ++--- 10 files changed, 11 insertions(+), 145 deletions(-) diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c index e92f394f8d7..16ff64f1824 100644 --- a/sys/dev/pci/drm/drm_linux.c +++ b/sys/dev/pci/drm/drm_linux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: drm_linux.c,v 1.92 2022/03/01 11:50:37 jsg Exp $ */ +/* $OpenBSD: drm_linux.c,v 1.93 2022/06/20 01:39:44 visa Exp $ */ /* * Copyright (c) 2013 Jonathan Gray * Copyright (c) 2015, 2016 Mark Kettenis @@ -2260,12 +2260,6 @@ dmabuf_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) return (ENOTTY); } -int -dmabuf_poll(struct file *fp, int events, struct proc *p) -{ - return (0); -} - int dmabuf_kqfilter(struct file *fp, struct knote *kn) { @@ -2326,7 +2320,6 @@ const struct fileops dmabufops = { .fo_read = dmabuf_read, .fo_write = dmabuf_write, .fo_ioctl = dmabuf_ioctl, - .fo_poll = dmabuf_poll, .fo_kqfilter = dmabuf_kqfilter, .fo_stat = dmabuf_stat, .fo_close = dmabuf_close, @@ -2848,12 +2841,6 @@ syncfile_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) return ENOTTY; } -int -syncfile_poll(struct file *fp, int events, struct proc *p) -{ - return 0; -} - int syncfile_kqfilter(struct file *fp, struct knote *kn) { @@ -2908,7 +2895,6 @@ const struct fileops syncfileops = { .fo_read = syncfile_read, .fo_write = syncfile_write, .fo_ioctl = syncfile_ioctl, - .fo_poll = syncfile_poll, .fo_kqfilter = syncfile_kqfilter, .fo_stat = syncfile_stat, .fo_close = syncfile_close, diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 378e029c204..235f1a57005 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_event.c,v 1.189 2022/06/12 10:34:36 visa Exp $ */ +/* $OpenBSD: kern_event.c,v 1.190 2022/06/20 01:39:44 visa Exp $ */ /*- * Copyright (c) 1999,2000,2001 Jonathan Lemon @@ -49,7 +49,6 @@ #include #include #include -#include #include #include #include @@ -79,7 +78,6 @@ int kqueue_read(struct file *, struct uio *, int); int kqueue_write(struct file *, struct uio *, int); int kqueue_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p); -int kqueue_poll(struct file *fp, int events, struct proc *p); int kqueue_kqfilter(struct file *fp, struct knote *kn); int kqueue_stat(struct file *fp, struct stat *st, struct proc *p); int kqueue_close(struct file *fp, struct proc *p); @@ -107,7 +105,6 @@ const struct fileops kqueueops = { .fo_read = kqueue_read, .fo_write = kqueue_write, .fo_ioctl = kqueue_ioctl, - .fo_poll = kqueue_poll, .fo_kqfilter = kqueue_kqfilter, .fo_stat = kqueue_stat, .fo_close = kqueue_close @@ -1531,25 +1528,6 @@ kqueue_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) return (ENOTTY); } -int -kqueue_poll(struct file *fp, int events, struct proc *p) -{ - struct kqueue *kq = (struct kqueue *)fp->f_data; - int revents = 0; - - if (events & (POLLIN | POLLRDNORM)) { - mtx_enter(&kq->kq_lock); - if (kq->kq_count) { - revents |= events & (POLLIN | POLLRDNORM); - } else { - selrecord(p, &kq->kq_sel); - kq->kq_state |= KQ_SEL; - } - mtx_leave(&kq->kq_lock); - } - return (revents); -} - int kqueue_stat(struct file *fp, struct stat *st, struct proc *p) { diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index bd61f838dd3..78884382d34 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.139 2022/05/30 14:06:16 visa Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.140 2022/06/20 01:39:44 visa Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -40,7 +40,6 @@ #include #include #include -#include #ifdef KTRACE #include #endif @@ -61,7 +60,6 @@ struct pipe_pair { int pipe_read(struct file *, struct uio *, int); int pipe_write(struct file *, struct uio *, int); int pipe_close(struct file *, struct proc *); -int pipe_poll(struct file *, int events, struct proc *); int pipe_kqfilter(struct file *fp, struct knote *kn); int pipe_ioctl(struct file *, u_long, caddr_t, struct proc *); int pipe_stat(struct file *fp, struct stat *ub, struct proc *p); @@ -70,7 +68,6 @@ static const struct fileops pipeops = { .fo_read = pipe_read, .fo_write = pipe_write, .fo_ioctl = pipe_ioctl, - .fo_poll = pipe_poll, .fo_kqfilter = pipe_kqfilter, .fo_stat = pipe_stat, .fo_close = pipe_close @@ -718,46 +715,6 @@ pipe_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) return (error); } -int -pipe_poll(struct file *fp, int events, struct proc *p) -{ - struct pipe *rpipe = fp->f_data, *wpipe; - struct rwlock *lock = rpipe->pipe_lock; - int revents = 0; - - rw_enter_write(lock); - wpipe = pipe_peer(rpipe); - - if (events & (POLLIN | POLLRDNORM)) { - if (rpipe->pipe_buffer.cnt > 0 || - (rpipe->pipe_state & PIPE_EOF)) - revents |= events & (POLLIN | POLLRDNORM); - } - - /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */ - if ((rpipe->pipe_state & PIPE_EOF) || wpipe == NULL) - revents |= POLLHUP; - else if (events & (POLLOUT | POLLWRNORM)) { - if (wpipe->pipe_buffer.size - wpipe->pipe_buffer.cnt >= PIPE_BUF) - revents |= events & (POLLOUT | POLLWRNORM); - } - - if (revents == 0) { - if (events & (POLLIN | POLLRDNORM)) { - selrecord(p, &rpipe->pipe_sel); - rpipe->pipe_state |= PIPE_SEL; - } - if (events & (POLLOUT | POLLWRNORM)) { - selrecord(p, &wpipe->pipe_sel); - wpipe->pipe_state |= PIPE_SEL; - } - } - - rw_exit_write(lock); - - return (revents); -} - int pipe_stat(struct file *fp, struct stat *ub, struct proc *p) { diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index c1adf1a929f..836485795e8 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_socket.c,v 1.50 2022/06/06 14:45:41 claudio Exp $ */ +/* $OpenBSD: sys_socket.c,v 1.51 2022/06/20 01:39:44 visa Exp $ */ /* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */ /* @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -52,7 +51,6 @@ const struct fileops socketops = { .fo_read = soo_read, .fo_write = soo_write, .fo_ioctl = soo_ioctl, - .fo_poll = soo_poll, .fo_kqfilter = soo_kqfilter, .fo_stat = soo_stat, .fo_close = soo_close @@ -149,42 +147,6 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) return (error); } -int -soo_poll(struct file *fp, int events, struct proc *p) -{ - struct socket *so = fp->f_data; - int revents = 0; - - solock(so); - if (events & (POLLIN | POLLRDNORM)) { - if (soreadable(so)) - revents |= events & (POLLIN | POLLRDNORM); - } - /* NOTE: POLLHUP and POLLOUT/POLLWRNORM are mutually exclusive */ - if (so->so_state & SS_ISDISCONNECTED) { - revents |= POLLHUP; - } else if (events & (POLLOUT | POLLWRNORM)) { - if (sowriteable(so)) - revents |= events & (POLLOUT | POLLWRNORM); - } - if (events & (POLLPRI | POLLRDBAND)) { - if (so->so_oobmark || (so->so_state & SS_RCVATMARK)) - revents |= events & (POLLPRI | POLLRDBAND); - } - if (revents == 0) { - if (events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) { - selrecord(p, &so->so_rcv.sb_sel); - so->so_rcv.sb_flags |= SB_SEL; - } - if (events & (POLLOUT | POLLWRNORM)) { - selrecord(p, &so->so_snd.sb_sel); - so->so_snd.sb_flags |= SB_SEL; - } - } - sounlock(so); - return (revents); -} - int soo_stat(struct file *fp, struct stat *ub, struct proc *p) { diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 87182a18050..9a646ae9bcb 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_vnops.c,v 1.119 2021/11/13 06:04:02 visa Exp $ */ +/* $OpenBSD: vfs_vnops.c,v 1.120 2022/06/20 01:39:44 visa Exp $ */ /* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */ /* @@ -54,14 +54,12 @@ #include #include #include -#include #include #include #include int vn_read(struct file *, struct uio *, int); int vn_write(struct file *, struct uio *, int); -int vn_poll(struct file *, int, struct proc *); int vn_kqfilter(struct file *, struct knote *); int vn_closefile(struct file *, struct proc *); int vn_seek(struct file *, off_t *, int, struct proc *); @@ -70,7 +68,6 @@ const struct fileops vnops = { .fo_read = vn_read, .fo_write = vn_write, .fo_ioctl = vn_ioctl, - .fo_poll = vn_poll, .fo_kqfilter = vn_kqfilter, .fo_stat = vn_statfile, .fo_close = vn_closefile, @@ -547,15 +544,6 @@ vn_ioctl(struct file *fp, u_long com, caddr_t data, struct proc *p) return (error); } -/* - * File table vnode poll routine. - */ -int -vn_poll(struct file *fp, int events, struct proc *p) -{ - return (VOP_POLL(fp->f_data, fp->f_flag, events, p)); -} - /* * Check that the vnode is still valid, and if so * acquire requested lock. diff --git a/sys/sys/eventvar.h b/sys/sys/eventvar.h index 3ccb4620a87..1e20fb2cf53 100644 --- a/sys/sys/eventvar.h +++ b/sys/sys/eventvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: eventvar.h,v 1.14 2022/03/16 14:38:43 visa Exp $ */ +/* $OpenBSD: eventvar.h,v 1.15 2022/06/20 01:39:44 visa Exp $ */ /*- * Copyright (c) 1999,2000 Jonathan Lemon @@ -65,7 +65,6 @@ struct kqueue { struct task kq_task; /* deferring of activation */ int kq_state; /* [q] */ -#define KQ_SEL 0x01 #define KQ_SLEEP 0x02 #define KQ_DYING 0x04 }; diff --git a/sys/sys/file.h b/sys/sys/file.h index 0a9105e1f2c..b29b43122a4 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -1,4 +1,4 @@ -/* $OpenBSD: file.h,v 1.65 2022/01/20 03:43:31 jsg Exp $ */ +/* $OpenBSD: file.h,v 1.66 2022/06/20 01:39:44 visa Exp $ */ /* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */ /* @@ -66,7 +66,6 @@ struct fileops { int (*fo_read)(struct file *, struct uio *, int); int (*fo_write)(struct file *, struct uio *, int); int (*fo_ioctl)(struct file *, u_long, caddr_t, struct proc *); - int (*fo_poll)(struct file *, int, struct proc *); int (*fo_kqfilter)(struct file *, struct knote *); int (*fo_stat)(struct file *, struct stat *, struct proc *); int (*fo_close)(struct file *, struct proc *); diff --git a/sys/sys/pipe.h b/sys/sys/pipe.h index 72822aac7ef..7bdcf9bbee3 100644 --- a/sys/sys/pipe.h +++ b/sys/sys/pipe.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pipe.h,v 1.27 2020/06/29 18:23:18 anton Exp $ */ +/* $OpenBSD: pipe.h,v 1.28 2022/06/20 01:39:44 visa Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -62,7 +62,6 @@ struct pipebuf { #define PIPE_WANTR 0x008 /* Reader wants some characters. */ #define PIPE_WANTW 0x010 /* Writer wants space to put characters. */ #define PIPE_WANTD 0x020 /* Pipe is wanted to be run-down. */ -#define PIPE_SEL 0x040 /* Pipe has a select active. */ #define PIPE_EOF 0x080 /* Pipe is in EOF condition. */ #define PIPE_LOCK 0x100 /* Thread has exclusive I/O access. */ #define PIPE_LWANT 0x200 /* Thread wants exclusive I/O access. */ diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 142eb0af05f..d698fc8f380 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.102 2022/06/06 14:45:41 claudio Exp $ */ +/* $OpenBSD: socketvar.h,v 1.103 2022/06/20 01:39:44 visa Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -270,7 +270,6 @@ struct knote; int soo_read(struct file *, struct uio *, int); int soo_write(struct file *, struct uio *, int); int soo_ioctl(struct file *, u_long, caddr_t, struct proc *); -int soo_poll(struct file *, int, struct proc *); int soo_kqfilter(struct file *, struct knote *); int soo_close(struct file *, struct proc *); int soo_stat(struct file *, struct stat *, struct proc *); diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c index 10128c38944..a74d3a6e916 100644 --- a/usr.bin/fstat/fstat.c +++ b/usr.bin/fstat/fstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fstat.c,v 1.102 2021/07/17 20:46:02 kn Exp $ */ +/* $OpenBSD: fstat.c,v 1.103 2022/06/20 01:39:44 visa Exp $ */ /* * Copyright (c) 2009 Todd C. Miller @@ -562,9 +562,8 @@ kqueuetrans(struct kinfo_file *kf) printf("kqueue "); hide((void *)(uintptr_t)kf->f_data); - printf(" %d state: %s%s\n", + printf(" %d state: %s\n", kf->kq_count, - (kf->kq_state & KQ_SEL) ? "S" : "", (kf->kq_state & KQ_SLEEP) ? "W" : ""); return; } -- 2.20.1