Date: Tue, 3 Jun 2025 16:46:03 GMT From: Robert Wing <rew@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 03ad449f6cbd - main - newfs: enable newfs to run on plain files without a bsdlabel Message-ID: <202506031646.553Gk3Qk093943@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=03ad449f6cbd17995111891b438fdc97c50f0f51 commit 03ad449f6cbd17995111891b438fdc97c50f0f51 Author: Robert Wing <rew@FreeBSD.org> AuthorDate: 2025-06-03 16:47:11 +0000 Commit: Robert Wing <rew@FreeBSD.org> CommitDate: 2025-06-03 16:47:11 +0000 newfs: enable newfs to run on plain files without a bsdlabel For awhile now it's been possible to newfs a plain file...however, newfs errors out when the file doesn't have a bsdlabel - this commit changes that. Reviewed by: mckusick Differential Revision: https://reviews.freebsd.org/D50562 --- sbin/newfs/newfs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 9c45c9150955..78a297e6074a 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -342,6 +342,11 @@ main(int argc, char *argv[]) } pp = NULL; lp = getdisklabel(); + /* + * set filesystem size from file size when a bsdlabel isn't present + */ + if (lp == NULL && is_file) + fssize = mediasize / sectorsize; if (lp != NULL) { if (!is_file) /* already set for files */ part_name = special[strlen(special) - 1]; @@ -431,7 +436,7 @@ getdisklabel(void) bootarea + (0 /* labeloffset */ + 1 /* labelsoffset */ * sectorsize), &lab, MAXPARTITIONS)) - errx(1, "no valid label found"); + return (NULL); lp = &lab; return &lab;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202506031646.553Gk3Qk093943>