From 51eaf50af9034eef5dd054415811e122bf66073e Mon Sep 17 00:00:00 2001 From: JinWang An Date: Mon, 26 Dec 2022 13:14:06 +0900 Subject: [PATCH] Imported Upstream version 3.0.25 --- ChangeLog | 42 ++++++++++++++++++++++-- Makefile | 2 +- VERSION | 2 +- manpages/Makefile | 2 +- manpages/bin/update-version.sh | 10 +++--- manpages/de/fatlabel.de.8 | 4 +-- manpages/de/fsck.fat.de.8 | 4 +-- manpages/de/mkfs.fat.de.8 | 4 +-- manpages/en/fatlabel.8 | 4 +-- manpages/en/fsck.fat.8 | 4 +-- manpages/en/mkfs.fat.8 | 4 +-- manpages/po/de/fatlabel.8.po | 9 ++---- manpages/po/de/fsck.fat.8.po | 9 ++---- manpages/po/de/mkfs.fat.8.po | 9 ++---- manpages/pot/fatlabel.8.pot | 6 ++-- manpages/pot/fsck.fat.8.pot | 6 ++-- manpages/pot/mkfs.fat.8.pot | 6 ++-- src/boot.c | 12 +++---- src/boot.h | 2 +- src/check.c | 56 ++++++++++++++++---------------- src/check.h | 2 +- src/common.c | 2 +- src/common.h | 2 +- src/fat.c | 72 +++++++++++++++++++++--------------------- src/fat.h | 18 +++++------ src/fatlabel.c | 2 +- src/file.c | 2 +- src/file.h | 2 +- src/fsck.fat.c | 9 ++---- src/fsck.fat.h | 13 ++++---- src/io.c | 2 +- src/io.h | 2 +- src/lfn.c | 2 +- src/lfn.h | 2 +- src/mkfs.fat.c | 17 +++++----- src/version.h | 6 ++-- 36 files changed, 189 insertions(+), 163 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b167af..414d1db 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,42 @@ -commit 55bd7b7 (HEAD, master) +commit acf64ae (HEAD, origin/master, origin/HEAD, master) +Author: Daniel Baumann +Date: Fri Jan 17 07:09:54 2014 +0100 + + Updating copyright headers for 2014. + + Signed-off-by: Daniel Baumann + +commit 21fe921 +Author: Andrew Tridgell +Date: Tue Jan 14 09:37:51 2014 +1100 + + Fixed remaining 64 bit build warnings. + + Some of these may be real bugs. + + Signed-off-by: Daniel Baumann + +commit 9e3a2b1 +Author: Andrew Tridgell +Date: Tue Jan 14 09:25:28 2014 +1100 + + Prevent corruption of FAT during fsck on 64 bit platforms. + + unsigned long is 64 bit on x86-64, which means set_fat was writing two + entries, which corrupts the next entry. This can cause loss of data in + another file. + + Signed-off-by: Daniel Baumann + +commit 0d2c9bc (tag: v3.0.24) +Author: Daniel Baumann +Date: Sat Nov 23 10:36:55 2013 +0100 + + Releasing version 3.0.24. + + Signed-off-by: Daniel Baumann + +commit 55bd7b7 Author: Jaroslav Skarvada Date: Sat Nov 23 10:34:48 2013 +0100 @@ -11,7 +49,7 @@ Date: Sat Nov 23 10:34:48 2013 +0100 Signed-off-by: Daniel Baumann -commit 6debb4a (tag: v3.0.23, origin/master, origin/HEAD) +commit 6debb4a (tag: v3.0.23) Author: Daniel Baumann Date: Tue Oct 15 08:05:46 2013 +0200 diff --git a/Makefile b/Makefile index f36338a..81256ef 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile # -# Copyright (C) 2008-2013 Daniel Baumann +# Copyright (C) 2008-2014 Daniel Baumann # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/VERSION b/VERSION index 03a04fc..de2e889 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.24 +3.0.25 diff --git a/manpages/Makefile b/manpages/Makefile index 982557b..28b29fa 100644 --- a/manpages/Makefile +++ b/manpages/Makefile @@ -1,7 +1,7 @@ # Makefile ## dosfstools(7) -## Copyright (C) 2006-2013 Daniel Baumann +## Copyright (C) 2006-2014 Daniel Baumann ## ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. ## This is free software, and you are welcome to redistribute it diff --git a/manpages/bin/update-version.sh b/manpages/bin/update-version.sh index 6b13bfa..48e9c08 100755 --- a/manpages/bin/update-version.sh +++ b/manpages/bin/update-version.sh @@ -1,7 +1,7 @@ #!/bin/sh ## dosfstools(7) -## Copyright (C) 2006-2013 Daniel Baumann +## Copyright (C) 2006-2014 Daniel Baumann ## ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING. ## This is free software, and you are welcome to redistribute it @@ -36,8 +36,8 @@ do then for _FILE in po/${_LANGUAGE}/*.po do - sed -i -e "s|^msgstr .*.2013-.*$|msgstr \"${DAY}.${MONTH}.${YEAR}\"|g" \ - -e "s|^msgstr .*.2013\"$|msgstr \"${DAY}.${MONTH}.${YEAR}\"|g" \ + sed -i -e "s|^msgstr .*.2014-.*$|msgstr \"${DAY}.${MONTH}.${YEAR}\"|g" \ + -e "s|^msgstr .*.2014\"$|msgstr \"${DAY}.${MONTH}.${YEAR}\"|g" \ "${_FILE}" done fi @@ -48,8 +48,8 @@ if ls po/pt_BR/*.po > /dev/null 2>&1 then for _FILE in po/pt_BR/*.po do - sed -i -e "s|^msgstr .*.2013-.*$|msgstr \"${DAY}-${MONTH}-${YEAR}\"|g" \ - -e "s|^msgstr .*-2013\"$|msgstr \"${DAY}-${MONTH}-${YEAR}\"|g" \ + sed -i -e "s|^msgstr .*.2014-.*$|msgstr \"${DAY}-${MONTH}-${YEAR}\"|g" \ + -e "s|^msgstr .*-2014\"$|msgstr \"${DAY}-${MONTH}-${YEAR}\"|g" \ "${_FILE}" done fi diff --git a/manpages/de/fatlabel.de.8 b/manpages/de/fatlabel.de.8 index 6265b5a..52b3025 100644 --- a/manpages/de/fatlabel.de.8 +++ b/manpages/de/fatlabel.de.8 @@ -1,6 +1,6 @@ .\" fatlabel.8 - manpage for fatlabel .\" -.\" Copyright (C) 2006-2013 Daniel Baumann +.\" Copyright (C) 2006-2014 Daniel Baumann .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH FATLABEL 8 2013\-11\-23 3.0.24 dosfstools +.TH FATLABEL 8 2014\-01\-17 3.0.25 dosfstools .SH NAME \fBfatlabel\fP \- set or get MS\-DOS filesystem label diff --git a/manpages/de/fsck.fat.de.8 b/manpages/de/fsck.fat.de.8 index 5b9c95e..4c0c4fe 100644 --- a/manpages/de/fsck.fat.de.8 +++ b/manpages/de/fsck.fat.de.8 @@ -1,6 +1,6 @@ .\" fsck.fat.8 - manpage for fsck.fat .\" -.\" Copyright (C) 2006-2013 Daniel Baumann +.\" Copyright (C) 2006-2014 Daniel Baumann .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH FSCK.FAT 8 2013\-11\-23 3.0.24 dosfstools +.TH FSCK.FAT 8 2014\-01\-17 3.0.25 dosfstools .SH NAME \fBfsck.fat\fP \- check and repair MS\-DOS filesystems diff --git a/manpages/de/mkfs.fat.de.8 b/manpages/de/mkfs.fat.de.8 index 0c90055..c34f932 100644 --- a/manpages/de/mkfs.fat.de.8 +++ b/manpages/de/mkfs.fat.de.8 @@ -1,6 +1,6 @@ .\" mkfs.fat.8 - manpage for fs.fatck .\" -.\" Copyright (C) 2006-2013 Daniel Baumann +.\" Copyright (C) 2006-2014 Daniel Baumann .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -24,7 +24,7 @@ .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* -.TH MKFS.FAT 8 2013\-11\-23 3.0.24 dosfstools +.TH MKFS.FAT 8 2014\-01\-17 3.0.25 dosfstools .SH NAME \fBmkfs.fat\fP \- create an MS\-DOS filesystem under Linux diff --git a/manpages/en/fatlabel.8 b/manpages/en/fatlabel.8 index 2478606..ba944dc 100644 --- a/manpages/en/fatlabel.8 +++ b/manpages/en/fatlabel.8 @@ -1,6 +1,6 @@ .\" fatlabel.8 - manpage for fatlabel .\" -.\" Copyright (C) 2006-2013 Daniel Baumann +.\" Copyright (C) 2006-2014 Daniel Baumann .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ .\" can be found in /usr/share/common-licenses/GPL-3 file. .\" .\" -.TH FATLABEL 8 2013\-11\-23 3.0.24 "dosfstools" +.TH FATLABEL 8 2014\-01\-17 3.0.25 "dosfstools" .SH NAME \fBfatlabel\fR \- set or get MS\-DOS filesystem label diff --git a/manpages/en/fsck.fat.8 b/manpages/en/fsck.fat.8 index d9f10d5..61d14e5 100644 --- a/manpages/en/fsck.fat.8 +++ b/manpages/en/fsck.fat.8 @@ -1,6 +1,6 @@ .\" fsck.fat.8 - manpage for fsck.fat .\" -.\" Copyright (C) 2006-2013 Daniel Baumann +.\" Copyright (C) 2006-2014 Daniel Baumann .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ .\" can be found in /usr/share/common-licenses/GPL-3 file. .\" .\" -.TH FSCK.FAT 8 2013\-11\-23 3.0.24 "dosfstools" +.TH FSCK.FAT 8 2014\-01\-17 3.0.25 "dosfstools" .SH NAME \fBfsck.fat\fR \- check and repair MS\-DOS filesystems diff --git a/manpages/en/mkfs.fat.8 b/manpages/en/mkfs.fat.8 index 653e247..f358516 100644 --- a/manpages/en/mkfs.fat.8 +++ b/manpages/en/mkfs.fat.8 @@ -1,6 +1,6 @@ .\" mkfs.fat.8 - manpage for fs.fatck .\" -.\" Copyright (C) 2006-2013 Daniel Baumann +.\" Copyright (C) 2006-2014 Daniel Baumann .\" .\" This program is free software: you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ .\" can be found in /usr/share/common-licenses/GPL-3 file. .\" .\" -.TH MKFS.FAT 8 2013\-11\-23 3.0.24 "dosfstools" +.TH MKFS.FAT 8 2014\-01\-17 3.0.25 "dosfstools" .SH NAME \fBmkfs.fat\fR \- create an MS-DOS filesystem under Linux diff --git a/manpages/po/de/fatlabel.8.po b/manpages/po/de/fatlabel.8.po index 6727949..5428ba0 100644 --- a/manpages/po/de/fatlabel.8.po +++ b/manpages/po/de/fatlabel.8.po @@ -1,12 +1,9 @@ # German translations for dosfstools package -# Copyright (C) 2013 Free Software Foundation, Inc. -# This file is distributed under the same license as the dosfstools package. -# Automatically generated, 2013. # msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2013-11-23 10:36+0100\n" +"POT-Creation-Date: 2014-01-17 07:10+0100\n" "PO-Revision-Date: 2013-06-06 09:34+0300\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -25,13 +22,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2013-11-23" +msgid "2014-01-17" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.24" +msgid "3.0.25" msgstr "" #. type: TH diff --git a/manpages/po/de/fsck.fat.8.po b/manpages/po/de/fsck.fat.8.po index b90ece5..5075781 100644 --- a/manpages/po/de/fsck.fat.8.po +++ b/manpages/po/de/fsck.fat.8.po @@ -1,12 +1,9 @@ # German translations for dosfstools package -# Copyright (C) 2013 Free Software Foundation, Inc. -# This file is distributed under the same license as the dosfstools package. -# Automatically generated, 2013. # msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2013-11-23 10:36+0100\n" +"POT-Creation-Date: 2014-01-17 07:10+0100\n" "PO-Revision-Date: 2013-06-06 09:34+0300\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -19,13 +16,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2013-11-23" +msgid "2014-01-17" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.24" +msgid "3.0.25" msgstr "" #. type: TH diff --git a/manpages/po/de/mkfs.fat.8.po b/manpages/po/de/mkfs.fat.8.po index 92a85fd..9688d3e 100644 --- a/manpages/po/de/mkfs.fat.8.po +++ b/manpages/po/de/mkfs.fat.8.po @@ -1,12 +1,9 @@ # German translations for dosfstools package -# Copyright (C) 2013 Free Software Foundation, Inc. -# This file is distributed under the same license as the dosfstools package. -# Automatically generated, 2013. # msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2013-11-23 10:36+0100\n" +"POT-Creation-Date: 2014-01-17 07:10+0100\n" "PO-Revision-Date: 2013-06-06 09:34+0300\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" @@ -19,13 +16,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2013-11-23" +msgid "2014-01-17" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.24" +msgid "3.0.25" msgstr "" #. type: TH diff --git a/manpages/pot/fatlabel.8.pot b/manpages/pot/fatlabel.8.pot index ee8c99e..6e11e04 100644 --- a/manpages/pot/fatlabel.8.pot +++ b/manpages/pot/fatlabel.8.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2013-11-23 10:36+0100\n" +"POT-Creation-Date: 2014-01-17 07:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,13 +25,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2013-11-23" +msgid "2014-01-17" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.24" +msgid "3.0.25" msgstr "" #. type: TH diff --git a/manpages/pot/fsck.fat.8.pot b/manpages/pot/fsck.fat.8.pot index 16857ad..eed92a8 100644 --- a/manpages/pot/fsck.fat.8.pot +++ b/manpages/pot/fsck.fat.8.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2013-11-23 10:36+0100\n" +"POT-Creation-Date: 2014-01-17 07:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,13 +19,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2013-11-23" +msgid "2014-01-17" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.24" +msgid "3.0.25" msgstr "" #. type: TH diff --git a/manpages/pot/mkfs.fat.8.pot b/manpages/pot/mkfs.fat.8.pot index a180b29..35df010 100644 --- a/manpages/pot/mkfs.fat.8.pot +++ b/manpages/pot/mkfs.fat.8.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: dosfstools VERSION\n" -"POT-Creation-Date: 2013-11-23 10:36+0100\n" +"POT-Creation-Date: 2014-01-17 07:10+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,13 +19,13 @@ msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "2013-11-23" +msgid "2014-01-17" msgstr "" #. type: TH #: en/fatlabel.8:22 en/fsck.fat.8:22 en/mkfs.fat.8:22 #, no-wrap -msgid "3.0.24" +msgid "3.0.25" msgstr "" #. type: TH diff --git a/src/boot.c b/src/boot.c index b56a5a3..45fb3c8 100644 --- a/src/boot.c +++ b/src/boot.c @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -110,12 +110,12 @@ static void dump_boot(DOS_FS * fs, struct boot_sector *b, unsigned lss) printf("%10d root directory entries\n", fs->root_entries); } else { printf("Root directory start at cluster %lu (arbitrary size)\n", - fs->root_cluster); + (unsigned long)fs->root_cluster); } printf("Data area starts at byte %llu (sector %llu)\n", (unsigned long long)fs->data_start, (unsigned long long)fs->data_start / lss); - printf("%10lu data clusters (%llu bytes)\n", fs->clusters, + printf("%10lu data clusters (%llu bytes)\n", (unsigned long)fs->clusters, (unsigned long long)fs->clusters * fs->cluster_size); printf("%u sectors/track, %u heads\n", le16toh(b->secs_track), le16toh(b->heads)); @@ -391,7 +391,7 @@ void read_boot(DOS_FS * fs) " but has only %lu clusters, less than the required " "minimum of %d.\n" " This may lead to problems on some systems.\n", - fs->clusters, FAT16_THRESHOLD); + (unsigned long)fs->clusters, FAT16_THRESHOLD); check_fat_state_bit(fs, &b); fs->backupboot_start = le16toh(b.backup_boot) * logical_sector_size; @@ -440,7 +440,7 @@ void read_boot(DOS_FS * fs) } if (fs->clusters > - ((unsigned long long)fs->fat_size * 8 / fs->fat_bits) - 2) + ((uint64_t)fs->fat_size * 8 / fs->fat_bits) - 2) die("Filesystem has %d clusters but only space for %d FAT entries.", fs->clusters, ((unsigned long long)fs->fat_size * 8 / fs->fat_bits) - 2); @@ -493,7 +493,7 @@ static void write_boot_label(DOS_FS * fs, char *label) loff_t find_volume_de(DOS_FS * fs, DIR_ENT * de) { - unsigned long cluster; + uint32_t cluster; loff_t offset; int i; diff --git a/src/boot.h b/src/boot.h index 7b42844..d52e624 100644 --- a/src/boot.h +++ b/src/boot.h @@ -1,7 +1,7 @@ /* boot.h - Read and analyze ia PC/MS-DOS boot sector Copyright (C) 1993 Werner Almesberger - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/check.c b/src/check.c index 12affac..213542f 100644 --- a/src/check.c +++ b/src/check.c @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ static DOS_FILE *root; /* get start field of a dir entry */ #define FSTART(p,fs) \ - ((unsigned long)le16toh(p->dir_ent.start) | \ + ((uint32_t)le16toh(p->dir_ent.start) | \ (fs->fat_bits == 32 ? le16toh(p->dir_ent.starthi) << 16 : 0)) #define MODIFY(p,i,v) \ @@ -56,7 +56,7 @@ static DOS_FILE *root; #define MODIFY_START(p,v,fs) \ do { \ - unsigned long __v = (v); \ + uint32_t __v = (v); \ if (!p->offset) { \ /* writing to fake entry for FAT32 root dir */ \ if (!__v) die("Oops, deleting FAT32 root dir!"); \ @@ -83,7 +83,7 @@ loff_t alloc_rootdir_entry(DOS_FS * fs, DIR_ENT * de, const char *pattern) if (fs->root_cluster) { DIR_ENT d2; int i = 0, got = 0; - unsigned long clu_num, prev = 0; + uint32_t clu_num, prev = 0; loff_t offset2; clu_num = fs->root_cluster; @@ -345,7 +345,7 @@ static void lfn_remove(loff_t from, loff_t to) static void drop_file(DOS_FS * fs, DOS_FILE * file) { - unsigned long cluster; + uint32_t cluster; MODIFY(file, name[0], DELETED_FLAG); if (file->lfn) @@ -356,13 +356,12 @@ static void drop_file(DOS_FS * fs, DOS_FILE * file) --n_files; } -static void truncate_file(DOS_FS * fs, DOS_FILE * file, unsigned long clusters) +static void truncate_file(DOS_FS * fs, DOS_FILE * file, uint32_t clusters) { int deleting; - unsigned long walk, next, prev; + uint32_t walk, next; walk = FSTART(file, fs); - prev = 0; if ((deleting = !clusters)) MODIFY_START(file, 0, fs); while (walk > 0 && walk != -1) { @@ -371,7 +370,6 @@ static void truncate_file(DOS_FS * fs, DOS_FILE * file, unsigned long clusters) set_fat(fs, walk, 0); else if ((deleting = !--clusters)) set_fat(fs, walk, -1); - prev = walk; walk = next; } } @@ -379,7 +377,7 @@ static void truncate_file(DOS_FS * fs, DOS_FILE * file, unsigned long clusters) static void auto_rename(DOS_FILE * file) { DOS_FILE *first, *walk; - unsigned long int number; + uint32_t number; if (!file->offset) return; /* cannot rename FAT32 root dir */ @@ -387,7 +385,7 @@ static void auto_rename(DOS_FILE * file) number = 0; while (1) { char num[8]; - sprintf(num, "%07lu", number); + sprintf(num, "%07lu", (unsigned long)number); memcpy(file->dir_ent.name, "FSCK", 4); memcpy(file->dir_ent.name + 4, num, 4); memcpy(file->dir_ent.ext, num + 4, 3); @@ -484,7 +482,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) { DOS_FILE *owner; int restart; - unsigned long expect, curr, this, clusters, prev, walk, clusters2; + uint32_t expect, curr, this, clusters, prev, walk, clusters2; if (file->dir_ent.attr & ATTR_DIR) { if (le32toh(file->dir_ent.size)) { @@ -497,8 +495,8 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) MSDOS_NAME)) { expect = FSTART(file->parent, fs); if (FSTART(file, fs) != expect) { - printf("%s\n Start (%ld) does not point to parent (%ld)\n", - path_name(file), FSTART(file, fs), expect); + printf("%s\n Start (%lu) does not point to parent (%lu)\n", + path_name(file), (unsigned long)FSTART(file, fs), (long)expect); MODIFY_START(file, expect, fs); } return 0; @@ -512,7 +510,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) expect = 0; if (FSTART(file, fs) != expect) { printf("%s\n Start (%lu) does not point to .. (%lu)\n", - path_name(file), FSTART(file, fs), expect); + path_name(file), (unsigned long)FSTART(file, fs), (unsigned long)expect); MODIFY_START(file, expect, fs); } return 0; @@ -527,7 +525,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) if (FSTART(file, fs) >= fs->clusters + 2) { printf ("%s\n Start cluster beyond limit (%lu > %lu). Truncating file.\n", - path_name(file), FSTART(file, fs), fs->clusters + 1); + path_name(file), (unsigned long)FSTART(file, fs), (unsigned long)(fs->clusters + 1)); if (!file->offset) die("Bad FAT32 root directory! (bad start cluster)\n"); MODIFY_START(file, 0, fs); @@ -540,7 +538,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) if (!curEntry.value || bad_cluster(fs, curr)) { printf("%s\n Contains a %s cluster (%lu). Assuming EOF.\n", - path_name(file), curEntry.value ? "bad" : "free", curr); + path_name(file), curEntry.value ? "bad" : "free", (unsigned long)curr); if (prev) set_fat(fs, prev, -1); else if (!file->offset) @@ -550,12 +548,12 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) break; } if (!(file->dir_ent.attr & ATTR_DIR) && le32toh(file->dir_ent.size) <= - (unsigned long long)clusters * fs->cluster_size) { + (uint64_t)clusters * fs->cluster_size) { printf - ("%s\n File size is %u bytes, cluster chain length is > %llu " + ("%s\n File size is %u bytes, cluster chain length is > %lu " "bytes.\n Truncating file to %u bytes.\n", path_name(file), le32toh(file->dir_ent.size), - (unsigned long long)clusters * fs->cluster_size, + (uint64_t)clusters * fs->cluster_size, le32toh(file->dir_ent.size)); truncate_file(fs, file, clusters); break; @@ -604,7 +602,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) else MODIFY_START(owner, 0, fs); MODIFY(owner, size, - htole32((unsigned long long)clusters * + htole32((uint64_t)clusters * fs->cluster_size)); if (restart) return 1; @@ -634,7 +632,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) prev = curr; } if (!(file->dir_ent.attr & ATTR_DIR) && le32toh(file->dir_ent.size) > - (unsigned long long)clusters * fs->cluster_size) { + (uint64_t)clusters * fs->cluster_size) { printf ("%s\n File size is %u bytes, cluster chain length is %llu bytes." "\n Truncating file to %llu bytes.\n", path_name(file), @@ -642,7 +640,7 @@ static int check_file(DOS_FS * fs, DOS_FILE * file) (unsigned long long)clusters * fs->cluster_size, (unsigned long long)clusters * fs->cluster_size); MODIFY(file, size, - htole32((unsigned long long)clusters * fs->cluster_size)); + htole32((uint64_t)clusters * fs->cluster_size)); } return 0; } @@ -812,7 +810,7 @@ static int check_dir(DOS_FS * fs, DOS_FILE ** root, int dots) static void test_file(DOS_FS * fs, DOS_FILE * file, int read_test) { DOS_FILE *owner; - unsigned long walk, prev, clusters, next_clu; + uint32_t walk, prev, clusters, next_clu; prev = clusters = 0; for (walk = FSTART(file, fs); walk > 0 && walk < fs->clusters + 2; @@ -826,7 +824,7 @@ static void test_file(DOS_FS * fs, DOS_FILE * file, int read_test) if ((owner = get_owner(fs, walk))) { if (owner == file) { printf("%s\n Circular cluster chain. Truncating to %lu " - "cluster%s.\n", path_name(file), clusters, + "cluster%s.\n", path_name(file), (unsigned long)clusters, clusters == 1 ? "" : "s"); if (prev) set_fat(fs, prev, -1); @@ -845,7 +843,7 @@ static void test_file(DOS_FS * fs, DOS_FILE * file, int read_test) clusters++; } else { printf("%s\n Cluster %lu (%lu) is unreadable. Skipping it.\n", - path_name(file), clusters, walk); + path_name(file), (unsigned long)clusters, (unsigned long)walk); if (prev) set_fat(fs, prev, next_cluster(fs, walk)); else @@ -868,7 +866,7 @@ static void test_file(DOS_FS * fs, DOS_FILE * file, int read_test) static void undelete(DOS_FS * fs, DOS_FILE * file) { - unsigned long clusters, left, prev, walk; + uint32_t clusters, left, prev, walk; clusters = left = (le32toh(file->dir_ent.size) + fs->cluster_size - 1) / fs->cluster_size; @@ -896,7 +894,7 @@ static void undelete(DOS_FS * fs, DOS_FILE * file) MODIFY_START(file, 0, fs); if (left) printf("Warning: Did only undelete %lu of %lu cluster%s.\n", - clusters - left, clusters, clusters == 1 ? "" : "s"); + (unsigned long)clusters - left, (unsigned long)clusters, clusters == 1 ? "" : "s"); } @@ -979,7 +977,7 @@ static int scan_dir(DOS_FS * fs, DOS_FILE * this, FDSC ** cp) { DOS_FILE **chain; int i; - unsigned long clu_num; + uint32_t clu_num; chain = &this->first; i = 0; diff --git a/src/check.h b/src/check.h index 0a076ba..fcb6bea 100644 --- a/src/check.h +++ b/src/check.h @@ -1,7 +1,7 @@ /* check.h - Check and repair a PC/MS-DOS filesystem Copyright (C) 1993 Werner Almesberger - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/common.c b/src/common.c index 12afc69..af222a2 100644 --- a/src/common.c +++ b/src/common.c @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/common.h b/src/common.h index 395bb07..8508602 100644 --- a/src/common.h +++ b/src/common.h @@ -1,7 +1,7 @@ /* common.h - Common functions Copyright (C) 1993 Werner Almesberger - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/fat.c b/src/fat.c index 7e8239e..027c586 100644 --- a/src/fat.c +++ b/src/fat.c @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -43,7 +43,7 @@ * @param[in] cluster Cluster of interest * @param[in] fs Information from the FAT boot sectors (bits per FAT entry) */ -void get_fat(FAT_ENTRY * entry, void *fat, unsigned long cluster, DOS_FS * fs) +void get_fat(FAT_ENTRY * entry, void *fat, uint32_t cluster, DOS_FS * fs) { unsigned char *ptr; @@ -60,7 +60,7 @@ void get_fat(FAT_ENTRY * entry, void *fat, unsigned long cluster, DOS_FS * fs) /* According to M$, the high 4 bits of a FAT32 entry are reserved and * are not part of the cluster number. So we cut them off. */ { - unsigned long e = le32toh(((unsigned int *)fat)[cluster]); + uint32_t e = le32toh(((unsigned int *)fat)[cluster]); entry->value = e & 0xfffffff; entry->reserved = e >> 28; } @@ -81,10 +81,10 @@ void get_fat(FAT_ENTRY * entry, void *fat, unsigned long cluster, DOS_FS * fs) void read_fat(DOS_FS * fs) { int eff_size; - unsigned long i; + uint32_t i; void *first, *second = NULL; int first_ok, second_ok; - unsigned long total_num_clusters; + uint32_t total_num_clusters; /* Clean up from previous pass */ if (fs->fat) @@ -151,13 +151,13 @@ void read_fat(DOS_FS * fs) FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); if (curEntry.value == 1) { - printf("Cluster %ld out of range (1). Setting to EOF.\n", i - 2); + printf("Cluster %ld out of range (1). Setting to EOF.\n", (long)(i - 2)); set_fat(fs, i, -1); } if (curEntry.value >= fs->clusters + 2 && (curEntry.value < FAT_MIN_BAD(fs))) { printf("Cluster %ld out of range (%ld > %ld). Setting to EOF.\n", - i - 2, curEntry.value, fs->clusters + 2 - 1); + (long)(i - 2), (long)curEntry.value, (long)(fs->clusters + 2 - 1)); set_fat(fs, i, -1); } } @@ -176,13 +176,13 @@ void read_fat(DOS_FS * fs) * -1 == end-of-chain * -2 == bad cluster */ -void set_fat(DOS_FS * fs, unsigned long cluster, unsigned long new) +void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new) { unsigned char *data = NULL; int size; loff_t offs; - if ((long)new == -1) + if (new == -1) new = FAT_EOF(fs); else if ((long)new == -2) new = FAT_BAD(fs); @@ -219,7 +219,7 @@ void set_fat(DOS_FS * fs, unsigned long cluster, unsigned long new) offs = fs->fat_start + cluster * 4; /* According to M$, the high 4 bits of a FAT32 entry are reserved and * are not part of the cluster number. So we never touch them. */ - *(unsigned long *)data = htole32((new & 0xfffffff) | + *(uint32_t *)data = htole32((new & 0xfffffff) | (curEntry.reserved << 28)); size = 4; } @@ -233,7 +233,7 @@ void set_fat(DOS_FS * fs, unsigned long cluster, unsigned long new) } } -int bad_cluster(DOS_FS * fs, unsigned long cluster) +int bad_cluster(DOS_FS * fs, uint32_t cluster) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, cluster, fs); @@ -251,9 +251,9 @@ int bad_cluster(DOS_FS * fs, unsigned long cluster) * @return -1 'cluster' is at the end of the chain * @return Other values Next cluster in this chain */ -unsigned long next_cluster(DOS_FS * fs, unsigned long cluster) +uint32_t next_cluster(DOS_FS * fs, uint32_t cluster) { - unsigned long value; + uint32_t value; FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, cluster, fs); @@ -264,10 +264,10 @@ unsigned long next_cluster(DOS_FS * fs, unsigned long cluster) return FAT_IS_EOF(fs, value) ? -1 : value; } -loff_t cluster_start(DOS_FS * fs, unsigned long cluster) +loff_t cluster_start(DOS_FS * fs, uint32_t cluster) { return fs->data_start + ((loff_t) cluster - - 2) * (unsigned long long)fs->cluster_size; + 2) * (uint64_t)fs->cluster_size; } /** @@ -279,7 +279,7 @@ loff_t cluster_start(DOS_FS * fs, unsigned long cluster) * @param[in] owner Information on dentry that owns this cluster * (may be NULL) */ -void set_owner(DOS_FS * fs, unsigned long cluster, DOS_FILE * owner) +void set_owner(DOS_FS * fs, uint32_t cluster, DOS_FILE * owner) { if (fs->cluster_owner == NULL) die("Internal error: attempt to set owner in non-existent table"); @@ -290,7 +290,7 @@ void set_owner(DOS_FS * fs, unsigned long cluster, DOS_FILE * owner) fs->cluster_owner[cluster] = owner; } -DOS_FILE *get_owner(DOS_FS * fs, unsigned long cluster) +DOS_FILE *get_owner(DOS_FS * fs, uint32_t cluster) { if (fs->cluster_owner == NULL) return NULL; @@ -300,7 +300,7 @@ DOS_FILE *get_owner(DOS_FS * fs, unsigned long cluster) void fix_bad(DOS_FS * fs) { - unsigned long i; + uint32_t i; if (verbose) printf("Checking for bad clusters.\n"); @@ -310,7 +310,7 @@ void fix_bad(DOS_FS * fs) if (!get_owner(fs, i) && !FAT_IS_BAD(fs, curEntry.value)) if (!fs_test(cluster_start(fs, i), fs->cluster_size)) { - printf("Cluster %lu is unreadable.\n", i); + printf("Cluster %lu is unreadable.\n", (unsigned long)i); set_fat(fs, i, -2); } } @@ -319,7 +319,7 @@ void fix_bad(DOS_FS * fs) void reclaim_free(DOS_FS * fs) { int reclaimed; - unsigned long i; + uint32_t i; if (verbose) printf("Checking for unused clusters.\n"); @@ -335,7 +335,7 @@ void reclaim_free(DOS_FS * fs) } } if (reclaimed) - printf("Reclaimed %d unused cluster%s (%llu bytes).\n", reclaimed, + printf("Reclaimed %d unused cluster%s (%llu bytes).\n", (int)reclaimed, reclaimed == 1 ? "" : "s", (unsigned long long)reclaimed * fs->cluster_size); } @@ -350,11 +350,11 @@ void reclaim_free(DOS_FS * fs) * clusters link to it. * @param[in] start_cluster Where to start scanning for orphans */ -static void tag_free(DOS_FS * fs, DOS_FILE * owner, unsigned long *num_refs, - unsigned long start_cluster) +static void tag_free(DOS_FS * fs, DOS_FILE * owner, uint32_t *num_refs, + uint32_t start_cluster) { int prev; - unsigned long i, walk; + uint32_t i, walk; if (start_cluster == 0) start_cluster = 2; @@ -403,16 +403,16 @@ void reclaim_file(DOS_FS * fs) DOS_FILE orphan; int reclaimed, files; int changed = 0; - unsigned long i, next, walk; - unsigned long *num_refs = NULL; /* Only for orphaned clusters */ - unsigned long total_num_clusters; + uint32_t i, next, walk; + uint32_t *num_refs = NULL; /* Only for orphaned clusters */ + uint32_t total_num_clusters; if (verbose) printf("Reclaiming unconnected clusters.\n"); total_num_clusters = fs->clusters + 2UL; - num_refs = alloc(total_num_clusters * sizeof(unsigned long)); - memset(num_refs, 0, (total_num_clusters * sizeof(unsigned long))); + num_refs = alloc(total_num_clusters * sizeof(uint32_t)); + memset(num_refs, 0, (total_num_clusters * sizeof(uint32_t))); /* Guarantee that all orphan chains (except cycles) end cleanly * with an end-of-chain mark. @@ -457,7 +457,7 @@ void reclaim_file(DOS_FS * fs) die("Internal error: num_refs going below zero"); set_fat(fs, i, -1); changed = curEntry.value; - printf("Broke cycle at cluster %lu in free chain.\n", i); + printf("Broke cycle at cluster %lu in free chain.\n", (unsigned long)i); /* If we've created a new chain head, * tag_free() can claim it @@ -497,10 +497,10 @@ void reclaim_file(DOS_FS * fs) free(num_refs); } -unsigned long update_free(DOS_FS * fs) +uint32_t update_free(DOS_FS * fs) { - unsigned long i; - unsigned long free = 0; + uint32_t i; + uint32_t free = 0; int do_set = 0; for (i = 2; i < fs->clusters + 2; i++) { @@ -519,7 +519,7 @@ unsigned long update_free(DOS_FS * fs) if (fs->free_clusters != 0xFFFFFFFF) { if (free != fs->free_clusters) { printf("Free cluster summary wrong (%ld vs. really %ld)\n", - fs->free_clusters, free); + (long)fs->free_clusters, (long)free); if (interactive) printf("1) Correct\n2) Don't correct\n"); else @@ -528,7 +528,7 @@ unsigned long update_free(DOS_FS * fs) do_set = 1; } } else { - printf("Free cluster summary uninitialized (should be %ld)\n", free); + printf("Free cluster summary uninitialized (should be %ld)\n", (long)free); if (rw) { if (interactive) printf("1) Set it\n2) Leave it uninitialized\n"); @@ -540,7 +540,7 @@ unsigned long update_free(DOS_FS * fs) } if (do_set) { - unsigned long le_free = htole32(free); + uint32_t le_free = htole32(free); fs->free_clusters = free; fs_write(fs->fsinfo_start + offsetof(struct info_sector, free_clusters), sizeof(le_free), &le_free); diff --git a/src/fat.h b/src/fat.h index 096d224..b50ed4a 100644 --- a/src/fat.h +++ b/src/fat.h @@ -1,7 +1,7 @@ /* fat.h - Read/write access to the FAT Copyright (C) 1993 Werner Almesberger - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,38 +28,38 @@ void read_fat(DOS_FS * fs); /* Loads the FAT of the filesystem described by FS. Initializes the FAT, replaces broken FATs and rejects invalid cluster entries. */ -void get_fat(FAT_ENTRY * entry, void *fat, unsigned long cluster, DOS_FS * fs); +void get_fat(FAT_ENTRY * entry, void *fat, uint32_t cluster, DOS_FS * fs); /* Retrieve the FAT entry (next chained cluster) for CLUSTER. */ -void set_fat(DOS_FS * fs, unsigned long cluster, unsigned long new); +void set_fat(DOS_FS * fs, uint32_t cluster, int32_t new); /* Changes the value of the CLUSTERth cluster of the FAT of FS to NEW. Special values of NEW are -1 (EOF, 0xff8 or 0xfff8) and -2 (bad sector, 0xff7 or 0xfff7) */ -int bad_cluster(DOS_FS * fs, unsigned long cluster); +int bad_cluster(DOS_FS * fs, uint32_t cluster); /* Returns a non-zero integer if the CLUSTERth cluster is marked as bad or zero otherwise. */ -unsigned long next_cluster(DOS_FS * fs, unsigned long cluster); +uint32_t next_cluster(DOS_FS * fs, uint32_t cluster); /* Returns the number of the cluster following CLUSTER, or -1 if this is the last cluster of the respective cluster chain. CLUSTER must not be a bad cluster. */ -loff_t cluster_start(DOS_FS * fs, unsigned long cluster); +loff_t cluster_start(DOS_FS * fs, uint32_t cluster); /* Returns the byte offset of CLUSTER, relative to the respective device. */ -void set_owner(DOS_FS * fs, unsigned long cluster, DOS_FILE * owner); +void set_owner(DOS_FS * fs, uint32_t cluster, DOS_FILE * owner); /* Sets the owner pointer of the respective cluster to OWNER. If OWNER was NULL before, it can be set to NULL or any non-NULL value. Otherwise, only NULL is accepted as the new value. */ -DOS_FILE *get_owner(DOS_FS * fs, unsigned long cluster); +DOS_FILE *get_owner(DOS_FS * fs, uint32_t cluster); /* Returns the owner of the repective cluster or NULL if the cluster has no owner. */ @@ -78,7 +78,7 @@ void reclaim_file(DOS_FS * fs); for them in the root directory. Also tries to fix all inconsistencies (e.g. loops, shared clusters, etc.) in the process. */ -unsigned long update_free(DOS_FS * fs); +uint32_t update_free(DOS_FS * fs); /* Updates free cluster count in FSINFO sector. */ diff --git a/src/fatlabel.c b/src/fatlabel.c index d45fb95..1484ba5 100644 --- a/src/fatlabel.c +++ b/src/fatlabel.c @@ -3,7 +3,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek Copyright (C) 2007 Red Hat, Inc. - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/file.c b/src/file.c index c80769a..30adcde 100644 --- a/src/file.c +++ b/src/file.c @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/file.h b/src/file.h index 3d2624d..3adfc96 100644 --- a/src/file.h +++ b/src/file.h @@ -1,7 +1,7 @@ /* file.h - Additional file attributes Copyright (C) 1993 Werner Almesberger - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/fsck.fat.c b/src/fsck.fat.c index dbf8890..ce6cee6 100644 --- a/src/fsck.fat.c +++ b/src/fsck.fat.c @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -105,8 +105,7 @@ int main(int argc, char **argv) { DOS_FS fs; int salvage_files, verify, c; - unsigned n_files_check = 0, n_files_verify = 0; - unsigned long free_clusters = 0; + uint32_t free_clusters = 0; memset(&fs, 0, sizeof(fs)); rw = salvage_files = verify = 0; @@ -197,7 +196,6 @@ int main(int argc, char **argv) free_clusters = update_free(&fs); file_unused(); qfree(&mem_queue); - n_files_check = n_files; if (verify) { n_files = 0; printf("Starting verification pass.\n"); @@ -205,7 +203,6 @@ int main(int argc, char **argv) scan_root(&fs); reclaim_free(&fs); qfree(&mem_queue); - n_files_verify = n_files; } exit: @@ -221,7 +218,7 @@ exit: if (!boot_only) printf("%s: %u files, %lu/%lu clusters\n", argv[optind], - n_files, fs.clusters - free_clusters, fs.clusters); + n_files, (unsigned long)fs.clusters - free_clusters, (unsigned long)fs.clusters); return fs_close(rw) ? 1 : 0; } diff --git a/src/fsck.fat.h b/src/fsck.fat.h index 8f3374e..9d4bb16 100644 --- a/src/fsck.fat.h +++ b/src/fsck.fat.h @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,6 +38,7 @@ #include #include +#include #include #define VFAT_LN_ATTR (ATTR_RO | ATTR_HIDDEN | ATTR_SYS | ATTR_VOLUME) @@ -149,8 +150,8 @@ typedef struct _dos_file { } DOS_FILE; typedef struct { - unsigned long value; - unsigned long reserved; + uint32_t value; + uint32_t reserved; } FAT_ENTRY; typedef struct { @@ -159,12 +160,12 @@ typedef struct { unsigned int fat_size; /* unit is bytes */ unsigned int fat_bits; /* size of a FAT entry */ unsigned int eff_fat_bits; /* # of used bits in a FAT entry */ - unsigned long root_cluster; /* 0 for old-style root dir */ + uint32_t root_cluster; /* 0 for old-style root dir */ loff_t root_start; unsigned int root_entries; loff_t data_start; unsigned int cluster_size; - unsigned long clusters; + uint32_t clusters; loff_t fsinfo_start; /* 0 if not present */ long free_clusters; loff_t backupboot_start; /* 0 if not present */ @@ -180,7 +181,7 @@ extern void *mem_queue; /* value to use as end-of-file marker */ #define FAT_EOF(fs) ((atari_format ? 0xfff : 0xff8) | FAT_EXTD(fs)) -#define FAT_IS_EOF(fs,v) ((unsigned long)(v) >= (0xff8|FAT_EXTD(fs))) +#define FAT_IS_EOF(fs,v) ((uint32_t)(v) >= (0xff8|FAT_EXTD(fs))) /* value to mark bad clusters */ #define FAT_BAD(fs) (0xff7 | FAT_EXTD(fs)) /* range of values used for bad clusters */ diff --git a/src/io.c b/src/io.c index 490c7a2..3755ba5 100644 --- a/src/io.c +++ b/src/io.c @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/io.h b/src/io.h index 33c60db..ea0e35d 100644 --- a/src/io.h +++ b/src/io.h @@ -2,7 +2,7 @@ Copyright (C) 1993 Werner Almesberger Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/lfn.c b/src/lfn.c index 8516cc5..2e60198 100644 --- a/src/lfn.c +++ b/src/lfn.c @@ -1,7 +1,7 @@ /* lfn.c - Functions for handling VFAT long filenames Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/lfn.h b/src/lfn.h index 3dde4fa..e5c3991 100644 --- a/src/lfn.h +++ b/src/lfn.h @@ -1,7 +1,7 @@ /* lfn.h - Functions for handling VFAT long filenames Copyright (C) 1998 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c index 9868272..96ba47e 100644 --- a/src/mkfs.fat.c +++ b/src/mkfs.fat.c @@ -5,7 +5,7 @@ Copyright (C) 1993-1994 David Hudson Copyright (C) 1998 H. Peter Anvin Copyright (C) 1998-2005 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -64,6 +64,7 @@ #include #include #include +#include #include #include @@ -257,7 +258,7 @@ static long volume_id; /* Volume ID number */ static time_t create_time; /* Creation time */ static struct timeval create_timeval; /* Creation time */ static char volume_name[] = NO_NAME; /* Volume name */ -static unsigned long long blocks; /* Number of blocks in filesystem */ +static uint64_t blocks; /* Number of blocks in filesystem */ static int sector_size = 512; /* Size of a logical sector */ static int sector_size_set = 0; /* User selected sector size */ static int backup_boot = 0; /* Sector# of backup boot sector */ @@ -299,7 +300,7 @@ static void alarm_intr(int alnum); static void check_blocks(void); static void get_list_blocks(char *filename); static int valid_offset(int fd, loff_t offset); -static unsigned long long count_blocks(char *filename, int *remainder); +static uint64_t count_blocks(char *filename, int *remainder); static void check_mount(char *device_name); static void establish_params(int device_num, int size); static void setup_tables(void); @@ -454,7 +455,7 @@ static void get_list_blocks(char *filename) { int i; FILE *listfile; - unsigned long blockno; + long blockno; listfile = fopen(filename, "r"); if (listfile == (FILE *) NULL) @@ -488,7 +489,7 @@ static int valid_offset(int fd, loff_t offset) /* Given a filename, look to see how many blocks of BLOCK_SIZE are present, returning the answer */ -static unsigned long long count_blocks(char *filename, int *remainder) +static uint64_t count_blocks(char *filename, int *remainder) { loff_t high, low; int fd; @@ -704,7 +705,7 @@ def_hd_params: * fs size < 32G: 16k clusters * fs size >= 32G: 32k clusters */ - unsigned long sz_mb = + uint32_t sz_mb = (blocks + (1 << (20 - BLOCK_SIZE_BITS)) - 1) >> (20 - BLOCK_SIZE_BITS); bs.cluster_size = @@ -1408,7 +1409,7 @@ int main(int argc, char **argv) struct stat statbuf; int i = 0, pos, ch; int create = 0; - unsigned long long cblocks = 0; + uint64_t cblocks = 0; int min_sector_size; if (argc && *argv) { /* What's the program name? */ @@ -1649,7 +1650,7 @@ int main(int argc, char **argv) blocks = strtoull(argv[optind + 1], &tmp, 0); if (!create && blocks != cblocks) { fprintf(stderr, "Warning: block count mismatch: "); - fprintf(stderr, "found %llu but assuming %llu.\n", cblocks, blocks); + fprintf(stderr, "found %llu but assuming %llu.\n", (unsigned long long)cblocks, (unsigned long long)blocks); } } else if (optind == argc - 1) { /* Or use value found */ if (create) diff --git a/src/version.h b/src/version.h index 7d8ac47..683a7f7 100644 --- a/src/version.h +++ b/src/version.h @@ -1,7 +1,7 @@ /* version.h Copyright (C) 1998-2005 Roman Hodek - Copyright (C) 2008-2013 Daniel Baumann + Copyright (C) 2008-2014 Daniel Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ #ifndef _version_h #define _version_h -#define VERSION "3.0.24" -#define VERSION_DATE "2013-11-23" +#define VERSION "3.0.25" +#define VERSION_DATE "2014-01-17" #endif -- 2.7.4