qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 00/16] introduce OptsVisitor, rebase -net/-netde


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 00/16] introduce OptsVisitor, rebase -net/-netdev parsing
Date: Mon, 11 Jun 2012 09:06:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Il 09/06/2012 17:30, Laszlo Ersek ha scritto:
> The net init functions all depend on integer optarg values being
> non-negative. Originally this is (or should be...) ensured by
> parse_option_number() [qemu-option.c] calling strtoull(), and "more
> recently" by opts_type_int() in this series.
> 
> i. If the opts visitor should be able to parse negative integers
> (currently not necessary for net/netdev types), then I have to change
> opts_type_int() accordingly. To restore the non-negative invariants, I
> must either reintroduce ">= 0" manual checks in the net init funcs
> (conflicts with our frugality), or constrain myself to
> uint8/uint16/uint32/uint64 field types in the json.

I think this is the best choice.  Use uint* types.

> +{ 'type': 'NetdevVdeOptions',
> +  'data': {
> +    '*sock':  'str',
> +    '*port':  'int',
> +    '*group': 'str',
> +    '*mode':  'int' } }

Lucky, both of these can be uint16 so that assignment to int is safe.

> +{ 'type': 'NetLegacy',
> +  'data': {
> +    '*vlan': 'int',
> +    'name':  'str',
> +    'opts':  'NetClientOptions' } }

Just a 32-bit token, int32 will be fine.

> +{ 'type': 'NetLegacyNicOptions',
> +  'data': {
> +    '*netdev':  'str',
> +    '*macaddr': 'str',
> +    '*model':   'str',
> +    '*addr':    'str',
> +    '*vectors': 'int' } }

Has to be tested anyway against 0x7ffffff (only six "f"s), so uint32 is
good here too.

Paolo



reply via email to

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