There is no need that mkfs.fat depends on systemd. It uses it only for
reading additional information about block device.
This patch replace systemd/udev dependency code by reading those additional
information about block device directly from sysfs.
So no functionality of mkfs.fat is lost or removed.
Add testsuite on the basis of the automake framework. As a start, three
tests for basic mkfs functionality compare mkfs generated images against
references images.
Signed-off-by: Andreas Bombe <aeb@debian.org>
It appears libblkid is not as widely available as presumed, since some
platforms only have the original libblkid included in e2fsprogs which
lacks the needed functionality. This commit removes the requirement and
use of libblkid.
As a replacement, blkdev.c from util-linux is included, which offers the
required basic functionality in a portable way.
Signed-off-by: Andreas Bombe <aeb@debian.org>
The device probing in mkfs.fat is used to get device parameters where
needed and also to decide whether to refuse overwriting a device due to
possible user error. This code has suffered severe bitrot and is highly
Linux specific. Highlights include using hardcoded major/minor device
numbers to classify a device, and using 8 bits major/minor numbers that
have become obsolete a long time ago and thus often misidentifying a
device.
The overhauled implementation is now in src/device_info.c and makes use
of libudev (optional, recommended) and libblkid (required) to probe the
device and where Linux ioctls are required it provides fallbacks and
does not attempt to call these on non-Linux systems. The FAT parameter
selection has been unified and simplified in the process.
A new executable testdevinfo has been added that gets built but not
automatically installed. It takes one file name, uses the same probing
as mkfs.fat would with verbose messages enabled and displays the
results.
Signed-off-by: Andreas Bombe <aeb@debian.org>