aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRob Norris <[email protected]>2024-02-29 11:25:24 +1100
committerTony Hutter <[email protected]>2024-09-05 13:40:05 -0700
commit82ff9aafd687d4eebb6041c99fa822e0478a2024 (patch)
tree320aeb8b1ac6fbbdabcaf2e7be99b53626402292 /lib
parentd4d79451cb87aa0d93f9068ce5844098a5ebe3b5 (diff)
value strings: pretty printers for flags and enums
This adds zfs_valstr, a collection of pretty printers for bitfields and enums. These are useful in debugging, logging and other display contexts where raw values are difficult for the untrained (or even trained!) eye to decipher. Sponsored-by: Klara, Inc. Sponsored-by: Wasabi Technology, Inc. Signed-off-by: Rob Norris <[email protected]>
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/Makefile.am1
-rw-r--r--lib/libzfs/libzfs.abi51
-rw-r--r--lib/libzpool/Makefile.am1
3 files changed, 53 insertions, 0 deletions
diff --git a/lib/libzfs/Makefile.am b/lib/libzfs/Makefile.am
index 5e74d908d..a976faaf9 100644
--- a/lib/libzfs/Makefile.am
+++ b/lib/libzfs/Makefile.am
@@ -47,6 +47,7 @@ nodist_libzfs_la_SOURCES = \
module/zcommon/zfs_fletcher_superscalar4.c \
module/zcommon/zfs_namecheck.c \
module/zcommon/zfs_prop.c \
+ module/zcommon/zfs_valstr.c \
module/zcommon/zpool_prop.c \
module/zcommon/zprop_common.c
diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi
index 88dd8b3c6..51b29643e 100644
--- a/lib/libzfs/libzfs.abi
+++ b/lib/libzfs/libzfs.abi
@@ -454,6 +454,13 @@
<elf-symbol name='zfs_userns' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_userspace' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_valid_proplist' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='zfs_valstr_zio_flag' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='zfs_valstr_zio_flag_bits' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='zfs_valstr_zio_flag_pairs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='zfs_valstr_zio_priority' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='zfs_valstr_zio_stage' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='zfs_valstr_zio_stage_bits' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+ <elf-symbol name='zfs_valstr_zio_stage_pairs' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_version_kernel' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_version_nvlist' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
<elf-symbol name='zfs_version_print' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
@@ -9831,6 +9838,50 @@
<return type-id='c19b74c3'/>
</function-decl>
</abi-instr>
+ <abi-instr address-size='64' path='module/zcommon/zfs_valstr.c' language='LANG_C99'>
+ <function-decl name='zfs_valstr_zio_flag' mangled-name='zfs_valstr_zio_flag' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_flag'>
+ <parameter type-id='9c313c2d' name='bits'/>
+ <parameter type-id='26a90f95' name='out'/>
+ <parameter type-id='b59d7dce' name='outlen'/>
+ <return type-id='b59d7dce'/>
+ </function-decl>
+ <function-decl name='zfs_valstr_zio_flag_bits' mangled-name='zfs_valstr_zio_flag_bits' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_flag_bits'>
+ <parameter type-id='9c313c2d' name='bits'/>
+ <parameter type-id='26a90f95' name='out'/>
+ <parameter type-id='b59d7dce' name='outlen'/>
+ <return type-id='b59d7dce'/>
+ </function-decl>
+ <function-decl name='zfs_valstr_zio_flag_pairs' mangled-name='zfs_valstr_zio_flag_pairs' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_flag_pairs'>
+ <parameter type-id='9c313c2d' name='bits'/>
+ <parameter type-id='26a90f95' name='out'/>
+ <parameter type-id='b59d7dce' name='outlen'/>
+ <return type-id='b59d7dce'/>
+ </function-decl>
+ <function-decl name='zfs_valstr_zio_stage' mangled-name='zfs_valstr_zio_stage' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_stage'>
+ <parameter type-id='9c313c2d' name='bits'/>
+ <parameter type-id='26a90f95' name='out'/>
+ <parameter type-id='b59d7dce' name='outlen'/>
+ <return type-id='b59d7dce'/>
+ </function-decl>
+ <function-decl name='zfs_valstr_zio_stage_bits' mangled-name='zfs_valstr_zio_stage_bits' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_stage_bits'>
+ <parameter type-id='9c313c2d' name='bits'/>
+ <parameter type-id='26a90f95' name='out'/>
+ <parameter type-id='b59d7dce' name='outlen'/>
+ <return type-id='b59d7dce'/>
+ </function-decl>
+ <function-decl name='zfs_valstr_zio_stage_pairs' mangled-name='zfs_valstr_zio_stage_pairs' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_stage_pairs'>
+ <parameter type-id='9c313c2d' name='bits'/>
+ <parameter type-id='26a90f95' name='out'/>
+ <parameter type-id='b59d7dce' name='outlen'/>
+ <return type-id='b59d7dce'/>
+ </function-decl>
+ <function-decl name='zfs_valstr_zio_priority' mangled-name='zfs_valstr_zio_priority' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zfs_valstr_zio_priority'>
+ <parameter type-id='95e97e5e' name='v'/>
+ <parameter type-id='26a90f95' name='out'/>
+ <parameter type-id='b59d7dce' name='outlen'/>
+ <return type-id='b59d7dce'/>
+ </function-decl>
+ </abi-instr>
<abi-instr address-size='64' path='module/zcommon/zpool_prop.c' language='LANG_C99'>
<function-decl name='zpool_prop_string_to_index' mangled-name='zpool_prop_string_to_index' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='zpool_prop_string_to_index'>
<parameter type-id='5d0c23fb' name='prop'/>
diff --git a/lib/libzpool/Makefile.am b/lib/libzpool/Makefile.am
index 81949bf9e..ff30af7d2 100644
--- a/lib/libzpool/Makefile.am
+++ b/lib/libzpool/Makefile.am
@@ -64,6 +64,7 @@ nodist_libzpool_la_SOURCES = \
module/zcommon/zfs_fletcher_superscalar4.c \
module/zcommon/zfs_namecheck.c \
module/zcommon/zfs_prop.c \
+ module/zcommon/zfs_valstr.c \
module/zcommon/zpool_prop.c \
module/zcommon/zprop_common.c \
\