From 8f0d63493612f758f98d10101d9197a3f3152542 Mon Sep 17 00:00:00 2001 From: rik Date: Sun, 6 Aug 2006 11:04:22 +0000 Subject: [PATCH] Fix compilation. Reviewed by: julian@ --- share/examples/drivers/make_device_driver.sh | 21 +++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/share/examples/drivers/make_device_driver.sh b/share/examples/drivers/make_device_driver.sh index 14e3d3ba1616..cae5d06632df 100755 --- a/share/examples/drivers/make_device_driver.sh +++ b/share/examples/drivers/make_device_driver.sh @@ -152,8 +152,6 @@ __FBSDID("\$${RCS_KEYWORD}$"); #include #include -#include -#include #include #include @@ -198,7 +196,7 @@ struct ${1}_softc { struct resource* res_irq; /* Resource for irq range. */ struct resource* res_drq; /* Resource for dma channel. */ device_t device; - dev_t dev; + struct cdev *dev; void *intr_cookie; void *vaddr; /* Virtual address of mem resource. */ char buffer[BUFFERSIZE]; /* If we need to buffer something. */ @@ -219,8 +217,8 @@ static d_mmap_t ${1}mmap; static d_poll_t ${1}poll; static void ${1}intr(void *arg); -#define CDEV_MAJOR 20 static struct cdevsw ${1}_cdevsw = { + .d_version = D_VERSION, .d_open = ${1}open, .d_close = ${1}close, .d_read = ${1}read, @@ -229,7 +227,6 @@ static struct cdevsw ${1}_cdevsw = { .d_poll = ${1}poll, .d_mmap = ${1}mmap, .d_name = "${1}", - .d_maj = CDEV_MAJOR, }; static devclass_t ${1}_devclass; @@ -818,7 +815,7 @@ ${1}intr(void *arg) } static int -${1}ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +${1}ioctl (struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { struct ${1}_softc *scp = DEV2SOFTC(dev); @@ -840,7 +837,7 @@ ${1}ioctl (dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) * This should get you started. */ static int -${1}open(dev_t dev, int oflags, int devtype, struct thread *td) +${1}open(struct cdev *dev, int oflags, int devtype, struct thread *td) { struct ${1}_softc *scp = DEV2SOFTC(dev); @@ -852,7 +849,7 @@ ${1}open(dev_t dev, int oflags, int devtype, struct thread *td) } static int -${1}close(dev_t dev, int fflag, int devtype, struct thread *td) +${1}close(struct cdev *dev, int fflag, int devtype, struct thread *td) { struct ${1}_softc *scp = DEV2SOFTC(dev); @@ -864,7 +861,7 @@ ${1}close(dev_t dev, int fflag, int devtype, struct thread *td) } static int -${1}read(dev_t dev, struct uio *uio, int ioflag) +${1}read(struct cdev *dev, struct uio *uio, int ioflag) { struct ${1}_softc *scp = DEV2SOFTC(dev); int toread; @@ -879,7 +876,7 @@ ${1}read(dev_t dev, struct uio *uio, int ioflag) } static int -${1}write(dev_t dev, struct uio *uio, int ioflag) +${1}write(struct cdev *dev, struct uio *uio, int ioflag) { struct ${1}_softc *scp = DEV2SOFTC(dev); int towrite; @@ -894,7 +891,7 @@ ${1}write(dev_t dev, struct uio *uio, int ioflag) } static int -${1}mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) +${1}mmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) { struct ${1}_softc *scp = DEV2SOFTC(dev); @@ -913,7 +910,7 @@ ${1}mmap(dev_t dev, vm_offset_t offset, vm_paddr_t *paddr, int nprot) } static int -${1}poll(dev_t dev, int which, struct thread *td) +${1}poll(struct cdev *dev, int which, struct thread *td) { struct ${1}_softc *scp = DEV2SOFTC(dev);