* [PATCH nft] src: use printf() instead of pr_debug() whenever possible
@ 2015-01-08 12:13 Pablo Neira Ayuso
2015-01-08 12:21 ` Patrick McHardy
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2015-01-08 12:13 UTC (permalink / raw)
To: netfilter-devel; +Cc: kaber
pr_debug() is disabled with --with-mini-gmp since it relies on the
gmp_printf(), which is not available in the mini-gmp implementation.
Use printf() instead of pr_debug() if no mpz_t types are used, so
we get debugging information for proto-ctx as well.
This leaves the pr_debug() usage limited to src/segtree.c.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
src/netlink_delinearize.c | 2 --
src/proto.c | 14 +++++++-------
2 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/src/netlink_delinearize.c b/src/netlink_delinearize.c
index e9a04dd..b34d586 100644
--- a/src/netlink_delinearize.c
+++ b/src/netlink_delinearize.c
@@ -915,8 +915,6 @@ static void expr_postprocess(struct rule_pp_ctx *ctx,
{
struct expr *expr = *exprp, *i;
- //pr_debug("%s len %u\n", expr->ops->name, expr->len);
-
switch (expr->ops->type) {
case EXPR_MAP:
expr_postprocess(ctx, stmt, &expr->map);
diff --git a/src/proto.c b/src/proto.c
index 7dc7b3e..6a12ee8 100644
--- a/src/proto.c
+++ b/src/proto.c
@@ -137,15 +137,15 @@ static void proto_ctx_debug(const struct proto_ctx *ctx, enum proto_bases base)
if (!(debug_level & DEBUG_PROTO_CTX))
return;
- pr_debug("update %s protocol context:\n", proto_base_names[base]);
+ printf("update %s protocol context:\n", proto_base_names[base]);
for (i = PROTO_BASE_LL_HDR; i <= PROTO_BASE_MAX; i++) {
- pr_debug(" %-20s: %s%s\n",
- proto_base_names[i],
- ctx->protocol[i].desc ? ctx->protocol[i].desc->name :
- "none",
- i == base ? " <-" : "");
+ printf(" %-20s: %s%s\n",
+ proto_base_names[i],
+ ctx->protocol[i].desc ? ctx->protocol[i].desc->name :
+ "none",
+ i == base ? " <-" : "");
}
- pr_debug("\n");
+ printf("\n");
#endif
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH nft] src: use printf() instead of pr_debug() whenever possible
2015-01-08 12:13 [PATCH nft] src: use printf() instead of pr_debug() whenever possible Pablo Neira Ayuso
@ 2015-01-08 12:21 ` Patrick McHardy
2015-01-08 12:31 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: Patrick McHardy @ 2015-01-08 12:21 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: netfilter-devel
On 08.01, Pablo Neira Ayuso wrote:
> pr_debug() is disabled with --with-mini-gmp since it relies on the
> gmp_printf(), which is not available in the mini-gmp implementation.
> Use printf() instead of pr_debug() if no mpz_t types are used, so
> we get debugging information for proto-ctx as well.
>
> This leaves the pr_debug() usage limited to src/segtree.c.
I don't think this patch is conceptually good. The intention of
pr_debug() is to be able to disable debugging at compile time
to avoid ifdefs everywhere.
We currently need them for external debugging functions like mnl,
but f.i. in proto_ctx_debug() the compiler should very well be able
to determine that the function is a NOP without debugging enabled.
I'd rather change pr_debug to a normal printf and adapt segtree to
use a pr_gmp_debug or something like that.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-08 12:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-08 12:13 [PATCH nft] src: use printf() instead of pr_debug() whenever possible Pablo Neira Ayuso
2015-01-08 12:21 ` Patrick McHardy
2015-01-08 12:31 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).