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 d_kqfilter_t targkqfilter;
static void targreadfiltdetach(struct knote *kn); static void targreadfiltdetach(struct knote *kn);
static int targreadfilt(struct knote *kn, long hint); static int targreadfilt(struct knote *kn, long hint);
static struct filterops targread_filtops = static struct filterops targread_filtops = {
{ 1, NULL, targreadfiltdetach, targreadfilt }; .f_isfd = 1,
.f_detach = targreadfiltdetach,
.f_event = targreadfilt,
};
static struct cdevsw targ_cdevsw = { static struct cdevsw targ_cdevsw = {
.d_version = D_VERSION, .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 void filt_fifodetach_notsup(struct knote *kn);
static int filt_fifo_notsup(struct knote *kn, long hint); static int filt_fifo_notsup(struct knote *kn, long hint);
static struct filterops fiforead_filtops = static struct filterops fiforead_filtops = {
{ 1, NULL, filt_fifordetach, filt_fiforead }; .f_isfd = 1,
static struct filterops fifowrite_filtops = .f_detach = filt_fifordetach,
{ 1, NULL, filt_fifowdetach, filt_fifowrite }; .f_event = filt_fiforead,
static struct filterops fifo_notsup_filtops = };
{ 1, NULL, filt_fifodetach_notsup, filt_fifo_notsup }; 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 = { struct vop_vector fifo_specops = {
.vop_default = &default_vnodeops, .vop_default = &default_vnodeops,

View File

@ -80,8 +80,11 @@ static d_poll_t apmpoll;
static d_kqfilter_t apmkqfilter; static d_kqfilter_t apmkqfilter;
static void apmreadfiltdetach(struct knote *kn); static void apmreadfiltdetach(struct knote *kn);
static int apmreadfilt(struct knote *kn, long hint); static int apmreadfilt(struct knote *kn, long hint);
static struct filterops apm_readfiltops = static struct filterops apm_readfiltops = {
{ 1, NULL, apmreadfiltdetach, apmreadfilt }; .f_isfd = 1,
.f_detach = apmreadfiltdetach,
.f_event = apmreadfilt,
};
static struct cdevsw apm_cdevsw = { static struct cdevsw apm_cdevsw = {
.d_version = D_VERSION, .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 void filt_timerdetach(struct knote *kn);
static int filt_timer(struct knote *kn, long hint); static int filt_timer(struct knote *kn, long hint);
static struct filterops file_filtops = static struct filterops file_filtops = {
{ 1, filt_fileattach, NULL, NULL }; .f_isfd = 1,
static struct filterops kqread_filtops = .f_attach = filt_fileattach,
{ 1, NULL, filt_kqdetach, filt_kqueue }; };
static struct filterops kqread_filtops = {
.f_isfd = 1,
.f_detach = filt_kqdetach,
.f_event = filt_kqueue,
};
/* XXX - move to kern_proc.c? */ /* XXX - move to kern_proc.c? */
static struct filterops proc_filtops = static struct filterops proc_filtops = {
{ 0, filt_procattach, filt_procdetach, filt_proc }; .f_isfd = 0,
static struct filterops timer_filtops = .f_attach = filt_procattach,
{ 0, filt_timerattach, filt_timerdetach, filt_timer }; .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 uma_zone_t knote_zone;
static int kq_ncallouts = 0; static int kq_ncallouts = 0;
@ -228,8 +241,10 @@ filt_nullattach(struct knote *kn)
return (ENXIO); return (ENXIO);
}; };
struct filterops null_filtops = struct filterops null_filtops = {
{ 0, filt_nullattach, NULL, NULL }; .f_isfd = 0,
.f_attach = filt_nullattach,
};
/* XXX - make SYSINIT to add these, and move into respective modules. */ /* XXX - make SYSINIT to add these, and move into respective modules. */
extern struct filterops sig_filtops; 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 void sigqueue_start(void);
static uma_zone_t ksiginfo_zone = NULL; static uma_zone_t ksiginfo_zone = NULL;
struct filterops sig_filtops = struct filterops sig_filtops = {
{ 0, filt_sigattach, filt_sigdetach, filt_signal }; .f_isfd = 0,
.f_attach = filt_sigattach,
.f_detach = filt_sigdetach,
.f_event = filt_signal,
};
int kern_logsigexit = 1; int kern_logsigexit = 1;
SYSCTL_INT(_kern, KERN_LOGSIGEXIT, logsigexit, CTLFLAG_RW, 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_piperead(struct knote *kn, long hint);
static int filt_pipewrite(struct knote *kn, long hint); static int filt_pipewrite(struct knote *kn, long hint);
static struct filterops pipe_rfiltops = static struct filterops pipe_rfiltops = {
{ 1, NULL, filt_pipedetach, filt_piperead }; .f_isfd = 1,
static struct filterops pipe_wfiltops = .f_detach = filt_pipedetach,
{ 1, NULL, filt_pipedetach, filt_pipewrite }; .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 * 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 = static struct filterops tty_kqops_read = {
{ 1, NULL, tty_kqops_read_detach, tty_kqops_read_event }; .f_isfd = 1,
static struct filterops tty_kqops_write = .f_detach = tty_kqops_read_detach,
{ 1, NULL, tty_kqops_write_detach, tty_kqops_write_event }; .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 static int
ttydev_kqfilter(struct cdev *dev, struct knote *kn) 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 = static struct filterops pts_kqops_read = {
{ 1, NULL, pts_kqops_read_detach, pts_kqops_read_event }; .f_isfd = 1,
static struct filterops pts_kqops_write = .f_detach = pts_kqops_read_detach,
{ 1, NULL, pts_kqops_write_detach, pts_kqops_write_event }; .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 static int
ptsdev_kqfilter(struct file *fp, struct knote *kn) 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_mqread(struct knote *kn, long hint);
static int filt_mqwrite(struct knote *kn, long hint); static int filt_mqwrite(struct knote *kn, long hint);
struct filterops mq_rfiltops = struct filterops mq_rfiltops = {
{ 1, NULL, filt_mqdetach, filt_mqread }; .f_isfd = 1,
struct filterops mq_wfiltops = .f_detach = filt_mqdetach,
{ 1, NULL, filt_mqdetach, filt_mqwrite }; .f_event = filt_mqread,
};
struct filterops mq_wfiltops = {
.f_isfd = 1,
.f_detach = filt_mqdetach,
.f_event = filt_mqwrite,
};
/* /*
* Initialize fileno bitmap * 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_sowrite(struct knote *kn, long hint);
static int filt_solisten(struct knote *kn, long hint); static int filt_solisten(struct knote *kn, long hint);
static struct filterops solisten_filtops = static struct filterops solisten_filtops = {
{ 1, NULL, filt_sordetach, filt_solisten }; .f_isfd = 1,
static struct filterops soread_filtops = .f_detach = filt_sordetach,
{ 1, NULL, filt_sordetach, filt_soread }; .f_event = filt_solisten,
static struct filterops sowrite_filtops = };
{ 1, NULL, filt_sowdetach, filt_sowrite }; 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; uma_zone_t socket_zone;
so_gen_t so_gencnt; /* generation count for sockets */ 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; static uma_zone_t kaio_zone, aiop_zone, aiocb_zone, aiol_zone, aiolio_zone;
/* kqueue filters for aio */ /* kqueue filters for aio */
static struct filterops aio_filtops = static struct filterops aio_filtops = {
{ 0, filt_aioattach, filt_aiodetach, filt_aio }; .f_isfd = 0,
static struct filterops lio_filtops = .f_attach = filt_aioattach,
{ 0, filt_lioattach, filt_liodetach, filt_lio }; .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; 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 void filt_fsdetach(struct knote *kn);
static int filt_fsevent(struct knote *kn, long hint); static int filt_fsevent(struct knote *kn, long hint);
struct filterops fs_filtops = struct filterops fs_filtops = {
{ 0, filt_fsattach, filt_fsdetach, filt_fsevent }; .f_isfd = 0,
.f_attach = filt_fsattach,
.f_detach = filt_fsdetach,
.f_event = filt_fsevent
};
static int static int
filt_fsattach(struct knote *kn) 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_vfswrite(struct knote *kn, long hint);
static int filt_vfsvnode(struct knote *kn, long hint); static int filt_vfsvnode(struct knote *kn, long hint);
static void filt_vfsdetach(struct knote *kn); static void filt_vfsdetach(struct knote *kn);
static struct filterops vfsread_filtops = static struct filterops vfsread_filtops = {
{ 1, NULL, filt_vfsdetach, filt_vfsread }; .f_isfd = 1,
static struct filterops vfswrite_filtops = .f_detach = filt_vfsdetach,
{ 1, NULL, filt_vfsdetach, filt_vfswrite }; .f_event = filt_vfsread
static struct filterops vfsvnode_filtops = };
{ 1, NULL, filt_vfsdetach, filt_vfsvnode }; 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 static void
vfs_knllock(void *arg) vfs_knllock(void *arg)

View File

@ -148,8 +148,11 @@ static struct cdevsw bpf_cdevsw = {
.d_kqfilter = bpfkqfilter, .d_kqfilter = bpfkqfilter,
}; };
static struct filterops bpfread_filtops = static struct filterops bpfread_filtops = {
{ 1, NULL, filt_bpfdetach, filt_bpfread }; .f_isfd = 1,
.f_detach = filt_bpfdetach,
.f_event = filt_bpfread,
};
/* /*
* Wrapper functions for various buffering methods. If the set of buffer * Wrapper functions for various buffering methods. If the set of buffer