diff options
author | Martin Blapp <mbr@FreeBSD.org> | 2003-08-03 10:39:29 +0000 |
---|---|---|
committer | Martin Blapp <mbr@FreeBSD.org> | 2003-08-03 10:39:29 +0000 |
commit | fffc6e58d90fb163e7fc5c404411e02660e28c84 (patch) | |
tree | 0d4b73fc06955d9d95dd780e6536a978b16813f2 /share/examples | |
parent | 745f3305030f5b38e4e3858218ed01e523d5aff4 (diff) | |
download | src-fffc6e58d90fb163e7fc5c404411e02660e28c84.tar.gz src-fffc6e58d90fb163e7fc5c404411e02660e28c84.zip |
Fix the cdev kld example.
PR: 52954
Submitted by: Priit Piipuu <priit.piipuu@mail.ee>
Reviewed by: phk
Notes
Notes:
svn path=/head/; revision=118385
Diffstat (limited to 'share/examples')
-rw-r--r-- | share/examples/kld/cdev/module/Makefile | 9 | ||||
-rw-r--r-- | share/examples/kld/cdev/module/cdevmod.c | 25 | ||||
-rw-r--r-- | share/examples/kld/cdev/test/Makefile | 2 | ||||
-rw-r--r-- | share/examples/kld/cdev/test/testcdev.c | 1 |
4 files changed, 14 insertions, 23 deletions
diff --git a/share/examples/kld/cdev/module/Makefile b/share/examples/kld/cdev/module/Makefile index 042427b56331..a35c5001395d 100644 --- a/share/examples/kld/cdev/module/Makefile +++ b/share/examples/kld/cdev/module/Makefile @@ -4,13 +4,4 @@ KMOD= cdev SRCS= cdev.c cdevmod.c -/dev/cdev: - mknod ${.TARGET} c 32 0 - -un/dev/cdev: .PHONY - rm -f /dev/cdev - .include <bsd.kmod.mk> - -load: /dev/cdev -unload: un/dev/cdev diff --git a/share/examples/kld/cdev/module/cdevmod.c b/share/examples/kld/cdev/module/cdevmod.c index cb80a72277c0..ceb6ce053217 100644 --- a/share/examples/kld/cdev/module/cdevmod.c +++ b/share/examples/kld/cdev/module/cdevmod.c @@ -75,23 +75,20 @@ #include "cdev.h" +#if __FreeBSD_version < 500000 #define CDEV_MAJOR 32 +#else +#define CDEV_MAJOR MAJOR_AUTO +#endif static struct cdevsw my_devsw = { - /* open */ mydev_open, - /* close */ mydev_close, - /* read */ mydev_read, - /* write */ mydev_write, - /* ioctl */ mydev_ioctl, - /* poll */ nopoll, - /* mmap */ nommap, - /* strategy */ nostrategy, - /* name */ "cdev", - /* maj */ CDEV_MAJOR, - /* dump */ nodump, - /* psize */ nopsize, - /* flags */ D_TTY, - /* bmaj */ -1 + /* open */ .d_open = mydev_open, + /* close */ .d_close = mydev_close, + /* read */ .d_read = mydev_read, + /* write */ .d_write = mydev_write, + /* ioctl */ .d_ioctl = mydev_ioctl, + /* name */ .d_name = "cdev", + /* maj */ .d_maj = CDEV_MAJOR }; /* diff --git a/share/examples/kld/cdev/test/Makefile b/share/examples/kld/cdev/test/Makefile index 2ca3d2188da7..ac228f9a4aff 100644 --- a/share/examples/kld/cdev/test/Makefile +++ b/share/examples/kld/cdev/test/Makefile @@ -89,4 +89,6 @@ unload: @echo ${MODSTAT} -n cdev +install: + .include <bsd.prog.mk> diff --git a/share/examples/kld/cdev/test/testcdev.c b/share/examples/kld/cdev/test/testcdev.c index d69c3f5b090f..0a6118103c03 100644 --- a/share/examples/kld/cdev/test/testcdev.c +++ b/share/examples/kld/cdev/test/testcdev.c @@ -75,6 +75,7 @@ #include <fcntl.h> #include <paths.h> #include <string.h> +#include <sys/types.h> #include <sys/ioccom.h> #define CDEV_IOCTL1 _IOR('C', 1, u_int) |