[parted-devel] [PATCH] detect device map type

Jim Meyering jim at meyering.net
Fri Jun 6 08:59:45 UTC 2008


Guido Günther <agx at sigxcpu.org> wrote:
> On Fri, Jun 06, 2008 at 09:00:14AM +0200, Jim Meyering wrote:
>> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
>> index 67b8fb6..04107d8 100644
>> --- a/libparted/arch/linux.c
>> +++ b/libparted/arch/linux.c
>> @@ -1158,6 +1158,7 @@ linux_new (const char* path)
>>          if (!dev)
>>                  goto error;
>> 
>> +        dev->dmtype = NULL;
>>          dev->path = strdup (path);
>>          if (!dev->path)
>>                  goto error_free_dev;
> That's fine but it needs a #ifdef ENABLE_DEVICE_MAPPER too.

Good point.
But I'll probably leave it as is and instead eliminate
the struct member #ifdef.  Fewer ifdefs is always better.

> I was under
> the impression that the whole PedDevice* struct would be initialized to
> zero - maybe that changed or I was just lucky it eneded up being zero in
> my tests. Thanks for fixing that.

You were lucky ;-)
I noticed the failure right away because I set MALLOC_PERTURB_ to a nonzero
value in my environment.  Otherwise, I would have seen it the next time
I ran the tests via valgrind.

> While looking at the code I wonder if we should move the whole dmtype
> into LinuxSpecific (since it is)? Let me know and I post a patch.

Good idea, but best to wait until after I push,
since otherwise our changes will surely conflict.
I'm including below the changes I expect to push today,
(this includes yours) though a few of my smaller c-sets are
probably going to be reordered and squashed.

> [..snip..]
>> I'm copying more of the lvm-related testing framework, so it will
>> be easier to keep things in sync.  Did those lvm-specific functions
>> cause trouble?
> No they didn't - they just thought they weren't needed. So I removed
> them, it makes sense to keep them if we intend to keep the file in sync
> with lvm.

Good.




More information about the parted-devel mailing list