- if (base != le32_to_cpu(sb.fat_sector_start) * SECTOR_SIZE(sb))
- exfat_bug("unexpected FAT location: %"PRIu64" (expected %u)",
- base, le32_to_cpu(sb.fat_sector_start) * SECTOR_SIZE(sb));
-
- if (!(c = fat_write_entry(c, 0xfffffff8, fd))) /* media type */
- return errno;
- if (!(c = fat_write_entry(c, 0xffffffff, fd))) /* some weird constant */
- return errno;
- if (!(c = fat_write_entries(c, cbm_size(), fd)))
- return errno;
- if (!(c = fat_write_entries(c, uct_size(), fd)))
- return errno;
- if (!(c = fat_write_entries(c, rootdir_size(), fd)))
- return errno;
+ if (!(c = fat_write_entry(dev, c, 0xfffffff8))) /* media type */
+ return 1;
+ if (!(c = fat_write_entry(dev, c, 0xffffffff))) /* some weird constant */
+ return 1;
+ if (!(c = fat_write_entries(dev, c, cbm.get_size())))
+ return 1;
+ if (!(c = fat_write_entries(dev, c, uct.get_size())))
+ return 1;
+ if (!(c = fat_write_entries(dev, c, rootdir.get_size())))
+ return 1;