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:
parent
55d7afa4ad
commit
a2d5643f88
|
@ -56,8 +56,8 @@ typedef const struct pool_config_ops {
|
||||||
/*
|
/*
|
||||||
* An instance of pool_config_ops_t is expected in the caller's binary.
|
* 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 pool_config_ops_t libzfs_config_ops;
|
||||||
_LIBZUTIL_H const pool_config_ops_t libzpool_config_ops;
|
_LIBZUTIL_H pool_config_ops_t libzpool_config_ops;
|
||||||
|
|
||||||
typedef struct importargs {
|
typedef struct importargs {
|
||||||
char **path; /* a list of paths to search */
|
char **path; /* a list of paths to search */
|
||||||
|
@ -71,9 +71,9 @@ typedef struct importargs {
|
||||||
} importargs_t;
|
} importargs_t;
|
||||||
|
|
||||||
_LIBZUTIL_H nvlist_t *zpool_search_import(void *, 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 **,
|
_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 const char * const * zpool_default_search_paths(size_t *count);
|
||||||
_LIBZUTIL_H int zpool_read_label(int, nvlist_t **, int *);
|
_LIBZUTIL_H int zpool_read_label(int, nvlist_t **, int *);
|
||||||
|
|
|
@ -907,7 +907,7 @@ typedef const struct dmu_object_byteswap_info {
|
||||||
} dmu_object_byteswap_info_t;
|
} dmu_object_byteswap_info_t;
|
||||||
|
|
||||||
extern const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES];
|
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.
|
* Get information on a DMU object.
|
||||||
|
|
|
@ -102,7 +102,7 @@ typedef struct zio_bad_cksum {
|
||||||
uint8_t zbc_has_cksum; /* expected/actual valid */
|
uint8_t zbc_has_cksum; /* expected/actual valid */
|
||||||
} zio_bad_cksum_t;
|
} 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];
|
zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -152,7 +152,7 @@ typedef const struct zio_compress_info {
|
||||||
zio_decompresslevel_func_t *ci_decompress_level;
|
zio_decompresslevel_func_t *ci_decompress_level;
|
||||||
} zio_compress_info_t;
|
} 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
|
* lz4 compression init & free
|
||||||
|
|
|
@ -350,7 +350,7 @@ pool_active(void *unused, const char *name, uint64_t guid,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const pool_config_ops_t libzpool_config_ops = {
|
pool_config_ops_t libzpool_config_ops = {
|
||||||
.pco_refresh_config = refresh_config,
|
.pco_refresh_config = refresh_config,
|
||||||
.pco_pool_active = pool_active,
|
.pco_pool_active = pool_active,
|
||||||
};
|
};
|
||||||
|
|
|
@ -1777,8 +1777,7 @@ zpool_find_import(libpc_handle_t *hdl, importargs_t *iarg)
|
||||||
|
|
||||||
|
|
||||||
nvlist_t *
|
nvlist_t *
|
||||||
zpool_search_import(void *hdl, importargs_t *import,
|
zpool_search_import(void *hdl, importargs_t *import, pool_config_ops_t *pco)
|
||||||
const pool_config_ops_t *pco)
|
|
||||||
{
|
{
|
||||||
libpc_handle_t handle = { 0 };
|
libpc_handle_t handle = { 0 };
|
||||||
nvlist_t *pools = NULL;
|
nvlist_t *pools = NULL;
|
||||||
|
@ -1821,7 +1820,7 @@ pool_match(nvlist_t *cfg, char *tgt)
|
||||||
|
|
||||||
int
|
int
|
||||||
zpool_find_config(void *hdl, const char *target, nvlist_t **configp,
|
zpool_find_config(void *hdl, const char *target, nvlist_t **configp,
|
||||||
importargs_t *args, const pool_config_ops_t *pco)
|
importargs_t *args, pool_config_ops_t *pco)
|
||||||
{
|
{
|
||||||
nvlist_t *pools;
|
nvlist_t *pools;
|
||||||
nvlist_t *match = NULL;
|
nvlist_t *match = NULL;
|
||||||
|
|
|
@ -43,7 +43,7 @@ typedef struct libpc_handle {
|
||||||
boolean_t lpc_open_access_error;
|
boolean_t lpc_open_access_error;
|
||||||
boolean_t lpc_desc_active;
|
boolean_t lpc_desc_active;
|
||||||
char lpc_desc[1024];
|
char lpc_desc[1024];
|
||||||
const pool_config_ops_t *lpc_ops;
|
pool_config_ops_t *lpc_ops;
|
||||||
void *lpc_lib_handle;
|
void *lpc_lib_handle;
|
||||||
} libpc_handle_t;
|
} libpc_handle_t;
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ zpl_snapdir_revalidate(struct dentry *dentry, unsigned int flags)
|
||||||
return (!!dentry->d_inode);
|
return (!!dentry->d_inode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const dentry_operations_t zpl_dops_snapdirs = {
|
static dentry_operations_t zpl_dops_snapdirs = {
|
||||||
/*
|
/*
|
||||||
* Auto mounting of snapshots is only supported for 2.6.37 and
|
* Auto mounting of snapshots is only supported for 2.6.37 and
|
||||||
* newer kernels. Prior to this kernel the ops->follow_link()
|
* newer kernels. Prior to this kernel the ops->follow_link()
|
||||||
|
|
|
@ -145,7 +145,7 @@ const dmu_object_type_info_t dmu_ot[DMU_OT_NUMTYPES] = {
|
||||||
{DMU_BSWAP_UINT64, TRUE, FALSE, FALSE, "bpobj subobj" }
|
{DMU_BSWAP_UINT64, TRUE, FALSE, FALSE, "bpobj subobj" }
|
||||||
};
|
};
|
||||||
|
|
||||||
const dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS] = {
|
dmu_object_byteswap_info_t dmu_ot_byteswap[DMU_BSWAP_NUMFUNCS] = {
|
||||||
{ byteswap_uint8_array, "uint8" },
|
{ byteswap_uint8_array, "uint8" },
|
||||||
{ byteswap_uint16_array, "uint16" },
|
{ byteswap_uint16_array, "uint16" },
|
||||||
{ byteswap_uint32_array, "uint32" },
|
{ byteswap_uint32_array, "uint32" },
|
||||||
|
|
|
@ -141,7 +141,7 @@ static int sa_modify_attrs(sa_handle_t *hdl, sa_attr_type_t newattr,
|
||||||
sa_data_op_t action, sa_data_locator_t *locator, void *datastart,
|
sa_data_op_t action, sa_data_locator_t *locator, void *datastart,
|
||||||
uint16_t buflen, dmu_tx_t *tx);
|
uint16_t buflen, dmu_tx_t *tx);
|
||||||
|
|
||||||
static const arc_byteswap_func_t sa_bswap_table[] = {
|
static arc_byteswap_func_t sa_bswap_table[] = {
|
||||||
byteswap_uint64_array,
|
byteswap_uint64_array,
|
||||||
byteswap_uint32_array,
|
byteswap_uint32_array,
|
||||||
byteswap_uint16_array,
|
byteswap_uint16_array,
|
||||||
|
|
|
@ -224,7 +224,7 @@ vdev_dbgmsg_print_tree(vdev_t *vd, int indent)
|
||||||
* Virtual device management.
|
* Virtual device management.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const vdev_ops_t *const vdev_ops_table[] = {
|
static vdev_ops_t *const vdev_ops_table[] = {
|
||||||
&vdev_root_ops,
|
&vdev_root_ops,
|
||||||
&vdev_raidz_ops,
|
&vdev_raidz_ops,
|
||||||
&vdev_draid_ops,
|
&vdev_draid_ops,
|
||||||
|
@ -246,7 +246,7 @@ static const vdev_ops_t *const vdev_ops_table[] = {
|
||||||
static vdev_ops_t *
|
static vdev_ops_t *
|
||||||
vdev_getops(const char *type)
|
vdev_getops(const char *type)
|
||||||
{
|
{
|
||||||
const vdev_ops_t *ops, *const *opspp;
|
vdev_ops_t *ops, *const *opspp;
|
||||||
|
|
||||||
for (opspp = vdev_ops_table; (ops = *opspp) != NULL; opspp++)
|
for (opspp = vdev_ops_table; (ops = *opspp) != NULL; opspp++)
|
||||||
if (strcmp(ops->vdev_op_type, type) == 0)
|
if (strcmp(ops->vdev_op_type, type) == 0)
|
||||||
|
|
|
@ -160,7 +160,7 @@ abd_fletcher_4_byteswap(abd_t *abd, uint64_t size,
|
||||||
abd_fletcher_4_impl(abd, size, &acd);
|
abd_fletcher_4_impl(abd, size, &acd);
|
||||||
}
|
}
|
||||||
|
|
||||||
const zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
|
zio_checksum_info_t zio_checksum_table[ZIO_CHECKSUM_FUNCTIONS] = {
|
||||||
{{NULL, NULL}, NULL, NULL, 0, "inherit"},
|
{{NULL, NULL}, NULL, NULL, 0, "inherit"},
|
||||||
{{NULL, NULL}, NULL, NULL, 0, "on"},
|
{{NULL, NULL}, NULL, NULL, 0, "on"},
|
||||||
{{abd_checksum_off, abd_checksum_off},
|
{{abd_checksum_off, abd_checksum_off},
|
||||||
|
|
|
@ -49,7 +49,7 @@ unsigned long zio_decompress_fail_fraction = 0;
|
||||||
/*
|
/*
|
||||||
* Compression vectors.
|
* Compression vectors.
|
||||||
*/
|
*/
|
||||||
const zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
|
zio_compress_info_t zio_compress_table[ZIO_COMPRESS_FUNCTIONS] = {
|
||||||
{"inherit", 0, NULL, NULL, NULL},
|
{"inherit", 0, NULL, NULL, NULL},
|
||||||
{"on", 0, NULL, NULL, NULL},
|
{"on", 0, NULL, NULL, NULL},
|
||||||
{"uncompressed", 0, NULL, NULL, NULL},
|
{"uncompressed", 0, NULL, NULL, NULL},
|
||||||
|
|
Loading…
Reference in New Issue