Commit Graph

63 Commits

Author SHA1 Message Date
kib
efd0fb2c01 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
kib
ed09ad9ef8 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
ru
763b9ae1f8 Switch the default WARNS level for sbin/ to 6.
Submitted by:	Ulrich Spörlein
2009-10-19 16:00:24 +00:00
ed
abe2fea9ee Style fixes to the newfs_msdos manpage.
Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 15:07:27 +00:00
ed
ef9b21ff5a Update documentation (forgotten in r190929).
Submitted by:	Christoph Mallon <christoph mallon gmx de>
2009-04-11 15:03:44 +00:00
ed
9f29dae198 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
ac65054d3a 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
98e7a432a7 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
9f361d5f3e 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
b4488507fc 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
95f93b12dc 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
60badb5739 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
avg
53ca38295e 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
mlaier
97597606a6 Fix build - cast off_t to (intmax_t) for printing. 2008-12-03 23:00:57 +00:00
luigi
18b0226daa 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
e7b613e283 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
remko
a233a2bd76 Be more accurate in the maximum filesize, it's 4GB not 4.3GB.
Reported by:	njl
2007-12-09 13:34:10 +00:00
remko
db036cab4d .Ed is not needed here, remove it.
Noticed by:	brueffer
2007-12-08 23:40:11 +00:00
remko
732b0262f6 Add information about the maximum file size for msdosfs.
PR:		docs/112935
Submitted by:	Julian Stacey <jhs at berklix dot org>
		Actually this was inspired by the ticket submitted
		by Julian.
MFC After:	3 days
2007-12-08 22:38:12 +00:00
trhodes
53cf3b5f4a 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
2007-05-31 20:06:46 +00:00
ru
1541af42f1 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
cognet
5f1e82c424 Bring back WARNS to 3 for arm until I figure out how to make gcc happy. 2005-01-24 01:56:06 +00:00
ru
13fe9ea5a2 Sort sections. 2005-01-18 10:09:38 +00:00
delphij
69da99d939 Oops... Remove the line leaked in the last commit which is not
intended to be there...
2005-01-17 14:27:31 +00:00
delphij
3d84f450ff 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.
2005-01-17 14:14:00 +00:00
ru
6cc4b6c220 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
ru
46fddaa54b Mechanically kill hard sentence breaks. 2004-07-02 21:45:06 +00:00
johan
31854a224a style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
tjr
6ddcc8e1b3 Remove unnecessary newlines from errx() arguments. 2004-02-17 02:02:18 +00:00
nyan
aca5ef0c28 Additional PC98 option is not needed. 2003-01-30 15:09:21 +00:00
scottl
00f1ad49da 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
2002-11-03 08:54:46 +00:00
peter
e3b4d3d562 EFI GPT partitions use 'p' as a slice seperator. eg: da0p1 or da0p217.
(There is a theoretical limit of 16384 partitions)
2002-10-04 00:29:26 +00:00
trhodes
136be46680 s/filesystem/file system/g as discussed on -developers 2002-08-21 18:11:48 +00:00
charnier
a2accd01f0 The .Nm utility 2002-07-06 19:34:18 +00:00
trhodes
896f3841bf more file system > filesystem 2002-05-16 04:10:46 +00:00
obrien
9baf2f1b03 Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by:	mike
2001-12-04 02:19:58 +00:00
ru
24c7b0a61d mdoc(7) police: s/BSD/.Bx/ where appropriate. 2001-08-14 10:01:54 +00:00
ru
86642a4ab4 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:33:27 +00:00
ru
56b5d7535b Set the default manual section for sbin/ to 8. 2001-03-20 18:13:31 +00:00
nyan
65a56b38f1 Added pc98 support.
Submitted by:	Akio Morita <amorita@meadow.scphys.kyoto-u.ac.jp>
2001-02-16 13:30:27 +00:00
ru
7fe8bd2b88 Prepare for mdoc(7)NG. 2000-12-18 15:16:24 +00:00
ru
ea31070695 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 16:52:27 +00:00
wollman
c5c43ce91f Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and thereby
<time.h>).
2000-10-10 01:50:26 +00:00
rnordier
dad09ef439 Remove redundant code left over on removal of /dev/rXXX handling
in r1.12.
2000-08-15 18:04:16 +00:00
rnordier
740ddcaef2 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.
2000-08-15 17:42:24 +00:00
rnordier
d4b9ebce72 Consistency fix. 2000-08-06 09:19:45 +00:00
asmodai
393b0e393d 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
2000-07-26 20:12:46 +00:00
kris
2af5f14804 Update device names in examples. 2000-05-07 09:08:31 +00:00
imp
212803777e Better error message for a case that I hit. 2000-04-14 06:10:01 +00:00
kato
f92ead7e07 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)
2000-03-30 03:41:09 +00:00