PERFORCE change 147974 for review
John Birrell
jb at FreeBSD.org
Thu Aug 21 06:18:17 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=147974
Change 147974 by jb at 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 <dtrace_anon.c>
+#if __FreeBSD_version < 800039
#include <dtrace_clone.c>
+#endif
#include <dtrace_ioctl.c>
#include <dtrace_load.c>
#include <dtrace_modevent.c>
==== //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);
More information about the p4-projects
mailing list