Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e14ba62
libspl: single zfs_context_os.h
robn Jul 6, 2025
bf8410f
libzpool: move zfs_context_os.h from libspl
robn Oct 26, 2025
4cea265
libzpool: move ZFS-specific headers from libspl
robn Oct 26, 2025
a95e250
libspl: move time definitions from zfs_context_os.h
robn Oct 16, 2025
30f436d
libspl: move mutex headers from zfs_context.h
robn Aug 8, 2025
16fb883
libspl: move mutex implementation from libzpool
robn Oct 26, 2025
61edfcc
libspl: move rwlock definitions from zfs_context.h
robn Aug 8, 2025
c9c5ac3
libspl: move rwlock implementation from libzpool
robn Oct 26, 2025
bb11dd5
libspl: move condvar definitions from zfs_context.h
robn Aug 8, 2025
0359711
libspl: move condvar implementation from libzpool
robn Oct 26, 2025
7243d6e
libspl: move cmn_err definitions from zfs_context.h
robn Aug 9, 2025
a65d333
libspl: move thread definitions from zfs_context.h
robn Aug 25, 2025
318a733
libspl: move thread implementation from libzpool
robn Oct 27, 2025
78c1f1e
libspl: move taskq definitions from zfs_context.h
robn Aug 16, 2025
7ad5870
libspl: move taskq implementation from libzpool
robn Oct 26, 2025
6cbe8f4
libspl: move cred definitions from zfs_context.h
robn Aug 25, 2025
24ee5d8
libspl: move cred implementation from libzpool
robn Oct 27, 2025
4989a45
libspl: move tsd definitions from zfs_context.h
robn Oct 15, 2025
e05cd5b
libspl: move kstat definitions from zfs_context.h, slim down to basics
robn Oct 16, 2025
9e5e175
libspl: move kstat implementation from libzpool
robn Oct 27, 2025
4775fb3
libspl: move procfs_list definitions from zfs_context.h
robn Oct 16, 2025
8515bc3
libspl: move procfs_list implementation from libzpool
robn Oct 27, 2025
3545e74
libspl: move kmem definitions from zfs_context.h
robn Oct 16, 2025
4f43476
libspl: move kmem implementation from libzpool
robn Oct 27, 2025
b405109
libspl: move vattr and xvattr definitions from zfs_context.h; enable …
robn Oct 17, 2025
8f89d7b
libspl: add include guards for sys/string.h
robn Oct 22, 2025
507c47d
libspl: move ptob() from zfs_context.h
robn Oct 18, 2025
9fcf822
zfs_context: remove duplicated access control stuff; remove kernel gate
robn Oct 18, 2025
bf3cb81
libzpool: separate driver-side include
robn Oct 24, 2025
fb7c89a
libspl: init/fini
robn Oct 24, 2025
cea4596
libspl: move physmem to sys/systm.h; initialise at libspl_init()
robn Oct 24, 2025
be4aa5b
libspl: move utsname() etc to sys/misc.h; initialise in libspl_init()
robn Oct 24, 2025
e606bef
zfs_context: move vn_dumpdir to libzpool
robn Oct 24, 2025
dea8b90
libspl: move random definitions from zfs_context.h
robn Oct 18, 2025
94a3644
libspl: move random impl from libzpool
robn Oct 24, 2025
e709dab
libspl: move callb stubs from zfs_context.h
robn Oct 18, 2025
653a360
libspl: move SID definitions from zfs_context.h; remove kernel gate
robn Oct 19, 2025
e6171c0
libspl: move SID implementation from libzpool
robn Oct 27, 2025
aaec7ca
libspl: move zone definitions from zfs_context.h
robn Oct 19, 2025
2d5872f
libzpool: remove unused userspace ioctl policy functions
robn Oct 19, 2025
45a7d56
zfs_context: remove misc unused
robn Oct 19, 2025
7a83db3
libspl: move remaining ddi_* prototypes from zfs_context.h
robn Oct 19, 2025
e892745
libspl: move DTRACE_PROBE macros from zfs_context.h
robn Oct 19, 2025
d3f55cd
libspl: common sysmacros.h
robn Oct 19, 2025
055e0c9
libzutil: move NN_NUMBUF_SZ from zfs_context.h nearer to nicenum()
robn Oct 19, 2025
36c263e
libspl: move compiler attribute macros from zfs_context.h
robn Oct 19, 2025
ecad15c
zfs_context: move empty __init/__exit macros to sys/debug.h
robn Oct 19, 2025
8769648
libspl: move loff_t declaration from zfs_context.h
robn Oct 19, 2025
7b48a23
debug: move all of the debug bits out of the spl
behlendorf Oct 31, 2025
b6ed0ee
libzpool: add BE_POSIX_VENDOR for userspace bootenv
robn Nov 8, 2025
65ebc1f
libzpool: remove global libzpool includes
behlendorf Oct 31, 2025
cc514fd
icp: remove global icp includes
behlendorf Oct 31, 2025
98afdf2
zfs_context: remove duplicate includes
behlendorf Oct 31, 2025
8afd140
libzpool: add zfs_impl.c, remove from libicp
robn Nov 8, 2025
cfa4e52
libspl: hide global data objects
robn Nov 11, 2025
b489c69
libspl/random: add switch to force pseudo-random numbers for all calls
robn Nov 11, 2025
b0993ca
lib: update ABI meta following libspl changes
robn Nov 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/raidz_test/raidz_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <sys/vdev_raidz_impl.h>
#include <assert.h>
#include <stdio.h>
#include <libzpool.h>
#include "raidz_test.h"

