qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v3 04/32] blockdev: Move bochs probe into separa


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH v3 04/32] blockdev: Move bochs probe into separate file
Date: Wed, 6 Jul 2016 17:41:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 06.07.2016 16:19, Max Reitz wrote:
> On 05.07.2016 17:24, Colin Lord wrote:
>> This puts the bochs probe function into its own separate file as part of
>> the process of modularizing block drivers. Having the probe functions
>> separate from the rest of the driver allows us to probe without having
>> to potentially unnecessarily load the driver.
>>
>> Signed-off-by: Colin Lord <address@hidden>
>> ---
>>  block/Makefile.objs          |  1 +
>>  block/bochs.c                | 55 
>> ++------------------------------------------
>>  block/probe/bochs.c          | 21 +++++++++++++++++
>>  include/block/driver/bochs.h | 40 ++++++++++++++++++++++++++++++++
>>  include/block/probe.h        |  6 +++++
>>  5 files changed, 70 insertions(+), 53 deletions(-)
>>  create mode 100644 block/probe/bochs.c
>>  create mode 100644 include/block/driver/bochs.h
>>  create mode 100644 include/block/probe.h
>>
> 
> [...]
> 
>> diff --git a/block/probe/bochs.c b/block/probe/bochs.c
>> new file mode 100644
>> index 0000000..8adc09f
>> --- /dev/null
>> +++ b/block/probe/bochs.c
>> @@ -0,0 +1,21 @@
>> +#include "qemu/osdep.h"
>> +#include "block/block_int.h"
>> +#include "block/probe.h"
>> +#include "block/driver/bochs.h"
>> +
>> +int bochs_probe(const uint8_t *buf, int buf_size, const char *filename)
>> +{
>> +    const struct bochs_header *bochs = (const void *)buf;
>> +
>> +    if (buf_size < HEADER_SIZE)
>> +    return 0;
>> +
>> +    if (!strcmp(bochs->magic, HEADER_MAGIC) &&
>> +    !strcmp(bochs->type, REDOLOG_TYPE) &&
>> +    !strcmp(bochs->subtype, GROWING_TYPE) &&
>> +    ((le32_to_cpu(bochs->version) == HEADER_VERSION) ||
>> +    (le32_to_cpu(bochs->version) == HEADER_V1)))
>> +    return 100;
>> +
>> +    return 0;
>> +}
> 
> Not sure what to do about the coding style here. Some people prefer code
> movement to be pure, but I feel bad about doing code movement and then
> leaving the code wrongly formatted. That is, in my opinion, every patch
> should pass checkpatch.pl (but I won't object to a patch that doesn't
> pass checkpatch.pl simply because of pre-existing code).

I've just seen that you indeed fix this later in this series. That's
good enough for me.

Max

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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