All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] The issue about parameters(uint64) of a device are treated as signed long int.
@ 2015-07-31  8:28 Lin Ma
  2015-08-07  4:54 ` Lin Ma
  0 siblings, 1 reply; 3+ messages in thread
From: Lin Ma @ 2015-07-31  8:28 UTC (permalink / raw)
  To: qemu-devel@nongnu.org Developers

Hi all,

Because qemu uses strtoll to parse string in parse_str function of 
qapi/string-input-visitor.c,  I'd like to know why the parameters of 
scsi-hd device which are specified as uint64(says wwn) are getting 
interpreted as signed long int's instead

e.g:
# qemu-system-x86_64 -device scsi-hd,?
......
scsi-hd.wwn=uint64
......

Does the highest bit of wwn value have special meaning and it must be a 
zero?

Thanks in advance,
Lin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] The issue about parameters(uint64) of a device are treated as signed long int.
  2015-07-31  8:28 [Qemu-devel] The issue about parameters(uint64) of a device are treated as signed long int Lin Ma
@ 2015-08-07  4:54 ` Lin Ma
  2015-08-07 12:09   ` Eric Blake
  0 siblings, 1 reply; 3+ messages in thread
From: Lin Ma @ 2015-08-07  4:54 UTC (permalink / raw)
  To: pbonzini@redhat.com >> Paolo Bonzini
  Cc: qemu-devel@nongnu.org Developers

Hi Paolo,

As mentioned in below email, The type of wwn is reported as uint64, But 
in qemu command line, The max valid value for wwn is
0x7fffffffffffffff. Obviously, it's treated as int64 there. I'd like to 
know that does the highest bit of  _world wide name_ have special
meaning and must be zero? May I have your thoughts?

Thanks,
Lin

在 2015年07月31日 16:28, Lin Ma 写道:
> Hi all,
>
> Because qemu uses strtoll to parse string in parse_str function of 
> qapi/string-input-visitor.c,  I'd like to know why the parameters of 
> scsi-hd device which are specified as uint64(says wwn) are getting 
> interpreted as signed long int's instead
>
> e.g:
> # qemu-system-x86_64 -device scsi-hd,?
> ......
> scsi-hd.wwn=uint64
> ......
>
> Does the highest bit of wwn value have special meaning and it must be 
> a zero?
>
> Thanks in advance,
> Lin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] The issue about parameters(uint64) of a device are treated as signed long int.
  2015-08-07  4:54 ` Lin Ma
@ 2015-08-07 12:09   ` Eric Blake
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Blake @ 2015-08-07 12:09 UTC (permalink / raw)
  To: lma, pbonzini@redhat.com >> Paolo Bonzini
  Cc: qemu-devel@nongnu.org Developers

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

On 08/06/2015 10:54 PM, Lin Ma wrote:
> Hi Paolo,
> 
> As mentioned in below email, The type of wwn is reported as uint64, But
> in qemu command line, The max valid value for wwn is
> 0x7fffffffffffffff. Obviously, it's treated as int64 there. I'd like to
> know that does the highest bit of  _world wide name_ have special
> meaning and must be zero? May I have your thoughts?

You can always pass a negative number to set the highest bit (that's
what libvirt does: when it is sending a uint64 value to qemu via command
line or QMP, it intentionally writes values larger than INT64_MAX by
first casting them to signed and writing the int64_t counterpart
instead). It's a shortcoming in our data parser, and not an actual
prohibition in values you can set.  And if you don't like the behavior,
patches are welcome.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-07 12:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-31  8:28 [Qemu-devel] The issue about parameters(uint64) of a device are treated as signed long int Lin Ma
2015-08-07  4:54 ` Lin Ma
2015-08-07 12:09   ` Eric Blake

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.