Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/opencrypto opencrypto: cleanup debug messages.



details:   https://anonhg.NetBSD.org/src/rev/23f6d633c150
branches:  trunk
changeset: 823972:23f6d633c150
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Wed May 17 06:33:04 2017 +0000

description:
opencrypto: cleanup debug messages.

diffstat:

 sys/opencrypto/crypto.c     |   33 +++++------
 sys/opencrypto/cryptodev.c  |  132 +++++++++++++++++++++-----------------------
 sys/opencrypto/cryptodev.h  |    6 +-
 sys/opencrypto/cryptosoft.c |    8 +-
 sys/opencrypto/deflate.c    |   47 +++++++--------
 sys/opencrypto/ocryptodev.c |   10 +-
 6 files changed, 113 insertions(+), 123 deletions(-)

diffs (truncated from 813 to 300 lines):

diff -r bb1ceeb92e3e -r 23f6d633c150 sys/opencrypto/crypto.c
--- a/sys/opencrypto/crypto.c   Wed May 17 06:30:15 2017 +0000
+++ b/sys/opencrypto/crypto.c   Wed May 17 06:33:04 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crypto.c,v 1.63 2017/05/10 09:45:51 knakahara Exp $ */
+/*     $NetBSD: crypto.c,v 1.64 2017/05/17 06:33:04 knakahara Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/crypto.c,v 1.4.2.5 2003/02/26 00:14:05 sam Exp $   */
 /*     $OpenBSD: crypto.c,v 1.41 2002/07/17 23:52:38 art Exp $ */
 
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.63 2017/05/10 09:45:51 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crypto.c,v 1.64 2017/05/17 06:33:04 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/reboot.h>
@@ -363,7 +363,7 @@
                /* See if all the algorithms are supported. */
                for (cr = cri; cr; cr = cr->cri_next)
                        if (crypto_drivers[hid].cc_alg[cr->cri_alg] == 0) {
-                               DPRINTF(("crypto_newsession: alg %d not supported\n", cr->cri_alg));
+                               DPRINTF("alg %d not supported\n", cr->cri_alg);
                                break;
                        }
 
@@ -387,8 +387,8 @@
                                (*sid) |= (lid & 0xffffffff);
                                crypto_drivers[hid].cc_sessions++;
                        } else {
-                               DPRINTF(("%s: crypto_drivers[%d].cc_newsession() failed. error=%d\n",
-                                       __func__, hid, err));
+                               DPRINTF("crypto_drivers[%d].cc_newsession() failed. error=%d\n",
+                                       hid, err);
                        }
                        goto done;
                        /*break;*/
@@ -746,8 +746,7 @@
        hid = CRYPTO_SESID2HID(crp->crp_sid);
 
        mutex_spin_enter(&crypto_q_mtx);
-       DPRINTF(("crypto_dispatch: crp %p, alg %d\n",
-               crp, crp->crp_desc->crd_alg));
+       DPRINTF("crp %p, alg %d\n", crp, crp->crp_desc->crd_alg);
 
        cryptostats.cs_ops++;
 
@@ -980,7 +979,7 @@
                /*
                 * Invoke the driver to process the request.
                 */
-               DPRINTF(("calling process for %p\n", crp));
+               DPRINTF("calling process for %p\n", crp);
                return (*process)(arg, crp, hint);
        } else {
                struct cryptodesc *crd;
@@ -1015,8 +1014,7 @@
 
        if (crp == NULL)
                return;
-       DPRINTF(("crypto_freereq[%u]: crp %p\n",
-               CRYPTO_SESID2LID(crp->crp_sid), crp));
+       DPRINTF("lid[%u]: crp %p\n", CRYPTO_SESID2LID(crp->crp_sid), crp);
 
        /* sanity check */
        if (crp->crp_flags & CRYPTO_F_ONRETQ) {
@@ -1076,8 +1074,7 @@
        if (crypto_timing)
                crypto_tstat(&cryptostats.cs_done, &crp->crp_tstamp);
 #endif
-       DPRINTF(("crypto_done[%u]: crp %p\n",
-               CRYPTO_SESID2LID(crp->crp_sid), crp));
+       DPRINTF("lid[%u]: crp %p\n", CRYPTO_SESID2LID(crp->crp_sid), crp);
 
        /*
         * Normal case; queue the callback for the thread.
@@ -1123,20 +1120,20 @@
                         * the same context, we can skip enqueueing crp_ret_q
                         * and cv_signal(&cryptoret_cv).
                         */
-                       DPRINTF(("crypto_done[%u]: crp %p CRYPTO_F_USER\n",
-                               CRYPTO_SESID2LID(crp->crp_sid), crp));
+                       DPRINTF("lid[%u]: crp %p CRYPTO_F_USER\n",
+                               CRYPTO_SESID2LID(crp->crp_sid), crp);
                } else
 #endif
                {
                        wasempty = TAILQ_EMPTY(&crp_ret_q);
-                       DPRINTF(("crypto_done[%u]: queueing %p\n",
-                               CRYPTO_SESID2LID(crp->crp_sid), crp));
+                       DPRINTF("lid[%u]: queueing %p\n",
+                               CRYPTO_SESID2LID(crp->crp_sid), crp);
                        crp->crp_flags |= CRYPTO_F_ONRETQ;
                        TAILQ_INSERT_TAIL(&crp_ret_q, crp, crp_next);
                        if (wasempty) {
-                               DPRINTF(("crypto_done[%u]: waking cryptoret, "
+                               DPRINTF("lid[%u]: waking cryptoret, "
                                        "crp %p hit empty queue\n.",
-                                       CRYPTO_SESID2LID(crp->crp_sid), crp));
+                                       CRYPTO_SESID2LID(crp->crp_sid), crp);
                                cv_signal(&cryptoret_cv);
                        }
                }
diff -r bb1ceeb92e3e -r 23f6d633c150 sys/opencrypto/cryptodev.c
--- a/sys/opencrypto/cryptodev.c        Wed May 17 06:30:15 2017 +0000
+++ b/sys/opencrypto/cryptodev.c        Wed May 17 06:33:04 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cryptodev.c,v 1.89 2017/04/24 03:29:37 knakahara Exp $ */
+/*     $NetBSD: cryptodev.c,v 1.90 2017/05/17 06:33:04 knakahara Exp $ */
 /*     $FreeBSD: src/sys/opencrypto/cryptodev.c,v 1.4.2.4 2003/06/03 00:09:02 sam Exp $        */
 /*     $OpenBSD: cryptodev.c,v 1.53 2002/07/10 22:21:30 mickey Exp $   */
 
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.89 2017/04/24 03:29:37 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cryptodev.c,v 1.90 2017/05/17 06:33:04 knakahara Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -336,11 +336,11 @@
                cse = csefind(fcr, cop->ses);
                mutex_exit(&crypto_mtx);
                if (cse == NULL) {
-                       DPRINTF(("csefind failed\n"));
+                       DPRINTF("csefind failed\n");
                        return EINVAL;
                }
                error = cryptodev_op(cse, cop, curlwp);
-               DPRINTF(("cryptodev_op error = %d\n", error));
+               DPRINTF("cryptodev_op error = %d\n", error);
                break;
        case CIOCNCRYPTM:
                mutex_enter(&crypto_mtx);
@@ -362,7 +362,7 @@
                break;
        case CIOCKEY:
                error = cryptodev_key((struct crypt_kop *)data);
-               DPRINTF(("cryptodev_key error = %d\n", error));
+               DPRINTF("cryptodev_key error = %d\n", error);
                break;
        case CIOCNFKEYM:
                mutex_enter(&crypto_mtx);
@@ -446,14 +446,14 @@
                        return EINVAL;
        }
 
-       DPRINTF(("cryptodev_op[%u]: iov_len %d\n",
-               CRYPTO_SESID2LID(cse->sid), iov_len));
+       DPRINTF("cryptodev_op[%u]: iov_len %d\n",
+               CRYPTO_SESID2LID(cse->sid), iov_len);
        if ((cse->tcomp) && cop->dst_len) {
                if (iov_len < cop->dst_len) {
                        /* Need larger iov to deal with decompress */
                        iov_len = cop->dst_len;
                }
-               DPRINTF(("cryptodev_op: iov_len -> %d for decompress\n", iov_len));
+               DPRINTF("cryptodev_op: iov_len -> %d for decompress\n", iov_len);
        }
 
        (void)memset(&cse->uio, 0, sizeof(cse->uio));
@@ -470,17 +470,16 @@
        if (iov_len > 0)
                cse->uio.uio_iov[0].iov_base = kmem_alloc(iov_len, KM_SLEEP);
        cse->uio.uio_resid = cse->uio.uio_iov[0].iov_len;
-       DPRINTF(("cryptodev_op[%u]: uio.iov_base %p malloced %d bytes\n",
+       DPRINTF("lid[%u]: uio.iov_base %p malloced %d bytes\n",
                CRYPTO_SESID2LID(cse->sid),
-               cse->uio.uio_iov[0].iov_base, iov_len));
+               cse->uio.uio_iov[0].iov_base, iov_len);
 
        crp = crypto_getreq((cse->tcomp != NULL) + (cse->txform != NULL) + (cse->thash != NULL));
        if (crp == NULL) {
                error = ENOMEM;
                goto bail;
        }
-       DPRINTF(("cryptodev_op[%u]: crp %p\n",
-               CRYPTO_SESID2LID(cse->sid), crp));
+       DPRINTF("lid[%u]: crp %p\n", CRYPTO_SESID2LID(cse->sid), crp);
 
        /* crds are always ordered tcomp, thash, then txform */
        /* with optional missing links */
@@ -506,10 +505,10 @@
                }
        }
 
