Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Sync with upstream r315983.



details:   https://anonhg.NetBSD.org/src/rev/1db95d4d89be
branches:  trunk
changeset: 452209:1db95d4d89be
user:      hannken <hannken%NetBSD.org@localhost>
date:      Sat Jun 22 09:48:39 2019 +0000

description:
Sync with upstream r315983.

FreeBSD splits "zfs_context.h" into:
  "lib/libzpool/common/sys/zfs_context.h" for user space
  "uts/common/fs/zfs/sys/zfs_context.h" for kernel space

Do the same here, move and sync "sys/sys/zfs_context.h" to
"dist/lib/libzpool/common/sys/zfs_context.h" and
"dist/uts/common/fs/zfs/sys/zfs_context.h".

Change "Makefile.zfs" to search includes from "dist/lib"
before "dist/uts" so we get the right include file.

Adapt "usr.sbin/fstyp/Makefile" to get the right include file.

diffstat:

 external/cddl/osnet/Makefile.zfs                               |   11 +-
 external/cddl/osnet/dist/lib/libzpool/common/sys/zfs_context.h |  841 ++++++++++
 external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h   |  139 +-
 external/cddl/osnet/sys/sys/zfs_context.h                      |  811 ---------
 usr.sbin/fstyp/Makefile                                        |    3 +-
 5 files changed, 987 insertions(+), 818 deletions(-)

diffs (truncated from 1921 to 300 lines):

diff -r 4ef8cb60e410 -r 1db95d4d89be external/cddl/osnet/Makefile.zfs
--- a/external/cddl/osnet/Makefile.zfs  Sat Jun 22 08:09:08 2019 +0000
+++ b/external/cddl/osnet/Makefile.zfs  Sat Jun 22 09:48:39 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.zfs,v 1.8 2018/06/07 13:21:44 kamil Exp $
+#      $NetBSD: Makefile.zfs,v 1.9 2019/06/22 09:48:39 hannken Exp $
 
 .include <bsd.own.mk>
 
@@ -21,10 +21,6 @@
 CPPFLAGS+=     -I${ZFSDIR}
 CPPFLAGS+=     -I${ZFSDIR}/include
 CPPFLAGS+=     -I${ZFSDIR}/sys
-CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common
-CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common/zfs
-CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common/fs/zfs
-CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common/sys
 
 CPPFLAGS+=     -I${ZFSDIR}/dist/common/zfs
 CPPFLAGS+=     -I${ZFSDIR}/dist/head
@@ -39,6 +35,11 @@
 
 CPPFLAGS+=      -I${ZFSDIR}/dist/common
 
+CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common
+CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common/zfs
+CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common/fs/zfs
+CPPFLAGS+=     -I${ZFSDIR}/dist/uts/common/sys
+
 CWARNFLAGS+=   -Wno-missing-field-initializers
 CWARNFLAGS+=   -Wno-strict-prototypes
 CWARNFLAGS+=   -Wno-cast-qual
