From: Matthew Dillon Date: Tue, 29 Jul 2003 20:03:08 +0000 (+0000) Subject: fileops messaging stage 1: add port and feature mask to struct fileops and X-Git-Tag: v2.0.1~13201 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/f53ede20c64b9516633966698f5abe8c6fbd9d00 fileops messaging stage 1: add port and feature mask to struct fileops and rename fo_ functions to fold. --- diff --git a/sys/dev/misc/streams/streams.c b/sys/dev/misc/streams/streams.c index 6f5e5cb867..14d6037284 100644 --- a/sys/dev/misc/streams/streams.c +++ b/sys/dev/misc/streams/streams.c @@ -31,7 +31,7 @@ * in 3.0-980524-SNAP then hacked a bit (but probably not enough :-). * * $FreeBSD: src/sys/dev/streams/streams.c,v 1.16.2.1 2001/02/26 04:23:07 jlemon Exp $ - * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.6 2003/07/26 18:12:42 dillon Exp $ + * $DragonFly: src/sys/dev/misc/streams/Attic/streams.c,v 1.7 2003/07/29 20:03:02 dillon Exp $ */ #include @@ -100,6 +100,8 @@ dev_t dt_ptm, dt_arp, dt_icmp, dt_ip, dt_tcp, dt_udp, dt_rawip, dt_unix_dgram, dt_unix_stream, dt_unix_ord_stream; static struct fileops svr4_netops = { + NULL, /* port */ + 0, /* autoq */ soo_read, soo_write, soo_ioctl, soo_poll, sokqfilter, soo_stat, svr4_soo_close }; diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 9d9ddba469..68f9798773 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -37,7 +37,7 @@ * * @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94 * $FreeBSD: src/sys/kern/kern_descrip.c,v 1.81.2.17 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/kern_descrip.c,v 1.9 2003/07/26 18:12:44 dillon Exp $ + * $DragonFly: src/sys/kern/kern_descrip.c,v 1.10 2003/07/29 20:03:04 dillon Exp $ */ #include "opt_compat.h" @@ -1680,6 +1680,8 @@ fildesc_drvinit(void *unused) } struct fileops badfileops = { + NULL, /* port */ + 0, /* autoq */ badfo_readwrite, badfo_readwrite, badfo_ioctl, diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 97f7327e39..a4d3e3193a 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_event.c,v 1.2.2.9 2003/05/08 07:47:16 kbyanc Exp $ - * $DragonFly: src/sys/kern/kern_event.c,v 1.7 2003/07/26 18:12:44 dillon Exp $ + * $DragonFly: src/sys/kern/kern_event.c,v 1.8 2003/07/29 20:03:05 dillon Exp $ */ #include @@ -70,6 +70,8 @@ static int kqueue_close(struct file *fp, struct thread *td); static void kqueue_wakeup(struct kqueue *kq); static struct fileops kqueueops = { + NULL, /* port */ + 0, /* autoq */ kqueue_read, kqueue_write, kqueue_ioctl, diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 73ce2ddd79..fca5efcc3e 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -17,7 +17,7 @@ * are met. * * $FreeBSD: src/sys/kern/sys_pipe.c,v 1.60.2.13 2002/08/05 15:05:15 des Exp $ - * $DragonFly: src/sys/kern/sys_pipe.c,v 1.6 2003/07/26 18:12:44 dillon Exp $ + * $DragonFly: src/sys/kern/sys_pipe.c,v 1.7 2003/07/29 20:03:05 dillon Exp $ */ /* @@ -103,6 +103,8 @@ static int pipe_stat __P((struct file *fp, struct stat *sb, struct thread *td)); static int pipe_ioctl __P((struct file *fp, u_long cmd, caddr_t data, struct thread *td)); static struct fileops pipeops = { + NULL, /* port */ + 0, /* autoq */ pipe_read, pipe_write, pipe_ioctl, pipe_poll, pipe_kqfilter, pipe_stat, pipe_close }; diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index ce055fb036..c1cdfb30d4 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -32,7 +32,7 @@ * * @(#)sys_socket.c 8.1 (Berkeley) 6/10/93 * $FreeBSD: src/sys/kern/sys_socket.c,v 1.28.2.2 2001/02/26 04:23:16 jlemon Exp $ - * $DragonFly: src/sys/kern/sys_socket.c,v 1.4 2003/07/26 19:42:11 rob Exp $ + * $DragonFly: src/sys/kern/sys_socket.c,v 1.5 2003/07/29 20:03:05 dillon Exp $ */ #include @@ -52,6 +52,8 @@ #include struct fileops socketops = { + NULL, /* port */ + 0, /* autoq */ soo_read, soo_write, soo_ioctl, soo_poll, sokqfilter, soo_stat, soo_close }; diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index df5246fe3c..1b1bf37edd 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -37,7 +37,7 @@ * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/vfs_vnops.c,v 1.87.2.13 2002/12/29 18:19:53 dillon Exp $ - * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.10 2003/07/26 19:42:11 rob Exp $ + * $DragonFly: src/sys/kern/vfs_vnops.c,v 1.11 2003/07/29 20:03:05 dillon Exp $ */ #include @@ -68,6 +68,8 @@ static int vn_write __P((struct file *fp, struct uio *uio, struct ucred *cred, int flags, struct thread *td)); struct fileops vnops = { + NULL, /* port */ + 0, /* autoq */ vn_read, vn_write, vn_ioctl, vn_poll, vn_kqfilter, vn_statfile, vn_closefile }; diff --git a/sys/opencrypto/cryptodev.c b/sys/opencrypto/cryptodev.c index 2994df0317..59b1684af5 100644 --- a/sys/opencrypto/cryptodev.c +++ b/sys/opencrypto/cryptodev.c @@ -1,5 +1,5 @@ /* $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $ */ -/* $DragonFly: src/sys/opencrypto/cryptodev.c,v 1.5 2003/07/21 05:50:44 dillon Exp $ */ +/* $DragonFly: src/sys/opencrypto/cryptodev.c,v 1.6 2003/07/29 20:03:06 dillon Exp $ */ /* $OpenBSD: cryptodev.c,v 1.52 2002/06/19 07:22:46 deraadt Exp $ */ /* @@ -90,6 +90,8 @@ static int cryptof_stat(struct file *, struct stat *, struct thread *); static int cryptof_close(struct file *, struct thread *); static struct fileops cryptofops = { + NULL, /* port */ + 0, /* autoq */ cryptof_rw, cryptof_rw, cryptof_ioctl, diff --git a/sys/sys/file.h b/sys/sys/file.h index 72749ef983..d2e10b2c5a 100644 --- a/sys/sys/file.h +++ b/sys/sys/file.h @@ -32,7 +32,7 @@ * * @(#)file.h 8.3 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/file.h,v 1.22.2.7 2002/11/21 23:39:24 sam Exp $ - * $DragonFly: src/sys/sys/file.h,v 1.3 2003/06/25 03:56:10 dillon Exp $ + * $DragonFly: src/sys/sys/file.h,v 1.4 2003/07/29 20:03:08 dillon Exp $ */ #ifndef _SYS_FILE_H_ @@ -51,6 +51,32 @@ struct proc; struct thread; struct uio; struct knote; +struct file; +struct ucred; +struct lwkt_port; + +struct fileops { + struct lwkt_port *fo_port; + u_int fo_autoq; + + int (*fold_read) (struct file *fp, struct uio *uio, + struct ucred *cred, int flags, + struct thread *td); + int (*fold_write) (struct file *fp, struct uio *uio, + struct ucred *cred, int flags, + struct thread *td); + int (*fold_ioctl) (struct file *fp, u_long com, + caddr_t data, struct thread *td); + int (*fold_poll) (struct file *fp, int events, + struct ucred *cred, struct thread *td); + int (*fold_kqfilter) (struct file *fp, + struct knote *kn); + int (*fold_stat) (struct file *fp, struct stat *sb, + struct thread *td); + int (*fold_close) (struct file *fp, struct thread *td); +}; + +#define FOF_OFFSET 1 /* fo_read(), fo_write() flags */ /* * Kernel descriptor table. @@ -68,24 +94,7 @@ struct file { short f_type; /* descriptor type */ u_int f_flag; /* see fcntl.h */ struct ucred *f_cred; /* credentials associated with descriptor */ - struct fileops { - int (*fo_read) __P((struct file *fp, struct uio *uio, - struct ucred *cred, int flags, - struct thread *td)); - int (*fo_write) __P((struct file *fp, struct uio *uio, - struct ucred *cred, int flags, - struct thread *td)); -#define FOF_OFFSET 1 - int (*fo_ioctl) __P((struct file *fp, u_long com, - caddr_t data, struct thread *td)); - int (*fo_poll) __P((struct file *fp, int events, - struct ucred *cred, struct thread *td)); - int (*fo_kqfilter) __P((struct file *fp, - struct knote *kn)); - int (*fo_stat) __P((struct file *fp, struct stat *sb, - struct thread *td)); - int (*fo_close) __P((struct file *fp, struct thread *td)); - } *f_ops; + struct fileops *f_ops; int f_seqcount; /* * count of sequential accesses -- cleared * by most seek operations. @@ -103,7 +112,7 @@ struct file { MALLOC_DECLARE(M_FILE); #endif -extern int fdrop __P((struct file *fp, struct thread *td)); +extern int fdrop (struct file *fp, struct thread *td); LIST_HEAD(filelist, file); extern struct filelist filehead; /* head of list of open files */ diff --git a/sys/sys/file2.h b/sys/sys/file2.h index 3de75aac84..9a98d41ec4 100644 --- a/sys/sys/file2.h +++ b/sys/sys/file2.h @@ -32,7 +32,7 @@ * * @(#)file.h 8.3 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/file.h,v 1.22.2.7 2002/11/21 23:39:24 sam Exp $ - * $DragonFly: src/sys/sys/file2.h,v 1.1 2003/06/25 03:57:27 dillon Exp $ + * $DragonFly: src/sys/sys/file2.h,v 1.2 2003/07/29 20:03:08 dillon Exp $ */ #ifndef _SYS_FILE2_H_ @@ -57,7 +57,7 @@ fo_read( int error; fhold(fp); - error = (*fp->f_ops->fo_read)(fp, uio, cred, flags, td); + error = (*fp->f_ops->fold_read)(fp, uio, cred, flags, td); fdrop(fp, td); return (error); } @@ -73,7 +73,7 @@ fo_write( int error; fhold(fp); - error = (*fp->f_ops->fo_write)(fp, uio, cred, flags, td); + error = (*fp->f_ops->fold_write)(fp, uio, cred, flags, td); fdrop(fp, td); return (error); } @@ -88,7 +88,7 @@ fo_ioctl( int error; fhold(fp); - error = (*fp->f_ops->fo_ioctl)(fp, com, data, td); + error = (*fp->f_ops->fold_ioctl)(fp, com, data, td); fdrop(fp, td); return (error); } @@ -103,7 +103,7 @@ fo_poll( int error; fhold(fp); - error = (*fp->f_ops->fo_poll)(fp, events, cred, td); + error = (*fp->f_ops->fold_poll)(fp, events, cred, td); fdrop(fp, td); return (error); } @@ -114,7 +114,7 @@ fo_stat(struct file *fp, struct stat *sb, struct thread *td) int error; fhold(fp); - error = (*fp->f_ops->fo_stat)(fp, sb, td); + error = (*fp->f_ops->fold_stat)(fp, sb, td); fdrop(fp, td); return (error); } @@ -122,13 +122,13 @@ fo_stat(struct file *fp, struct stat *sb, struct thread *td) static __inline int fo_close(struct file *fp, struct thread *td) { - return ((*fp->f_ops->fo_close)(fp, td)); + return ((*fp->f_ops->fold_close)(fp, td)); } static __inline int fo_kqfilter(struct file *fp, struct knote *kn) { - return ((*fp->f_ops->fo_kqfilter)(fp, kn)); + return ((*fp->f_ops->fold_kqfilter)(fp, kn)); } #endif /* _KERNEL */