1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * The contents of this file are subject to the terms of the 6 * Common Development and Distribution License (the "License"). 7 * You may not use this file except in compliance with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or https://opensource.org/licenses/CDDL-1.0. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 23 /* 24 * Copyright (c) 2025, Rob Norris <robn@despairlabs.com> 25 */ 26 27 #ifndef _SYS_TUNABLES_H 28 #define _SYS_TUNABLES_H 29 30 typedef enum { 31 ZFS_TUNABLE_TYPE_INT, 32 ZFS_TUNABLE_TYPE_UINT, 33 ZFS_TUNABLE_TYPE_ULONG, 34 ZFS_TUNABLE_TYPE_U64, 35 ZFS_TUNABLE_TYPE_STRING, 36 } zfs_tunable_type_t; 37 38 typedef enum { 39 ZFS_TUNABLE_PERM_ZMOD_RW, 40 ZFS_TUNABLE_PERM_ZMOD_RD, 41 } zfs_tunable_perm_t; 42 43 typedef struct zfs_tunable { 44 const char *zt_name; 45 void *zt_varp; 46 size_t zt_varsz; 47 zfs_tunable_type_t zt_type; 48 zfs_tunable_perm_t zt_perm; 49 const char *zt_desc; 50 } zfs_tunable_t; 51 52 int zfs_tunable_set(const zfs_tunable_t *tunable, const char *val); 53 int zfs_tunable_get(const zfs_tunable_t *tunable, char *val, size_t valsz); 54 55 const zfs_tunable_t *zfs_tunable_lookup(const char *name); 56 57 typedef int (*zfs_tunable_iter_t)(const zfs_tunable_t *tunable, void *arg); 58 void zfs_tunable_iter(zfs_tunable_iter_t cb, void *arg); 59 60 #endif 61