1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * This file and its contents are supplied under the terms of the 4 * Common Development and Distribution License ("CDDL"), version 1.0. 5 * You may only use this file in accordance with the terms of version 6 * 1.0 of the CDDL. 7 * 8 * A full copy of the text of the CDDL should have accompanied this 9 * source. A copy of the CDDL is also available via the Internet at 10 * https://opensource.org/license/CDDL-1.0. 11 */ 12 13 /* 14 * Copyright (c) 2025, Rob Norris <robn@despairlabs.com> 15 */ 16 17 #ifndef _SYS_TUNABLES_H 18 //#define _SYS_TUNABLES_H extern __attribute__((visibility("hidden"))) 19 #define _SYS_TUNABLES_H extern 20 21 typedef enum { 22 ZFS_TUNABLE_TYPE_INT, 23 ZFS_TUNABLE_TYPE_UINT, 24 ZFS_TUNABLE_TYPE_ULONG, 25 ZFS_TUNABLE_TYPE_U64, 26 ZFS_TUNABLE_TYPE_STRING, 27 } zfs_tunable_type_t; 28 29 typedef enum { 30 ZFS_TUNABLE_PERM_ZMOD_RW, 31 ZFS_TUNABLE_PERM_ZMOD_RD, 32 } zfs_tunable_perm_t; 33 34 typedef struct zfs_tunable { 35 const char *zt_name; 36 void *zt_varp; 37 size_t zt_varsz; 38 zfs_tunable_type_t zt_type; 39 zfs_tunable_perm_t zt_perm; 40 const char *zt_desc; 41 } zfs_tunable_t; 42 43 _SYS_TUNABLES_H int zfs_tunable_set(const zfs_tunable_t *tunable, 44 const char *val); 45 _SYS_TUNABLES_H int zfs_tunable_get(const zfs_tunable_t *tunable, char *val, 46 size_t valsz); 47 48 _SYS_TUNABLES_H const zfs_tunable_t *zfs_tunable_lookup(const char *name); 49 50 typedef int (*zfs_tunable_iter_t)(const zfs_tunable_t *tunable, void *arg); 51 _SYS_TUNABLES_H void zfs_tunable_iter(zfs_tunable_iter_t cb, void *arg); 52 53 #endif 54