From: Namhyung Kim <namhyung@kernel.org>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org,
virtualization@lists.linux-foundation.org,
Tony Luck <tony.luck@intel.com>,
Radim Kr??m???? <rkrcmar@redhat.com>,
Kees Cook <keescook@chromium.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Anton Vorontsov <anton@enomsg.org>,
LKML <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Minchan Kim <minchan@kernel.org>,
Anthony Liguori <aliguori@amazon.com>,
Colin Cross <ccross@android.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Ingo Molnar <mingo@kernel.org>
Subject: Re: [Qemu-devel] [PATCH 6/7] qemu: Implement virtio-pstore device
Date: Tue, 2 Aug 2016 00:52:55 +0900 [thread overview]
Message-ID: <20160801155255.GB24526@danjae.aot.lge.com> (raw)
In-Reply-To: <20160801092439.GF6455@redhat.com>
On Mon, Aug 01, 2016 at 10:24:39AM +0100, Daniel P. Berrange wrote:
> On Sat, Jul 30, 2016 at 05:57:02PM +0900, Namhyung Kim wrote:
> > On Thu, Jul 28, 2016 at 02:22:39PM +0100, Daniel P. Berrange wrote:
> > > > +static void virtio_pstore_from_filename(VirtIOPstore *s, char *name,
> > > > + char *buf, size_t sz,
> > > > + struct virtio_pstore_fileinfo *info)
> > > > +{
> > > > + snprintf(buf, sz, "%s/%s", s->directory, name);
> > > > +
> > > > + if (g_str_has_prefix(name, "dmesg-")) {
> > > > + info->type = VIRTIO_PSTORE_TYPE_DMESG;
> > > > + name += strlen("dmesg-");
> > > > + } else if (g_str_has_prefix(name, "console-")) {
> > > > + info->type = VIRTIO_PSTORE_TYPE_CONSOLE;
> > > > + name += strlen("console-");
> > > > + } else if (g_str_has_prefix(name, "unknown-")) {
> > > > + info->type = VIRTIO_PSTORE_TYPE_UNKNOWN;
> > > > + name += strlen("unknown-");
> > > > + }
>
> [snip]
>
> > > > + struct virtio_pstore_fileinfo info;
> > > > + size_t offset = sizeof(*res) + sizeof(info);
> > > > +
> > > > + if (s->dirp == NULL) {
> > > > + return -1;
> > > > + }
> > > > +
> > > > + dent = readdir(s->dirp);
> > > > + while (dent) {
> > > > + if (dent->d_name[0] != '.') {
> > > > + break;
> > > > + }
> > > > + dent = readdir(s->dirp);
> > > > + }
> > > > +
> > > > + if (dent == NULL) {
> > > > + return 0;
> > > > + }
> > >
> > > So this seems to just be picking the first filename reported by
> > > readdir that isn't starting with '.'. Surely this can't the right
> > > logic when your corresponding do_write method can pick several
> > > different filenames, its potluck which do_read will give back.
> >
> > Do you mean that it'd be better to check a list of known filenames and
> > fail if not?
>
> No, I mean that you have several different VIRTIO_PSTORE_TYPE_nnn and
> use a different file for each constant. When reading this directory
> though you're not looking for the file corresponding to any given
> VIRTIO_PSTORE_TYPE_nnn - you're simply reading whichever file is found
> first. So you might have just read a TYPE_CONSOLE or have read a
> TYPE_DMESG - it surely doesn't make sense to randonly read either
> TYPE_CONSOLE or TYPE_DMESG based on whatever order readdir() lists
> the files.
In fact, each VIRTIO_PSTORE_TYPE_xxx can have more than one files and
I don't care about the ordering between them. They will be fed to the
pstore filesystem on the guest.
But I also think it'd be better to scan files of known types only
rather than read out whatever readdir() gives.
Thanks,
Namhyung
next prev parent reply other threads:[~2016-08-01 15:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 15:08 [RFC/PATCHSET 0/7] virtio: Implement virtio pstore device (v2) Namhyung Kim
2016-07-27 15:08 ` [PATCH 1/7] pstore: Split pstore fragile flags Namhyung Kim
2016-07-27 15:08 ` [PATCH 2/7] pstore/ram: Set pstore flags dynamically Namhyung Kim
2016-07-27 15:08 ` [PATCH 3/7] pstore: Manage buffer position for async write Namhyung Kim
2016-07-27 15:08 ` [PATCH 4/7] virtio: Basic implementation of virtio pstore driver Namhyung Kim
2016-07-27 15:08 ` [PATCH 5/7] virtio-pstore: Support PSTORE_TYPE_CONSOLE Namhyung Kim
2016-07-27 15:08 ` [PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim
2016-07-28 0:02 ` Michael S. Tsirkin
2016-07-28 5:39 ` Namhyung Kim
2016-07-28 12:56 ` Stefan Hajnoczi
2016-07-28 13:08 ` [Qemu-devel] " Daniel P. Berrange
2016-07-30 8:38 ` Namhyung Kim
2016-08-01 9:21 ` Daniel P. Berrange
2016-08-01 15:34 ` Namhyung Kim
2016-07-28 14:38 ` Steven Rostedt
2016-07-28 13:22 ` [Qemu-devel] " Daniel P. Berrange
2016-07-30 8:57 ` Namhyung Kim
2016-08-01 9:24 ` Daniel P. Berrange
2016-08-01 15:52 ` Namhyung Kim [this message]
2016-07-27 15:08 ` [PATCH 7/7] kvmtool: " Namhyung Kim
2016-07-27 22:18 ` [RFC/PATCHSET 0/7] virtio: Implement virtio pstore device (v2) Michael S. Tsirkin
2016-07-28 2:46 ` Namhyung Kim
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=20160801155255.GB24526@danjae.aot.lge.com \
--to=namhyung@kernel.org \
--cc=aliguori@amazon.com \
--cc=anton@enomsg.org \
--cc=berrange@redhat.com \
--cc=ccross@android.com \
--cc=keescook@chromium.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=minchan@kernel.org \
--cc=mingo@kernel.org \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rkrcmar@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tony.luck@intel.com \
--cc=virtualization@lists.linux-foundation.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
all inboxes | Powered by JetHome®