From: Karel Zak <kzak@redhat.com>
To: Lukas Czerner <lczerner@redhat.com>
Cc: sandeen@redhat.com, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs_mkfs: wipe old signatures from the device
Date: Tue, 12 Feb 2013 12:31:52 +0100 [thread overview]
Message-ID: <20130212113152.GH20408@x2.net.home> (raw)
In-Reply-To: <1360667215-14701-1-git-send-email-lczerner@redhat.com>
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@redhat.com>
http://karelzak.blogspot.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2013-02-12 11:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-12 11:06 [PATCH] xfs_mkfs: wipe old signatures from the device Lukas Czerner
2013-02-12 11:31 ` Karel Zak [this message]
2013-02-12 11:58 ` Lukáš Czerner
2013-02-12 20:27 ` Dave Chinner
2013-02-13 8:01 ` Karel Zak
2013-02-13 10:41 ` Lukáš Czerner
2013-02-13 12:16 ` Karel Zak
2013-02-13 22:17 ` Dave Chinner
2013-02-14 7:29 ` Chris Murphy
2013-02-14 8:36 ` Lukáš Czerner
2013-02-14 11:04 ` Dave Chinner
2013-02-14 12:28 ` Lukáš Czerner
2013-02-14 14:48 ` Martin Steigerwald
2013-02-14 18:35 ` Eric Sandeen
2013-02-14 14:54 ` Hugo Mills
2013-02-14 17:25 ` Eric Sandeen
2013-02-14 19:08 ` Chris Murphy
2013-02-14 11:45 ` Dave Howorth
2013-02-14 19:17 ` Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130212113152.GH20408@x2.net.home \
--to=kzak@redhat.com \
--cc=lczerner@redhat.com \
--cc=sandeen@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox