From 289b9798be1bf488e4f0a17184a300862e078867 Mon Sep 17 00:00:00 2001 From: Conrad Meyer Date: Mon, 26 Mar 2018 22:31:29 +0000 Subject: [PATCH] OCF: CRYPTDEB(): Enhance to allow formatted logging Sponsored by: Dell EMC Isilon --- sys/opencrypto/crypto.c | 2 +- sys/opencrypto/cryptodev.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c index 0e3ae6965ca5..79abc050764f 100644 --- a/sys/opencrypto/crypto.c +++ b/sys/opencrypto/crypto.c @@ -525,7 +525,7 @@ crypto_newsession(u_int64_t *sid, struct cryptoini *cri, int crid) (*sid) |= (lid & 0xffffffff); cap->cc_sessions++; } else - CRYPTDEB("dev newsession failed"); + CRYPTDEB("dev newsession failed: %d", err); } else { CRYPTDEB("no driver"); err = EOPNOTSUPP; diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h index ea5173af62ac..eea1a00c50b8 100644 --- a/sys/opencrypto/cryptodev.h +++ b/sys/opencrypto/cryptodev.h @@ -348,10 +348,11 @@ struct cryptostats { #ifdef _KERNEL #if 0 -#define CRYPTDEB(s) do { printf("%s:%d: %s\n", __FILE__, __LINE__, s); \ - } while (0) +#define CRYPTDEB(s, ...) do { \ + printf("%s:%d: " s "\n", __FILE__, __LINE__, ## __VA_ARGS__); \ +} while (0) #else -#define CRYPTDEB(s) do { } while (0) +#define CRYPTDEB(...) do { } while (0) #endif /* Standard initialization structure beginning */