kernel/dm: Remove some unused variables.
authorSascha Wildner <saw@online.de>
Sat, 5 Jan 2013 11:21:47 +0000 (12:21 +0100)
committerSascha Wildner <saw@online.de>
Sat, 5 Jan 2013 11:22:48 +0000 (12:22 +0100)
Also start using a previously unused variable in dm_target_crypt.

sys/dev/disk/dm/device-mapper.c
sys/dev/disk/dm/dm_ioctl.c
sys/dev/disk/dm/targets/crypt/dm_target_crypt.c

index 510b8c0..74fb533 100644 (file)
@@ -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;
index 61ad816..a45e81c 100644 (file)
@@ -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);
index 24a86a8..8144169 100644 (file)
@@ -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);
        }