xfs
[Top] [All Lists]

Re: [PATCH] xfs_mkfs: wipe old signatures from the device

To: Karel Zak <kzak@xxxxxxxxxx>
Subject: Re: [PATCH] xfs_mkfs: wipe old signatures from the device
From: Lukáš Czerner <lczerner@xxxxxxxxxx>
Date: Tue, 12 Feb 2013 12:58:46 +0100 (CET)
Cc: Lukas Czerner <lczerner@xxxxxxxxxx>, xfs@xxxxxxxxxxx, sandeen@xxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20130212113152.GH20408@xxxxxxxxxxx>
References: <1360667215-14701-1-git-send-email-lczerner@xxxxxxxxxx> <20130212113152.GH20408@xxxxxxxxxxx>
User-agent: Alpine 2.00 (LFD 1167 2008-08-23)
On Tue, 12 Feb 2013, Karel Zak wrote:

> Date: Tue, 12 Feb 2013 12:31:52 +0100
> From: Karel Zak <kzak@xxxxxxxxxx>
> To: Lukas Czerner <lczerner@xxxxxxxxxx>
> Cc: xfs@xxxxxxxxxxx, sandeen@xxxxxxxxxx
> 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
> 
> 

<Prev in Thread] Current Thread [Next in Thread>