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

Jim Meyering jim at meyering.net
Mon Mar 7 15:20:19 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];
>> +
>> +	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];
>> +}

Hello Jiro,

I noticed this comment in nilf2s.c:

    /* primary superblock offset in 512bytes blocks. */
    #define NILFS_SB_OFFSET			2

That implies that we'd need a different offset for a sector size larger than 512.
Would you please update nilfs2.c so that it does not put garbage from the
stack into the two sectors (2nd and secondary) it writes?

Please use libparted/fs/ext2/interface.c's _ext2_clobber function as a model.



More information about the parted-devel mailing list