qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 05/32] blockdev: Move cloop probe to its own


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v3 05/32] blockdev: Move cloop probe to its own file
Date: Wed, 6 Jul 2016 16:33:20 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 05.07.2016 17:24, Colin Lord wrote:
> Isolates cloop probing function as part of the modularization process.
> 
> Signed-off-by: Colin Lord <address@hidden>
> ---
>  block/Makefile.objs   |  2 +-
>  block/cloop.c         | 16 +---------------
>  block/probe/cloop.c   | 17 +++++++++++++++++
>  include/block/probe.h |  1 +
>  4 files changed, 20 insertions(+), 16 deletions(-)
>  create mode 100644 block/probe/cloop.c

Reviewed-by: Max Reitz <address@hidden>

[...]

> diff --git a/block/probe/cloop.c b/block/probe/cloop.c
> new file mode 100644
> index 0000000..955c29c
> --- /dev/null
> +++ b/block/probe/cloop.c
> @@ -0,0 +1,17 @@
> +#include "qemu/osdep.h"
> +#include "block/probe.h"
> +
> +int cloop_probe(const uint8_t *buf, int buf_size, const char *filename)
> +{
> +    const char *magic_version_2_0 = "#!/bin/sh\n"
> +        "#V2.0 Format\n"
> +        "modprobe cloop file=$0 && mount -r -t iso9660 /dev/cloop $1\n";
> +    int length = strlen(magic_version_2_0);
> +    if (length > buf_size) {
> +        length = buf_size;

Pre-existing, but this seems a bit fishy to me. But, well, as long as
buf_size (BLOCK_PROBE_BUF_SIZE) will actually always be at least the
size of that string...

> +    }
> +    if (!memcmp(magic_version_2_0, buf, length)) {
> +        return 2;
> +    }
> +    return 0;
> +}

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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