CVS commit: src/sbin/newfs

2024-05-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri May 10 20:36:34 UTC 2024

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
s/superbock/superblock/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sbin/newfs/mkfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/newfs

2024-05-10 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri May 10 20:36:34 UTC 2024

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
s/superbock/superblock/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/sbin/newfs/mkfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.136 src/sbin/newfs/mkfs.c:1.137
--- src/sbin/newfs/mkfs.c:1.136	Thu Feb 22 02:11:29 2024
+++ src/sbin/newfs/mkfs.c	Fri May 10 20:36:34 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.137 2024/05/10 20:36:34 andvar Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.137 2024/05/10 20:36:34 andvar Exp $");
 #endif
 #endif /* not lint */
 
@@ -611,7 +611,7 @@ mkfs(const char *fsys, int fi, int fo,
 
 		/*
 		 * Ensure there is nothing that looks like a filesystem
-		 * superbock anywhere other than where ours will be.
+		 * superblock anywhere other than where ours will be.
 		 * If fsck finds the wrong one all hell breaks loose!
 		 */
 		for (i = 0; ; i++) {



CVS commit: src/sbin/newfs

2024-02-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 22 02:11:29 UTC 2024

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
if the window size works but is 0, assume it didn't work and use 80.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sbin/newfs/mkfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/newfs

2024-02-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Feb 22 02:11:29 UTC 2024

Modified Files:
src/sbin/newfs: mkfs.c

Log Message:
if the window size works but is 0, assume it didn't work and use 80.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sbin/newfs/mkfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.135 src/sbin/newfs/mkfs.c:1.136
--- src/sbin/newfs/mkfs.c:1.135	Wed Jul  5 10:58:58 2023
+++ src/sbin/newfs/mkfs.c	Thu Feb 22 02:11:29 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -672,7 +672,8 @@ mkfs(const char *fsys, int fi, int fo,
 	fld_width = verbosity < 4 ? 1 : snprintf(NULL, 0, "%" PRIu64, 
 		(uint64_t)FFS_FSBTODB(, cgsblock(, sblock.fs_ncg-1)));
 	/* Get terminal width */
-	if (ioctl(fileno(stdout), TIOCGWINSZ, ) == 0)
+	if (ioctl(fileno(stdout), TIOCGWINSZ, ) == 0 &&
+	winsize.ws_col != 0)
 		max_cols = winsize.ws_col;
 	else
 		max_cols = 80;



Re: CVS commit: src/sbin/newfs

2023-07-05 Thread Greg Troxel
Taylor R Campbell  writes:

> Well, what happened is:
>
> 1. I was drafting posix_memalign and aligned_alloc for libbsdmalloc in
>response to the thread about static program size yesterday, and
>carefully reading the specs -- POSIX 2018, C11 -- to make sure I
>got all the details right.
>
> 2. I saw a silly restriction in C11, that aligned_alloc(A, S) requires
>A to divide S.
>
> 3. For the sake of encouraging portable code, I figured we should
>enforce that restriction, so I went ahead and did that in both the
>libbsdmalloc front end I was writing and in jemalloc.  (This caused
>a bunch of tests to start failing.)
>
> 4. I audited all the uses of aligned_alloc in tree to make sury they
>meet the restriction (which fixed the tests).
>
> 5. Someone pointed out that the silly restriction that was imposed in
>C11 had actually been lifted in C17:
>
> (C11) The value of alignment shall be a valid alignment
> supported by the implementation and the value of size shall be
> an integral multiple of alignment.
>
> (C17) If the value of alignment is not a valid alignment
> supported by the implementation the function shall fail by
> returning a null pointer.
>
> 6. So I reverted the jemalloc enforcement of the C11 restriction, and
>reverted the fixes made to conform to it, and removed the
>restriction in the new libbsdmalloc code, and we're more or less
>back to where we started.
>
> Except I am now reminded that I updated t_posix_memalign.c to verify
> this silly restriction of aligned_alloc, so I'd better go fix that
> before a bunch of tests start failing again!

Thanks for taking the time to explain so thoroughly.  So we are back to
status quo ante-fixum, which is by definition always ok :-)


Re: CVS commit: src/sbin/newfs

2023-07-05 Thread Taylor R Campbell
> Date: Wed, 05 Jul 2023 07:03:09 -0400
> From: Greg Troxel 
> References: <20230705105858.33080f...@cvs.netbsd.org>
> 
> "Taylor R Campbell"  writes:
> 
> > Revert "newfs(8): Ensure A divides S before aligned_alloc(A, S)."
> >
> > C17 lifted this restriction.
> 
> I know we have only two toolchains maintained in tree, but did we really
> decide to require C17?

Well, what happened is:

1. I was drafting posix_memalign and aligned_alloc for libbsdmalloc in
   response to the thread about static program size yesterday, and
   carefully reading the specs -- POSIX 2018, C11 -- to make sure I
   got all the details right.

2. I saw a silly restriction in C11, that aligned_alloc(A, S) requires
   A to divide S.

3. For the sake of encouraging portable code, I figured we should
   enforce that restriction, so I went ahead and did that in both the
   libbsdmalloc front end I was writing and in jemalloc.  (This caused
   a bunch of tests to start failing.)

4. I audited all the uses of aligned_alloc in tree to make sury they
   meet the restriction (which fixed the tests).

5. Someone pointed out that the silly restriction that was imposed in
   C11 had actually been lifted in C17:

(C11) The value of alignment shall be a valid alignment
supported by the implementation and the value of size shall be
an integral multiple of alignment.

(C17) If the value of alignment is not a valid alignment
supported by the implementation the function shall fail by
returning a null pointer.

6. So I reverted the jemalloc enforcement of the C11 restriction, and
   reverted the fixes made to conform to it, and removed the
   restriction in the new libbsdmalloc code, and we're more or less
   back to where we started.

Except I am now reminded that I updated t_posix_memalign.c to verify
this silly restriction of aligned_alloc, so I'd better go fix that
before a bunch of tests start failing again!


CVS commit: src/sbin/newfs

2023-07-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  5 10:58:58 UTC 2023

Modified Files:
src/sbin/newfs: mkfs.c newfs.c

Log Message:
Revert "newfs(8): Ensure A divides S before aligned_alloc(A, S)."

C17 lifted this restriction.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sbin/newfs/mkfs.c
cvs rdiff -u -r1.119 -r1.120 src/sbin/newfs/newfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.134 src/sbin/newfs/mkfs.c:1.135
--- src/sbin/newfs/mkfs.c:1.134	Tue Jul  4 20:40:34 2023
+++ src/sbin/newfs/mkfs.c	Wed Jul  5 10:58:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.134 2023/07/04 20:40:34 riastradh Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mkfs.c,v 1.134 2023/07/04 20:40:34 riastradh Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.135 2023/07/05 10:58:58 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -201,11 +201,9 @@ mkfs(const char *fsys, int fi, int fo,
 			exit(12);
 	}
 #endif
-	__CTASSERT((sizeof(*fsun) % DEV_BSIZE) == 0);
 	if ((fsun = aligned_alloc(DEV_BSIZE, sizeof(*fsun))) == NULL)
 		exit(12);
 	memset(fsun, 0, sizeof(*fsun));
-	__CTASSERT((sizeof(*cgun) % DEV_BSIZE) == 0);
 	if ((cgun = aligned_alloc(DEV_BSIZE, sizeof(*cgun))) == NULL)
 		exit(12);
 	memset(cgun, 0, sizeof(*cgun));

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.119 src/sbin/newfs/newfs.c:1.120
--- src/sbin/newfs/newfs.c:1.119	Tue Jul  4 20:40:34 2023
+++ src/sbin/newfs/newfs.c	Wed Jul  5 10:58:58 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.119 2023/07/04 20:40:34 riastradh Exp $	*/
+/*	$NetBSD: newfs.c,v 1.120 2023/07/05 10:58:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.119 2023/07/04 20:40:34 riastradh Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.120 2023/07/05 10:58:58 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -624,9 +624,7 @@ main(int argc, char *argv[])
 		} else
 			bufsize = sfs.f_iosize;
 
-		__CTASSERT(powerof2(DEV_BSIZE));
-		if ((buf = aligned_alloc(DEV_BSIZE,
-			roundup2(bufsize, DEV_BSIZE))) == NULL)
+		if ((buf = aligned_alloc(DEV_BSIZE, bufsize)) == NULL)
 			err(1, "can't malloc buffer of %d",
 			bufsize);
 		memset(buf, 0, bufsize);



CVS commit: src/sbin/newfs

2023-07-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  5 10:58:58 UTC 2023

Modified Files:
src/sbin/newfs: mkfs.c newfs.c

Log Message:
Revert "newfs(8): Ensure A divides S before aligned_alloc(A, S)."

C17 lifted this restriction.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sbin/newfs/mkfs.c
cvs rdiff -u -r1.119 -r1.120 src/sbin/newfs/newfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sbin/newfs

2023-07-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul  4 20:40:34 UTC 2023

Modified Files:
src/sbin/newfs: mkfs.c newfs.c

Log Message:
newfs(8): Ensure A divides S before aligned_alloc(A, S).

Required by C11 Sec. 7.22.3.1 The aligned_alloc function, para. 2,
p. 348:

   The value of alignment shall be a valid alignment supported by the
   implementation and the value of size shall be an integral multiple
   of alignment.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sbin/newfs/mkfs.c
cvs rdiff -u -r1.118 -r1.119 src/sbin/newfs/newfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs/mkfs.c
diff -u src/sbin/newfs/mkfs.c:1.133 src/sbin/newfs/mkfs.c:1.134
--- src/sbin/newfs/mkfs.c:1.133	Sat Jan  7 19:41:29 2023
+++ src/sbin/newfs/mkfs.c	Tue Jul  4 20:40:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.133 2023/01/07 19:41:29 chs Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.134 2023/07/04 20:40:34 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1980, 1989, 1993
@@ -73,7 +73,7 @@
 #if 0
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
-__RCSID("$NetBSD: mkfs.c,v 1.133 2023/01/07 19:41:29 chs Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.134 2023/07/04 20:40:34 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -201,9 +201,11 @@ mkfs(const char *fsys, int fi, int fo,
 			exit(12);
 	}
 #endif
+	__CTASSERT((sizeof(*fsun) % DEV_BSIZE) == 0);
 	if ((fsun = aligned_alloc(DEV_BSIZE, sizeof(*fsun))) == NULL)
 		exit(12);
 	memset(fsun, 0, sizeof(*fsun));
+	__CTASSERT((sizeof(*cgun) % DEV_BSIZE) == 0);
 	if ((cgun = aligned_alloc(DEV_BSIZE, sizeof(*cgun))) == NULL)
 		exit(12);
 	memset(cgun, 0, sizeof(*cgun));

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.118 src/sbin/newfs/newfs.c:1.119
--- src/sbin/newfs/newfs.c:1.118	Thu Nov 17 06:40:39 2022
+++ src/sbin/newfs/newfs.c	Tue Jul  4 20:40:34 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.118 2022/11/17 06:40:39 chs Exp $	*/
+/*	$NetBSD: newfs.c,v 1.119 2023/07/04 20:40:34 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.118 2022/11/17 06:40:39 chs Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.119 2023/07/04 20:40:34 riastradh Exp $");
 #endif
 #endif /* not lint */
 
@@ -624,7 +624,9 @@ main(int argc, char *argv[])
 		} else
 			bufsize = sfs.f_iosize;
 
-		if ((buf = aligned_alloc(DEV_BSIZE, bufsize)) == NULL)
+		__CTASSERT(powerof2(DEV_BSIZE));
+		if ((buf = aligned_alloc(DEV_BSIZE,
+			roundup2(bufsize, DEV_BSIZE))) == NULL)
 			err(1, "can't malloc buffer of %d",
 			bufsize);
 		memset(buf, 0, bufsize);



CVS commit: src/sbin/newfs

2023-07-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Jul  4 20:40:34 UTC 2023

Modified Files:
src/sbin/newfs: mkfs.c newfs.c

Log Message:
newfs(8): Ensure A divides S before aligned_alloc(A, S).

Required by C11 Sec. 7.22.3.1 The aligned_alloc function, para. 2,
p. 348:

   The value of alignment shall be a valid alignment supported by the
   implementation and the value of size shall be an integral multiple
   of alignment.

XXX pullup-10


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sbin/newfs/mkfs.c
cvs rdiff -u -r1.118 -r1.119 src/sbin/newfs/newfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/sbin/newfs

2016-09-13 Thread Robert Elz
Date:Tue, 13 Sep 2016 00:50:30 +0100
From:Sevan Janiyan 
Message-ID:  <2d30ad57-2341-3b08-1d78-32b468cd5...@netbsd.org>

  | I can't seem to find the 4.3BSD-Reno release notes at the moment, but
  | the convention is interim releases do not count.
  | There are examples of that where 4.2BSD is being referenced in inherited
  | man pages when in-fact the tools actually showed up in 4.1{a,b,c}.

I think it is reasonable to ignore 4.1a (etc) for this kind of purpose,
but as I recall, 4.3 Reno & Tahoe were really full releases

kre



Re: CVS commit: src/sbin/newfs

2016-09-12 Thread Sevan Janiyan
On 13/09/2016 00:09, matthew green wrote:
> that never stopped them being referenced before.  infact, the macros
> appear know what they mean because it transforms:
> 
>.Bx 4.3 tahoe .
> 
> into:
> 
>The shells file format appeared in 4.3BSD-Tahoe.
> 
> ie, it capitalises and adds the dash.  i think it matter because there
> was a very long time between each of 4.3, reno, tahoe, 4.4 (closed)
> and 4.4-lite (and lite2).

For memfs support, it was actually covered in the 4.4BSD Release notes.
https://groups.google.com/d/msg/comp.unix.bsd/hZYO7xTDqQ8/NE-S-HWH9-wJ

"We  have also added amemory-based filesystem that runs in pageable
memory, allowing  large temporary filesystems without requiring
dedicated physical memory."

I can't seem to find the 4.3BSD-Reno release notes at the moment, but
the convention is interim releases do not count.
There are examples of that where 4.2BSD is being referenced in inherited
man pages when in-fact the tools actually showed up in 4.1{a,b,c}.



Sevan


re: CVS commit: src/sbin/newfs

2016-09-12 Thread matthew green
Sevan Janiyan writes:
> On 12/09/2016 22:02, matthew green wrote:
> > wouldn't "09/06/89" put it in 4.3RENO ?  from bsd-family-tree:
> > 
> > 4.3BSD Reno 1990-06-29 [QCU], [DOC]
> > 
> > 
> > .mrg.
> 
> Reno & Tahoe along with 4.1{a,b,c} were interim/beta releases.

that never stopped them being referenced before.  infact, the macros
appear know what they mean because it transforms:

   .Bx 4.3 tahoe .

into:

   The shells file format appeared in 4.3BSD-Tahoe.

ie, it capitalises and adds the dash.  i think it matter because there
was a very long time between each of 4.3, reno, tahoe, 4.4 (closed)
and 4.4-lite (and lite2).


.mrg.


re: CVS commit: src/sbin/newfs

2016-09-12 Thread matthew green
> Log Message:
> Memory File System support appeared in 4.4BSD, implemented as an extension to
> newfs(8). So while newfs may have appeared in 4.2BSD, MFS support was later.
> https://svnweb.freebsd.org/csrg/sbin/newfs/Makefile?r1=39047=39051
> Adjust HISTORY.
> Bump date.

wouldn't "09/06/89" put it in 4.3RENO ?  from bsd-family-tree:

4.3BSD Reno 1990-06-29 [QCU], [DOC]


.mrg.