char *".
These warnings appear when you compile the project with the option "-Wall", what
is done with the current default Makefile.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
https://bugzilla.redhat.com/show_bug.cgi?id=660154 for more information.
The problem is that alloc_rootdir_entry counts with 10000 files at max, but the
filename buffer is only 8 chars long. Due to pattern mask used it results to
only 10 files at max (FSCK0-9REC). If there is more than 10 files, it overflows
and hangs.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This is helpful for SD cards or other removable media which have an enabled
write lock -- without the "Permission denied" message, the user has to strace
mkdosfs to find out what's going on.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
the resulting applications report strange errors on "large" (> 2 GiB)
partitions:
Seek to -2118967808:Invalid argument
Warning: Filesystem is FAT32 according to fat_length and fat32_length fields,
but has only 8613 clusters, less than the required minimum of 65525.
This may lead to problems on some systems.
This appears to be due to compilation with a 32-bit off_t and lseek() library
function.
Use lseek64 for positioning, and change some suspect uses of off_t to loff_t.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Correct the code to align the root directory; it was broken before
since bs.dir_entries had already been set at the point of alignment.
This patch removes the dual use of bs.dir_entries and root_dir_entries
to carry the same information: the information is carried in
root_dir_entires exclusively, and then bs.dir_entries is set inside
setup_tables() at a late point.
The code to align the root directory is also wrapped in
if (align_structures); this avoids rounding the number of root
directory entries up to a whole sector when used with -a
(i.e. preserves the previous behavior.)
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Align all data structures (reserved sectors, FATs, root directory for
FAT12/16) to an even multiple of the cluster size. This means that if
the partition is aligned, so will all clusters be. This adds
significant performance for anything where the physical sector size is
larger than the logical sector size, e.g. flash media or large-sector
hard disks.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Firstly, packed attribute is added to the structure so that extension
is guarranteed to immediately follow name for the cross-name-extension
reads to succeed.
Secondly, writes into dir_entry->name that span through the extension as
well are split into two, so that FORTIFY_SOURCE's bound checking does
not abort dosfsck. There also was an off-by-one error in auto_rename()'s
sprintf().
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
If an orphan chain that linked to cluster 1 was reclaimed to a file,
deletion of the file would result in a filesystem panic.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
This patch reorganizes heap memory usage by dosfsck and mkdosfs
to support limited-memory embedded systems - in particular, those
based on Xilinx's Microblaze processor. It also adds a few comments.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>