diff -r 4ef8cb60e410 -r 1db95d4d89be external/cddl/osnet/dist/lib/libzpool/common/sys/zfs_context.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/external/cddl/osnet/dist/lib/libzpool/common/sys/zfs_context.h    Sat Jun 22 09:48:39 2019 +0000
@@ -0,0 +1,841 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2012, Joyent, Inc. All rights reserved.
+ */
+/*
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ */
+
+#ifndef _SYS_ZFS_CONTEXT_H
+#define        _SYS_ZFS_CONTEXT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define        _SYS_MUTEX_H
+#define        _SYS_RWLOCK_H
+#define        _SYS_CONDVAR_H
+#define        _SYS_SYSTM_H
+#define        _SYS_T_LOCK_H
+#define        _SYS_VNODE_H
+#define        _SYS_VFS_H
+#define        _SYS_SUNDDI_H
+#define        _SYS_CALLB_H
+#ifndef __NetBSD__
+#define        _SYS_SCHED_H_
+#else
+#define        _SYS_CONDVAR_H_
+#define _SYS_MUTEX_H_
+#define        _SYS_RWLOCK_H_
+#endif
+
+#include <solaris.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <string.h>
+#include <strings.h>
+#include <thread.h>
+#include <assert.h>
+#include <limits.h>
+#include <dirent.h>
+#include <time.h>
+#include <math.h>
+#include <umem.h>
+#include <inttypes.h>
+#include <fsshare.h>
+#include <pthread.h>
+#include <sched.h>
+#include <sys/debug.h>
+#include <sys/note.h>
+#include <sys/types.h>
+#include <sys/cred.h>
+#include <sys/atomic.h>
+#include <sys/sysmacros.h>
+#include <sys/bitmap.h>
+#include <sys/resource.h>
+#include <sys/byteorder.h>
+#include <sys/list.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/mntent.h>
+#include <sys/mnttab.h>
+#include <sys/zfs_debug.h>
+#include <sys/sdt.h>
+#include <sys/kstat.h>
+#include <sys/u8_textprep.h>
+#include <sys/kernel.h>
+#include <sys/disk.h>
+#include <sys/sysevent.h>
+#include <sys/sysevent/eventdefs.h>
+#include <sys/sysevent/dev.h>
+#ifndef __NetBSD__
+#include <machine/atomic.h>
+#else
+#include <sys/atomic.h>
+#endif
+#include <sys/debug.h>
+#ifdef illumos
+#include "zfs.h"
+#endif
+
+#define        ZFS_EXPORTS_PATH        "/etc/zfs/exports"
+
+/*
+ * Debugging
+ */
+
+/*
+ * Note that we are not using the debugging levels.
+ */
+
+#define        CE_CONT         0       /* continuation         */
+#define        CE_NOTE         1       /* notice               */
+#define        CE_WARN         2       /* warning              */
+#define        CE_PANIC        3       /* panic                */
+#define        CE_IGNORE       4       /* print nothing        */
+
+/*
+ * ZFS debugging
+ */
+
+#define        ZFS_LOG(...)    do {  } while (0)
+
+typedef u_longlong_t      rlim64_t;
+#define        RLIM64_INFINITY ((rlim64_t)-3)
+
+#ifdef ZFS_DEBUG
+extern void dprintf_setup(int *argc, char **argv);
+#endif /* ZFS_DEBUG */
+
+extern void cmn_err(int, const char *, ...);
+extern void vcmn_err(int, const char *, __va_list);
+extern void panic(const char *, ...);
+extern void vpanic(const char *, __va_list);
+
+#define        fm_panic        panic
+
+extern int aok;
+
+/*
+ * DTrace SDT probes have different signatures in userland than they do in
+ * the kernel.  If they're being used in kernel code, re-define them out of
+ * existence for their counterparts in libzpool.
+ *
+ * Here's an example of how to use the set-error probes in userland:
+ * zfs$target:::set-error /arg0 == EBUSY/ {stack();}
+ *
+ * Here's an example of how to use DTRACE_PROBE probes in userland:
+ * If there is a probe declared as follows:
+ * DTRACE_PROBE2(zfs__probe_name, uint64_t, blkid, dnode_t *, dn);
+ * Then you can use it as follows:
+ * zfs$target:::probe2 /copyinstr(arg0) == "zfs__probe_name"/
+ *     {printf("%u %p\n", arg1, arg2);}
+ */
+
+#ifdef DTRACE_PROBE
+#undef DTRACE_PROBE
+#endif /* DTRACE_PROBE */
+#ifdef illumos
+#define        DTRACE_PROBE(a) \
+       ZFS_PROBE0(#a)
+#endif
+
+#ifdef DTRACE_PROBE1
+#undef DTRACE_PROBE1
+#endif /* DTRACE_PROBE1 */
+#ifdef illumos
+#define        DTRACE_PROBE1(a, b, c) \
+       ZFS_PROBE1(#a, (unsigned long)c)
+#endif
+
+#ifdef DTRACE_PROBE2
+#undef DTRACE_PROBE2
+#endif /* DTRACE_PROBE2 */
+#ifdef illumos
+#define        DTRACE_PROBE2(a, b, c, d, e) \
+       ZFS_PROBE2(#a, (unsigned long)c, (unsigned long)e)
+#endif
+
+#ifdef DTRACE_PROBE3
+#undef DTRACE_PROBE3
+#endif /* DTRACE_PROBE3 */
+#ifdef illumos
+#define        DTRACE_PROBE3(a, b, c, d, e, f, g) \
+       ZFS_PROBE3(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g)
+#endif
+
+#ifdef DTRACE_PROBE4
+#undef DTRACE_PROBE4
+#endif /* DTRACE_PROBE4 */
+#ifdef illumos
+#define        DTRACE_PROBE4(a, b, c, d, e, f, g, h, i) \
+       ZFS_PROBE4(#a, (unsigned long)c, (unsigned long)e, (unsigned long)g, \
+       (unsigned long)i)
+#endif
+
+#ifdef illumos
+/*
+ * We use the comma operator so that this macro can be used without much
+ * additional code.  For example, "return (EINVAL);" becomes
+ * "return (SET_ERROR(EINVAL));".  Note that the argument will be evaluated
+ * twice, so it should not have side effects (e.g. something like:
+ * "return (SET_ERROR(log_error(EINVAL, info)));" would log the error twice).
+ */
+#define        SET_ERROR(err)  (ZFS_SET_ERROR(err), err)
+#else  /* !illumos */
+
+#define        DTRACE_PROBE(a) ((void)0)
+#define        DTRACE_PROBE1(a, b, c)  ((void)0)
+#define        DTRACE_PROBE2(a, b, c, d, e)    ((void)0)
+#define        DTRACE_PROBE3(a, b, c, d, e, f, g)      ((void)0)
+#define        DTRACE_PROBE4(a, b, c, d, e, f, g, h, i)        ((void)0)
+
+#define SET_ERROR(err) (err)
+#endif /* !illumos */
+
+/*
+ * Threads
+ */
+#define        curthread       ((void *)(uintptr_t)thr_self())
+
+#define        kpreempt(x)     sched_yield()
+
+typedef struct kthread kthread_t;
+
+#define        thread_create(stk, stksize, func, arg, len, pp, state, pri)     \
+       zk_thread_create(func, arg)
+#define        thread_exit() thr_exit(NULL)
+#define        thread_join(t)  panic("libzpool cannot join threads")
+
+#define        newproc(f, a, cid, pri, ctp, pid)       (ENOSYS)
+
+/* in libzpool, p0 exists only to have its address taken */
+struct proc {
+       uintptr_t       this_is_never_used_dont_dereference_it;
+};
+
+extern struct proc p0;
+#define        curproc         (&p0)
+
+#define        PS_NONE         -1
+
+extern kthread_t *zk_thread_create(void (*func)(), void *arg);
+
+#define        issig(why)      (FALSE)
+#define        ISSIG(thr, why) (FALSE)
+
+/*
+ * Mutexes
+ */
+typedef struct kmutex {
+       void            *m_owner;
+       boolean_t       initialized;
+       mutex_t         m_lock;
+} kmutex_t;
+
+#define        MUTEX_DEFAULT   USYNC_THREAD
+#undef MUTEX_HELD



Home | Main Index | Thread Index | Old Index