[parted-devel] [PATCH] libparted: add nilfs2 module

Jim Meyering jim at meyering.net
Mon Mar 7 15:10:07 UTC 2011


Petr Uzel wrote:
> On Sat, Mar 05, 2011 at 07:50:04PM +0100, Jim Meyering wrote:
>> Jiro SEKIBA wrote:
>>
>> > Hi,
>> >
>> > This is a new fs module to provide following:
>> > - probe nilfs2 filesystem partition
>> > - clobber nilfs2 filesystem partition
>> >
>
> .... snip ....
>
>> +
>> +#ifndef DISCOVER_ONLY
>> +static int
>> +nilfs2_clobber (PedGeometry* geom)
>> +{
>> +	char buf[512];
>> +	int ret[2];
>> +
>> +	printf("nilfs2_clobber\n");
>
> This looks like a leftover after debugging...

Thank you for catching that.
I obviously did not review this code.

An even more serious problem: hard-coded 512-byte buffer.
That would fail for sector-size != 512.

>> +	memset (buf, 0, 512);
>> +
>> +	ret[0] = ped_geometry_write (geom, buf, NILFS_SB_OFFSET, 1);
>> +	ret[1] = ped_geometry_write (geom, buf,
>> +				     NILFS_SB2_OFFSET(geom->length), 1);
>> +
>> +	return ret[0]|ret[1];
>> +}
>> +#endif /* !DISCOVER_ONLY */
>> +
>> +static PedFileSystemOps nilfs2_ops = {
>> +	probe:			nilfs2_probe,
>> +#ifndef DISCOVER_ONLY
>> + #if 0
>> +	clobber:		nilfs2_clobber,
>> + #else
>> +	clobber:		NULL,
>> + #endif
>
> Dtto. And this causes parted not to compile with -Wall (as -Werror
> added by default):
>
> libtool: compile: gcc -std=gnu99 -I. -I../../../lib -I../../../include
> -ggdb -O0 -Wall -Werror -MT nilfs2.lo -MD -MP -MF .deps/nilfs2.Tpo -c
> nilfs2.c -o nilfs2.o
> cc1: warnings being treated as errors
> nilfs2.c:142:1: error: 'nilfs2_clobber' defined but not used
> make[4]: *** [nilfs2.lo] Error 1

That highlights the fact that the usual CFLAGS_WARN options
were not in effect for that subdirectory.

I've begun fixing things:



More information about the parted-devel mailing list