Fix double const qualifier declarations

Some header files define structures like this one:

typedef const struct zio_checksum_info {
	/* ... */
	const char	*ci_name;
} zio_abd_checksum_func_t;

So we can use `zio_abd_checksum_func_t` for const declarations now.
It's not needed that we use the `const` qualifier again like this:
`const zio_abd_checksum_func_t *varname;`

This patch solves the double const qualifiers, which were found by
smatch.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #13961
This commit is contained in:
Tino Reichardt
2022-10-01 00:34:39 +02:00
committed by GitHub
parent 55d7afa4ad
commit a2d5643f88
13 changed files with 18 additions and 19 deletions
+4 -4
View File
@@ -56,8 +56,8 @@ typedef const struct pool_config_ops {
/*
* An instance of pool_config_ops_t is expected in the caller's binary.
*/
_LIBZUTIL_H const pool_config_ops_t libzfs_config_ops;
_LIBZUTIL_H const pool_config_ops_t libzpool_config_ops;
_LIBZUTIL_H pool_config_ops_t libzfs_config_ops;
_LIBZUTIL_H pool_config_ops_t libzpool_config_ops;
typedef struct importargs {
char **path; /* a list of paths to search */
@@ -71,9 +71,9 @@ typedef struct importargs {
} importargs_t;
_LIBZUTIL_H nvlist_t *zpool_search_import(void *, importargs_t *,
const pool_config_ops_t *);
pool_config_ops_t *);
_LIBZUTIL_H int zpool_find_config(void *, const char *, nvlist_t **,
importargs_t *, const pool_config_ops_t *);
importargs_t *, pool_config_ops_t *);
_LIBZUTIL_H const char * const * zpool_default_search_paths(size_t *count);
_LIBZUTIL_H int zpool_read_label(int, nvlist_t **, int *);
+1 -1
View File
@@ -907,7 +907,7 @@ typedef const struct dmu_object_byteswap_info {
} dmu_object_byteswap_info_t;
extern const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES];
extern const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS];
extern dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS];
/*
* Get information on a DMU object.
+1 -1
View File
@@ -102,7 +102,7 @@ typedef struct zio_bad_cksum {
uint8_t zbc_has_cksum; /* expected/actual valid */
} zio_bad_cksum_t;
_SYS_ZIO_CHECKSUM_H const zio_checksum_info_t
_SYS_ZIO_CHECKSUM_H zio_checksum_info_t
zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS];
/*
+1 -1
View File
@@ -152,7 +152,7 @@ typedef const struct zio_compress_info {
zio_decompresslevel_func_t *ci_decompress_level;
} zio_compress_info_t;
extern const zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS];
extern zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS];
/*
* lz4 compression init & free