Subject: bug#15356: [PATCH 16/19] libparted: Recognize btrfs filesystem

From: Håkon Løvdal <[email-masked]>
Date: Sun, 24 Nov 2013 20:48:46 +0100

On 11 September 2013 21:25, Brian C. Lane <[email-masked]> wrote:
> From: "Brian C. Lane" <[email-masked]>
> +static PedGeometry*
> +btrfs_probe (PedGeometry* geom)
> +{
...
> +        if (geom->length < offset+1)
> +                return 0;
> +        if (!ped_geometry_read (geom, &buf, offset, 1))
> +                return 0;
Should not these be NULL rather than 0?

> +
> +        if (PED_LE64_TO_CPU(buf.sb.magic) == BTRFS_MAGIC) {
> +                return ped_geometry_new (geom->dev, geom->start, geom->length);
> +        }
> +        return NULL;
> +}

When already providing feedback on this code, I will also ask if this
test can be reversed,
so that the conceptual flow is

        if (some_error_condition) {
                handle_error
        }
        normal_code

e.g. "test exceptions, not the normal case"

BR Håkon Løvdal