-       DPRINTF(("ocf[%u]: iov_len %zu, cop->len %u\n",
+       DPRINTF("ocf[%u]: iov_len %zu, cop->len %u\n",
                        CRYPTO_SESID2LID(cse->sid),
                        cse->uio.uio_iov[0].iov_len, 
-                       cop->len));
+                       cop->len);
 
        if ((error = copyin(cop->src, cse->uio.uio_iov[0].iov_base, cop->len)))
        {
@@ -538,8 +537,8 @@
                crdc->crd_alg = cse->comp_alg;
                crdc->crd_key = NULL;
                crdc->crd_klen = 0;
-               DPRINTF(("cryptodev_op[%u]: crdc setup for comp_alg %d.\n",
-                       CRYPTO_SESID2LID(cse->sid), crdc->crd_alg));
+               DPRINTF("lid[%u]: crdc setup for comp_alg %d.\n",
+                       CRYPTO_SESID2LID(cse->sid), crdc->crd_alg);
        }
 
        if (crda) {
@@ -550,7 +549,7 @@
                crda->crd_alg = cse->mac;
                crda->crd_key = cse->mackey;
                crda->crd_klen = cse->mackeylen * 8;
-               DPRINTF(("cryptodev_op: crda setup for mac %d.\n", crda->crd_alg));
+               DPRINTF("crda setup for mac %d.\n", crda->crd_alg);
        }
 
        if (crde) {
@@ -575,7 +574,7 @@
                crde->crd_alg = cse->cipher;
                crde->crd_key = cse->key;
                crde->crd_klen = cse->keylen * 8;
-               DPRINTF(("cryptodev_op: crde setup for cipher %d.\n", crde->crd_alg));
+               DPRINTF("crde setup for cipher %d.\n", crde->crd_alg);
        }
 
 
@@ -659,28 +658,28 @@
        case 0:
                break;
        default:
-               DPRINTF(("cryptodev_op: not waiting, error.\n"));
+               DPRINTF("not waiting, error.\n");
                mutex_exit(&crypto_mtx);
                cv_destroy(&crp->crp_cv);
                goto bail;
        }
 
        while (!(crp->crp_flags & CRYPTO_F_DQRETQ)) {
-               DPRINTF(("cryptodev_op[%d]: sleeping on cv %p for crp %p\n",
-                       (uint32_t)cse->sid, &crp->crp_cv, crp));
+               DPRINTF("cse->sid[%d]: sleeping on cv %p for crp %p\n",
+                       (uint32_t)cse->sid, &crp->crp_cv, crp);
                cv_wait(&crp->crp_cv, &crypto_mtx);     /* XXX cv_wait_sig? */
        }
        mutex_exit(&crypto_mtx);
        cv_destroy(&crp->crp_cv);
 
        if (crp->crp_etype != 0) {
-               DPRINTF(("cryptodev_op: crp_etype %d\n", crp->crp_etype));
+               DPRINTF("crp_etype %d\n", crp->crp_etype);
                error = crp->crp_etype;
                goto bail;
        }
 
        if (cse->error) {
-               DPRINTF(("cryptodev_op: cse->error %d\n", cse->error));
+               DPRINTF("cse->error %d\n", cse->error);
                error = cse->error;
                goto bail;
        }
@@ -696,18 +695,18 @@
        }
 
        if (cop->dst) {
-               DPRINTF(("cryptodev_op: copyout %d bytes to %p\n", dst_len, cop->dst));
+               DPRINTF("copyout %d bytes to %p\n", dst_len, cop->dst);
        }
        if (cop->dst &&
            (error = copyout(cse->uio.uio_iov[0].iov_base, cop->dst, dst_len)))
        {
-               DPRINTF(("cryptodev_op: copyout error %d\n", error));
+               DPRINTF("copyout error %d\n", error);
                goto bail;
        }
 
        if (cop->mac &&
            (error = copyout(crp->crp_mac, cop->mac, cse->thash->authsize))) {
-               DPRINTF(("cryptodev_op: mac copyout error %d\n", error));
+               DPRINTF("mac copyout error %d\n", error);
                goto bail;
        }
 
@@ -893,8 +892,7 @@
        mutex_exit(&crypto_mtx);
 
        if (krp->krp_status != 0) {
-               DPRINTF(("cryptodev_key: krp->krp_status 0x%08x\n",
-                   krp->krp_status));
+               DPRINTF("krp->krp_status 0x%08x\n", krp->krp_status);
                error = krp->krp_status;
                goto fail;
        }
@@ -907,8 +905,8 @@
                error = copyout(krp->krp_param[i].crp_p,
                    kop->crk_param[i].crp_p, size);
                if (error) {
-                       DPRINTF(("cryptodev_key: copyout oparam %d failed, "
-                           "error=%d\n", i-krp->krp_iparams, error));
+                       DPRINTF("copyout oparam %d failed, "
+                           "error=%d\n", i-krp->krp_iparams, error);



Home | Main Index | Thread Index | Old Index