From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: "Prashant Bhole" <bhole_prashant_q7@lab.ntt.co.jp>
Cc: "'David S . Miller'" <davem@davemloft.net>,
<netdev@vger.kernel.org>, "'Alexei Starovoitov'" <ast@kernel.org>,
"'Daniel Borkmann'" <daniel@iogearbox.net>,
"'Quentin Monnet'" <quentin.monnet@netronome.com>
Subject: Re: [PATCH net-next V3 2/3] tools: bpftool: show filenames of pinned objects
Date: Tue, 7 Nov 2017 20:33:17 -0800 [thread overview]
Message-ID: <20171107203317.21b65c01@cakuba> (raw)
In-Reply-To: <00d801d3583a$23219ff0$6964dfd0$@lab.ntt.co.jp>
On Wed, 8 Nov 2017 11:34:44 +0900, Prashant Bhole wrote:
> > > + FILE *mntfile = NULL;
> > > + FTSENT *ftse = NULL;
> > > + FTS *fts = NULL;
> > > + int fd, err;
> > > +
> > > + mntfile = setmntent("/proc/mounts", "r");
> > > + if (!mntfile)
> > > + return -1;
> > > +
> > > + while ((mntent = getmntent(mntfile)) != NULL) {
> >
> > Please try to avoid comparisons to NULL, writing:
> >
> > if (ptr)
> >
> > is more intuitive to most C programmers than:
> >
> > if (ptr != NULL)
>
> Jakub,
> Thank you for comments. I agree with using 'if (ptr)' for simple check, but
> here it is an assignment.
> It doesn't look intuitive and looks like a typo if I change it to:
> while ((mntent = getmntent(mntfile))) {
I still prefer this, if you don't mind.
> >
> > > + char *path[] = {mntent->mnt_dir, 0};
> >
> > Shouldn't there be spaces after and before the curly braces? Does
> checkpatch --
> > strict not warn about this?
>
> I will add spaces. checkpatch complained about this not being static const,
> but doing so causes compiler warning because it doesn't match with signature
> of fts_open()
Right, that's OK to ignore. Could you also make the 0 into a NULL,
though?
> I will submit v4 with changes for other comments if you are ok with replies
> above.
Thank you!
next prev parent reply other threads:[~2017-11-08 4:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-06 6:06 [PATCH net-next V3 0/3] tools: bpftool: show filenames of pinned objects Prashant Bhole
2017-11-06 6:06 ` [PATCH net-next V3 1/3] tools: bpftool: open pinned object without type check Prashant Bhole
2017-11-06 6:06 ` [PATCH net-next V3 2/3] tools: bpftool: show filenames of pinned objects Prashant Bhole
2017-11-07 12:36 ` Jakub Kicinski
2017-11-08 2:34 ` Prashant Bhole
2017-11-08 4:33 ` Jakub Kicinski [this message]
2017-11-06 6:06 ` [PATCH net-next V3 3/3] tools: bpftool: optionally " Prashant Bhole
2017-11-06 10:45 ` [PATCH net-next V3 0/3] tools: bpftool: " Quentin Monnet
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=20171107203317.21b65c01@cakuba \
--to=jakub.kicinski@netronome.com \
--cc=ast@kernel.org \
--cc=bhole_prashant_q7@lab.ntt.co.jp \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=quentin.monnet@netronome.com \
/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).