From: Sascha Wildner Date: Sat, 5 Jan 2013 11:21:47 +0000 (+0100) Subject: kernel/dm: Remove some unused variables. X-Git-Tag: v3.4.0rc~546 X-Git-Url: https://gitweb.dragonflybsd.org/~tuxillo/dragonfly.git/commitdiff_plain/3d089c230ec0db0c3d0ae83e140c0f9d59b22493 kernel/dm: Remove some unused variables. Also start using a previously unused variable in dm_target_crypt. --- diff --git a/sys/dev/disk/dm/device-mapper.c b/sys/dev/disk/dm/device-mapper.c index 510b8c055a..74fb533f57 100644 --- a/sys/dev/disk/dm/device-mapper.c +++ b/sys/dev/disk/dm/device-mapper.c @@ -136,11 +136,9 @@ static struct cmd_function cmd_fn[] = { static int dm_modcmd(module_t mod, int cmd, void *unused) { - int error, bmajor, cmajor; + int error; error = 0; - bmajor = -1; - cmajor = -1; switch (cmd) { case MOD_LOAD: @@ -390,8 +388,6 @@ dmstrategy(struct dev_strategy_args *ap) dm_table_entry_t *table_en; struct buf *nestbuf; - uint32_t dev_type; - uint64_t buf_start, buf_len, issued_len; uint64_t table_start, table_end; uint64_t start, end; @@ -402,7 +398,6 @@ dmstrategy(struct dev_strategy_args *ap) tbl = NULL; table_end = 0; - dev_type = 0; issued_len = 0; dmv = dev->si_drv1; @@ -501,7 +496,6 @@ dmdump(struct dev_dump_args *ap) dm_dev_t *dmv; dm_table_t *tbl; dm_table_entry_t *table_en; - uint32_t dev_type; uint64_t buf_start, buf_len, issued_len; uint64_t table_start, table_end; uint64_t start, end, data_offset; @@ -515,7 +509,6 @@ dmdump(struct dev_dump_args *ap) tbl = NULL; table_end = 0; - dev_type = 0; issued_len = 0; dmv = dev->si_drv1; diff --git a/sys/dev/disk/dm/dm_ioctl.c b/sys/dev/disk/dm/dm_ioctl.c index 61ad8163af..a45e81ceb4 100644 --- a/sys/dev/disk/dm/dm_ioctl.c +++ b/sys/dev/disk/dm/dm_ioctl.c @@ -583,15 +583,12 @@ dm_table_deps_ioctl(prop_dictionary_t dm_dict) uint32_t flags, minor; int table_type; - size_t i; name = NULL; uuid = NULL; dmv = NULL; flags = 0; - i = 0; - prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name); prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_UUID, &uuid); prop_dictionary_get_uint32(dm_dict, DM_IOCTL_FLAGS, &flags); @@ -820,7 +817,7 @@ dm_table_status_ioctl(prop_dictionary_t dm_dict) prop_array_t cmd_array; prop_dictionary_t target_dict; - uint32_t rec_size, minor; + uint32_t minor; const char *name, *uuid; char *params; @@ -832,7 +829,6 @@ dm_table_status_ioctl(prop_dictionary_t dm_dict) name = NULL; params = NULL; flags = 0; - rec_size = 0; prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name); prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_UUID, &uuid); diff --git a/sys/dev/disk/dm/targets/crypt/dm_target_crypt.c b/sys/dev/disk/dm/targets/crypt/dm_target_crypt.c index 24a86a8800..8144169345 100644 --- a/sys/dev/disk/dm/targets/crypt/dm_target_crypt.c +++ b/sys/dev/disk/dm/targets/crypt/dm_target_crypt.c @@ -249,35 +249,35 @@ essiv_ivgen_ctor(struct target_crypt_config *priv, char *iv_hash, void **p_ivpri hashlen = SHA1_RESULTLEN; SHA1Init(&ctx); - SHA1Update(&ctx, priv->crypto_key, priv->crypto_klen>>3); + SHA1Update(&ctx, priv->crypto_key, klen); SHA1Final(crypto_keyhash, &ctx); } else if (!strcmp(iv_hash, "sha256")) { SHA256_CTX ctx; hashlen = SHA256_DIGEST_LENGTH; SHA256_Init(&ctx); - SHA256_Update(&ctx, priv->crypto_key, priv->crypto_klen>>3); + SHA256_Update(&ctx, priv->crypto_key, klen); SHA256_Final(crypto_keyhash, &ctx); } else if (!strcmp(iv_hash, "sha384")) { SHA384_CTX ctx; hashlen = SHA384_DIGEST_LENGTH; SHA384_Init(&ctx); - SHA384_Update(&ctx, priv->crypto_key, priv->crypto_klen>>3); + SHA384_Update(&ctx, priv->crypto_key, klen); SHA384_Final(crypto_keyhash, &ctx); } else if (!strcmp(iv_hash, "sha512")) { SHA512_CTX ctx; hashlen = SHA512_DIGEST_LENGTH; SHA512_Init(&ctx); - SHA512_Update(&ctx, priv->crypto_key, priv->crypto_klen>>3); + SHA512_Update(&ctx, priv->crypto_key, klen); SHA512_Final(crypto_keyhash, &ctx); } else if (!strcmp(iv_hash, "md5")) { MD5_CTX ctx; hashlen = MD5_DIGEST_LENGTH; MD5Init(&ctx); - MD5Update(&ctx, priv->crypto_key, priv->crypto_klen>>3); + MD5Update(&ctx, priv->crypto_key, klen); MD5Final(crypto_keyhash, &ctx); } else if (!strcmp(iv_hash, "rmd160") || !strcmp(iv_hash, "ripemd160")) { @@ -285,7 +285,7 @@ essiv_ivgen_ctor(struct target_crypt_config *priv, char *iv_hash, void **p_ivpri hashlen = 160/8; RMD160Init(&ctx); - RMD160Update(&ctx, priv->crypto_key, priv->crypto_klen>>3); + RMD160Update(&ctx, priv->crypto_key, klen); RMD160Final(crypto_keyhash, &ctx); } else { return EINVAL; @@ -951,13 +951,10 @@ dmtc_crypto_read_start(dm_target_crypt_config_t *priv, struct bio *bio) struct dmtc_helper *dmtc; struct cryptodesc *crd; struct cryptop *crp; - struct cryptoini *cri; int i, bytes, sectors, sz; off_t isector; u_char *ptr, *space; - cri = &priv->crypto_session; - /* * Note: b_resid no good after read I/O, it will be 0, use * b_bcount. @@ -1130,13 +1127,10 @@ dmtc_crypto_write_start(dm_target_crypt_config_t *priv, struct bio *bio) struct dmtc_helper *dmtc; struct cryptodesc *crd; struct cryptop *crp; - struct cryptoini *cri; int i, bytes, sectors, sz; off_t isector; u_char *ptr, *space; - cri = &priv->crypto_session; - /* * Use b_bcount for consistency */ @@ -1375,12 +1369,9 @@ dmtc_crypto_dump_start(dm_target_crypt_config_t *priv, struct dmtc_dump_helper * { struct cryptodesc *crd; struct cryptop *crp; - struct cryptoini *cri; int i, bytes, sectors; off_t isector; - cri = &priv->crypto_session; - bytes = dump_helper->length; isector = dump_helper->offset / DEV_BSIZE; /* ivgen salt base? */ @@ -1437,7 +1428,6 @@ static int dmtc_crypto_cb_dump_done(struct cryptop *crp) { struct dmtc_dump_helper *dump_helper; - dm_target_crypt_config_t *priv; int n; if (crp->crp_etype == EAGAIN) @@ -1459,7 +1449,6 @@ dmtc_crypto_cb_dump_done(struct cryptop *crp) n = atomic_fetchadd_int(&dump_helper->sectors, -1); if (n == 1) { - priv = dump_helper->priv; atomic_add_int(dump_helper->ident, 1); wakeup(dump_helper); }