diff options
author | Don Brady <[email protected]> | 2018-09-02 15:09:53 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-09-02 12:09:53 -0700 |
commit | e8bcb693d6a19962291e4429f2dc4ce60693bef7 (patch) | |
tree | a4afbb8d0562aae23e9fd8fd561fd2182b14db8e /include | |
parent | bb91178e60df553071ce2e18b0067ef703f7b583 (diff) |
Add zfs module feature and property info to sysfs
This extends our sysfs '/sys/module/zfs' entry to include feature
and property attributes. The primary consumer of this information
is user processes, like the zfs CLI, that need to know what the
current loaded ZFS module supports. The libzfs binary will consult
this information when instantiating the zfs and zpool property
tables and the pool features table.
This introduces 4 kernel objects (dirs) into '/sys/module/zfs'
with corresponding attributes (files):
features.runtime
features.pool
properties.dataset
properties.pool
Reviewed-by: Matthew Ahrens <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Closes #7706
Diffstat (limited to 'include')
-rw-r--r-- | include/sys/Makefile.am | 1 | ||||
-rw-r--r-- | include/sys/zfs_sysfs.h | 47 | ||||
-rw-r--r-- | include/zfeature_common.h | 2 | ||||
-rw-r--r-- | include/zfs_prop.h | 1 |
4 files changed, 51 insertions, 0 deletions
diff --git a/include/sys/Makefile.am b/include/sys/Makefile.am index f246c111d..644ddaab3 100644 --- a/include/sys/Makefile.am +++ b/include/sys/Makefile.am @@ -119,6 +119,7 @@ COMMON_H = \ $(top_srcdir)/include/sys/zfs_rlock.h \ $(top_srcdir)/include/sys/zfs_sa.h \ $(top_srcdir)/include/sys/zfs_stat.h \ + $(top_srcdir)/include/sys/zfs_sysfs.h \ $(top_srcdir)/include/sys/zfs_vfsops.h \ $(top_srcdir)/include/sys/zfs_vnops.h \ $(top_srcdir)/include/sys/zfs_znode.h \ diff --git a/include/sys/zfs_sysfs.h b/include/sys/zfs_sysfs.h new file mode 100644 index 000000000..7c4a0304f --- /dev/null +++ b/include/sys/zfs_sysfs.h @@ -0,0 +1,47 @@ +/* + * 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) 2018 by Delphix. All rights reserved. + */ + +#ifndef _SYS_ZFS_SYSFS_H +#define _SYS_ZFS_SYSFS_H + +#ifdef _KERNEL + +void zfs_sysfs_init(void); +void zfs_sysfs_fini(void); + +#else + +#define zfs_sysfs_init() +#define zfs_sysfs_fini() + +#endif + +#define ZFS_SYSFS_POOL_PROPERTIES "properties.pool" +#define ZFS_SYSFS_DATASET_PROPERTIES "properties.dataset" +#define ZFS_SYSFS_KERNEL_FEATURES "features.kernel" +#define ZFS_SYSFS_POOL_FEATURES "features.pool" + +#define ZFS_SYSFS_DIR "/sys/module/zfs" + +#endif /* _SYS_ZFS_SYSFS_H */ diff --git a/include/zfeature_common.h b/include/zfeature_common.h index c5aabce0e..8d31309e8 100644 --- a/include/zfeature_common.h +++ b/include/zfeature_common.h @@ -85,6 +85,7 @@ typedef struct zfeature_info { const char *fi_guid; /* On-disk feature identifier */ const char *fi_desc; /* Feature description */ zfeature_flags_t fi_flags; + boolean_t fi_zfs_mod_supported; /* supported by running zfs module */ /* array of dependencies, terminated by SPA_FEATURE_NONE */ const spa_feature_t *fi_depends; } zfeature_info_t; @@ -98,6 +99,7 @@ extern zfeature_info_t spa_feature_table[SPA_FEATURES]; extern boolean_t zfeature_is_valid_guid(const char *); extern boolean_t zfeature_is_supported(const char *); +extern int zfeature_lookup_guid(const char *, spa_feature_t *); extern int zfeature_lookup_name(const char *, spa_feature_t *); extern boolean_t zfeature_depends_on(spa_feature_t, spa_feature_t); diff --git a/include/zfs_prop.h b/include/zfs_prop.h index 60e08552a..89b6a2024 100644 --- a/include/zfs_prop.h +++ b/include/zfs_prop.h @@ -78,6 +78,7 @@ typedef struct { boolean_t pd_rightalign; /* column alignment for "zfs list" */ boolean_t pd_visible; /* do we list this property with the */ /* "zfs get" help message */ + boolean_t pd_zfs_mod_supported; /* supported by running zfs module */ const zprop_index_t *pd_table; /* for index properties, a table */ /* defining the possible values */ size_t pd_table_size; /* number of entries in pd_table[] */ |