diff options
author | Karel Zak | 2009-09-15 22:43:58 +0200 |
---|---|---|
committer | Karel Zak | 2009-09-16 10:57:23 +0200 |
commit | 4d72b3371845f8ab9775dd84bee0d174ac6334b7 (patch) | |
tree | 32277b726eb4170a1727a139cf03d07b9999385f /shlibs/blkid/src/probe.c | |
parent | libblkid: use chains in blkid_do_{safe,full,}_probe() (diff) | |
download | kernel-qcow2-util-linux-4d72b3371845f8ab9775dd84bee0d174ac6334b7.tar.gz kernel-qcow2-util-linux-4d72b3371845f8ab9775dd84bee0d174ac6334b7.tar.xz kernel-qcow2-util-linux-4d72b3371845f8ab9775dd84bee0d174ac6334b7.zip |
libblkid: add missing comments to probe.c
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs/blkid/src/probe.c')
-rw-r--r-- | shlibs/blkid/src/probe.c | 82 |
1 files changed, 73 insertions, 9 deletions
diff --git a/shlibs/blkid/src/probe.c b/shlibs/blkid/src/probe.c index 2be42fc2c..a68881db2 100644 --- a/shlibs/blkid/src/probe.c +++ b/shlibs/blkid/src/probe.c @@ -1,12 +1,70 @@ /* - * probe.c - reads tags (LABEL, UUID, FS type, ..) from a block device + * Low-level libblkid probing API * - * Copyright (C) 2008 Karel Zak <kzak@redhat.com> + * Copyright (C) 2008-2009 Karel Zak <kzak@redhat.com> * * This file may be redistributed under the terms of the * GNU Lesser General Public License. */ +/** + * SECTION: lowprobe + * @title: Low-level probing + * @short_description: low-level prober initialization + * + * The low-level probing routines always and directly read information from + * the selected (see blkid_probe_set_device()) device. + * + * The probing routines are grouped together into separate chains. Currently, + * the librray provides superblocks, partitions and topology chains. + * + * The probing routines is possible to filter (enable/disable) by type (e.g. + * fstype "vfat" or partype "gpt") or by usage flags (e.g. BLKID_USAGE_RAID). + * These filters are per-chain. For more details see the chain specific + * documenation. + * + * The low-level API provides two ways how access to probing results. + * + * 1. The NAME=value (tag) interface. This interface is older and returns all data + * as strings. This interface is generic for all chains. + * + * 2. The binary interfaces. These interfaces return data in the native formats. + * The interface is always specific to the probing chain. + */ + +/** + * SECTION: lowprobe-tags + * @title: Low-level tags + * @short_description: generic NAME=value interface. + * + * The probing routines inside the chain are mutually exclusive by default -- + * only few probing routines are marked as "tolerant". The "tolerant" probing + * routines are used for filesystem which can share the same device with any + * other filesystem. The blkid_do_safeprobe() checks for the "tolerant" flag. + * + * The SUPERBLOCKS chain is enabled by default. The all others chains is + * necessary to enable by blkid_probe_enable_'CHAINNAME'(). See chains specific + * documenation. + * + * The blkid_do_probe() function returns a result from only one probing + * routine, and the next call from the next probing routine. It means you need + * to call the function in loop, for example: + * + * <informalexample> + * <programlisting> + * while((blkid_do_probe(pr) == 0) + * ... use result ... + * </programlisting> + * </informalexample> + * + * The blkid_do_safeprobe() is the same as blkid_do_probe(), but returns only + * first probing result for every enabled chain. This function checks for + * ambivalent results (e.g. more "intolerant" filesystems superblocks on the + * device). + * + * The probing result is set of NAME=value pairs (the NAME is always unique). + */ + #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -629,13 +687,6 @@ done: return count ? 0 : 1; } -int blkid_probe_numof_values(blkid_probe pr) -{ - if (!pr) - return -1; - return pr->nvals; -} - struct blkid_prval *blkid_probe_assign_value( blkid_probe pr, const char *name) { @@ -694,6 +745,19 @@ int blkid_probe_vsprintf_value(blkid_probe pr, const char *name, } /** + * blkid_probe_numof_values: + * @pr: probe + * + * Returns: number of values in probing result or -1 in case of error. + */ +int blkid_probe_numof_values(blkid_probe pr) +{ + if (!pr) + return -1; + return pr->nvals; +} + +/** * blkid_probe_get_value: * @pr: probe * @num: wanted value in range 0..N, where N is blkid_probe_numof_values() - 1 |