diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2019-12-31 13:48:33 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2019-12-31 13:48:33 +0000 |
commit | e1d46407d705bb612ebbeebddbe85779b52a42a5 (patch) | |
tree | b128da7e2130d5eeae1d5918b1cc8692523d852b /sys/miscfs | |
parent | a2985aa5fb51f9899868daaf2cde0dfa5a0f449f (diff) |
Use C99 designated initializers with struct filterops. In addition,
make the structs const so that the data are put in .rodata.
OK mpi@, deraadt@, anton@, bluhm@
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/fifofs/fifo_vnops.c | 19 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_device.c | 18 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_vnops.c | 28 |
3 files changed, 44 insertions, 21 deletions
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index 947badf3a91..d71b917214f 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.69 2019/12/12 16:33:02 visa Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.70 2019/12/31 13:48:32 visa Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -107,10 +107,19 @@ int filt_fiforead(struct knote *kn, long hint); void filt_fifowdetach(struct knote *kn); int filt_fifowrite(struct knote *kn, long hint); -struct filterops fiforead_filtops = - { 1, NULL, filt_fifordetach, filt_fiforead }; -struct filterops fifowrite_filtops = - { 1, NULL, filt_fifowdetach, filt_fifowrite }; +const struct filterops fiforead_filtops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = filt_fifordetach, + .f_event = filt_fiforead, +}; + +const struct filterops fifowrite_filtops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = filt_fifowdetach, + .f_event = filt_fifowrite, +}; /* * Open called to set up a new instance of a fifo or diff --git a/sys/miscfs/fuse/fuse_device.c b/sys/miscfs/fuse/fuse_device.c index 334a5e6f37b..14a78e92370 100644 --- a/sys/miscfs/fuse/fuse_device.c +++ b/sys/miscfs/fuse/fuse_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_device.c,v 1.29 2018/06/27 13:58:22 helg Exp $ */ +/* $OpenBSD: fuse_device.c,v 1.30 2019/12/31 13:48:32 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -70,17 +70,17 @@ int filt_fuse_read(struct knote *, long); void filt_fuse_rdetach(struct knote *); const static struct filterops fuse_rd_filtops = { - 1, - NULL, - filt_fuse_rdetach, - filt_fuse_read + .f_isfd = 1, + .f_attach = NULL, + .f_detach = filt_fuse_rdetach, + .f_event = filt_fuse_read, }; const static struct filterops fuse_seltrue_filtops = { - 1, - NULL, - filt_fuse_rdetach, - filt_seltrue + .f_isfd = 1, + .f_attach = NULL, + .f_detach = filt_fuse_rdetach, + .f_event = filt_seltrue, }; #ifdef FUSE_DEBUG diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index 6bf5aad757d..d96daac441f 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.55 2019/08/05 08:35:59 anton Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.56 2019/12/31 13:48:32 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -110,12 +110,26 @@ struct vops fusefs_vops = { .vop_advlock = fusefs_advlock, }; -struct filterops fusefsread_filtops = - { 1, NULL, filt_fusefsdetach, filt_fusefsread }; -struct filterops fusefswrite_filtops = - { 1, NULL, filt_fusefsdetach, filt_fusefswrite }; -struct filterops fusefsvnode_filtops = - { 1, NULL, filt_fusefsdetach, filt_fusefsvnode }; +const struct filterops fusefsread_filtops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = filt_fusefsdetach, + .f_event = filt_fusefsread, +}; + +const struct filterops fusefswrite_filtops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = filt_fusefsdetach, + .f_event = filt_fusefswrite, +}; + +const struct filterops fusefsvnode_filtops = { + .f_isfd = 1, + .f_attach = NULL, + .f_detach = filt_fusefsdetach, + .f_event = filt_fusefsvnode, +}; int fusefs_kqfilter(void *v) |