Date: Thu, 20 Apr 2006 02:17:18 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 95655 for review Message-ID: <200604200217.k3K2HI3u022755@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=95655 Change 95655 by jb@jb_freebsd2 on 2006/04/20 02:16:41 Work-in-progress update. I much prefer working on this stuff with the functions in separate files. Affected files ... .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap.c#2 edit .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_close.c#1 add .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_ioctl.c#1 add .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_load.c#1 add .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_modevent.c#1 add .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_open.c#1 add .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_sysctl.c#1 add .. //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap_unload.c#1 add Differences ... ==== //depot/projects/dtrace/src/sys/cddl/dev/fasttrap/fasttrap.c#2 (text+ko) ==== @@ -38,92 +38,38 @@ #include <sys/poll.h> #include <sys/proc.h> #include <sys/selinfo.h> +#include <sys/sysctl.h> #include <sys/uio.h> #include <sys/unistd.h> -#include <machine/bus.h> -#include <machine/cpu.h> +#include <contrib/opensolaris/uts/common/sys/dtrace_impl.h> -#include <contrib/opensolaris/uts/common/sys/dtrace.h> -#include <cddl/dev/fasttrap/fasttrap.h> +#define FASTTRAP_MINOR 0 -#define DTRACE_MINOR 0 - -static d_close_t fasttrap_close; -static d_ioctl_t fasttrap_ioctl; -static d_open_t fasttrap_open; +static d_close_t fasttrap_close; +static d_ioctl_t fasttrap_ioctl; +static d_open_t fasttrap_open; +static int fasttrap_load(void); +static int fasttrap_unload(void); static struct cdevsw fasttrap_cdevsw = { - .d_version = D_VERSION, - .d_close = fasttrap_close, - .d_ioctl = fasttrap_ioctl, - .d_open = fasttrap_open, - .d_name = "fasttrap", + .d_version = D_VERSION, + .d_close = fasttrap_close, + .d_ioctl = fasttrap_ioctl, + .d_open = fasttrap_open, + .d_name = "fasttrap", }; /* For use with make_dev(9)/destroy_dev(9). */ static struct cdev *fasttrap_dev; -/* ARGSUSED */ -static int -fasttrap_close(struct cdev *dev __unused, int flags, int fmt __unused, - struct thread *td) -{ - return (0); -} - -/* ARGSUSED */ -static int -fasttrap_ioctl(struct cdev *dev __unused, u_long cmd, caddr_t addr __unused, - int flags __unused, struct thread *td __unused) -{ - int error = 0; - - switch (cmd) { - /* Really handled in upper layer */ - case FIOASYNC: - case FIONBIO: - break; - default: - error = ENOTTY; - } - return (error); -} - -/* ARGSUSED */ -static int -fasttrap_open(struct cdev *dev, int oflags, int devtype, struct thread *td) -{ - int error = 0; - return (error); -} - -/* ARGSUSED */ -static int -fasttrap_modevent(module_t mod __unused, int type, void *data __unused) -{ - int error = 0; - - switch (type) { - case MOD_LOAD: - fasttrap_dev = make_dev(&fasttrap_cdevsw, DTRACE_MINOR, - UID_ROOT, GID_WHEEL, 0660, "fasttrap"); - break; - - case MOD_UNLOAD: - destroy_dev(fasttrap_dev); - break; - - case MOD_SHUTDOWN: - break; - - default: - error = EOPNOTSUPP; - break; - - } - return (error); -} +#include <cddl/dev/fasttrap/fasttrap_close.c> +#include <cddl/dev/fasttrap/fasttrap_ioctl.c> +#include <cddl/dev/fasttrap/fasttrap_load.c> +#include <cddl/dev/fasttrap/fasttrap_modevent.c> +#include <cddl/dev/fasttrap/fasttrap_open.c> +#include <cddl/dev/fasttrap/fasttrap_sysctl.c> +#include <cddl/dev/fasttrap/fasttrap_unload.c> DEV_MODULE(fasttrap, fasttrap_modevent, NULL); MODULE_VERSION(fasttrap, 1);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200604200217.k3K2HI3u022755>