Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.
The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.
No functional change intended.
This includes some whitespace and minor bug fixes relative to NetBSD,
which will be submitted upstream at the conclusion of the makefs
msdos update.
NetBSD revs:
mkfs_msdos.c 1.11
mkfs_msdos.h 1.4
newfs_msdos.8 1.22
newfs_msdos.c 1.44
Submitted by: Siva Mahadevan <smahadevan@freebsdfoundation.org>
Reviewed by: emaste
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation
Return -1 on errors from mkfs_msdos() instead of err()/errx(), to
allow different consumers to handle errors as appropriate.
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation
NetBSD split newfs_msdos in two so that they can reuse the file system
creation part in makefs. This change is a step on the path of bringing
that support to FreeBSD.
Reviewed by: kib, pfg
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D3905
Microsoft recommends avoiding the use of spaces in the
string structures for FAT. Unfortunately they do just
that by default in the case of unlabeled filesystems.
Follow the default MS behavior to avoid confusion in
common tools like file(1). This was actually the
default behavior before r203868.
Obtained from: NetBSD (CVS rev. 1.39)
MFC after: 3 days
FAT12 1..4084
FAT16 4085..65524
FAT32 65525..
This is required for interoperability with other FAT implementations,
and in particular UEFI.
Obtained from: NetBSD
Sponsored by: The FreeBSD Foundation
The fields from deMTime and deMDate in the DOS directory entry
are actually the last-modified time/date.
According to some online documentation these are the only
timestamps available in FAT12/FAT16.
MFC after: 3 days
- Simplify diagnostic messages.
- Adopt lowercase first letters to make the messages
more canonical.
PR: bin/175404
Submitted by: Christoph Mallon
Reviewed by: bde
MFC after: 3 days
Remove C99 initializers: they don't help in this case.
Set errno to 0 before strtoll() (from NetBSD).
PR: 151850
Suggested by: bde
Approved by: jhb (Mentor)
MFC after: 2 weeks
change the on-disk format in an incompatible way. Without this change,
msdosfs created on FreeBSD/arm would not be mountable.
PR: bin/162486
Submitted by: Ian Lepore <freebsd damnhippie dyndns org>
Reported by: Mattia Rossi <mrossi at swin.edu.au>
MFC after: 3 days
- C99 initializers.
- Change the default volume label from "NO NAME" to "NO_NAME".
- Set OEM String to "BSD4.4 " following the unnamed spacing convention
in that other OS that suggests "MSWIN4.1"
Also, David Naylor's changes for Clang, mostly changing the signess
of constants.
Submitted by: Pedro F. Giffuni <giffunip tutopia com>
Clang fixes by: David Naylor <naylor.b.david gmail com>
Reviewed by: bde (with some disagreement about Clang issues)
MFC after: 2 weeks
fstat(fd, &sb) was not executed unconditionally anymore so sb was read
uninitialised when -C is used.
Submitted by: Christoph Mallon <christoph mallon gmx de>
Either use parameters provided by user or make them up.
The code for faking CHS params is borrowed from disklabel code.
The logic for using user-provided and auto-guessed parameters is not
perfect, so to speak.
PR: bin/121182
Approved by: jhb (mentor)
when preparing images for emulators or flash devices:
+ option '-C size' to create the underlying image file with given size.
Saves doing a 'dd' before, and especially it creates a sparse file
+ option '-@ offset' to build the FAT image at the specified offset
in the image file or device;
+ make the cluster size adaptive on the filesystem size.
Previously the default was 4k which is really unconvenient with
large media; now it goes from 512 bytes to 32k depending on
filesystem size (i still need to check whether it makes sense
to go further up, to 64k or above);
+ fix default geometry when not specified on the command line,
use 63 sectors/255 heads by default.
Also trim the size so it exactly a multiple of a track, to avoid
complaints in some filesystem code.
+ document all the above, plus some manual page clarifications.
MFC after: 4 weeks
a plain file and a geometry is not explicitly supplied through
command line or disktab entry.
This way you can a FAT image on a file as simply as this:
newfs_msdos ./some/file
(right now you need a much longer command
newfs_msdos -h 32 -u 64 -S 512 -s $total_blocks -o 0 ./some/file
Will be merged after 7.1 and 6.4 are released.
See also the related PR which suggests a similar change.
PR: bin/121182
MFC after: 4 weeks
correct place on large sector disks. The boot signature should be at
offset 0x1fe in the BPB; newfs_msdos currently stores it 2 bytes from
the end of the sector.
Taken from: NetBSD
- Initialize everything in the struct array, not only the mentioned
ones
- Unconditionally initialize hs to 0 to avoid repeatly doing so
- Cast to unsigned int when comparing to unsigned variables.
getdiskinfo(). For the fixed-disk case, bpb->hid probably isn't
handled correctly, but I'm not sure if this is a serious problem since
the primary use of this program is to format floppy disks.
Reviewed by: phk