svn commit: r197134 - in head/sys: cam/scsi fs/fifofs i386/acpica kern net

Robert Watson rwatson at FreeBSD.org
Sat Sep 12 20:03:45 UTC 2009


Author: rwatson
Date: Sat Sep 12 20:03:45 2009
New Revision: 197134
URL: http://svn.freebsd.org/changeset/base/197134

Log:
  Use C99 initialization for struct filterops.
  
  Obtained from:	Mac OS X
  Sponsored by:	Apple Inc.
  MFC after:	3 weeks

Modified:
  head/sys/cam/scsi/scsi_target.c
  head/sys/fs/fifofs/fifo_vnops.c
  head/sys/i386/acpica/acpi_machdep.c
  head/sys/kern/kern_event.c
  head/sys/kern/kern_sig.c
  head/sys/kern/sys_pipe.c
  head/sys/kern/tty.c
  head/sys/kern/tty_pts.c
  head/sys/kern/uipc_mqueue.c
  head/sys/kern/uipc_socket.c
  head/sys/kern/vfs_aio.c
  head/sys/kern/vfs_subr.c
  head/sys/net/bpf.c

Modified: head/sys/cam/scsi/scsi_target.c
==============================================================================
--- head/sys/cam/scsi/scsi_target.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/cam/scsi/scsi_target.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -103,8 +103,11 @@ static d_poll_t		targpoll;
 static d_kqfilter_t	targkqfilter;
 static void		targreadfiltdetach(struct knote *kn);
 static int		targreadfilt(struct knote *kn, long hint);
-static struct filterops targread_filtops =
-	{ 1, NULL, targreadfiltdetach, targreadfilt };
+static struct filterops targread_filtops = {
+	.f_isfd = 1,
+	.f_detach = targreadfiltdetach,
+	.f_event = targreadfilt,
+};
 
 static struct cdevsw targ_cdevsw = {
 	.d_version =	D_VERSION,

Modified: head/sys/fs/fifofs/fifo_vnops.c
==============================================================================
--- head/sys/fs/fifofs/fifo_vnops.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/fs/fifofs/fifo_vnops.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -100,12 +100,21 @@ static int	filt_fifowrite(struct knote *
 static void	filt_fifodetach_notsup(struct knote *kn);
 static int	filt_fifo_notsup(struct knote *kn, long hint);
 
-static struct filterops fiforead_filtops =
-	{ 1, NULL, filt_fifordetach, filt_fiforead };
-static struct filterops fifowrite_filtops =
-	{ 1, NULL, filt_fifowdetach, filt_fifowrite };
-static struct filterops fifo_notsup_filtops =
-	{ 1, NULL, filt_fifodetach_notsup, filt_fifo_notsup };
+static struct filterops fiforead_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_fifordetach,
+	.f_event = filt_fiforead,
+};
+static struct filterops fifowrite_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_fifowdetach,
+	.f_event = filt_fifowrite,
+};
+static struct filterops fifo_notsup_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_fifodetach_notsup,
+	.f_event = filt_fifo_notsup,
+};
 
 struct vop_vector fifo_specops = {
 	.vop_default =		&default_vnodeops,

Modified: head/sys/i386/acpica/acpi_machdep.c
==============================================================================
--- head/sys/i386/acpica/acpi_machdep.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/i386/acpica/acpi_machdep.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -80,8 +80,11 @@ static d_poll_t		apmpoll;
 static d_kqfilter_t	apmkqfilter;
 static void		apmreadfiltdetach(struct knote *kn);
 static int		apmreadfilt(struct knote *kn, long hint);
-static struct filterops	apm_readfiltops =
-	{ 1, NULL, apmreadfiltdetach, apmreadfilt };
+static struct filterops	apm_readfiltops = {
+	.f_isfd = 1,
+	.f_detach = apmreadfiltdetach,
+	.f_event = apmreadfilt,
+};
 
 static struct cdevsw apm_cdevsw = {
 	.d_version =	D_VERSION,

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/kern_event.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -142,15 +142,28 @@ static int	filt_timerattach(struct knote
 static void	filt_timerdetach(struct knote *kn);
 static int	filt_timer(struct knote *kn, long hint);
 
-static struct filterops file_filtops =
-	{ 1, filt_fileattach, NULL, NULL };
-static struct filterops kqread_filtops =
-	{ 1, NULL, filt_kqdetach, filt_kqueue };
+static struct filterops file_filtops = {
+	.f_isfd = 1,
+	.f_attach = filt_fileattach,
+};
+static struct filterops kqread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_kqdetach,
+	.f_event = filt_kqueue,
+};
 /* XXX - move to kern_proc.c?  */
-static struct filterops proc_filtops =
-	{ 0, filt_procattach, filt_procdetach, filt_proc };
-static struct filterops timer_filtops =
-	{ 0, filt_timerattach, filt_timerdetach, filt_timer };
+static struct filterops proc_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_procattach,
+	.f_detach = filt_procdetach,
+	.f_event = filt_proc,
+};
+static struct filterops timer_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_timerattach,
+	.f_detach = filt_timerdetach,
+	.f_event = filt_timer,
+};
 
 static uma_zone_t	knote_zone;
 static int 		kq_ncallouts = 0;
