From ff24404b376ee802a4160e1f4edaa37d405149af Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 2 Mar 2003 19:17:51 +0000 Subject: [PATCH] Don't use evil casts in cdevsw initialization. --- sys/dev/null/null.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/dev/null/null.c b/sys/dev/null/null.c index 6bdce78131ba..c96faf0cf8b2 100644 --- a/sys/dev/null/null.c +++ b/sys/dev/null/null.c @@ -44,15 +44,16 @@ static dev_t zero_dev; static d_write_t null_write; static d_ioctl_t null_ioctl; static d_read_t zero_read; +static d_read_t null_read; #define CDEV_MAJOR 2 #define NULL_MINOR 2 #define ZERO_MINOR 12 static struct cdevsw null_cdevsw = { - /* open */ (d_open_t *)nullop, - /* close */ (d_close_t *)nullop, - /* read */ (d_read_t *)nullop, + /* open */ nullopen, + /* close */ nullclose, + /* read */ null_read, /* write */ null_write, /* ioctl */ null_ioctl, /* poll */ nopoll, @@ -67,8 +68,8 @@ static struct cdevsw null_cdevsw = { }; static struct cdevsw zero_cdevsw = { - /* open */ (d_open_t *)nullop, - /* close */ (d_close_t *)nullop, + /* open */ nullopen, + /* close */ nullclose, /* read */ zero_read, /* write */ null_write, /* ioctl */ noioctl, @@ -85,6 +86,13 @@ static struct cdevsw zero_cdevsw = { static void *zbuf; +static int +null_read(dev_t dev __unused, struct uio *uio, int flags __unused) +{ + + return 0; +} + /* ARGSUSED */ static int null_write(dev_t dev __unused, struct uio *uio, int flags __unused)