summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-09-12 20:03:45 +0000
committerrwatson <rwatson@FreeBSD.org>2009-09-12 20:03:45 +0000
commit53eaed07bcf1ec0f1a38e0b490d95f1ee307055a (patch)
treea4c213c079a55cd47cd1026ebfbedf0f22cafea1 /sys/kern
parentdb3ff4e5c03b76a4899555f3db282820ce0c3470 (diff)
downloadFreeBSD-src-53eaed07bcf1ec0f1a38e0b490d95f1ee307055a.zip
FreeBSD-src-53eaed07bcf1ec0f1a38e0b490d95f1ee307055a.tar.gz
Use C99 initialization for struct filterops.
Obtained from: Mac OS X Sponsored by: Apple Inc. MFC after: 3 weeks
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_event.c35
-rw-r--r--sys/kern/kern_sig.c8
-rw-r--r--sys/kern/sys_pipe.c14
-rw-r--r--sys/kern/tty.c14
-rw-r--r--sys/kern/tty_pts.c14
-rw-r--r--sys/kern/uipc_mqueue.c14
-rw-r--r--sys/kern/uipc_socket.c21
-rw-r--r--sys/kern/vfs_aio.c16
-rw-r--r--sys/kern/vfs_subr.c29
9 files changed, 119 insertions, 46 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index 6603d11..6336049 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -142,15 +142,28 @@ static int filt_timerattach(struct knote *kn);
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;
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index cdf757d..74e625a 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -111,8 +111,12 @@ static struct thread *sigtd(struct proc *p, int sig, int prop);
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,
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index ce20d28..fcfb226 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -162,10 +162,16 @@ static void filt_pipedetach(struct knote *kn);
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
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index a14f714..6990b8f 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -635,10 +635,16 @@ tty_kqops_write_event(struct knote *kn, long hint)
}
}
-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)
diff --git a/sys/kern/tty_pts.c b/sys/kern/tty_pts.c
index 350244b..bc6e158 100644
--- a/sys/kern/tty_pts.c
+++ b/sys/kern/tty_pts.c
@@ -494,10 +494,16 @@ pts_kqops_write_event(struct knote *kn, long hint)
}
}
-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)
diff --git a/sys/kern/uipc_mqueue.c b/sys/kern/uipc_mqueue.c
index 69bf59c..c44ab5a 100644
--- a/sys/kern/uipc_mqueue.c
+++ b/sys/kern/uipc_mqueue.c
@@ -256,10 +256,16 @@ static void filt_mqdetach(struct knote *kn);
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
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 2f4dd92..d11af34 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -151,12 +151,21 @@ static void filt_sowdetach(struct knote *kn);
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 */
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 3f7596b..088e4f6 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -372,10 +372,18 @@ static int filt_lio(struct knote *kn, long hint);
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;
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index f3ec565..c40dad1 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -4002,8 +4002,12 @@ static int filt_fsattach(struct knote *kn);
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, long hint);
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)
OpenPOWER on IntegriCloud