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