Update ABD stats for linear page Linux
[zfs.git] / include / zfs_valstr.h
blob77c26ce1ae7d1248ceed340101fd402f59bba02c
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or https://opensource.org/licenses/CDDL-1.0.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright (c) 2024, Klara Inc.
26 #ifndef _ZFS_VALSTR_H
27 #define _ZFS_VALSTR_H extern __attribute__((visibility("default")))
29 #include <sys/fs/zfs.h>
30 #include <sys/types.h>
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
37 * These macros create function prototypes for pretty-printing or stringifying
38 * certain kinds of numeric types.
40 * _ZFS_VALSTR_DECLARE_BITFIELD(name) creates:
42 * size_t zfs_valstr_<name>_bits(uint64_t bits, char *out, size_t outlen);
43 * expands single char for each set bit, and space for each clear bit
45 * size_t zfs_valstr_<name>_pairs(uint64_t bits, char *out, size_t outlen);
46 * expands two-char mnemonic for each bit set in `bits`, separated by `|`
48 * size_t zfs_valstr_<name>(uint64_t bits, char *out, size_t outlen);
49 * expands full name of each bit set in `bits`, separated by spaces
51 * _ZFS_VALSTR_DECLARE_ENUM(name) creates:
53 * size_t zfs_valstr_<name>(int v, char *out, size_t outlen);
54 * expands full name of enum value
56 * Each _ZFS_VALSTR_DECLARE_xxx needs a corresponding _VALSTR_xxx_IMPL string
57 * table in vfs_valstr.c.
60 #define _ZFS_VALSTR_DECLARE_BITFIELD(name) \
61 _ZFS_VALSTR_H size_t zfs_valstr_ ## name ## _bits( \
62 uint64_t bits, char *out, size_t outlen); \
63 _ZFS_VALSTR_H size_t zfs_valstr_ ## name ## _pairs( \
64 uint64_t bits, char *out, size_t outlen); \
65 _ZFS_VALSTR_H size_t zfs_valstr_ ## name( \
66 uint64_t bits, char *out, size_t outlen); \
68 #define _ZFS_VALSTR_DECLARE_ENUM(name) \
69 _ZFS_VALSTR_H size_t zfs_valstr_ ## name( \
70 int v, char *out, size_t outlen); \
72 _ZFS_VALSTR_DECLARE_BITFIELD(zio_flag)
73 _ZFS_VALSTR_DECLARE_BITFIELD(zio_stage)
75 _ZFS_VALSTR_DECLARE_ENUM(zio_priority)
77 #undef _ZFS_VALSTR_DECLARE_BITFIELD
78 #undef _ZFS_VALSTR_DECLARE_ENUM
80 #ifdef __cplusplus
82 #endif
84 #endif /* _ZFS_VALSTR_H */