qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/2] Add 'serial' attribute to virtio-blk devic


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH 1/2] Add 'serial' attribute to virtio-blk devices
Date: Sat, 19 Jun 2010 15:59:10 +0000

On Sat, Jun 19, 2010 at 10:58 AM, Ulrich Drepper <address@hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 06/19/2010 01:24 AM, Blue Swirl wrote:
>>> +static inline int serial_sysfs(char *d, char *s, int n)
>>> +{
>>> +       char *di = d;
>>
>> I'd change this to:
>> static inline ssize_t serial_sysfs(char *d, const char *s, ssize_t n)
>> {
>>        const char *di = d;
>>
>>> +
>>> +       while (*s && n--)
>>> +               *d++ = *s++;
>>> +       return d - di;
>
> I would guess you mean
>
>   char *const di = d;
>
> Quite different and doesn't elicit warnings from the compiler.

I had actually confused the types of d and s. So either your version
or the original for this line.

The return statement assumes that ptrdiff_t is equal to ssize_t (or
int in the original version) but I guess that's OK.



reply via email to

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