From faa295b9a60ef2689e9e78c2bc779ca815a07227 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Sun, 19 Oct 2025 12:13:32 +1100 Subject: [PATCH] libspl: move SID definitions from zfs_context.h; remove kernel gate Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #17861 --- include/sys/zfs_context.h | 10 -------- lib/libspl/include/Makefile.am | 1 + lib/libspl/include/sys/sid.h | 44 ++++++++++++++++++++++++++++++++++ lib/libzpool/kernel.c | 1 + module/zfs/zfs_fuid.c | 2 +- 5 files changed, 47 insertions(+), 11 deletions(-) create mode 100644 lib/libspl/include/sys/sid.h diff --git a/include/sys/zfs_context.h b/include/sys/zfs_context.h index c11c2c9e2..bec036db5 100644 --- a/include/sys/zfs_context.h +++ b/include/sys/zfs_context.h @@ -238,16 +238,6 @@ extern int zfs_secpolicy_destroy_perms(const char *name, cred_t *cr); extern int secpolicy_zfs(const cred_t *cr); extern zoneid_t getzoneid(void); -/* SID stuff */ -typedef struct ksiddomain { - uint_t kd_ref; - uint_t kd_len; - char *kd_name; -} ksiddomain_t; - -ksiddomain_t *ksid_lookupdomain(const char *); -void ksiddomain_rele(ksiddomain_t *); - #define DDI_SLEEP KM_SLEEP #define ddi_log_sysevent(_a, _b, _c, _d, _e, _f, _g) \ sysevent_post_event(_c, _d, _b, "libzpool", _e, _f) diff --git a/lib/libspl/include/Makefile.am b/lib/libspl/include/Makefile.am index c7a39fccb..6784823e5 100644 --- a/lib/libspl/include/Makefile.am +++ b/lib/libspl/include/Makefile.am @@ -55,6 +55,7 @@ libspl_sys_HEADERS = \ %D%/sys/procfs_list.h \ %D%/sys/random.h \ %D%/sys/rwlock.h \ + %D%/sys/sid.h \ %D%/sys/simd.h \ %D%/sys/stack.h \ %D%/sys/stdtypes.h \ diff --git a/lib/libspl/include/sys/sid.h b/lib/libspl/include/sys/sid.h new file mode 100644 index 000000000..74789c5d9 --- /dev/null +++ b/lib/libspl/include/sys/sid.h @@ -0,0 +1,44 @@ +// 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 _SYS_SID_H +#define _SYS_SID_H + +#include + +/* SID stuff */ +typedef struct ksiddomain { + uint_t kd_ref; + uint_t kd_len; + char *kd_name; +} ksiddomain_t; + +ksiddomain_t *ksid_lookupdomain(const char *); +void ksiddomain_rele(ksiddomain_t *); + +#endif diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c index 44a85f1ad..33e03b127 100644 --- a/lib/libzpool/kernel.c +++ b/lib/libzpool/kernel.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include diff --git a/module/zfs/zfs_fuid.c b/module/zfs/zfs_fuid.c index 7f786c00b..aa10741ba 100644 --- a/module/zfs/zfs_fuid.c +++ b/module/zfs/zfs_fuid.c @@ -28,8 +28,8 @@ #include #include #include -#ifdef _KERNEL #include +#ifdef _KERNEL #include #include #endif