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
static void cdrom_size_correction(blkid_probe pr)
{
    uint64_t n, nsectors = pr->size >> 9;

    for (n = nsectors - 12; n < nsectors; n++)
    {
        if (!is_sector_readable(pr->fd, n))
            goto failed;
    }

    DBG(LOWPROBE, ul_debug("CDROM: full size available"));
    return;
failed:
    /* 'n' is the failed sector, reduce device size to n-1; */
    DBG(LOWPROBE, ul_debug("CDROM: reduce size from %ju to %ju.",
                           (uintmax_t)pr->size, (uintmax_t)n << 9));
    pr->size = n << 9;
}
/*
 * Linux kernel reports (BLKGETSIZE) cdrom device size greater than area
 * readable by read(2). We have to reduce the probing area to avoid unwanted
 * I/O errors in probing functions. It seems that unreadable are always last 2
 * or 3 CD blocks (CD block size is 2048 bytes, it means 12 in 512-byte
 * sectors).
 */
Linux kernel reports (BLKGETSIZE) cdrom device size greater than area
readable by read(2). We have to reduce the probing area to avoid unwanted
I/O errors in probing functions. It seems that unreadable are always last 2
or 3 CD blocks (CD block size is 2048 bytes, it means 12 in 512-byte
sectors).
Linux kernel reports ( BLKGETSIZE ) cdrom device size greater than area readable by read ( 2 ) . We have to reduce the probing area to avoid unwanted I / O errors in probing functions . It seems that unreadable are always last 2 or 3 CD blocks ( CD block size is 2048 bytes it means 12 in 512 - byte sectors ) .
static void cdrom_size_correction(blkid_probe pr)
{
    uint64_t n, nsectors = pr->size >> 9;
    for (n = nsectors - 12; n < nsectors; n++)
    {
        if (!is_sector_readable(pr->fd, n))
            goto failed;
    }
    DBG(LOWPROBE, ul_debug("CDROM: full size available"));
    return;
failed:
    DBG(LOWPROBE, ul_debug("CDROM: reduce size from %ju to %ju.",
                           (uintmax_t)pr->size, (uintmax_t)n << 9));
    pr->size = n << 9;
}
static void cdrom_size_correction ( blkid_probe pr ) { uint64_t n , nsectors = pr -> size >> 9 ; for ( n = nsectors - 12 ; n < nsectors ; n ++ ) { if ( ! is_sector_readable ( pr -> fd , n ) ) goto failed ; } DBG ( LOWPROBE , ul_debug ( " " ) ) ; return ; failed : DBG ( LOWPROBE , ul_debug ( " " , ( uintmax_t ) pr -> size , ( uintmax_t ) n << 9 ) ) ; pr -> size = n << 9 ; }
Linux kernel reports (BLKGETSIZE) cdrom device size greater than area
 readable by read(2).
Linux kernel reports ( BLKGETSIZE ) cdrom device size greater than area readable by read ( 2 ) .
/* 'n' is the failed sector, reduce device size to n-1; */