static int *rand_data;
Expand Down
1 change: 1 addition & 0 deletions cmd/zdb/zdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
#include <sys/zstd/zstd.h>
#include <sys/backtrace.h>

#include <libzpool.h>
#include <libnvpair.h>
#include <libzutil.h>
#include <libzfs_core.h>
Expand Down
1 change: 1 addition & 0 deletions cmd/zhack.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include <zfeature_common.h>
#include <libzutil.h>
#include <sys/metaslab_impl.h>
#include <libzpool.h>

static importargs_t g_importargs;
static char *g_pool;
Expand Down
4 changes: 2 additions & 2 deletions cmd/zstream/zstream_redup.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ zfs_redup_stream(int infd, int outfd, boolean_t verbose)
#ifdef _ILP32
uint64_t max_rde_size = SMALLEST_POSSIBLE_MAX_RDT_MB << 20;
#else
uint64_t physmem = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE);
uint64_t physbytes = sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE);
uint64_t max_rde_size =
MAX((physmem * MAX_RDT_PHYSMEM_PERCENT) / 100,
MAX((physbytes * MAX_RDT_PHYSMEM_PERCENT) / 100,
SMALLEST_POSSIBLE_MAX_RDT_MB << 20);
#endif

Expand Down
18 changes: 7 additions & 11 deletions cmd/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@
#include <sys/crypto/icp.h>
#include <sys/zfs_impl.h>
#include <sys/backtrace.h>
#include <libzpool.h>
#include <libspl.h>

static int ztest_fd_data = -1;
static int ztest_fd_rand = -1;

typedef struct ztest_shared_hdr {
uint64_t zh_hdr_size;
Expand Down Expand Up @@ -902,13 +903,10 @@ ztest_random(uint64_t range)
{
uint64_t r;

ASSERT3S(ztest_fd_rand, >=, 0);

if (range == 0)
return (0);

if (read(ztest_fd_rand, &r, sizeof (r)) != sizeof (r))
fatal(B_TRUE, "short read from /dev/urandom");
random_get_pseudo_bytes((uint8_t *)&r, sizeof (r));

return (r % range);
}
Expand Down Expand Up @@ -8145,10 +8143,8 @@ ztest_raidz_expand_run(ztest_shared_t *zs, spa_t *spa)
/* Setup a 1 MiB buffer of random data */
uint64_t bufsize = 1024 * 1024;
void *buffer = umem_alloc(bufsize, UMEM_NOFAIL);
random_get_pseudo_bytes((uint8_t *)&buffer, bufsize);

if (read(ztest_fd_rand, buffer, bufsize) != bufsize) {
fatal(B_TRUE, "short read from /dev/urandom");
}
/*
* Put some data in the pool and then attach a vdev to initiate
* reflow.
Expand Down Expand Up @@ -8954,13 +8950,13 @@ main(int argc, char **argv)
exit(EXIT_FAILURE);
}

libspl_init();

/*
* Force random_get_bytes() to use /dev/urandom in order to prevent
* ztest from needlessly depleting the system entropy pool.
*/
random_path = "/dev/urandom";
ztest_fd_rand = open(random_path, O_RDONLY | O_CLOEXEC);
ASSERT3S(ztest_fd_rand, >=, 0);
random_force_pseudo(B_TRUE);

if (!fd_data_str) {
process_options(argc, argv);
Expand Down
4 changes: 2 additions & 2 deletions config/Rules.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ AM_CPPFLAGS = \
-include $(top_builddir)/zfs_config.h \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(top_srcdir)/module/icp/include \
-I$(top_srcdir)/lib/libspl/include \
-I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@
-I$(top_srcdir)/lib/libspl/include/os/@ac_system_l@ \
-I$(top_srcdir)/lib/libzpool/include

AM_LIBTOOLFLAGS = --silent

Expand Down
1 change: 1 addition & 0 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ USER_H = \
libzfs.h \
libzfs_core.h \
libzfsbootenv.h \
libzpool.h \
libzutil.h \
thread_pool.h

Expand Down
51 changes: 51 additions & 0 deletions include/libzpool.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: CDDL-1.0
/*
* 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 https://opensource.org/licenses/CDDL-1.0.
* 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 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2012, 2018 by Delphix. All rights reserved.
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
*/

#ifndef _LIBZPOOL_H
#define _LIBZPOOL_H extern __attribute__((visibility("default")))

#include <sys/zfs_context.h>

#ifdef __cplusplus
extern "C" {
#endif

extern char *vn_dumpdir;

_LIBZPOOL_H void kernel_init(int mode);
_LIBZPOOL_H void kernel_fini(void);

struct spa;
_LIBZPOOL_H void show_pool_stats(struct spa *);
_LIBZPOOL_H int handle_tunable_option(const char *, boolean_t);

#ifdef __cplusplus
}
#endif

#endif
1 change: 1 addition & 0 deletions include/libzutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ _LIBZUTIL_H void zfs_nicetime(uint64_t, char *, size_t);
_LIBZUTIL_H void zfs_niceraw(uint64_t, char *, size_t);

#define nicenum(num, buf, size) zfs_nicenum(num, buf, size)
#define NN_NUMBUF_SZ (6)

_LIBZUTIL_H void zpool_dump_ddt(const ddt_stat_t *, const ddt_histogram_t *);
_LIBZUTIL_H int zpool_history_unpack(char *, uint64_t, uint64_t *, nvlist_t ***,
Expand Down
4 changes: 2 additions & 2 deletions include/os/freebsd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ noinst_HEADERS = \
%D%/spl/sys/procfs_list.h \
%D%/spl/sys/random.h \
%D%/spl/sys/rwlock.h \
%D%/spl/sys/sdt.h \
%D%/spl/sys/sid.h \
%D%/spl/sys/sig.h \
%D%/spl/sys/simd.h \
Expand All @@ -63,7 +62,6 @@ noinst_HEADERS = \
%D%/spl/sys/time.h \
%D%/spl/sys/timer.h \
%D%/spl/sys/trace.h \
%D%/spl/sys/trace_zfs.h \
%D%/spl/sys/types.h \
%D%/spl/sys/types32.h \
%D%/spl/sys/uio.h \
Expand All @@ -82,10 +80,12 @@ noinst_HEADERS = \
%D%/zfs/sys/arc_os.h \
%D%/zfs/sys/freebsd_crypto.h \
%D%/zfs/sys/freebsd_event.h \
%D%/zfs/sys/trace_zfs.h \
%D%/zfs/sys/vdev_os.h \
%D%/zfs/sys/zfs_bootenv_os.h \
%D%/zfs/sys/zfs_context_os.h \
%D%/zfs/sys/zfs_ctldir.h \
%D%/zfs/sys/zfs_debug_os.h \
%D%/zfs/sys/zfs_dir.h \
%D%/zfs/sys/zfs_ioctl_compat.h \
%D%/zfs/sys/zfs_vfsops_os.h \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@
* $FreeBSD$
*/

#ifndef _OPENSOLARIS_SYS_SDT_H_
#define _OPENSOLARIS_SYS_SDT_H_
#ifndef _SYS_ZFS_DEBUG_OS_H
#define _SYS_ZFS_DEBUG_OS_H

#include <sys/sdt.h>

#include_next <sys/sdt.h>
#ifdef KDTRACE_HOOKS
SDT_PROBE_DECLARE(sdt, , , set__error);

Expand All @@ -44,4 +45,4 @@ SDT_PROBE_DECLARE(sdt, , , set__error);
#define SET_ERROR(err) (err)
#endif

#endif /* _OPENSOLARIS_SYS_SDT_H_ */
#endif /* _SYS_ZFS_DEBUG_OS_H */
2 changes: 1 addition & 1 deletion include/os/linux/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ kernel_sys_HEADERS = \
%D%/zfs/sys/zfs_bootenv_os.h \
%D%/zfs/sys/zfs_context_os.h \
%D%/zfs/sys/zfs_ctldir.h \
%D%/zfs/sys/zfs_debug_os.h \
%D%/zfs/sys/zfs_dir.h \
%D%/zfs/sys/zfs_vfsops_os.h \
%D%/zfs/sys/zfs_vnops_os.h \
Expand Down Expand Up @@ -97,7 +98,6 @@ kernel_spl_sys_HEADERS = \
%D%/spl/sys/time.h \
%D%/spl/sys/timer.h \
%D%/spl/sys/trace.h \
%D%/spl/sys/trace_spl.h \
%D%/spl/sys/trace_taskq.h \
%D%/spl/sys/tsd.h \
%D%/spl/sys/types.h \
Expand Down
8 changes: 0 additions & 8 deletions include/os/linux/spl/sys/sysmacros.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
#include <sys/signal.h>
#include <asm/page.h>


#ifndef _KERNEL
#define _KERNEL __KERNEL__
#endif

#define FALSE 0
#define TRUE 1

Expand Down Expand Up @@ -202,9 +197,6 @@ makedev(unsigned int major, unsigned int minor)
#define P2SAMEHIGHBIT_TYPED(x, y, type) \
(((type)(x) ^ (type)(y)) < ((type)(x) & (type)(y)))

#define SET_ERROR(err) \
(__set_error(__FILE__, __func__, __LINE__, err), err)

#include <linux/sort.h>
#define qsort(base, num, size, cmp) \
sort(base, num, size, cmp, NULL)
Expand Down
29 changes: 29 additions & 0 deletions include/os/linux/zfs/sys/zfs_debug_os.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: CDDL-1.0
/*
* 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 https://opensource.org/licenses/CDDL-1.0.
* 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
*/

#ifndef _SYS_ZFS_DEBUG_OS_H
#define _SYS_ZFS_DEBUG_OS_H

#define SET_ERROR(err) \
(__set_error(__FILE__, __func__, __LINE__, err), err)

#endif /* _SYS_ZFS_DEBUG_OS_H */
2 changes: 2 additions & 0 deletions include/sys/crypto/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extern "C" {
#endif

#include <sys/zfs_context.h>
#include <sys/types.h>
#include <sys/uio.h>

/* Cryptographic Mechanisms */

Expand Down
2 changes: 1 addition & 1 deletion include/sys/zfs_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#ifdef _KERNEL
#include <sys/isa_defs.h>
#include <sys/types32.h>
#include <sys/xvattr.h>
#endif
#include <sys/xvattr.h>
#include <sys/acl.h>
#include <sys/dmu.h>
#include <sys/zfs_fuid.h>
Expand Down
1 change: 1 addition & 0 deletions include/sys/zfs_bootenv.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ extern "C" {
#define BE_FREEBSD_VENDOR "freebsd"
#define BE_GRUB_VENDOR "grub"
#define BE_LINUX_VENDOR "linux"
#define BE_POSIX_VENDOR "posix"

#include <sys/zfs_bootenv_os.h>

Expand Down
Loading
Loading