From ab347a1433d5852544a3b8dfb2326a0dfab6538e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 29 Sep 2009 21:58:52 +0200 Subject: libblkid: use blkid_new_probe_from_filename() in docs Signed-off-by: Karel Zak --- shlibs/blkid/src/partitions/partitions.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'shlibs/blkid/src/partitions') diff --git a/shlibs/blkid/src/partitions/partitions.c b/shlibs/blkid/src/partitions/partitions.c index c1c39164c..aa70df638 100644 --- a/shlibs/blkid/src/partitions/partitions.c +++ b/shlibs/blkid/src/partitions/partitions.c @@ -38,12 +38,11 @@ * * * blkid_probe pr; - * int fd; * const char *ptname; * - * fd = open(devname, O_RDONLY); - * pr = blkid_new_probe(); - * blkid_probe_set_device(pr, fd, 0, 0); + * pr = blkid_new_probe_from_filename(devname); + * if (!pr) + * err("%s: faild to open device", devname); * * blkid_probe_enable_partitions(pr, TRUE); * blkid_do_fullprobe(pr); @@ -52,7 +51,6 @@ * printf("%s partition type detected\n", pttype); * * blkid_free_probe(pr); - * close(fd); * * // don't forget to check return codes in your code! * @@ -65,11 +63,10 @@ * blkid_probe pr; * blkid_partlist ls; * int nparts, i; - * int fd; * - * fd = open(devname, O_RDONLY); - * pr = blkid_new_probe(); - * blkid_probe_set_device(pr, fd, 0, 0); + * pr = blkid_new_probe_from_filename(devname); + * if (!pr) + * err("%s: faild to open device", devname); * * ls = blkid_probe_get_partitions(pr); * nparts = blkid_partlist_numof_partitions(ls); @@ -84,7 +81,6 @@ * } * * blkid_free_probe(pr); - * close(fd); * * // don't forget to check return codes in your code! * -- cgit v1.2.3-55-g7522