[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wjQjL+W66NZ=+Rc_ibEznmt9bcY5MjxgLkqV1DtrFM4ow@mail.gmail.com>
Date: Fri, 13 Mar 2020 17:40:03 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH v4 20/69] merging pick_link() with get_link(), part 2
Hmm..
On Fri, Mar 13, 2020 at 4:55 PM Al Viro <viro@...iv.linux.org.uk> wrote:
>@@ -2370,10 +2375,9 @@ static int path_lookupat(struct nameidata *nd, unsigned flags, struct path *path
> + while (!(err = link_path_walk(s, nd)) &&
> + (s = lookup_last(nd)) != NULL)
> + ;
There's two copies of that loop (the other being in path_openat()). Is
there a reason why it's written that odd way?
Why is the loop body empty, when the *natural* way to write that would
seem to be
while (!(err = link_path_walk(s, nd))) {
s = lookup_last(nd));
if (!s)
break;
}
which may be a few lines longer, but a lot more legible.
I don't think you should use assignments in tests, unless strictly
required. Yes, that "err = ..." part almost has to be written that
way, but the "s = ..." part doesn't seem to have any reason for being
in the conditional.
And I'm only reading the patches, so once again: maybe I'm messing up
by mis-reading something. And maybe you have some reason for that
pattern.
Linus
Powered by blists - more mailing lists