}
}
-static bool verify_vbr_checksum(struct exfat_dev* dev, void* sector,
- off_t sector_size)
+static bool verify_vbr_checksum(const struct exfat* ef, void* sector)
{
+ off_t sector_size = SECTOR_SIZE(*ef->sb);
uint32_t vbr_checksum;
int i;
- if (exfat_pread(dev, sector, sector_size, 0) < 0)
+ if (exfat_pread(ef->dev, sector, sector_size, 0) < 0)
{
exfat_error("failed to read boot sector");
return false;
vbr_checksum = exfat_vbr_start_checksum(sector, sector_size);
for (i = 1; i < 11; i++)
{
- if (exfat_pread(dev, sector, sector_size, i * sector_size) < 0)
+ if (exfat_pread(ef->dev, sector, sector_size, i * sector_size) < 0)
{
exfat_error("failed to read VBR sector");
return false;
vbr_checksum = exfat_vbr_add_checksum(sector, sector_size,
vbr_checksum);
}
- if (exfat_pread(dev, sector, sector_size, i * sector_size) < 0)
+ if (exfat_pread(ef->dev, sector, sector_size, i * sector_size) < 0)
{
exfat_error("failed to read VBR checksum sector");
return false;
return -ENOMEM;
}
/* use zero_cluster as a temporary buffer for VBR checksum verification */
- if (!verify_vbr_checksum(ef->dev, ef->zero_cluster, SECTOR_SIZE(*ef->sb)))
+ if (!verify_vbr_checksum(ef, ef->zero_cluster))
{
exfat_free(ef);
return -EIO;