From: Will Deacon <will.deacon@arm.com>
To: "G. Campana" <gcampana+kvm@quarkslab.com>
Cc: kvm@vger.kernel.org, andre.przywara@arm.com
Subject: Re: [PATCH 7/7] kvmtool: 9p: refactor rel_to_abs()
Date: Thu, 17 Nov 2016 12:20:08 +0000 [thread overview]
Message-ID: <20161117122008.GF22855@arm.com> (raw)
In-Reply-To: <9c821c8f-46a7-052c-0c0c-7c84cc19a8f6@quarkslab.com>
On Thu, Nov 10, 2016 at 04:18:54PM +0100, G. Campana wrote:
> On 08/11/2016 03:38, Will Deacon wrote:
> > On Tue, Oct 18, 2016 at 06:03:05PM +0200, G. Campana wrote:
> >> @@ -614,7 +618,6 @@ static void virtio_p9_readdir(struct p9_dev *p9dev,
> >> struct stat st;
> >> struct p9_fid *fid;
> >> struct dirent *dent;
> >> - char full_path[PATH_MAX];
> >> u64 offset, old_offset;
> >>
> >> rcount = 0;
> >> @@ -645,11 +648,8 @@ static void virtio_p9_readdir(struct p9_dev *p9dev,
> >> break;
> >> }
> >> old_offset = dent->d_off;
> >> - if (rel_to_abs(p9dev, dent->d_name, full_path, sizeof(full_path)) != 0) {
> >> - errno = ENAMETOOLONG;
> >> - goto err_out;
> >> - }
> >> - lstat(full_path, &st);
> >> + if (stat_rel(p9dev, dent->d_name, &st) != 0)
> >> + memset(&st, -1, sizeof(st));
> >
> > Why the memset, and not goto err_out?
> >
> Because the user may not be allowed to stat some entries in a directory
> and it shouldn't make readdir() fail.
Ok, but is memsetting to -1 really the right thing to do? This gets
"converted" into a p9_qid_t, which will then look pretty strange (path
and version will be set to 0xff, type will be set to P9_QTDIR).
Does 9p not have a better way to communicate that the stat failed?
Will
next prev parent reply other threads:[~2016-11-17 17:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 16:03 [PATCH 7/7] kvmtool: 9p: refactor rel_to_abs() G. Campana
2016-11-08 2:38 ` Will Deacon
2016-11-10 15:18 ` G. Campana
2016-11-17 12:20 ` Will Deacon [this message]
2016-11-18 15:33 ` G. Campana
2016-11-18 15:37 ` Will Deacon
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=20161117122008.GF22855@arm.com \
--to=will.deacon@arm.com \
--cc=andre.przywara@arm.com \
--cc=gcampana+kvm@quarkslab.com \
--cc=kvm@vger.kernel.org \
/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).