[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160826122723.GA12514@redhat.com>
Date: Fri, 26 Aug 2016 08:27:23 -0400
From: "Daniel P. Berrange" <berrange@...hat.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: virtio-dev@...ts.oasis-open.org, kvm@...r.kernel.org,
qemu-devel@...gnu.org, virtualization@...ts.linux-foundation.org,
LKML <linux-kernel@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Anthony Liguori <aliguori@...zon.com>,
Anton Vorontsov <anton@...msg.org>,
Colin Cross <ccross@...roid.com>,
Kees Cook <keescook@...omium.org>,
Tony Luck <tony.luck@...el.com>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>,
Minchan Kim <minchan@...nel.org>
Subject: Re: [PATCH 2/3] qemu: Implement virtio-pstore device
On Fri, Aug 26, 2016 at 01:48:40PM +0900, Namhyung Kim wrote:
> Hi Daniel,
>
> On Wed, Aug 24, 2016 at 06:00:51PM -0400, Daniel P. Berrange wrote:
> > > + fd = open(filename, O_RDONLY);
> > > + if (fd < 0) {
> > > + error_report("cannot open %s", filename);
> > > + goto out;
> > > + }
> > > +
> > > + if (fstat(fd, &stbuf) < 0) {
> > > + goto out;
> > > + }
> > > +
> > > + rarg->vps = s;
> > > + rarg->elem = elem;
> > > + rarg->info.id = cpu_to_le64(rarg->info.id);
> > > + rarg->info.type = cpu_to_le16(rarg->info.type);
> > > + rarg->info.flags = cpu_to_le32(rarg->info.flags);
> > > + rarg->info.time_sec = cpu_to_le64(stbuf.st_ctim.tv_sec);
> > > + rarg->info.time_nsec = cpu_to_le32(stbuf.st_ctim.tv_nsec);
> > > +
> > > + rarg->ioc = qio_channel_new_fd(fd, &err);
> >
> > You should just use qio_channel_open_path() and avoid the earlier
> > call to open()
>
> I did it because to call fstat() using the fd and wanted to keep the
> generic ioc pointer.
I'd suggest just using a cast inline, eg
fstat(QIO_CHANNEL_FILE(ioc)->fd, &stbuf)
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
Powered by blists - more mailing lists