netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>,
	netfilter-devel@vger.kernel.org, Eric Leblond <eric@regit.org>,
	Florian Westphal <fw@strlen.de>
Subject: Re: [nft PATCH v2 5/5] src: get rid of printf
Date: Fri, 29 Sep 2017 13:19:29 +0200	[thread overview]
Message-ID: <20170929111929.GA5643@salvia> (raw)
In-Reply-To: <20170929105735.GE32305@orbyte.nwl.cc>

On Fri, Sep 29, 2017 at 12:57:35PM +0200, Phil Sutter wrote:
> Hi Pablo,
> 
> On Fri, Sep 29, 2017 at 12:38:15PM +0200, Pablo Neira Ayuso wrote:
> > On Thu, Sep 28, 2017 at 05:17:45PM +0200, Phil Sutter wrote:
> > > This patch introduces nft_print()/nft_gmp_print() functions which have
> > > to be used instead of printf to output information that were previously
> > > send to stdout. These functions print to a FILE pointer defined in
> > > struct output_ctx. It is set by calling:
> > > 
> > > | old_fp = nft_ctx_set_output(ctx, new_fp);
> > > 
> > > Having an application-defined FILE pointer is actually quite flexible:
> > > Using fmemopen() or even fopencookie(), an application gains full
> > > control over what is printed and where it should go to.
> > 
> > Applied, thanks a lot for taking over this work.
> 
> Cool, thanks!
> 
> Note that I missed two spots when reviewing the patches:
> 
> * nft_gmp_print() lacks a call to fflush(). This is not a problem in
>   practice, but inconsistent with regards to nft_print(). I'll send a
>   follow-up fixing it.

OK.

> * Did you notice how my patch changes main() to move stdout to another
>   file descriptor? I used that to make sure I didn't miss a spot when
>   converting the code. In theory, we could just drop it again since
>   everything's working. What do you suggest?

Please, drop it. Thanks.

      reply	other threads:[~2017-09-29 11:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 15:17 [nft PATCH v2 0/5] Get output under application control Phil Sutter
2017-09-28 15:17 ` [nft PATCH v2 1/5] rule: Use C99-style initializer in cache_init() Phil Sutter
2017-09-29 10:25   ` Pablo Neira Ayuso
2017-09-28 15:17 ` [nft PATCH v2 2/5] exthdr: Simplify tcp option printing a bit Phil Sutter
2017-09-29 10:25   ` Pablo Neira Ayuso
2017-09-28 15:17 ` [nft PATCH v2 3/5] erec_print: Pass output FILE pointer to netlink_dump_expr() Phil Sutter
2017-09-29 10:26   ` Pablo Neira Ayuso
2017-09-28 15:17 ` [nft PATCH v2 4/5] rule: Refactor chain_print_declaration() Phil Sutter
2017-09-29 10:26   ` Pablo Neira Ayuso
2017-09-28 15:17 ` [nft PATCH v2 5/5] src: get rid of printf Phil Sutter
2017-09-29 10:38   ` Pablo Neira Ayuso
2017-09-29 10:57     ` Phil Sutter
2017-09-29 11:19       ` Pablo Neira Ayuso [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170929111929.GA5643@salvia \
    --to=pablo@netfilter.org \
    --cc=eric@regit.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).