qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Small patch for getdents syscall


From: Henry Wertz
Subject: Re: [Qemu-devel] Small patch for getdents syscall
Date: Mon, 13 Mar 2017 14:00:34 -0500

On Mar 13, 2017 5:49 AM, "Peter Maydell" <address@hidden> wrote:
>
> On 8 March 2017 at 00:40, Henry Wertz <address@hidden> wrote:
> > I have a trivial, 1-line patch for getdents function; due to
> >...
> There is a theoretically better way to handle the 64-bit
> guest on 32-bit host case: since here you know that the
> guest dirent struct is bigger than the host dirent
> struct you could read them directly into the guest buffer
> and then convert in-place rather than having to malloc
> a temporary buffer. The conversion code is a little
> bit awkward though because you have to make sure you don't
> overwrite host data you haven't read yet, so I think
> you would need to start at the end of the buffer and
> work backwards. This is basically fixing the #else
> part of this code to work for guest > host as well
> as for guest == host.

That does sound like it'd be better (avoiding one unnecessary malloc at
least.)

>
> However, since 64-bit-on-32 is not exactly a very common
> use case these days I think your patch is an OK fix for
> things.
I'd guess this use might (slightly) increase if more x86 binary software
begins to be shipped x86-64 instead.  That said, this particular code path
may still barely be used; I would have expected most (especially 64-bit)
software would call getdents64 instead of getdents, and was surprised to
find aapt uses getdents instead.

> Reviewed-by: Peter Maydell <address@hidden>

>
> PS: we prefer 'unified' format diffs; git format-patch
> should produce those by default.
>
> thanks
> -- PMM

OK I'll make sure to do that next time.

Thanks!

-- Henry Wertz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]