summaryrefslogtreecommitdiffstats
path: root/shlibs/blkid/samples/mkfs.c
diff options
context:
space:
mode:
authorKarel Zak2009-09-29 21:46:30 +0200
committerKarel Zak2009-09-29 21:46:30 +0200
commitf38db0cfb1a78dd1a189a486d1382c7ba284b928 (patch)
treee2554f80f893d1160c3451f87a71650d3ed67cbc /shlibs/blkid/samples/mkfs.c
parentlibblkid: add support for SBMAGIC and SBMAGIC_OFFSET (diff)
downloadkernel-qcow2-util-linux-f38db0cfb1a78dd1a189a486d1382c7ba284b928.tar.gz
kernel-qcow2-util-linux-f38db0cfb1a78dd1a189a486d1382c7ba284b928.tar.xz
kernel-qcow2-util-linux-f38db0cfb1a78dd1a189a486d1382c7ba284b928.zip
libblkid: add blkid_new_probe_from_filename()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/samples/mkfs.c')
-rw-r--r--shlibs/blkid/samples/mkfs.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/shlibs/blkid/samples/mkfs.c b/shlibs/blkid/samples/mkfs.c
index 866ca6e36..eb9e27f5f 100644
--- a/shlibs/blkid/samples/mkfs.c
+++ b/shlibs/blkid/samples/mkfs.c
@@ -22,7 +22,7 @@
int main(int argc, char *argv[])
{
- int fd, rc;
+ int rc;
char *devname;
blkid_probe pr;
blkid_topology tp;
@@ -35,17 +35,10 @@ int main(int argc, char *argv[])
}
devname = argv[1];
-
- fd = open(devname, O_RDONLY);
- if (fd < 0)
- errx(EXIT_FAILURE, "%s: open() failed", devname);
-
- pr = blkid_new_probe();
+ pr = blkid_new_probe_from_filename(devname);
if (!pr)
- errx(EXIT_FAILURE, "faild to allocate a new libblkid probe");
-
- if (blkid_probe_set_device(pr, fd, 0, 0) != 0)
- errx(EXIT_FAILURE, "failed to assign device to libblkid probe");
+ err(EXIT_FAILURE, "%s: faild to create a new libblkid probe",
+ devname);
/*
* check Filesystems / Partitions overwrite