From owner-p4-projects@FreeBSD.ORG Thu Aug 21 06:18:17 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 98631106566B; Thu, 21 Aug 2008 06:18:17 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 290FE1065673 for ; Thu, 21 Aug 2008 06:18:17 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 190758FC1D for ; Thu, 21 Aug 2008 06:18:17 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7L6IGlf068830 for ; Thu, 21 Aug 2008 06:18:16 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7L6IGb5068825 for perforce@freebsd.org; Thu, 21 Aug 2008 06:18:16 GMT (envelope-from jb@freebsd.org) Date: Thu, 21 Aug 2008 06:18:16 GMT Message-Id: <200808210618.m7L6IGb5068825@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 147974 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Aug 2008 06:18:17 -0000 http://perforce.freebsd.org/chv.cgi?CH=147974 Change 147974 by jb@freebsd3 on 2008/08/21 06:17:43 IFC Affected files ... .. //depot/projects/dtrace7/src/cddl/Makefile.inc#6 integrate .. //depot/projects/dtrace7/src/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c#4 integrate .. //depot/projects/dtrace7/src/sys/cddl/compat/opensolaris/sys/types.h#3 integrate .. //depot/projects/dtrace7/src/sys/cddl/compat/opensolaris/sys/uio.h#3 integrate .. //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c#7 integrate .. //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c#3 integrate .. //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#5 integrate .. //depot/projects/dtrace7/src/sys/cddl/dev/dtrace/dtrace_ioctl.c#4 integrate .. //depot/projects/dtrace7/src/sys/cddl/dev/dtrace/dtrace_load.c#5 integrate .. //depot/projects/dtrace7/src/sys/cddl/dev/dtrace/dtrace_unload.c#5 integrate Differences ... ==== //depot/projects/dtrace7/src/cddl/Makefile.inc#6 (text+ko) ==== @@ -4,3 +4,5 @@ OPENSOLARIS_SYS_DISTDIR= ${.CURDIR}/../../../sys/cddl/contrib/opensolaris IGNORE_PRAGMA= YES + +CFLAGS+= -DNEED_SOLARIS_BOOLEAN ==== //depot/projects/dtrace7/src/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c#4 (text+ko) ==== ==== //depot/projects/dtrace7/src/sys/cddl/compat/opensolaris/sys/types.h#3 (text+ko) ==== @@ -64,12 +64,13 @@ typedef int64_t rlim64_t; #else - +#ifdef NEED_SOLARIS_BOOLEAN #if defined(__XOPEN_OR_POSIX) typedef enum { _B_FALSE, _B_TRUE } boolean_t; #else typedef enum { B_FALSE, B_TRUE } boolean_t; #endif /* defined(__XOPEN_OR_POSIX) */ +#endif typedef longlong_t offset_t; typedef u_longlong_t u_offset_t; ==== //depot/projects/dtrace7/src/sys/cddl/compat/opensolaris/sys/uio.h#3 (text+ko) ==== @@ -51,6 +51,7 @@ #define uio_loffset uio_offset +#ifdef BUILDING_ZFS static __inline int zfs_uiomove(void *cp, size_t n, enum uio_rw dir, uio_t *uio) { @@ -59,5 +60,6 @@ return (uiomove(cp, (int)n, uio)); } #define uiomove(cp, n, dir, uio) zfs_uiomove((cp), (n), (dir), (uio)) +#endif #endif /* !_OPENSOLARIS_SYS_UIO_H_ */ ==== //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c#7 (text) ==== @@ -18,7 +18,7 @@ * * CDDL HEADER END * - * $FreeBSD: src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c,v 1.5 2008/06/11 18:55:19 ed Exp $ + * $FreeBSD: src/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c,v 1.6 2008/08/19 21:28:58 jb Exp $ */ /* @@ -3007,6 +3007,9 @@ case DIF_VAR_EXECARGS: { struct pargs *p_args = curthread->td_proc->p_args; + if (p_args == NULL) + return(0); + return (dtrace_dif_varstrz( (uintptr_t) p_args->ar_args, p_args->ar_length, state, mstate)); } @@ -10598,7 +10601,6 @@ /* * If there is already a buffer allocated for this CPU, it * is only possible that this is a DR event. In this case, - * the buffer size must match our specified size. */ if (buf->dtb_tomax != NULL) { ASSERT(buf->dtb_size == size); @@ -13616,7 +13618,9 @@ cyclic_remove(state->dts_deadman); #else callout_stop(&state->dts_cleaner); + callout_drain(&state->dts_cleaner); callout_stop(&state->dts_deadman); + callout_drain(&state->dts_deadman); #endif dtrace_dstate_fini(&vstate->dtvs_dynvars); @@ -15235,6 +15239,15 @@ } #endif +#if !defined(sun) +#if __FreeBSD_version >= 800039 +static void +dtrace_dtr(void *data __unused) +{ +} +#endif +#endif + /*ARGSUSED*/ static int #if defined(sun) @@ -15260,6 +15273,7 @@ #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. @@ -15275,6 +15289,7 @@ */ if (dev->si_drv1 != NULL) return (EBUSY); +#endif cred_p = dev->si_cred; #endif @@ -15286,9 +15301,11 @@ 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); } @@ -15320,7 +15337,11 @@ 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); @@ -15334,9 +15355,11 @@ #endif mutex_exit(&dtrace_lock); #if !defined(sun) +#if __FreeBSD_version < 800039 /* Destroy the cloned device. */ destroy_dev(dev); #endif +#endif return (EAGAIN); } @@ -15362,11 +15385,16 @@ 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 (minor(dev) == 0) return (0); +#else + dtrace_state_t *state; + devfs_get_cdevpriv((void **) &state); +#endif #endif @@ -15386,8 +15414,12 @@ #if !defined(sun) kmem_free(state, 0); +#if __FreeBSD_version < 800039 dev->si_drv1 = NULL; +#else + devfs_clear_cdevpriv(); #endif +#endif } ASSERT(dtrace_opens > 0); @@ -15401,8 +15433,10 @@ mutex_exit(&dtrace_lock); mutex_exit(&cpu_lock); +#if __FreeBSD_version < 800039 /* Schedule this cloned device to be destroyed. */ destroy_dev_sched(dev); +#endif return (0); } @@ -16436,16 +16470,20 @@ static d_ioctl_t dtrace_ioctl; 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; +#endif void dtrace_invop_init(void); void dtrace_invop_uninit(void); static struct cdevsw dtrace_cdevsw = { .d_version = D_VERSION, - .d_flags = D_NEEDMINOR, + .d_flags = D_TRACKCLOSE | D_NEEDMINOR, .d_close = dtrace_close, .d_ioctl = dtrace_ioctl, .d_open = dtrace_open, @@ -16453,7 +16491,9 @@ }; #include +#if __FreeBSD_version < 800039 #include +#endif #include #include #include ==== //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c#3 (text+ko) ==== @@ -196,7 +196,7 @@ break; } zs->zst_ph_offset = prefetch_tail; - zs->zst_last = lbolt; + zs->zst_last = LBOLT; } /* @@ -517,7 +517,7 @@ for (zs = list_head(&zf->zf_stream); zs; zs = list_next(&zf->zf_stream, zs)) { - if (((lbolt - zs->zst_last) / hz) > zfetch_min_sec_reap) + if (((LBOLT - zs->zst_last) / hz) > zfetch_min_sec_reap) break; } @@ -639,7 +639,7 @@ newstream->zst_ph_offset = zst.zst_len + zst.zst_offset; newstream->zst_cap = zst.zst_len; newstream->zst_direction = ZFETCH_FORWARD; - newstream->zst_last = lbolt; + newstream->zst_last = LBOLT; mutex_init(&newstream->zst_lock, NULL, MUTEX_DEFAULT, NULL); ==== //depot/projects/dtrace7/src/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c#5 (text+ko) ==== ==== //depot/projects/dtrace7/src/sys/cddl/dev/dtrace/dtrace_ioctl.c#4 (text+ko) ==== @@ -32,7 +32,12 @@ 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); ==== //depot/projects/dtrace7/src/sys/cddl/dev/dtrace/dtrace_load.c#5 (text+ko) ==== @@ -154,11 +154,15 @@ 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"); +#endif return; } ==== //depot/projects/dtrace7/src/sys/cddl/dev/dtrace/dtrace_unload.c#5 (text+ko) ==== @@ -28,6 +28,7 @@ dtrace_state_t *state; int error = 0; +#if __FreeBSD_version < 800039 /* * Check if there is still an event handler callback * registered. @@ -40,6 +41,9 @@ /* Stop device cloning. */ clone_cleanup(&dtrace_clones); } +#else + destroy_dev(dtrace_dev); +#endif mutex_enter(&dtrace_provider_lock); mutex_enter(&dtrace_lock);