Skip to contentSkip to conversation

The issue about parameters(uint64) of a device are treated as signed long int.

Qemu-devel Lin Ma 2 participants 3 messages Jul 31, 2015 – Aug 7, 2015

lore
Share & tools
lore

Lin Ma

author
#0 lore raw

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

author
#1 lore raw

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

Quoted 14 lines · 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

#2 lore raw
Quoted 7 lines · Lin Ma

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.

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