X-Git-Url: https://git.sven.stormbind.net/?p=sven%2Fexfatprogs.git;a=blobdiff_plain;f=dump%2Fdump.c;fp=dump%2Fdump.c;h=7ede5508cf8dd839b258951c0862281f5d46a83a;hp=85d5101f40e8653d193d32e4304390aa5902c9f5;hb=21a474abad45d108a72be1dc0cf5e509652ff09f;hpb=f815d23a8085371d4487dc8e1cfa2731b78cbeec diff --git a/dump/dump.c b/dump/dump.c index 85d5101..7ede550 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -76,15 +76,15 @@ static int exfat_show_ondisk_all_info(struct exfat_blk_dev *bd) unsigned char *bitmap; char *volume_label; - ppbr = malloc(bd->sector_size); + ppbr = malloc(EXFAT_MAX_SECTOR_SIZE); if (!ppbr) { exfat_err("Cannot allocate pbr: out of memory\n"); return -ENOMEM; } /* read main boot sector */ - ret = exfat_read_sector(bd, (char *)ppbr, BOOT_SEC_IDX); - if (ret < 0) { + if (exfat_read(bd->dev_fd, (char *)ppbr, EXFAT_MAX_SECTOR_SIZE, + 0) != (ssize_t)EXFAT_MAX_SECTOR_SIZE) { exfat_err("main boot sector read failed\n"); ret = -EIO; goto free_ppbr; @@ -107,12 +107,8 @@ static int exfat_show_ondisk_all_info(struct exfat_blk_dev *bd) goto free_ppbr; } - if (bd->sector_size != 1 << pbsx->sect_size_bits) { - exfat_err("bogus sector size : %u (sector size bits : %u)\n", - bd->sector_size, pbsx->sect_size_bits); - ret = -EINVAL; - goto free_ppbr; - } + bd->sector_size_bits = pbsx->sect_size_bits; + bd->sector_size = 1 << pbsx->sect_size_bits; clu_offset = le32_to_cpu(pbsx->clu_offset); total_clus = le32_to_cpu(pbsx->clu_count);