From e1d46407d705bb612ebbeebddbe85779b52a42a5 Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Tue, 31 Dec 2019 13:48:33 +0000 Subject: 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@ --- sys/miscfs/fifofs/fifo_vnops.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'sys/miscfs/fifofs/fifo_vnops.c') 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 -- cgit v1.2.3