History log of /freebsd-10.1-release/sbin/newfs_msdos/newfs_msdos.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 270034 15-Aug-2014 pfg

MFC r269953:
Use "NO NAME" as the default unnamed label.

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)


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 255339 07-Sep-2013 pfg

newfs_msdos: fix inaccurate comments.

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


# 245648 19-Jan-2013 pfg

newfs_msdos: cosmetical cleanups

- 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


# 228740 20-Dec-2011 pfg

Many style fixes.
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


# 227454 11-Nov-2011 delphij

Use __packed to prevent alignment from taking place, which otherwise may
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


# 223946 12-Jul-2011 ae

Use NULL instead of 0 for third argument of sigaction(2).

Pointed by: kib
MFC after: 2 weeks


# 223945 12-Jul-2011 ae

Add SIGINFO handler.

Reviewed by: kib
Obtained from: NetBSD (partly)
MFC after: 2 weeks


# 203869 14-Feb-2010 kib

Rename variables to match msdosfs headers.

Submitted by: Pedro F. Giffuni <giffunip tutopia com>
Reviewed by: bde
MFC after: 2 weeks


# 203868 14-Feb-2010 kib

Some cleanups from NetBSD:
- 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


# 190932 11-Apr-2009 ed

Do not prepend /dev/ when -C is used.

Submitted by: Christoph Mallon <christoph mallon gmx de>


# 190931 11-Apr-2009 ed

When using -C, do not warn when the file is not a character device, but warn when it is not a regular file.

Submitted by: Christoph Mallon <christoph mallon gmx de>


# 190930 11-Apr-2009 ed

Fix a bug in r185587.

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>


# 190929 11-Apr-2009 ed

Use ftruncate() instead of lseek()+write()+lseek() to set the created
file (-C) to the requested size.

Submitted by: Christoph Mallon <christoph mallon gmx de>


# 190927 11-Apr-2009 ed

De-static local variables in main() (which is not recursive) and const-ify
others.

Submitted by: Christoph Mallon <christoph mallon gmx de>


# 190925 11-Apr-2009 ed

Show -@ and -C in usage, which were added in r185587.

Submitted by: Christoph Mallon <christoph mallon gmx de>


# 190924 11-Apr-2009 ed

Clean up the usage() function to use a single fprintf().

Submitted by: Christoph Mallon <christoph mallon gmx de>


# 189112 27-Feb-2009 avg

newfs_msdos: allow to work with media that doesn't have any CHS params

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)


# 185594 03-Dec-2008 mlaier

Fix build - cast off_t to (intmax_t) for printing.


# 185587 03-Dec-2008 luigi

Some useful operational extensions to newfs_msdos, especially
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


# 185345 26-Nov-2008 luigi

Create a fake geometry (16 heads, 64 sectors) when dealing with
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


# 170166 31-May-2007 trhodes

The newfs_msdos utility does not store the boot signature in the
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


# 140384 17-Jan-2005 delphij

WARNS=6 cleanup:

- 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.


# 125916 17-Feb-2004 tjr

Remove unnecessary newlines from errx() arguments.


# 106372 03-Nov-2002 scottl

Bring newfs_msdos into the GEOM world. Totally rewrite and simplify
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


# 104429 03-Oct-2002 peter

EFI GPT partitions use 'p' as a slice seperator. eg: da0p1 or da0p217.
(There is a theoretical limit of 16384 partitions)


# 102231 21-Aug-2002 trhodes

s/filesystem/file system/g as discussed on -developers


# 96707 16-May-2002 trhodes

more file system > filesystem


# 66907 09-Oct-2000 wollman

Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).


# 64685 15-Aug-2000 rnordier

Remove redundant code left over on removal of /dev/rXXX handling
in r1.12.


# 64682 15-Aug-2000 rnordier

Partially revert r1.12, in which a warnx() if the device is not a
character device is changed to an errx(). This unnecessarily
compromises device independence.


# 63892 26-Jul-2000 asmodai

Fix the reporting of a raw device node.

Change a warnx to an errx since we should only attempt to use
this utility on a character device.

Approved by: green


# 59215 14-Apr-2000 imp

Better error message for a case that I hit.


# 58814 30-Mar-2000 kato

Added 640KB and 1232KB formats, which were standard MS-DOS formats of
2DD and 2HD disks in Japan.

Submitted by: Shigeharu TAKENO <shige@iee.niit.ac.jp>
Pointed out by: chi@bd.mbn.or.jp (Chiharu Shibata)


# 50476 27-Aug-1999 peter

$Id$ -> $FreeBSD$


# 48954 20-Jul-1999 billf

Avoid ambigious if-else


# 42261 03-Jan-1999 jkh

Clean up some more residual /usr/mdec references. I left all the
extra rbootd/boot rom cruft pointing at /usr/mdec since it either
doesn't exist or doesn't work anyway, so who cares? :)


# 41586 07-Dec-1998 rnordier

Use '#' flag in place of "0x" in format strings.


# 40487 17-Oct-1998 bde

Don't assume that time_t is long.


# 37759 19-Jul-1998 rnordier

Minor consistency fixes.


# 37708 16-Jul-1998 rnordier

Reverse charnier's changes to usage.


# 37665 15-Jul-1998 charnier

Correct use of .Nm. Remove unused #includes. Short usage() string, see man
page for details.


# 37447 06-Jul-1998 rnordier

This commit was generated by cvs2svn to compensate for changes in r37446,
which included commits to RCS files with non-trunk default branches.


# 37446 06-Jul-1998 rnordier

Add newfs_msdos: extensive newfs-style support for creating FAT12,
FAT16, and FAT32 file systems in all their various horriblenesses.

Approved-in-concept by: joerg