patch-src_boot_c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. --- dosfstools-3.0.26.orig/src/boot.c 2014-01-17 07:06:54.000000000 +0100
  2. +++ dosfstools-3.0.26/src/boot.c 2014-05-17 08:59:02.419708114 +0200
  3. @@ -155,7 +155,7 @@ static void check_backup_boot(DOS_FS * f
  4. fs->backupboot_start = bbs * lss;
  5. b->backup_boot = htole16(bbs);
  6. fs_write(fs->backupboot_start, sizeof(*b), b);
  7. - fs_write((loff_t) offsetof(struct boot_sector, backup_boot),
  8. + fs_write((off_t) offsetof(struct boot_sector, backup_boot),
  9. sizeof(b->backup_boot), &b->backup_boot);
  10. printf("Created backup of boot sector in sector %d\n", bbs);
  11. return;
  12. @@ -233,9 +233,9 @@ static void read_fsinfo(DOS_FS * fs, str
  13. break;
  14. if (s > 0 && s < le16toh(b->reserved)) {
  15. init_fsinfo(&i);
  16. - fs_write((loff_t) s * lss, sizeof(i), &i);
  17. + fs_write((off_t) s * lss, sizeof(i), &i);
  18. b->info_sector = htole16(s);
  19. - fs_write((loff_t) offsetof(struct boot_sector, info_sector),
  20. + fs_write((off_t) offsetof(struct boot_sector, info_sector),
  21. sizeof(b->info_sector), &b->info_sector);
  22. if (fs->backupboot_start)
  23. fs_write(fs->backupboot_start +
  24. @@ -327,7 +327,7 @@ void read_boot(DOS_FS * fs)
  25. unsigned total_sectors;
  26. unsigned short logical_sector_size, sectors;
  27. unsigned fat_length;
  28. - loff_t data_size;
  29. + off_t data_size;
  30. fs_read(0, sizeof(b), &b);
  31. logical_sector_size = GET_UNALIGNED_W(b.sector_size);
  32. @@ -352,18 +352,18 @@ void read_boot(DOS_FS * fs)
  33. if (verbose)
  34. printf("Checking we can access the last sector of the filesystem\n");
  35. /* Can't access last odd sector anyway, so round down */
  36. - fs_test((loff_t) ((total_sectors & ~1) - 1) * (loff_t) logical_sector_size,
  37. + fs_test((off_t) ((total_sectors & ~1) - 1) * (off_t) logical_sector_size,
  38. logical_sector_size);
  39. fat_length = le16toh(b.fat_length) ?
  40. le16toh(b.fat_length) : le32toh(b.fat32_length);
  41. - fs->fat_start = (loff_t) le16toh(b.reserved) * logical_sector_size;
  42. - fs->root_start = ((loff_t) le16toh(b.reserved) + b.fats * fat_length) *
  43. + fs->fat_start = (off_t) le16toh(b.reserved) * logical_sector_size;
  44. + fs->root_start = ((off_t) le16toh(b.reserved) + b.fats * fat_length) *
  45. logical_sector_size;
  46. fs->root_entries = GET_UNALIGNED_W(b.dir_entries);
  47. fs->data_start = fs->root_start + ROUND_TO_MULTIPLE(fs->root_entries <<
  48. MSDOS_DIR_BITS,
  49. logical_sector_size);
  50. - data_size = (loff_t) total_sectors *logical_sector_size - fs->data_start;
  51. + data_size = (off_t) total_sectors *logical_sector_size - fs->data_start;
  52. fs->clusters = data_size / fs->cluster_size;
  53. fs->root_cluster = 0; /* indicates standard, pre-FAT32 root dir */
  54. fs->fsinfo_start = 0; /* no FSINFO structure */
  55. @@ -491,10 +491,10 @@ static void write_boot_label(DOS_FS * fs
  56. }
  57. }
  58. -loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de)
  59. +off_t find_volume_de(DOS_FS * fs, DIR_ENT * de)
  60. {
  61. uint32_t cluster;
  62. - loff_t offset;
  63. + off_t offset;
  64. int i;
  65. if (fs->root_cluster) {
  66. @@ -525,7 +525,7 @@ static void write_volume_label(DOS_FS *
  67. {
  68. time_t now = time(NULL);
  69. struct tm *mtime = localtime(&now);
  70. - loff_t offset;
  71. + off_t offset;
  72. int created;
  73. DIR_ENT de;