Use C99 initialization for struct filterops.

Obtained from:	Mac OS X
Sponsored by:	Apple Inc.
MFC after:	3 weeks
This commit is contained in:
rwatson 2009-09-12 20:03:45 +00:00
parent db3ff4e5c0
commit 53eaed07bc
13 changed files with 149 additions and 58 deletions

View File

@ -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,

View File

@ -100,12 +100,21 @@ static int filt_fifowrite(struct knote *kn, long hint);
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,

View File

@ -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,

View File

@ -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;

View File

@ -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,

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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 */

View File

@ -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;

View File

@ -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)

View File

@ -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