bug-parted
[Top][All Lists]
Advanced

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

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


From: Håkon Løvdal
Subject: bug#15356: [PATCH 16/19] libparted: Recognize btrfs filesystem
Date: Sun, 24 Nov 2013 20:48:46 +0100

On 11 September 2013 21:25, Brian C. Lane <address@hidden> wrote:
> From: "Brian C. Lane" <address@hidden>
> +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





reply via email to

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