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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ;-)

 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

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs


[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux