Date: Tue, 14 Oct 2014 23:16:53 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r273110 - in stable/10/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace Message-ID: <201410142316.s9ENGruW021251@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Tue Oct 14 23:16:52 2014 New Revision: 273110 URL: https://svnweb.freebsd.org/changeset/base/273110 Log: MFC r267851: Continue the crusade towards a dev_clone()-free kernel, removing its usage from dtrace. The dtrace code already uses cdevpriv(9) since FreeBSD 8, so this change is quite harmless. Originally by: davide Reviewed by: markj Deleted: stable/10/sys/cddl/dev/dtrace/dtrace_clone.c Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c stable/10/sys/cddl/dev/dtrace/dtrace_ioctl.c stable/10/sys/cddl/dev/dtrace/dtrace_load.c stable/10/sys/cddl/dev/dtrace/dtrace_unload.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Oct 14 21:19:23 2014 (r273109) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Oct 14 23:16:52 2014 (r273110) @@ -16728,10 +16728,8 @@ dtrace_attach(dev_info_t *devi, ddi_atta #endif #if !defined(sun) -#if __FreeBSD_version >= 800039 static void dtrace_dtr(void *); #endif -#endif /*ARGSUSED*/ static int @@ -16758,27 +16756,7 @@ dtrace_open(struct cdev *dev, int oflags return (ENXIO); #else cred_t *cred_p = NULL; - -#if __FreeBSD_version < 800039 - /* - * The first minor device is the one that is cloned so there is - * nothing more to do here. - */ - if (dev2unit(dev) == 0) - return 0; - - /* - * Devices are cloned, so if the DTrace state has already - * been allocated, that means this device belongs to a - * different client. Each client should open '/dev/dtrace' - * to get a cloned device. - */ - if (dev->si_drv1 != NULL) - return (EBUSY); -#endif - cred_p = dev->si_cred; -#endif /* * If no DTRACE_PRIV_* bits are set in the credential, then the @@ -16786,11 +16764,6 @@ dtrace_open(struct cdev *dev, int oflags */ dtrace_cred2priv(cred_p, &priv, &uid, &zoneid); if (priv == DTRACE_PRIV_NONE) { -#if !defined(sun) -#if __FreeBSD_version < 800039 - /* Destroy the cloned device. */ - destroy_dev(dev); -#endif #endif return (EACCES); @@ -16823,12 +16796,8 @@ dtrace_open(struct cdev *dev, int oflags state = dtrace_state_create(devp, cred_p); #else state = dtrace_state_create(dev); -#if __FreeBSD_version < 800039 - dev->si_drv1 = state; -#else devfs_set_cdevpriv(state, dtrace_dtr); #endif -#endif mutex_exit(&cpu_lock); @@ -16840,12 +16809,6 @@ dtrace_open(struct cdev *dev, int oflags --dtrace_opens; #endif mutex_exit(&dtrace_lock); -#if !defined(sun) -#if __FreeBSD_version < 800039 - /* Destroy the cloned device. */ - destroy_dev(dev); -#endif -#endif return (EAGAIN); } @@ -16858,9 +16821,6 @@ dtrace_open(struct cdev *dev, int oflags #if defined(sun) static int dtrace_close(dev_t dev, int flag, int otyp, cred_t *cred_p) -#elif __FreeBSD_version < 800039 -static int -dtrace_close(struct cdev *dev, int flags, int fmt __unused, struct thread *td) #else static void dtrace_dtr(void *data) @@ -16875,18 +16835,9 @@ dtrace_dtr(void *data) state = ddi_get_soft_state(dtrace_softstate, minor); #else -#if __FreeBSD_version < 800039 - dtrace_state_t *state = dev->si_drv1; - - /* Check if this is not a cloned device. */ - if (dev2unit(dev) == 0) - return (0); -#else dtrace_state_t *state = data; #endif -#endif - mutex_enter(&cpu_lock); mutex_enter(&dtrace_lock); @@ -16903,9 +16854,6 @@ dtrace_dtr(void *data) #if !defined(sun) kmem_free(state, 0); -#if __FreeBSD_version < 800039 - dev->si_drv1 = NULL; -#endif #endif } @@ -16924,12 +16872,7 @@ dtrace_dtr(void *data) mutex_exit(&dtrace_lock); mutex_exit(&cpu_lock); -#if __FreeBSD_version < 800039 - /* Schedule this cloned device to be destroyed. */ - destroy_dev_sched(dev); -#endif - -#if defined(sun) || __FreeBSD_version < 800039 +#if defined(sun) return (0); #endif } @@ -17969,24 +17912,14 @@ static d_ioctl_t dtrace_ioctl; static d_ioctl_t dtrace_ioctl_helper; static void dtrace_load(void *); static int dtrace_unload(void); -#if __FreeBSD_version < 800039 -static void dtrace_clone(void *, struct ucred *, char *, int , struct cdev **); -static struct clonedevs *dtrace_clones; /* Ptr to the array of cloned devices. */ -static eventhandler_tag eh_tag; /* Event handler tag. */ -#else static struct cdev *dtrace_dev; static struct cdev *helper_dev; -#endif void dtrace_invop_init(void); void dtrace_invop_uninit(void); static struct cdevsw dtrace_cdevsw = { .d_version = D_VERSION, -#if __FreeBSD_version < 800039 - .d_flags = D_TRACKCLOSE | D_NEEDMINOR, - .d_close = dtrace_close, -#endif .d_ioctl = dtrace_ioctl, .d_open = dtrace_open, .d_name = "dtrace", @@ -17999,9 +17932,6 @@ static struct cdevsw helper_cdevsw = { }; #include <dtrace_anon.c> -#if __FreeBSD_version < 800039 -#include <dtrace_clone.c> -#endif #include <dtrace_ioctl.c> #include <dtrace_load.c> #include <dtrace_modevent.c> Modified: stable/10/sys/cddl/dev/dtrace/dtrace_ioctl.c ============================================================================== --- stable/10/sys/cddl/dev/dtrace/dtrace_ioctl.c Tue Oct 14 21:19:23 2014 (r273109) +++ stable/10/sys/cddl/dev/dtrace/dtrace_ioctl.c Tue Oct 14 23:16:52 2014 (r273110) @@ -78,12 +78,9 @@ static int dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags __unused, struct thread *td) { -#if __FreeBSD_version < 800039 - dtrace_state_t *state = dev->si_drv1; -#else dtrace_state_t *state; devfs_get_cdevpriv((void **) &state); -#endif + int error = 0; if (state == NULL) return (EINVAL); Modified: stable/10/sys/cddl/dev/dtrace/dtrace_load.c ============================================================================== --- stable/10/sys/cddl/dev/dtrace/dtrace_load.c Tue Oct 14 21:19:23 2014 (r273109) +++ stable/10/sys/cddl/dev/dtrace/dtrace_load.c Tue Oct 14 23:16:52 2014 (r273110) @@ -158,18 +158,10 @@ dtrace_load(void *dummy) mutex_exit(&cpu_lock); -#if __FreeBSD_version < 800039 - /* Enable device cloning. */ - clone_setup(&dtrace_clones); - - /* Setup device cloning events. */ - eh_tag = EVENTHANDLER_REGISTER(dev_clone, dtrace_clone, 0, 1000); -#else dtrace_dev = make_dev(&dtrace_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "dtrace/dtrace"); helper_dev = make_dev(&helper_cdevsw, 0, UID_ROOT, GID_WHEEL, 0660, "dtrace/helper"); -#endif return; } Modified: stable/10/sys/cddl/dev/dtrace/dtrace_unload.c ============================================================================== --- stable/10/sys/cddl/dev/dtrace/dtrace_unload.c Tue Oct 14 21:19:23 2014 (r273109) +++ stable/10/sys/cddl/dev/dtrace/dtrace_unload.c Tue Oct 14 23:16:52 2014 (r273110) @@ -28,23 +28,8 @@ dtrace_unload() dtrace_state_t *state; int error = 0; -#if __FreeBSD_version < 800039 - /* - * Check if there is still an event handler callback - * registered. - */ - if (eh_tag != 0) { - /* De-register the device cloning event handler. */ - EVENTHANDLER_DEREGISTER(dev_clone, eh_tag); - eh_tag = 0; - - /* Stop device cloning. */ - clone_cleanup(&dtrace_clones); - } -#else destroy_dev(dtrace_dev); destroy_dev(helper_dev); -#endif mutex_enter(&dtrace_provider_lock); mutex_enter(&dtrace_lock);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410142316.s9ENGruW021251>