Commit Graph

97 Commits

Author SHA1 Message Date
Ed Maste
041b03daab newfs_msdos: move mkfs_msdos to separate file for later use in makefs
Sponsored by:	The FreeBSD Foundation
2015-10-15 19:00:33 +00:00
Ed Maste
4d45a6738a newfs_msdos: rework option parsing to match NetBSD
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
2015-10-15 16:19:00 +00:00
Edward Tomasz Napierala
b8c19fd719 It's 2015, and some people are still trying to use fdisk and then
go asking what debug flags to set for GEOM to make it work.  Advice
them to use gpart(8) instead.

Something similar should probably done with disklabel,
but I need to rewrite the disklabel examples first.

Reviewed by:	wblock@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3315
2015-09-02 14:08:43 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Pedro F. Giffuni
67128bdc88 Update documented OEM string in newfs_msdos(8).
This was updated in r203868 to better match the naming scheme
in other OSs that use FAT.

MFC after:	3 days
2015-04-09 19:07:01 +00:00
Warner Losh
a91275f72f Remove old ioctl use and support, once and for all. 2015-01-06 05:28:37 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Pedro F. Giffuni
69905bdec3 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)
MFC after:	3 days
2014-08-13 21:18:31 +00:00
Baptiste Daroussin
bd0891ceb3 use .Mt to mark up email addresses consistently (part1)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:40:43 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Pedro F. Giffuni
b251c17a97 Small cleanup: mostly whitespace vs. tabs. 2014-04-30 21:19:46 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Ed Maste
6bb4cf4fef Correct min/max cluster counts for FAT12/16/32
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
2014-04-24 20:53:09 +00:00
Simon J. Gerraty
3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Sergey Kandaurov
05d98029e9 Sweep man pages replacing ad -> ada.
Approved by:	re (blackend)
MFC after:	1 week
X-MFC note:	stable/9 only
2013-10-01 18:41:53 +00:00
Simon J. Gerraty
d466a5b069 Merge head 2013-09-11 18:16:18 +00:00
Pedro F. Giffuni
a0161728bb 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
2013-09-07 03:10:12 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Pedro F. Giffuni
f4f891a751 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
2013-01-19 03:34:02 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Ed Schouten
6b99842ada Globally replace u_int*_t from (non-contributed) man pages.
The reasoning behind this, is that if we are consistent in our
documentation about the uint*_t stuff, people will be less tempted to
write new code that uses the non-standard types.

I am not going to bump the man page dates, as these changes can be
considered style nits. The meaning of the man pages is unaffected.

MFC after:	1 month
2012-02-12 18:29:56 +00:00
Pedro F. Giffuni
1ac4aa743c 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
2011-12-20 15:50:54 +00:00
Xin LI
658029e0d8 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
2011-11-11 20:31:48 +00:00
Andrey V. Elsukov
20ddb07906 Use NULL instead of 0 for third argument of sigaction(2).
Pointed by:	kib
MFC after:	2 weeks
2011-07-12 10:07:07 +00:00
Andrey V. Elsukov
40be4bee6f Add SIGINFO handler.
Reviewed by:	kib
Obtained from:	NetBSD (partly)
MFC after:	2 weeks
2011-07-12 09:03:38 +00:00
Warner Losh
25faff346c MFtbemd:
Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.
2010-08-23 22:24:11 +00:00
Benedict Reuschling
2c396c7a30 Clarify that the "number of bytes per sector"-range in the
-S option is meant to be "inclusive".

The original issue of the PR was already fixed.

PR:                 docs/142418
Submitted by:       David Naylor (naylor dot b dot david at gmail dot com)
No objection from:  kib
MFC after:          5 days
2010-07-25 11:31:29 +00:00
Konstantin Belousov
2490c5654b Rename variables to match msdosfs headers.
Submitted by:	Pedro F. Giffuni <giffunip tutopia com>
Reviewed by:	bde
MFC after:	2 weeks
2010-02-14 12:25:39 +00:00
Konstantin Belousov
fb95e056a5 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
2010-02-14 12:25:03 +00:00
Ruslan Ermilov
106d839190 Switch the default WARNS level for sbin/ to 6.
Submitted by:	Ulrich Spörlein
2009-10-19 16:00:24 +00:00
Ed Schouten
c4b3a33012 Style fixes to the newfs_msdos manpage.
Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 15:07:27 +00:00
Ed Schouten
7390fae428 Update documentation (forgotten in r190929).
Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 15:03:44 +00:00
Ed Schouten
3c7bcffad2 Do not prepend /dev/ when -C is used.
Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 14:56:29 +00:00
Ed Schouten
36df607c9f 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>
2009-04-11 14:53:32 +00:00
Ed Schouten
f069c0aff0 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>
2009-04-11 14:43:22 +00:00
Ed Schouten
18a064438f 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>
2009-04-11 14:33:10 +00:00
Ed Schouten
20f96000fa De-static local variables in main() (which is not recursive) and const-ify
others.

Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 14:24:54 +00:00
Ed Schouten
101669c6f0 Show -@ and -C in usage, which were added in r185587.
Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 14:20:45 +00:00
Ed Schouten
b64e8d53e7 Clean up the usage() function to use a single fprintf().
Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 14:15:56 +00:00
Andriy Gapon
d461b46dd5 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)
2009-02-27 17:29:48 +00:00
Max Laier
d3adc65594 Fix build - cast off_t to (intmax_t) for printing. 2008-12-03 23:00:57 +00:00
Luigi Rizzo
b87d1601b6 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
2008-12-03 18:22:36 +00:00
Luigi Rizzo
045651ec1e 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
2008-11-26 21:05:03 +00:00