@@ -228,8 +241,10 @@ filt_nullattach(struct knote *kn)
 	return (ENXIO);
 };
 
-struct filterops null_filtops =
-	{ 0, filt_nullattach, NULL, NULL };
+struct filterops null_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_nullattach,
+};
 
 /* XXX - make SYSINIT to add these, and move into respective modules. */
 extern struct filterops sig_filtops;

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/kern_sig.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -111,8 +111,12 @@ static struct thread *sigtd(struct proc 
 static void	sigqueue_start(void);
 
 static uma_zone_t	ksiginfo_zone = NULL;
-struct filterops sig_filtops =
-	{ 0, filt_sigattach, filt_sigdetach, filt_signal };
+struct filterops sig_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_sigattach,
+	.f_detach = filt_sigdetach,
+	.f_event = filt_signal,
+};
 
 int	kern_logsigexit = 1;
 SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, 

Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/sys_pipe.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -162,10 +162,16 @@ static void	filt_pipedetach(struct knote
 static int	filt_piperead(struct knote *kn, long hint);
 static int	filt_pipewrite(struct knote *kn, long hint);
 
-static struct filterops pipe_rfiltops =
-	{ 1, NULL, filt_pipedetach, filt_piperead };
-static struct filterops pipe_wfiltops =
-	{ 1, NULL, filt_pipedetach, filt_pipewrite };
+static struct filterops pipe_rfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_pipedetach,
+	.f_event = filt_piperead
+};
+static struct filterops pipe_wfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_pipedetach,
+	.f_event = filt_pipewrite
+};
 
 /*
  * Default pipe buffer size(s), this can be kind-of large now because pipe

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/tty.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -635,10 +635,16 @@ tty_kqops_write_event(struct knote *kn, 
 	}
 }
 
-static struct filterops tty_kqops_read =
-    { 1, NULL, tty_kqops_read_detach, tty_kqops_read_event };
-static struct filterops tty_kqops_write =
-    { 1, NULL, tty_kqops_write_detach, tty_kqops_write_event };
+static struct filterops tty_kqops_read = {
+	.f_isfd = 1,
+	.f_detach = tty_kqops_read_detach,
+	.f_event = tty_kqops_read_event,
+};
+static struct filterops tty_kqops_write = {
+	.f_isfd = 1,
+	.f_detach = tty_kqops_write_detach,
+	.f_event = tty_kqops_write_event,
+};
 
 static int
 ttydev_kqfilter(struct cdev *dev, struct knote *kn)

Modified: head/sys/kern/tty_pts.c
==============================================================================
--- head/sys/kern/tty_pts.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/tty_pts.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -494,10 +494,16 @@ pts_kqops_write_event(struct knote *kn, 
 	}
 }
 
-static struct filterops pts_kqops_read =
-    { 1, NULL, pts_kqops_read_detach, pts_kqops_read_event };
-static struct filterops pts_kqops_write =
-    { 1, NULL, pts_kqops_write_detach, pts_kqops_write_event };
+static struct filterops pts_kqops_read = {
+	.f_isfd = 1,
+	.f_detach = pts_kqops_read_detach,
+	.f_event = pts_kqops_read_event,
+};
+static struct filterops pts_kqops_write = {
+	.f_isfd = 1,
+	.f_detach = pts_kqops_write_detach,
+	.f_event = pts_kqops_write_event,
+};
 
 static int
 ptsdev_kqfilter(struct file *fp, struct knote *kn)

Modified: head/sys/kern/uipc_mqueue.c
==============================================================================
--- head/sys/kern/uipc_mqueue.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/uipc_mqueue.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -256,10 +256,16 @@ static void	filt_mqdetach(struct knote *
 static int	filt_mqread(struct knote *kn, long hint);
 static int	filt_mqwrite(struct knote *kn, long hint);
 
-struct filterops mq_rfiltops =
-	{ 1, NULL, filt_mqdetach, filt_mqread };
-struct filterops mq_wfiltops =
-	{ 1, NULL, filt_mqdetach, filt_mqwrite };
+struct filterops mq_rfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_mqdetach,
+	.f_event = filt_mqread,
+};
+struct filterops mq_wfiltops = {
+	.f_isfd = 1,
+	.f_detach = filt_mqdetach,
+	.f_event = filt_mqwrite,
+};
 
 /*
  * Initialize fileno bitmap

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/uipc_socket.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -151,12 +151,21 @@ static void	filt_sowdetach(struct knote 
 static int	filt_sowrite(struct knote *kn, long hint);
 static int	filt_solisten(struct knote *kn, long hint);
 
-static struct filterops solisten_filtops =
-	{ 1, NULL, filt_sordetach, filt_solisten };
-static struct filterops soread_filtops =
-	{ 1, NULL, filt_sordetach, filt_soread };
-static struct filterops sowrite_filtops =
-	{ 1, NULL, filt_sowdetach, filt_sowrite };
+static struct filterops solisten_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_sordetach,
+	.f_event = filt_solisten,
+};
+static struct filterops soread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_sordetach,
+	.f_event = filt_soread,
+};
+static struct filterops sowrite_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_sowdetach,
+	.f_event = filt_sowrite,
+};
 
 uma_zone_t socket_zone;
 so_gen_t	so_gencnt;	/* generation count for sockets */

