qemu-ppc
[Top][All Lists]
Advanced

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

RE: [PATCH 3/5] hw/core/loader: Provide rom_add_file() a 'max_size' argu


From: Taylor Simpson
Subject: RE: [PATCH 3/5] hw/core/loader: Provide rom_add_file() a 'max_size' argument
Date: Mon, 9 Mar 2020 17:44:45 +0000


> -----Original Message-----
> From: Qemu-devel <qemu-devel-
> bounces+tsimpson=address@hidden> On Behalf Of Philippe
> Mathieu-Daudé
> Sent: Monday, March 9, 2020 9:44 AM
> To: address@hidden
> Cc: Eduardo Habkost <address@hidden>; Michael S. Tsirkin
> <address@hidden>; Alistair Francis <address@hidden>; Mark Cave-
> Ayland <address@hidden>; address@hidden; Gerd
> Hoffmann <address@hidden>; Paolo Bonzini <address@hidden>;
> David Gibson <address@hidden>; Philippe Mathieu-Daudé
> <address@hidden>; Artyom Tarasenko <address@hidden>;
> Richard Henderson <address@hidden>
> Subject: [PATCH 3/5] hw/core/loader: Provide rom_add_file() a 'max_size'
> argument
>
>
> -#define rom_add_file_fixed(_f, _a, _i)          \
> -    rom_add_file(_f, NULL, _a, _i, false, NULL, NULL)
> +#define rom_add_file_fixed(_f, _a, _i) \
> +    rom_add_file(_f, NULL, _a, -1, _i, false, NULL, NULL)
>  #define rom_add_blob_fixed(_f, _b, _l, _a)      \
>      rom_add_blob(_f, _b, _l, _l, _a, NULL, NULL, NULL, NULL, true)
>  #define rom_add_file_mr(_f, _mr, _i)            \
> -    rom_add_file(_f, NULL, 0, _i, false, _mr, NULL)
> +    rom_add_file(_f, NULL, 0, -1, _i, false, _mr, NULL)
>  #define rom_add_file_as(_f, _as, _i)            \
> -    rom_add_file(_f, NULL, 0, _i, false, NULL, _as)
> +    rom_add_file(_f, NULL, 0, -1, _i, false, NULL, _as)
>  #define rom_add_file_fixed_as(_f, _a, _i, _as)          \
> -    rom_add_file(_f, NULL, _a, _i, false, NULL, _as)
> +    rom_add_file(_f, NULL, _a, -1, _i, false, NULL, _as)
>  #define rom_add_blob_fixed_as(_f, _b, _l, _a, _as)      \
>      rom_add_blob(_f, _b, _l, _l, _a, NULL, NULL, NULL, _as, true)

The above looks like -1 represents an unknown max_len.

> +    rom->romsize = max_len ? max_len : rom->datasize;

So, shouldn't this check max_len == -1?  In general, wouldn't it be better to 
#define UNKNOWN_MAX_LEN to make it more clear what the value is used for?

reply via email to

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