Hi,
if (be32_to_cpu(capdata.sectors) == 0xFFFFFFFFUL) {
dprintf(1, "%s: >2TB Detected trying READCAP(16)\n", s);
struct cdbres_read_capacity_16 capdata16;
ret = cdb_read_capacity16(&dop, &capdata16);
drive->blksize = be32_to_cpu(capdata16.blksize);
if (drive->blksize != DISK_SECTOR_SIZE) {
dprintf(1, "%s: unsupported block size %d\n", s, drive->blksize);
return -1;
}
drive->sectors = be64_to_cpu(capdata16.sectors);
dprintf(1, "READCAP(16) %s blksize=%d sectors=%llX\n"
, s, drive->blksize, drive->sectors);
} else {
drive->blksize = be32_to_cpu(capdata.blksize);
if (drive->blksize != DISK_SECTOR_SIZE) {
dprintf(1, "%s: unsupported block size %d\n", s, drive->blksize);
return -1;
}
drive->sectors = (u64)be32_to_cpu(capdata.sectors) + 1;
dprintf(1, "%s blksize=%d sectors=%u\n"
, s, drive->blksize, (unsigned)drive->sectors);
}
The blksize check and the capacity logging can be moved out of the if block so it is not duplicated.
take care, Gerd