openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/libblkid/src/probe.c
int blkid_do_safeprobe(blkid_probe pr)
{
    int i, count = 0, rc = 0;

    if (pr->flags & BLKID_FL_NOSCAN_DEV)
        return 1;

    blkid_probe_start(pr);

    for (i = 0; i < BLKID_NCHAINS; i++)
    {
        struct blkid_chain* chn;

        chn = pr->cur_chain = &pr->chains[i];
        chn->binary = FALSE; /* for sure... */

        DBG(LOWPROBE, ul_debug("chain safeprobe %s %s", chn->driver->name,
                               chn->enabled ? "ENABLED" : "DISABLED"));

        if (!chn->enabled)
            continue;

        blkid_probe_chain_reset_position(chn);

        rc = chn->driver->safeprobe(pr, chn);

        blkid_probe_chain_reset_position(chn);

        /* rc: -2 ambivalent, -1 = error, 0 = success, 1 = no result */
        if (rc < 0)
            goto done; /* error */
        if (rc == 0)
            count++; /* success */
    }

done:
    blkid_probe_end(pr);
    if (rc < 0)
        return rc;
    return count ? 0 : 1;
}
/**
 * blkid_do_safeprobe:
 * @pr: prober
 *
 * This function gathers probing results from all enabled chains and checks
 * for ambivalent results (e.g. more filesystems on the device).
 *
 * This is string-based NAME=value interface only.
 *
 * Note about superblocks chain -- the function does not check for filesystems
 * when a RAID signature is detected.  The function also does not check for
 * collision between RAIDs. The first detected RAID is returned. The function
 * checks for collision between partition table and RAID signature -- it's
 * recommended to enable partitions chain together with superblocks chain.
 *
 * Returns: 0 on success, 1 if nothing is detected, -2 if ambivalent result is
 * detected and -1 on case of error.
 */
@pr: prober

This function gathers probing results from all enabled chains and checks
for ambivalent results .

This is string-based NAME=value interface only.

Note about superblocks chain -- the function does not check for filesystems
when a RAID signature is detected.  The function also does not check for
collision between RAIDs. The first detected RAID is returned. The function
checks for collision between partition table and RAID signature -- it's
recommended to enable partitions chain together with superblocks chain.

0 on success, 1 if nothing is detected, -2 if ambivalent result is
detected and -1 on case of error.
@pr : prober This function gathers probing results from all enabled chains and checks for ambivalent results . This is string - based NAME = value interface only . Note about superblocks chain -- the function does not check for filesystems when a RAID signature is detected . The function also does not check for collision between RAIDs . The first detected RAID is returned . The function checks for collision between partition table and RAID signature -- it ' s recommended to enable partitions chain together with superblocks chain . 0 on success 1 if nothing is detected - 2 if ambivalent result is detected and - 1 on case of error .
int blkid_do_safeprobe(blkid_probe pr)
{
    int i, count = 0, rc = 0;
    if (pr->flags & BLKID_FL_NOSCAN_DEV)
        return 1;
    blkid_probe_start(pr);
    for (i = 0; i < BLKID_NCHAINS; i++)
    {
        struct blkid_chain* chn;
        chn = pr->cur_chain = &pr->chains[i];
        chn->binary = FALSE; 
        DBG(LOWPROBE, ul_debug("chain safeprobe %s %s", chn->driver->name,
                               chn->enabled ? "ENABLED" : "DISABLED"));
        if (!chn->enabled)
            continue;
        blkid_probe_chain_reset_position(chn);
        rc = chn->driver->safeprobe(pr, chn);
        blkid_probe_chain_reset_position(chn);
        if (rc < 0)
            goto done; 
        if (rc == 0)
            count++; 
    }
done:
    blkid_probe_end(pr);
    if (rc < 0)
        return rc;
    return count ? 0 : 1;
}
int blkid_do_safeprobe ( blkid_probe pr ) { int i , count = 0 , rc = 0 ; if ( pr -> flags & BLKID_FL_NOSCAN_DEV ) return 1 ; blkid_probe_start ( pr ) ; for ( i = 0 ; i < BLKID_NCHAINS ; i ++ ) { struct blkid_chain * chn ; chn = pr -> cur_chain = & pr -> chains [ i ] ; chn -> binary = FALSE ; DBG ( LOWPROBE , ul_debug ( " " , chn -> driver -> name , chn -> enabled ? " " : " " ) ) ; if ( ! chn -> enabled ) continue ; blkid_probe_chain_reset_position ( chn ) ; rc = chn -> driver -> safeprobe ( pr , chn ) ; blkid_probe_chain_reset_position ( chn ) ; if ( rc < 0 ) goto done ; if ( rc == 0 ) count ++ ; } done : blkid_probe_end ( pr ) ; if ( rc < 0 ) return rc ; return count ? 0 : 1 ; }
blkid_do_safeprobe:
 @pr: prober
blkid_do_safeprobe : @pr : prober
/* for sure... */ /* rc: -2 ambivalent, -1 = error, 0 = success, 1 = no result */ /* error */ /* success */