aboutsummaryrefslogtreecommitdiff
path: root/sbin/newfs_msdos/newfs_msdos.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r351382 (by delphij):Dimitry Andric2020-02-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) for FSI_Nxt_Free instead of providing a wrong value. With this change, fsck_msdosfs would no longer complain about invalid FSInfo information. MFC r355317 (by delphij): newfs_msdos: -A is incompatible with -r, not -o. PR: 242314 Submitted by: Guy Yur <guyyur gmail com> MFC r357227: Merge r357225 from the clang1000-import branch: Fix the following -Werror warning from clang 10.0.0 in newfs_msdos: sbin/newfs_msdos/newfs_msdos.c:181:2: error: misleading indentation; statement is not part of the previous 'if' [-Werror,-Wmisleading-indentation] if (o.align) { ^ sbin/newfs_msdos/newfs_msdos.c:179:5: note: previous statement is here if (argc < 1 || argc > 2) ^ Notes: svn path=/stable/11/; revision=357516
* MFC r355318, r355513Xin LI2019-12-221-3/+2
| | | | | | | | | | | | | | r355318: Explicitly exit() instead of return in main(). r355513: Fix a couple of minor issues with newfs_msdos: - Do not unnecessarily strdup(). - Check return value of getdiskinfo(), if it failed, bail out. Notes: svn path=/stable/11/; revision=355999
* MFC r335189:Xin LI2018-07-161-1/+8
| | | | | | | | | | | | Added option to cluster-align the start of the root directory. Obtained from: Android Obtained from: https://android.googlesource.com/platform/system/core/+/052f27562154d175267999106bd6bf18fc8c363e Obtained from: https://android.googlesource.com/platform/system/core/+/8218b6aae9cd4a19fa074a8a8203fe9275b35447 Differential Revision: https://reviews.freebsd.org/D15672 Notes: svn path=/stable/11/; revision=336329
* MFC r318355,318366: add -T (timestamp) option for reproducible buildsXin LI2018-07-161-2/+23
| | | | Notes: svn path=/stable/11/; revision=336328
* MFC r326276:Eitan Adler2018-03-051-1/+3
| | | | | | | | | | | | | | | | | | | various: general adoption of SPDX licensing ID tags. 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. Notes: svn path=/stable/11/; revision=330449
* Use netbsd usage() implementation in newfs_msdosEd Maste2015-11-271-27/+14
| | | | | | | | | | In r289629 newfs_msdos option descriptions are available in mkfs_msdos.h. Obtained from: NetBSD Notes: svn path=/head/; revision=291385
* newfs_msdos: rework error handling for eventual use in makefsEd Maste2015-11-231-1/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=291219
* newfs_msdos: move mkfs_msdos to separate file for later use in makefsEd Maste2015-10-151-835/+2
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=289376
* newfs_msdos: rework option parsing to match NetBSDEd Maste2015-10-151-125/+162
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=289369
* Remove old ioctl use and support, once and for all.Warner Losh2015-01-061-20/+18
| | | | Notes: svn path=/head/; revision=276737
* Use "NO NAME" as the default unnamed label.Pedro F. Giffuni2014-08-131-1/+1
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=269953
* Small cleanup: mostly whitespace vs. tabs.Pedro F. Giffuni2014-04-301-31/+31
| | | | Notes: svn path=/head/; revision=265164
* Correct min/max cluster counts for FAT12/16/32Ed Maste2014-04-241-5/+5
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=264889
* newfs_msdos: fix inaccurate comments.Pedro F. Giffuni2013-09-071-2/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=255339
* newfs_msdos: cosmetical cleanupsPedro F. Giffuni2013-01-191-4/+4
| | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=245648
* Many style fixes.Pedro F. Giffuni2011-12-201-59/+79
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=228740
* Use __packed to prevent alignment from taking place, which otherwise mayXin LI2011-11-111-5/+5
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=227454
* Use NULL instead of 0 for third argument of sigaction(2).Andrey V. Elsukov2011-07-121-1/+1
| | | | | | | | Pointed by: kib MFC after: 2 weeks Notes: svn path=/head/; revision=223946
* Add SIGINFO handler.Andrey V. Elsukov2011-07-121-0/+24
| | | | | | | | | Reviewed by: kib Obtained from: NetBSD (partly) MFC after: 2 weeks Notes: svn path=/head/; revision=223945
* Rename variables to match msdosfs headers.Konstantin Belousov2010-02-141-245/+246
| | | | | | | | | Submitted by: Pedro F. Giffuni <giffunip tutopia com> Reviewed by: bde MFC after: 2 weeks Notes: svn path=/head/; revision=203869
* Some cleanups from NetBSD:Konstantin Belousov2010-02-141-19/+22
| | | | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=203868
* Do not prepend /dev/ when -C is used.Ed Schouten2009-04-111-1/+1
| | | | | | | Submitted by: Christoph Mallon <christoph mallon gmx de> Notes: svn path=/head/; revision=190932
* When using -C, do not warn when the file is not a character device, but warn ↵Ed Schouten2009-04-111-2/+7
| | | | | | | | | when it is not a regular file. Submitted by: Christoph Mallon <christoph mallon gmx de> Notes: svn path=/head/; revision=190931
* Fix a bug in r185587.Ed Schouten2009-04-111-2/+3
| | | | | | | | | | 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> Notes: svn path=/head/; revision=190930
* Use ftruncate() instead of lseek()+write()+lseek() to set the createdEd Schouten2009-04-111-5/+1
| | | | | | | | | file (-C) to the requested size. Submitted by: Christoph Mallon <christoph mallon gmx de> Notes: svn path=/head/; revision=190929
* De-static local variables in main() (which is not recursive) and const-ifyEd Schouten2009-04-111-10/+10
| | | | | | | | | others. Submitted by: Christoph Mallon <christoph mallon gmx de> Notes: svn path=/head/; revision=190927
* Show -@ and -C in usage, which were added in r185587.Ed Schouten2009-04-111-0/+2
| | | | | | | Submitted by: Christoph Mallon <christoph mallon gmx de> Notes: svn path=/head/; revision=190925
* Clean up the usage() function to use a single fprintf().Ed Schouten2009-04-111-26/+25
| | | | | | | Submitted by: Christoph Mallon <christoph mallon gmx de> Notes: svn path=/head/; revision=190924
* newfs_msdos: allow to work with media that doesn't have any CHS paramsAndriy Gapon2009-02-271-5/+17
| | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=189112
* Fix build - cast off_t to (intmax_t) for printing.Max Laier2008-12-031-2/+3
| | | | Notes: svn path=/head/; revision=185594
* Some useful operational extensions to newfs_msdos, especiallyLuigi Rizzo2008-12-031-8/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=185587
* Create a fake geometry (16 heads, 64 sectors) when dealing withLuigi Rizzo2008-11-261-3/+14
| | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=185345
* The newfs_msdos utility does not store the boot signature in theTom Rhodes2007-05-311-6/+6
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=170166
* WARNS=6 cleanup:Xin LI2005-01-171-16/+16
| | | | | | | | | | - 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. Notes: svn path=/head/; revision=140384
* Remove unnecessary newlines from errx() arguments.Tim J. Robbins2004-02-171-4/+4
| | | | Notes: svn path=/head/; revision=125916
* Bring newfs_msdos into the GEOM world. Totally rewrite and simplifyScott Long2002-11-031-83/+49
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=106372
* EFI GPT partitions use 'p' as a slice seperator. eg: da0p1 or da0p217.Peter Wemm2002-10-041-1/+1
| | | | | | | (There is a theoretical limit of 16384 partitions) Notes: svn path=/head/; revision=104429
* s/filesystem/file system/g as discussed on -developersTom Rhodes2002-08-211-13/+13
| | | | Notes: svn path=/head/; revision=102231
* more file system > filesystemTom Rhodes2002-05-161-13/+13
| | | | Notes: svn path=/head/; revision=96707
* Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and therebyGarrett Wollman2000-10-101-1/+3
| | | | | | | <time.h>). Notes: svn path=/head/; revision=66907
* Remove redundant code left over on removal of /dev/rXXX handlingRobert Nordier2000-08-151-2/+0
| | | | | | | in r1.12. Notes: svn path=/head/; revision=64685
* Partially revert r1.12, in which a warnx() if the device is not aRobert Nordier2000-08-151-1/+1
| | | | | | | | character device is changed to an errx(). This unnecessarily compromises device independence. Notes: svn path=/head/; revision=64682
* Fix the reporting of a raw device node.Jeroen Ruigrok van der Werven2000-07-261-2/+2
| | | | | | | | | | Change a warnx to an errx since we should only attempt to use this utility on a character device. Approved by: green Notes: svn path=/head/; revision=63892
* Better error message for a case that I hit.Warner Losh2000-04-141-1/+2
| | | | Notes: svn path=/head/; revision=59215
* Added 640KB and 1232KB formats, which were standard MS-DOS formats ofKATO Takenori2000-03-301-0/+2
| | | | | | | | | | 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) Notes: svn path=/head/; revision=58814
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Avoid ambigious if-elseBill Fumerola1999-07-211-4/+7
| | | | Notes: svn path=/head/; revision=48954
* Clean up some more residual /usr/mdec references. I left all theJordan K. Hubbard1999-01-031-2/+2
| | | | | | | | extra rbootd/boot rom cruft pointing at /usr/mdec since it either doesn't exist or doesn't work anyway, so who cares? :) Notes: svn path=/head/; revision=42261
* Use '#' flag in place of "0x" in format strings.Robert Nordier1998-12-071-5/+5
| | | | Notes: svn path=/head/; revision=41586
* Don't assume that time_t is long.Bruce Evans1998-10-171-2/+4
| | | | Notes: svn path=/head/; revision=40487