libzfs: const correctness

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12968
This commit is contained in:
наб 2022-01-12 17:28:41 +01:00 committed by Brian Behlendorf
parent bf12053cb2
commit 0f7a0cc7c2
3 changed files with 9 additions and 8 deletions

View File

@ -553,8 +553,8 @@ _LIBZFS_H int zfs_crypto_create(libzfs_handle_t *, char *, nvlist_t *,
nvlist_t *, boolean_t stdin_available, uint8_t **, uint_t *); nvlist_t *, boolean_t stdin_available, uint8_t **, uint_t *);
_LIBZFS_H int zfs_crypto_clone_check(libzfs_handle_t *, zfs_handle_t *, char *, _LIBZFS_H int zfs_crypto_clone_check(libzfs_handle_t *, zfs_handle_t *, char *,
nvlist_t *); nvlist_t *);
_LIBZFS_H int zfs_crypto_attempt_load_keys(libzfs_handle_t *, char *); _LIBZFS_H int zfs_crypto_attempt_load_keys(libzfs_handle_t *, const char *);
_LIBZFS_H int zfs_crypto_load_key(zfs_handle_t *, boolean_t, char *); _LIBZFS_H int zfs_crypto_load_key(zfs_handle_t *, boolean_t, const char *);
_LIBZFS_H int zfs_crypto_unload_key(zfs_handle_t *); _LIBZFS_H int zfs_crypto_unload_key(zfs_handle_t *);
_LIBZFS_H int zfs_crypto_rewrap(zfs_handle_t *, nvlist_t *, boolean_t); _LIBZFS_H int zfs_crypto_rewrap(zfs_handle_t *, nvlist_t *, boolean_t);

View File

@ -685,7 +685,7 @@ end:
*/ */
static int static int
get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey, get_key_material(libzfs_handle_t *hdl, boolean_t do_verify, boolean_t newkey,
zfs_keyformat_t keyformat, char *keylocation, const char *fsname, zfs_keyformat_t keyformat, const char *keylocation, const char *fsname,
uint8_t **km_out, size_t *kmlen_out, boolean_t *can_retry_out) uint8_t **km_out, size_t *kmlen_out, boolean_t *can_retry_out)
{ {
int ret; int ret;
@ -1240,7 +1240,7 @@ out:
* filesystem and all of its children. * filesystem and all of its children.
*/ */
int int
zfs_crypto_attempt_load_keys(libzfs_handle_t *hdl, char *fsname) zfs_crypto_attempt_load_keys(libzfs_handle_t *hdl, const char *fsname)
{ {
int ret; int ret;
zfs_handle_t *zhp = NULL; zfs_handle_t *zhp = NULL;
@ -1275,7 +1275,8 @@ error:
} }
int int
zfs_crypto_load_key(zfs_handle_t *zhp, boolean_t noop, char *alt_keylocation) zfs_crypto_load_key(zfs_handle_t *zhp, boolean_t noop,
const char *alt_keylocation)
{ {
int ret, attempts = 0; int ret, attempts = 0;
char errbuf[1024]; char errbuf[1024];
@ -1283,7 +1284,7 @@ zfs_crypto_load_key(zfs_handle_t *zhp, boolean_t noop, char *alt_keylocation)
uint64_t keyformat = ZFS_KEYFORMAT_NONE; uint64_t keyformat = ZFS_KEYFORMAT_NONE;
char prop_keylocation[MAXNAMELEN]; char prop_keylocation[MAXNAMELEN];
char prop_encroot[MAXNAMELEN]; char prop_encroot[MAXNAMELEN];
char *keylocation = NULL; const char *keylocation = NULL;
uint8_t *key_material = NULL, *key_data = NULL; uint8_t *key_material = NULL, *key_data = NULL;
size_t key_material_len; size_t key_material_len;
boolean_t is_encroot, can_retry = B_FALSE, correctible = B_FALSE; boolean_t is_encroot, can_retry = B_FALSE, correctible = B_FALSE;

View File

@ -2030,7 +2030,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
nvlist_t *nv = NULL; nvlist_t *nv = NULL;
nvlist_t *nvinfo = NULL; nvlist_t *nvinfo = NULL;
nvlist_t *missing = NULL; nvlist_t *missing = NULL;
char *thename; const char *thename;
char *origname; char *origname;
int ret; int ret;
int error = 0; int error = 0;
@ -2047,7 +2047,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
return (zfs_error_fmt(hdl, EZFS_INVALIDNAME, return (zfs_error_fmt(hdl, EZFS_INVALIDNAME,
dgettext(TEXT_DOMAIN, "cannot import '%s'"), dgettext(TEXT_DOMAIN, "cannot import '%s'"),
newname)); newname));
thename = (char *)newname; thename = newname;
} else { } else {
thename = origname; thename = origname;
} }