aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/newfs_msdos
Commit message (Collapse)AuthorAgeFilesLines
* Fix makefs bootstrap on macOS after D25563Alex Richardson2020-08-251-0/+1
| | | | | | | | | | | The macOS assert.h header does not define static_assert when compiling in C99 mode. To fix this compile with -std=c11. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D25928 Notes: svn path=/head/; revision=364765
* Use KERN_MAXPHYS.Xin LI2020-07-051-19/+46
| | | | | | | | | | Suggested by: imp Reviewed by: imp, cem (earlier version), emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25563 Notes: svn path=/head/; revision=362937
* Gather writes to larger chunks (MAXPHYS) instead of issuing them inXin LI2020-07-041-18/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | sectors. On my SanDisk Cruzer Blade 16GB USB stick this made formatting much faster: x before + after +--------------------------------------------------------------------------+ |+ | |+ x | |+ x x| |A MA|| +--------------------------------------------------------------------------+ N Min Max Median Avg Stddev x 3 15.89 16.38 16 16.09 0.2570992 + 3 0.32 0.37 0.35 0.34666667 0.025166115 Difference at 95.0% confidence -15.7433 +/- 0.414029 -97.8455% +/- 0.25668% (Student's t, pooled s = 0.182665) Reviewed by: emaste MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D24508 Notes: svn path=/head/; revision=362936
* Fix the following -Werror warning from clang 10.0.0 in newfs_msdos:Dimitry Andric2020-01-281-4/+4
| | | | | | | | | | | | | | 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) ^ MFC after: 3 days Notes: svn path=/projects/clang1000-import/; revision=357225
* Allow bootstrapping makefs on older FreeBSD hosts and Linux/macOSAlex Richardson2020-01-271-11/+44
| | | | | | | | | | | | | | | | | | | | | | In order to do so we need to install the msdosfs headers to the bootstrap sysroot and avoid includes of kernel headers that may not exist on every host (e.g. sys/lockmgr.h). This change should allow bootstrapping of makefs on FreeBSD 11+ as well as Linux and macOS. We also have to avoid using the IO_SYNC macro since that may not be available. In makefs it is only used to switch between calling bwrite() and bdwrite() which both call the same function. Therefore we can simply always call bwrite(). For our CheriBSD builds we always bootstrap makefs by setting LOCAL_XTOOL_DIRS='lib/libnetbsd usr.sbin/makefs' and use the makefs binary from the build tree to create a bootable disk image. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D23201 Notes: svn path=/head/; revision=357169
* Fix a couple of minor issues with newfs_msdos:Xin LI2019-12-082-7/+4
| | | | | | | | | | | | - Do not unnecessarily strdup(). - Check return value of getdiskinfo(), if it failed, bail out. Reviewed by: imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22729 Notes: svn path=/head/; revision=355513
* Explicitly exit() instead of return in main().Xin LI2019-12-031-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=355318
* newfs_msdos: -A is incompatible with -r, not -o.Xin LI2019-12-031-1/+1
| | | | | | | | | PR: 242314 Submitted by: Guy Yur <guyyur gmail com> MFC after: 2 weeks Notes: svn path=/head/; revision=355317
* makefs: avoid warning when creating FAT filesystem on existing fileEd Maste2019-11-081-0/+2
| | | | | | | | | | | | | | Previously the mkfs_msdos function (from newfs_msdos) emitted warnings in the case that an image size is specified and the target is not a file, or no size is specified and the target is not a character device. The latter warning (not a character device) doesn't make sense when this code is used in makefs, regardless of whether an image size is specified or not. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354537
* When creating a new FAT32 filesystem, use "unknown" (0xFFFFFFFF) forXin LI2019-08-221-1/+1
| | | | | | | | | | | | FSI_Nxt_Free instead of providing a wrong value. With this change, fsck_msdosfs would no longer complain about invalid FSInfo information. MFC after: 2 weeks Notes: svn path=/head/; revision=351382
* Added option to cluster-align the start of the root directory.Xin LI2018-06-154-47/+93
| | | | | | | | | | | Obtained from: Android Obtained from: https://android.googlesource.com/platform/system/core/+/052f27562154d175267999106bd6bf18fc8c363e Obtained from: https://android.googlesource.com/platform/system/core/+/8218b6aae9cd4a19fa074a8a8203fe9275b35447 MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D15672 Notes: svn path=/head/; revision=335189
* Only call close if fd and fd1 are not -1.Warner Losh2018-01-051-2/+4
| | | | | | | CID: 1384018, 1384017 Notes: svn path=/head/; revision=327570
* Close fd and fd1 before returning now that we're done with them.Warner Losh2017-12-281-0/+3
| | | | | | | CID: 978234, 978236 Notes: svn path=/head/; revision=327275
* various: general adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-1/+3
| | | | | | | | | | | | | | | | | 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=/head/; revision=326276
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* newfs_msdos: clarify description of -T (timestamp) optionEd Maste2017-05-161-9/+11
| | | | | | | | | | Submitted by: Siva Mahadevan <smahadevan@freebsdfoundation.org> Reported by: Daniel Shahaf <danielsh apache org> Reviewed by: emaste Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=318366
* newfs_msdos: add -T (timestamp) option for reproducible buildsEd Maste2017-05-164-6/+44
| | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=318355
* The code only converts from bpbHugeSectors to bpbSectors if the sum ofWarner Losh2016-08-301-1/+1
| | | | | | | | | | | | | | | the hidden and huge sectors is less than or equal MAXU16. When formatting in Windows bpbSectors is still used for 63488 sectors and 2048 hidden (sum > MAXU16). The hidden sectors count is the number of sectors before the FAT16 Boot Record so it shouldn't affect the sector count. Attached patch (huge_sec_conversion.patch) to only check for bpb.bpbHugeSectors <= MAXU16 when converting to bpbSectors. Submitted by: Guy Yur PR: 183234 Notes: svn path=/head/; revision=305075
* Remove CHS alignment. It's not needed and causes problems for the BBBWarner Losh2016-08-301-7/+0
| | | | | | | | | | boot partition. NetBSD removed it in 1.10 in their repo some time ago. Submitted by: Guy Yur PR: 183234 Notes: svn path=/head/; revision=305074
* Use nitems() from sys/param.h.Marcelo Araujo2016-04-191-1/+1
| | | | | | | MFC after: 2 weeks. Notes: svn path=/head/; revision=298250
* Explicitly add more files to the 'runtime' package.Glen Barber2016-02-091-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295450
* Fix leak in mkfs_msdos(..) by initializing img to NULL and free'ing at the endEnji Cooper2015-12-061-40/+47
| | | | | | | | | | | | | | of the function Differential Revision: https://reviews.freebsd.org/D4405 MFC after: 1 week PR: 204943 Reviewed by: emaste, jilles Reported by: David Binderman <dcb314@hotmail.com> Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291908
* 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
* mkfs_msdos: sync with NetBSDEd Maste2015-11-271-3/+8
| | | | | | | | | Add a sanity test and clean up whitespace. Obtained from: NetBSD Notes: svn path=/head/; revision=291382
* newfs_msdos: rework error handling for eventual use in makefsEd Maste2015-11-232-98/+191
| | | | | | | | | | | 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
* Update $NetBSD$ IDEd Maste2015-11-231-1/+1
| | | | | | | | | NetBSD mkfs_msdos.h rev 1.3 removed the no-endorsement clause from the license block, which had already been done in the source I imported in r289629. Notes: svn path=/head/; revision=291218
* newfs_msdos: use NetBSD's mkfs_msdos.h verbatim for makefs compatibilityEd Maste2015-10-201-42/+50
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=289629
* newfs_msdos: prefer snprintf to sprintfEd Maste2015-10-161-1/+1
| | | | | | | | Obtained from: NetBSD Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=289424
* newfs_msdos: move mkfs_msdos to separate file for later use in makefsEd Maste2015-10-154-835/+918
| | | | | | | 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
* It's 2015, and some people are still trying to use fdisk and thenEdward Tomasz Napierala2015-09-021-3/+1
| | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=287396
* Add META_MODE support.Simon J. Gerraty2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=284345
| * dirdeps.mk now sets DEP_RELDIRSimon J. Gerraty2015-06-081-2/+0
| | | | | | | | Notes: svn path=/projects/bmake/; revision=284172
| * Merge sync of headSimon J. Gerraty2015-05-272-22/+20
| |\ | |/ |/| | | Notes: svn path=/projects/bmake/; revision=283595
| * Merge from head@274682Simon J. Gerraty2014-11-191-1/+1
| |\ | | | | | | | | | Notes: svn path=/projects/bmake/; revision=274683
| * \ Merge head from 7/28Simon J. Gerraty2014-08-191-1/+1
| |\ \ | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=270164
| * | | Updated dependenciesSimon J. Gerraty2014-05-161-1/+0
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=266219
| * | | Updated dependenciesSimon J. Gerraty2014-05-101-0/+2
| | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265802
| * | | Merge from headSimon J. Gerraty2014-05-081-31/+31
| |\ \ \ | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265720
| * \ \ \ Merge headSimon J. Gerraty2014-04-281-5/+5
| |\ \ \ \ | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=265044
| * \ \ \ \ Merge head@256284Simon J. Gerraty2013-10-131-3/+3
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=256424
| * \ \ \ \ \ Merge headSimon J. Gerraty2013-09-111-2/+2
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=255477
| * | | | | | | Updated dependenciesSimon J. Gerraty2013-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=248169
| * | | | | | | Updated dependenciesSimon J. Gerraty2013-02-161-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246868
| * | | | | | | Sync with HEAD.David E. O'Brien2013-02-081-4/+4
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | Notes: svn path=/projects/bmake/; revision=246555
| * | | | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.Marcel Moolenaar2012-08-221-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net> Notes: svn path=/projects/bmake/; revision=239572
* | | | | | | | | Update documented OEM string in newfs_msdos(8).Pedro F. Giffuni2015-04-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was updated in r203868 to better match the naming scheme in other OSs that use FAT. MFC after: 3 days Notes: svn path=/head/; revision=281320
* | | | | | | | | 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
* | | | | | | use .Mt to mark up email addresses consistently (part1)Baptiste Daroussin2014-06-201-1/+1
| |_|_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR: 191174 Submitted by: Franco Fichtner <franco@lastsummer.de> Notes: svn path=/head/; revision=267667