[PATCH] xfs_mkfs: wipe old signatures from the device

Lukáš Czerner lczerner at redhat.com
Tue Feb 12 05:58:46 CST 2013


On Tue, 12 Feb 2013, Karel Zak wrote:

> Date: Tue, 12 Feb 2013 12:31:52 +0100
> From: Karel Zak <kzak at redhat.com>
> To: Lukas Czerner <lczerner at redhat.com>
> Cc: xfs at oss.sgi.com, sandeen at redhat.com
> Subject: Re: [PATCH] xfs_mkfs: wipe old signatures from the device
> 
> On Tue, Feb 12, 2013 at 12:06:55PM +0100, Lukas Czerner wrote:
> > +wipe_signatures(
> > +	char		*device,
> > +	int		dryrun)
> > +{
> > +	blkid_probe	pr = NULL;
> > +	int		ret = 0;
> > +	int		fd;
> > +
> > +	pr = blkid_new_probe_from_filename(device);
> > +	if (!pr)
> > +		goto out;
> > +
> > +	fd = open(device, O_RDWR|O_CLOEXEC);
> > +	if (fd < 0) {
> > +		ret = -1;
> > +		goto out;
> > +	}
> > +	ret = blkid_probe_set_device(pr, fd, 0, 0);
> 
>  This does not make sense. The blkid_new_probe_from_filename() also
>  opens (read-only) the device ;-)

Good to know thanks!

-Lukas

> 
>  You need:
> 
>    pr = blkid_new_probe();
>    if (!pr)
>       goto out;
> 
>    fd = open(device, O_RDWR|O_CLOEXEC);
>    if (fd < 0) {
> 		ret = -1;
> 		goto out;
>    }
>    ret = blkid_probe_set_device(pr, fd, 0, 0);
> 
> 
>  Maybe you also need something like
>  
>    AC_CHECK_LIB(blkid, blkid_do_wipe, [have_blkidwipe=yes], [have_blkidwipe=no])
> 
>  or so, because old libblkid versions does not contain wipe stuff. See also
>  m4/package_blkid.m4 in xfsprogs where is already check for blkid topology
>  stuff.
> 
> 
>  Karel
> 
> 



More information about the xfs mailing list