[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] linux-user: Allow getdents to be provided by ge
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH] linux-user: Allow getdents to be provided by getdents64 |
Date: |
Mon, 3 Jun 2013 16:45:45 +0100 |
On 3 June 2013 16:15, Richard Henderson <address@hidden> wrote:
> On 06/02/2013 10:10 AM, Peter Maydell wrote:
>> + tde->d_ino = tswapal(ino);
>> + tde->d_off = tswapal(off);
>> + tde->d_reclen = tswap16(treclen);
>> + memmove(tde->d_name, de->d_name, namelen + 1);
>
> Wouldn't it be better to do the memmove first? Then you really are reading
> all
> of the dirent64 data first, like your comment says.
It doesn't actually make a difference, in fact, but I agree
it would be clearer that way round.
>> + /* The target_dirent type is in what was formerly a
>> padding
>> + * byte at the end of the structure:
>> + */
>> + *(((char *)tde) + treclen - 1) = type;
>
> Maybe easier to read as
>
> ((char *)tde)[treclen - 1] = type
>
> ?
Dunno. It's not actually a char array, so I kind of prefer
to use plain pointer arithmetic for this kind of thing.
-- PMM