Modified: head/sys/kern/vfs_aio.c
==============================================================================
--- head/sys/kern/vfs_aio.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/vfs_aio.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -372,10 +372,18 @@ static int	filt_lio(struct knote *kn, lo
 static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiol_zone, aiolio_zone;
 
 /* kqueue filters for aio */
-static struct filterops aio_filtops =
-	{ 0, filt_aioattach, filt_aiodetach, filt_aio };
-static struct filterops lio_filtops =
-	{ 0, filt_lioattach, filt_liodetach, filt_lio };
+static struct filterops aio_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_aioattach,
+	.f_detach = filt_aiodetach,
+	.f_event = filt_aio,
+};
+static struct filterops lio_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_lioattach,
+	.f_detach = filt_liodetach,
+	.f_event = filt_lio
+};
 
 static eventhandler_tag exit_tag, exec_tag;
 

Modified: head/sys/kern/vfs_subr.c
==============================================================================
--- head/sys/kern/vfs_subr.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/kern/vfs_subr.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -4002,8 +4002,12 @@ static int	filt_fsattach(struct knote *k
 static void	filt_fsdetach(struct knote *kn);
 static int	filt_fsevent(struct knote *kn, long hint);
 
-struct filterops fs_filtops =
-	{ 0, filt_fsattach, filt_fsdetach, filt_fsevent };
+struct filterops fs_filtops = {
+	.f_isfd = 0,
+	.f_attach = filt_fsattach,
+	.f_detach = filt_fsdetach,
+	.f_event = filt_fsevent
+};
 
 static int
 filt_fsattach(struct knote *kn)
@@ -4076,12 +4080,21 @@ static int	filt_vfsread(struct knote *kn
 static int	filt_vfswrite(struct knote *kn, long hint);
 static int	filt_vfsvnode(struct knote *kn, long hint);
 static void	filt_vfsdetach(struct knote *kn);
-static struct filterops vfsread_filtops =
-	{ 1, NULL, filt_vfsdetach, filt_vfsread };
-static struct filterops vfswrite_filtops =
-	{ 1, NULL, filt_vfsdetach, filt_vfswrite };
-static struct filterops vfsvnode_filtops =
-	{ 1, NULL, filt_vfsdetach, filt_vfsvnode };
+static struct filterops vfsread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_vfsdetach,
+	.f_event = filt_vfsread
+};
+static struct filterops vfswrite_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_vfsdetach,
+	.f_event = filt_vfswrite
+};
+static struct filterops vfsvnode_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_vfsdetach,
+	.f_event = filt_vfsvnode
+};
 
 static void
 vfs_knllock(void *arg)

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c	Sat Sep 12 19:53:31 2009	(r197133)
+++ head/sys/net/bpf.c	Sat Sep 12 20:03:45 2009	(r197134)
@@ -148,8 +148,11 @@ static struct cdevsw bpf_cdevsw = {
 	.d_kqfilter =	bpfkqfilter,
 };
 
-static struct filterops bpfread_filtops =
-	{ 1, NULL, filt_bpfdetach, filt_bpfread };
+static struct filterops bpfread_filtops = {
+	.f_isfd = 1,
+	.f_detach = filt_bpfdetach,
+	.f_event = filt_bpfread,
+};
 
 /*
  * Wrapper functions for various buffering methods.  If the set of buffer


More information about the svn-src-head mailing list