CVS commit: src/usr.sbin/makefs

2024-06-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 17 23:53:42 UTC 2024

Modified Files:
src/usr.sbin/makefs: ffs.c

Log Message:
makefs(8): Fix format string for newly 64-bit target inode numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.sbin/makefs/ffs.c

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

Modified files:

Index: src/usr.sbin/makefs/ffs.c
diff -u src/usr.sbin/makefs/ffs.c:1.75 src/usr.sbin/makefs/ffs.c:1.76
--- src/usr.sbin/makefs/ffs.c:1.75	Thu Dec 28 12:13:55 2023
+++ src/usr.sbin/makefs/ffs.c	Mon Jun 17 23:53:42 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs.c,v 1.75 2023/12/28 12:13:55 tsutsui Exp $	*/
+/*	$NetBSD: ffs.c,v 1.76 2024/06/17 23:53:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -71,7 +71,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.75 2023/12/28 12:13:55 tsutsui Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.76 2024/06/17 23:53:42 riastradh Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -826,8 +826,8 @@ ffs_populate_dir(const char *dir, fsnode
 			root, fsopts);
 
 		if (debug & DEBUG_FS_POPULATE_NODE) {
-			printf("ffs_populate_dir: writing ino %d, %s",
-			cur->inode->ino, inode_type(cur->type));
+			printf("ffs_populate_dir: writing ino %lld, %s",
+			(long long)cur->inode->ino, inode_type(cur->type));
 			if (cur->inode->nlink > 1)
 printf(", nlink %d", cur->inode->nlink);
 			putchar('\n');



CVS commit: src/usr.sbin/makefs

2024-06-17 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Jun 17 23:53:42 UTC 2024

Modified Files:
src/usr.sbin/makefs: ffs.c

Log Message:
makefs(8): Fix format string for newly 64-bit target inode numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/usr.sbin/makefs/ffs.c

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



CVS commit: src/usr.sbin/makefs

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 20:22:20 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Bump inode number on target FS from 32 bits to 64 bits


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/makefs/makefs.h

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



CVS commit: src/usr.sbin/makefs

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 20:22:20 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Bump inode number on target FS from 32 bits to 64 bits


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/usr.sbin/makefs/makefs.h

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

Modified files:

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.41 src/usr.sbin/makefs/makefs.h:1.42
--- src/usr.sbin/makefs/makefs.h:1.41	Sun Feb 18 16:59:16 2024
+++ src/usr.sbin/makefs/makefs.h	Mon Jun 17 20:22:20 2024
@@ -89,7 +89,7 @@ enum fi_flags {
 };
 
 typedef struct {
-	uint32_t	 ino;		/* inode number used on target fs */
+	uint64_t	 ino;		/* inode number used on target fs */
 	uint32_t	 nlink;		/* number of links to this entry */
 	enum fi_flags	 flags;		/* flags used by fs specific code */
 	struct stat	 st;		/* stat entry */



CVS commit: src/usr.sbin/makefs/cd9660

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 13:31:17 UTC 2024

Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_conversion.c

Log Message:
We know the target string buffer only needs 18 but gcc can't figure this out.
Fixes compiling with -Werror=format-truncation


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makefs/cd9660/cd9660_conversion.c

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



CVS commit: src/usr.sbin/makefs/cd9660

2024-06-17 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Mon Jun 17 13:31:17 UTC 2024

Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_conversion.c

Log Message:
We know the target string buffer only needs 18 but gcc can't figure this out.
Fixes compiling with -Werror=format-truncation


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makefs/cd9660/cd9660_conversion.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660/cd9660_conversion.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_conversion.c:1.5 src/usr.sbin/makefs/cd9660/cd9660_conversion.c:1.6
--- src/usr.sbin/makefs/cd9660/cd9660_conversion.c:1.5	Wed Feb  8 21:33:12 2017
+++ src/usr.sbin/makefs/cd9660/cd9660_conversion.c	Mon Jun 17 13:31:17 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_conversion.c,v 1.5 2017/02/08 21:33:12 christos Exp $	*/
+/*	$NetBSD: cd9660_conversion.c,v 1.6 2024/06/17 13:31:17 reinoud Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_conversion.c,v 1.5 2017/02/08 21:33:12 christos Exp $");
+__RCSID("$NetBSD: cd9660_conversion.c,v 1.6 2024/06/17 13:31:17 reinoud Exp $");
 #endif  /* !__lint */
 
 
@@ -174,7 +174,7 @@ void
 cd9660_time_8426(unsigned char *buf, time_t tim)
 {
 	struct tm t;
-	char temp[18];
+	char temp[70];	/* we know its only 18 but gcc can't figure this out */
 
 	if (stampst.st_ino)
 		(void)gmtime_r(, );



CVS commit: src/usr.sbin/makefs

2024-05-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  8 15:57:56 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.8 makefs.c walk.c

Log Message:
Add an option to warn and error out for mtree missing entries.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.71 src/usr.sbin/makefs/makefs.8:1.72
--- src/usr.sbin/makefs/makefs.8:1.71	Thu Nov 17 01:40:41 2022
+++ src/usr.sbin/makefs/makefs.8	Wed May  8 11:57:56 2024
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.71 2022/11/17 06:40:41 chs Exp $
+.\"	$NetBSD: makefs.8,v 1.72 2024/05/08 15:57:56 christos Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 4, 2021
+.Dd May 8, 2024
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -260,6 +260,10 @@ ISO/Ecma UDF file system.
 .El
 .It Fl x
 Exclude file system nodes not explicitly listed in the specfile.
+Repeating this flag causes
+.Nm
+to print a warning for each missing system nodes and exit with an error code
+if there are any missing.
 .It Fl Z
 Create a sparse file for
 .Sy ffs .

Index: src/usr.sbin/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.57 src/usr.sbin/makefs/makefs.c:1.58
--- src/usr.sbin/makefs/makefs.c:1.57	Sun Feb 18 11:59:16 2024
+++ src/usr.sbin/makefs/makefs.c	Wed May  8 11:57:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.c,v 1.57 2024/02/18 16:59:16 christos Exp $	*/
+/*	$NetBSD: makefs.c,v 1.58 2024/05/08 15:57:56 christos Exp $	*/
 
 /*
  * Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: makefs.c,v 1.57 2024/02/18 16:59:16 christos Exp $");
+__RCSID("$NetBSD: makefs.c,v 1.58 2024/05/08 15:57:56 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -261,7 +261,7 @@ main(int argc, char *argv[])
 			break;
 
 		case 'x':
-			fsoptions.onlyspec = 1;
+			fsoptions.onlyspec++;
 			break;
 
 		case 'Z':

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.39 src/usr.sbin/makefs/walk.c:1.40
--- src/usr.sbin/makefs/walk.c:1.39	Wed Apr 24 17:59:39 2024
+++ src/usr.sbin/makefs/walk.c	Wed May  8 11:57:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $	*/
+/*	$NetBSD: walk.c,v 1.40 2024/05/08 15:57:56 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $");
+__RCSID("$NetBSD: walk.c,v 1.40 2024/05/08 15:57:56 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -65,6 +65,7 @@ static	void	 apply_specentry(const char 
 static	fsnode	*create_fsnode(const char *, const char *, const char *,
 			   struct stat *);
 static	fsinode	*link_check(fsinode *);
+static size_t missing = 0;
 
 /*
  * fsnode_cmp --
@@ -429,6 +430,9 @@ apply_specfile(const char *specfile, con
 	apply_specdir(dir, root, parent, speconly);
 
 	free_nodes(root);
+	if (missing)
+		errx(EXIT_FAILURE, "Add %zu missing entries in `%s'", 
+		missing, specfile);
 }
 
 static void
@@ -469,6 +473,11 @@ apply_specdir(const char *dir, NODE *spe
 	break;
 			}
 			if (curnode == NULL) {
+if (speconly > 1) {
+	warnx("missing specfile entry for %s/%s",
+	dir, curfsnode->name);
+	missing++;
+}
 if (debug & DEBUG_APPLY_SPECONLY) {
 	printf("%s: trimming %s/%s %p\n",
 	__func__, dir, curfsnode->name,



CVS commit: src/usr.sbin/makefs

2024-05-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed May  8 15:57:56 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.8 makefs.c walk.c

Log Message:
Add an option to warn and error out for mtree missing entries.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/makefs/makefs.8
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 24 21:59:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: fix out-of-bounds fsnode count in fsnode_sort

Found by running './makefs img.dat cd9660'.

While here, apply more KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Apr 24 21:59:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: fix out-of-bounds fsnode count in fsnode_sort

Found by running './makefs img.dat cd9660'.

While here, apply more KNF.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.38 src/usr.sbin/makefs/walk.c:1.39
--- src/usr.sbin/makefs/walk.c:1.38	Wed Apr 24 14:23:37 2024
+++ src/usr.sbin/makefs/walk.c	Wed Apr 24 21:59:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $	*/
+/*	$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $");
+__RCSID("$NetBSD: walk.c,v 1.39 2024/04/24 21:59:39 rillig Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -93,7 +93,6 @@ fsnode_sort(fsnode *first, const char *r
 	size_t num = 0;
 
 	for (fsnode *tmp = first; tmp; tmp = tmp->next, num++) {
-		num++;
 		if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
 			printf("%s: pre sort: %s %s %s\n",
 			__func__, root, dir, tmp->name);
@@ -103,7 +102,7 @@ fsnode_sort(fsnode *first, const char *r
 	for (fsnode *tmp = first; tmp; tmp = tmp->next)
 		*listptr++ = tmp;
 
-	qsort (list, num, sizeof(*list), fsnode_cmp);
+	qsort(list, num, sizeof(*list), fsnode_cmp);
 
 	for (size_t i = 0; i < num - 1; ++i)
 		list[i]->next = list[i + 1];
@@ -562,7 +561,7 @@ apply_specdir(const char *dir, NODE *spe
 			if (curfsnode->type != S_IFDIR)
 errx(EXIT_FAILURE,
 "`%s' is not a directory", path);
-			assert (curfsnode->child != NULL);
+			assert(curfsnode->child != NULL);
 			apply_specdir(path, curnode, curfsnode->child, speconly);
 		}
 	}
@@ -676,14 +675,14 @@ dump_fsnodes(fsnode *root)
 			assert(cur->symlink != NULL);
 			printf(" -> %s", cur->symlink);
 		} else {
-			assert (cur->symlink == NULL);
+			assert(cur->symlink == NULL);
 		}
 		if (cur->inode->nlink > 1)
 			printf(", nlinks=%d", cur->inode->nlink);
 		putchar('\n');
 
 		if (cur->child) {
-			assert (cur->type == S_IFDIR);
+			assert(cur->type == S_IFDIR);
 			dump_fsnodes(cur->child);
 		}
 	}



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 24 14:23:37 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
use __func__


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.37 src/usr.sbin/makefs/walk.c:1.38
--- src/usr.sbin/makefs/walk.c:1.37	Wed Apr 24 10:02:39 2024
+++ src/usr.sbin/makefs/walk.c	Wed Apr 24 10:23:37 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.37 2024/04/24 14:02:39 christos Exp $	*/
+/*	$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.37 2024/04/24 14:02:39 christos Exp $");
+__RCSID("$NetBSD: walk.c,v 1.38 2024/04/24 14:23:37 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -95,7 +95,8 @@ fsnode_sort(fsnode *first, const char *r
 	for (fsnode *tmp = first; tmp; tmp = tmp->next, num++) {
 		num++;
 		if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
-			printf ("pre sort: %s %s %s\n", root, dir, tmp->name);
+			printf("%s: pre sort: %s %s %s\n",
+			__func__, root, dir, tmp->name);
 	}
 
 	list = listptr = ecalloc(num, sizeof(*list));
@@ -112,7 +113,8 @@ fsnode_sort(fsnode *first, const char *r
 	free(list);
 	if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
 		for (fsnode *tmp = first; tmp; tmp = tmp->next)
-			printf("post sort: %s %s %s\n", root, dir, tmp->name);
+			printf("%s: post sort: %s %s %s\n",
+			__func__, root, dir, tmp->name);
 
 	return first;
 }
@@ -144,7 +146,7 @@ walk_dir(const char *root, const char *d
 	if ((size_t)len >= sizeof(path))
 		errx(EXIT_FAILURE, "Pathname too long.");
 	if (debug & DEBUG_WALK_DIR)
-		printf("walk_dir: %s %p\n", path, parent);
+		printf("%s: %s %p\n", __func__, path, parent);
 	if ((dirp = opendir(path)) == NULL)
 		err(EXIT_FAILURE, "Can't opendir `%s'", path);
 	rp = path + strlen(root) + 1;
@@ -173,7 +175,8 @@ walk_dir(const char *root, const char *d
 dot = 0;
 			}
 		if (debug & DEBUG_WALK_DIR_NODE)
-			printf("scanning %s/%s/%s\n", root, dir, name);
+			printf("%s: scanning %s/%s/%s\n",
+			__func__, root, dir, name);
 		if (snprintf(path + len, sizeof(path) - len, "/%s", name) >=
 		(int)sizeof(path) - len)
 			errx(EXIT_FAILURE, "Pathname too long.");
@@ -198,7 +201,7 @@ walk_dir(const char *root, const char *d
 #ifdef S_ISSOCK
 		if (S_ISSOCK(stbuf.st_mode & S_IFMT)) {
 			if (debug & DEBUG_WALK_DIR_NODE)
-printf("  skipping socket %s\n", path);
+printf("%s: skipping socket %s\n", __func__, path);
 			continue;
 		}
 #endif
@@ -218,8 +221,8 @@ walk_dir(const char *root, const char *d
 if (S_ISDIR(cur->type) &&
 S_ISDIR(stbuf.st_mode)) {
 	if (debug & DEBUG_WALK_DIR_NODE)
-		printf("merging %s with %p\n",
-		path, cur->child);
+		printf("%s: merging %s with %p\n",
+		__func__, path, cur->child);
 	cur->child = walk_dir(root, rp, cur,
 	cur->child, replace, follow);
 	continue;
@@ -232,7 +235,8 @@ walk_dir(const char *root, const char *d
 	inode_type(cur->type));
 else {
 	if (debug & DEBUG_WALK_DIR_NODE)
-		printf("replacing %s %s\n",
+		printf("%s: replacing %s %s\n",
+		__func__,
 		inode_type(stbuf.st_mode),
 		path);
 	if (cur == join->next)
@@ -280,7 +284,8 @@ walk_dir(const char *root, const char *d
 cur->inode = curino;
 cur->inode->nlink++;
 if (debug & DEBUG_WALK_DIR_LINKCHECK)
-	printf("link_check: found [%ju, %ju]\n",
+	printf("%s: link check found [%ju, %ju]\n",
+	__func__,
 	(uintmax_t)curino->st.st_dev,
 	(uintmax_t)curino->st.st_ino);
 			}
@@ -403,7 +408,7 @@ apply_specfile(const char *specfile, con
 	assert(parent != NULL);
 
 	if (debug & DEBUG_APPLY_SPECFILE)
-		printf("apply_specfile: %s, %s %p\n", specfile, dir, parent);
+		printf("%s: %s, %s %p\n", __func__, specfile, dir, parent);
 
 /* read in the specfile */
 	if ((fp = fopen(specfile, "r")) == NULL)
@@ -438,7 +443,7 @@ apply_specdir(const char *dir, NODE *spe
 	assert(dirnode != NULL);
 
 	if (debug & DEBUG_APPLY_SPECFILE)
-		printf("apply_specdir: %s %p %p\n", dir, specnode, dirnode);
+		printf("%s: %s %p %p\n", __func__, dir, specnode, dirnode);
 
 	if (specnode->type != F_DIR)
 		errx(EXIT_FAILURE, "Specfile node `%s/%s' is not a directory",
@@ -466,7 +471,9 @@ apply_specdir(const char *dir, NODE *spe
 			}
 			if (curnode == NULL) {
 if (debug & DEBUG_APPLY_SPECONLY) {
-	printf("apply_specdir: trimming %s/%s %p\n", dir, curfsnode->name, curfsnode);
+	printf("%s: trimming %s/%s %p\n",
+	__func__, dir, curfsnode->name,
+	curfsnode);
 }
 free_fsnodes(curfsnode);
 			}
@@ -477,13 +484,12 @@ 

CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 24 14:23:37 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
use __func__


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 24 14:02:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
make a separate sorting function and KNF (thanks rillig)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.36 src/usr.sbin/makefs/walk.c:1.37
--- src/usr.sbin/makefs/walk.c:1.36	Tue Apr 23 18:18:56 2024
+++ src/usr.sbin/makefs/walk.c	Wed Apr 24 10:02:39 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.36 2024/04/23 22:18:56 christos Exp $	*/
+/*	$NetBSD: walk.c,v 1.37 2024/04/24 14:02:39 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.36 2024/04/23 22:18:56 christos Exp $");
+__RCSID("$NetBSD: walk.c,v 1.37 2024/04/24 14:02:39 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -86,6 +86,37 @@ fsnode_cmp(const void *vleft, const void
 	return strcmp(lname, rname);
 }
 
+static fsnode *
+fsnode_sort(fsnode *first, const char *root, const char *dir)
+{
+	fsnode **list, **listptr;
+	size_t num = 0;
+
+	for (fsnode *tmp = first; tmp; tmp = tmp->next, num++) {
+		num++;
+		if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
+			printf ("pre sort: %s %s %s\n", root, dir, tmp->name);
+	}
+
+	list = listptr = ecalloc(num, sizeof(*list));
+	for (fsnode *tmp = first; tmp; tmp = tmp->next)
+		*listptr++ = tmp;
+
+	qsort (list, num, sizeof(*list), fsnode_cmp);
+
+	for (size_t i = 0; i < num - 1; ++i)
+		list[i]->next = list[i + 1];
+	list[num - 1]->next = NULL;
+	first = list[0];
+	assert(strcmp(first->name, ".") == 0);
+	free(list);
+	if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
+		for (fsnode *tmp = first; tmp; tmp = tmp->next)
+			printf("post sort: %s %s %s\n", root, dir, tmp->name);
+
+	return first;
+}
+
 /*
  * walk_dir --
  *	build a tree of fsnodes from `root' and `dir', with a parent
@@ -106,14 +137,11 @@ walk_dir(const char *root, const char *d
 	char		*name, *rp;
 	int		dot, len;
 
-	fsnode **list, **listptr;
-	int num = 0;
-
 	assert(root != NULL);
 	assert(dir != NULL);
 
 	len = snprintf(path, sizeof(path), "%s/%s", root, dir);
-	if (len >= (int)sizeof(path))
+	if ((size_t)len >= sizeof(path))
 		errx(EXIT_FAILURE, "Pathname too long.");
 	if (debug & DEBUG_WALK_DIR)
 		printf("walk_dir: %s %p\n", path, parent);
@@ -155,14 +183,16 @@ walk_dir(const char *root, const char *d
 		} else {
 			if (lstat(path, ) == -1)
 err(EXIT_FAILURE, "Can't lstat `%s'", path);
-			/* As symlink permission bits vary between filesystems
-			   (ie. 0755 on FFS/NetBSD, 0777 for ext[234]/Linux),
-			   force them to 0755.  */
+			/*
+			 * Symlink permission bits vary between filesystems/OSs
+			 * (ie. 0755 on FFS/NetBSD, 0777 for ext[234]/Linux),
+			 * force them to 0755.
+			 */
 			if (S_ISLNK(stbuf.st_mode)) {
 stbuf.st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
 stbuf.st_mode |= S_IRWXU
- | S_IRGRP | S_IXGRP
- | S_IROTH | S_IXOTH;
+| S_IRGRP | S_IXGRP
+| S_IROTH | S_IXOTH;
 			}
 		}
 #ifdef S_ISSOCK
@@ -273,35 +303,7 @@ walk_dir(const char *root, const char *d
 	if (closedir(dirp) == -1)
 		err(EXIT_FAILURE, "Can't closedir `%s/%s'", root, dir);
 
-	/*
-	 * Sort entries.
-	 */
-	/* Create a plain list: Count, alloc, add.  */
-	for (fsnode *tmp = first; tmp; tmp = tmp->next) {
-		num++;
-		if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
-			printf ("pre sort: %s %s %s\n", root, dir, tmp->name);
-	}
-	list = listptr = ecalloc (num, sizeof (*list));
-	for (fsnode *tmp = first; tmp; tmp = tmp->next)
-		*listptr++ = tmp;
-	/* Sort plain list.  */
-	qsort (list, num, sizeof (*list), _cmp);
-	/* Rewire.  */
-	for (int i = 0; i < num - 1; ++i)
-		list[i]->next = list[i+1];
-	list[num - 1]->next = NULL;
-	first = list[0];
-	/* Check `first` to be ".".  */
-	assert (strcmp (first->name, ".") == 0);
-	/* Free.  */
-	free (list);
-	/* Dump sorted state.  */
-	if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
-		for (fsnode *tmp = first; tmp; tmp = tmp->next)
-			printf ("post sort: %s %s %s\n", root, dir, tmp->name);
-
-	return first;
+	return fsnode_sort(first, root, dir);
 }
 
 static fsnode *



CVS commit: src/usr.sbin/makefs

2024-04-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 24 14:02:39 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
make a separate sorting function and KNF (thanks rillig)


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 23 22:18:56 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
pass lint, simplify


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.35 src/usr.sbin/makefs/walk.c:1.36
--- src/usr.sbin/makefs/walk.c:1.35	Tue Apr 23 18:12:48 2024
+++ src/usr.sbin/makefs/walk.c	Tue Apr 23 18:18:56 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.35 2024/04/23 22:12:48 christos Exp $	*/
+/*	$NetBSD: walk.c,v 1.36 2024/04/23 22:18:56 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.35 2024/04/23 22:12:48 christos Exp $");
+__RCSID("$NetBSD: walk.c,v 1.36 2024/04/23 22:18:56 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -73,16 +73,17 @@ static	fsinode	*link_check(fsinode *);
  *	as compared by `strcmp()`.
  */
 static int
-fsnode_cmp (const void *_left, const void *_right)
+fsnode_cmp(const void *vleft, const void *vright)
 {
-	const fsnode * const left  = *(const fsnode * const *)_left;
-	const fsnode * const right = *(const fsnode * const *)_right;
+	const fsnode * const *left  = vleft;
+	const fsnode * const *right = vright;
+	const char *lname = (*left)->name, *rname = (*right)->name;
 
-	if (strcmp (left->name, ".") == 0)
+	if (strcmp(lname, ".") == 0)
 		return -1;
-	if (strcmp (right->name, ".") == 0)
+	if (strcmp(rname, ".") == 0)
 		return 1;
-	return strcmp (left->name, right->name);
+	return strcmp(lname, rname);
 }
 
 /*
@@ -249,14 +250,14 @@ walk_dir(const char *root, const char *d
 cur->inode = curino;
 cur->inode->nlink++;
 if (debug & DEBUG_WALK_DIR_LINKCHECK)
-	printf("link_check: found [%llu, %llu]\n",
-	(unsigned long long)curino->st.st_dev,
-	(unsigned long long)curino->st.st_ino);
+	printf("link_check: found [%ju, %ju]\n",
+	(uintmax_t)curino->st.st_dev,
+	(uintmax_t)curino->st.st_ino);
 			}
 		}
 		if (S_ISLNK(cur->type)) {
 			char	slink[PATH_MAX+1];
-			int	llen;
+			ssize_t	llen;
 
 			llen = readlink(path, slink, sizeof(slink) - 1);
 			if (llen == -1)
@@ -594,9 +595,9 @@ apply_specentry(const char *dir, NODE *s
 	}
 		/* XXX: ignoring F_NLINK for now */
 	if (specnode->flags & F_SIZE) {
-		ASEPRINT("size", "%lld",
-		(long long)dirnode->inode->st.st_size,
-		(long long)specnode->st_size);
+		ASEPRINT("size", "%jd",
+		(intmax_t)dirnode->inode->st.st_size,
+		(intmax_t)specnode->st_size);
 		dirnode->inode->st.st_size = specnode->st_size;
 	}
 	if (specnode->flags & F_SLINK) {
@@ -629,13 +630,13 @@ apply_specentry(const char *dir, NODE *s
 		ASEPRINT("flags", "%#lX",
 		(unsigned long)dirnode->inode->st.st_flags,
 		(unsigned long)specnode->st_flags);
-		dirnode->inode->st.st_flags = specnode->st_flags;
+		dirnode->inode->st.st_flags = (unsigned int)specnode->st_flags;
 	}
 #endif
 	if (specnode->flags & F_DEV) {
-		ASEPRINT("rdev", "%#llx",
-		(unsigned long long)dirnode->inode->st.st_rdev,
-		(unsigned long long)specnode->st_rdev);
+		ASEPRINT("rdev", "%#jx",
+		(uintmax_t)dirnode->inode->st.st_rdev,
+		(uintmax_t)specnode->st_rdev);
 		dirnode->inode->st.st_rdev = specnode->st_rdev;
 	}
 #undef ASEPRINT
@@ -712,16 +713,16 @@ link_check(fsinode *entry)
 	static struct entry {
 		fsinode *data;
 	} *htable;
-	static int htshift;  /* log(allocated size) */
-	static int htmask;   /* allocated size - 1 */
-	static int htused;   /* 2*number of insertions */
-	int h, h2;
+	static size_t htshift;  /* log(allocated size) */
+	static size_t htmask;   /* allocated size - 1 */
+	static size_t htused;   /* 2*number of insertions */
+	size_t h, h2;
 	uint64_t tmp;
 	/* this constant is (1<<64)/((1+sqrt(5))/2)
 	 * aka (word size)/(golden ratio)
 	 */
 	const uint64_t HTCONST = 11400714819323198485ULL;
-	const int HTBITS = 64;
+	const size_t HTBITS = 64;
 
 	/* Never store zero in hashtable */
 	assert(entry);
@@ -742,8 +743,7 @@ link_check(fsinode *entry)
 		htable = ecalloc(htmask+1, sizeof(*htable));
 		/* populate newly allocated hashtable */
 		if (ohtable) {
-			int i;
-			for (i = 0; i <= htmask>>1; i++)
+			for (size_t i = 0; i <= htmask>>1; i++)
 if (ohtable[i].data)
 	link_check(ohtable[i].data);
 			free(ohtable);



CVS commit: src/usr.sbin/makefs

2024-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 23 22:18:56 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
pass lint, simplify


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 23 22:12:48 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: Fix symlink permission bits

Permission bits for symlinks are taken straight from `lstat()`. However, the
actual bits presented to the user are filesystem/kernel specific. For example,
Linux with ext2/3/4 will use 0777 for symlinks, whereas NetBSD/FFS will
show 0755. As far as `makefs` is in the loop, the target filesystem will likely
be FFS, so use 0755.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 23 22:12:48 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: Fix symlink permission bits

Permission bits for symlinks are taken straight from `lstat()`. However, the
actual bits presented to the user are filesystem/kernel specific. For example,
Linux with ext2/3/4 will use 0777 for symlinks, whereas NetBSD/FFS will
show 0755. As far as `makefs` is in the loop, the target filesystem will likely
be FFS, so use 0755.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.34 src/usr.sbin/makefs/walk.c:1.35
--- src/usr.sbin/makefs/walk.c:1.34	Tue Apr 23 18:12:16 2024
+++ src/usr.sbin/makefs/walk.c	Tue Apr 23 18:12:48 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.34 2024/04/23 22:12:16 christos Exp $	*/
+/*	$NetBSD: walk.c,v 1.35 2024/04/23 22:12:48 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.34 2024/04/23 22:12:16 christos Exp $");
+__RCSID("$NetBSD: walk.c,v 1.35 2024/04/23 22:12:48 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -154,6 +154,15 @@ walk_dir(const char *root, const char *d
 		} else {
 			if (lstat(path, ) == -1)
 err(EXIT_FAILURE, "Can't lstat `%s'", path);
+			/* As symlink permission bits vary between filesystems
+			   (ie. 0755 on FFS/NetBSD, 0777 for ext[234]/Linux),
+			   force them to 0755.  */
+			if (S_ISLNK(stbuf.st_mode)) {
+stbuf.st_mode &= ~(S_IRWXU | S_IRWXG | S_IRWXO);
+stbuf.st_mode |= S_IRWXU
+ | S_IRGRP | S_IXGRP
+ | S_IROTH | S_IXOTH;
+			}
 		}
 #ifdef S_ISSOCK
 		if (S_ISSOCK(stbuf.st_mode & S_IFMT)) {



CVS commit: src/usr.sbin/makefs

2024-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 23 22:12:16 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: Sort directory contents by name (Jan-Benedict Glaw)

`makefs` inserts nodes into its internal data structures in the order as
returned by `readdir()` calls. As this is unpredictable, sort entries by
name before creating the target filesystem.

  This is done by first converting the (per-directory) linked list into
a plain array, sort it, finally re-link the list. Special case for the
sorting function: The "." directory entry seems to be ment to be always
at the front, so always check that first.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2024-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 23 22:12:16 UTC 2024

Modified Files:
src/usr.sbin/makefs: walk.c

Log Message:
makefs: Sort directory contents by name (Jan-Benedict Glaw)

`makefs` inserts nodes into its internal data structures in the order as
returned by `readdir()` calls. As this is unpredictable, sort entries by
name before creating the target filesystem.

  This is done by first converting the (per-directory) linked list into
a plain array, sort it, finally re-link the list. Special case for the
sorting function: The "." directory entry seems to be ment to be always
at the front, so always check that first.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.33 src/usr.sbin/makefs/walk.c:1.34
--- src/usr.sbin/makefs/walk.c:1.33	Thu Dec 28 07:13:55 2023
+++ src/usr.sbin/makefs/walk.c	Tue Apr 23 18:12:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.33 2023/12/28 12:13:55 tsutsui Exp $	*/
+/*	$NetBSD: walk.c,v 1.34 2024/04/23 22:12:16 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.33 2023/12/28 12:13:55 tsutsui Exp $");
+__RCSID("$NetBSD: walk.c,v 1.34 2024/04/23 22:12:16 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -66,6 +66,24 @@ static	fsnode	*create_fsnode(const char 
 			   struct stat *);
 static	fsinode	*link_check(fsinode *);
 
+/*
+ * fsnode_cmp --
+ *	This function is used by `qsort` so sort one directory's
+ *	entries.  `.` is always first, sollowed by anything else
+ *	as compared by `strcmp()`.
+ */
+static int
+fsnode_cmp (const void *_left, const void *_right)
+{
+	const fsnode * const left  = *(const fsnode * const *)_left;
+	const fsnode * const right = *(const fsnode * const *)_right;
+
+	if (strcmp (left->name, ".") == 0)
+		return -1;
+	if (strcmp (right->name, ".") == 0)
+		return 1;
+	return strcmp (left->name, right->name);
+}
 
 /*
  * walk_dir --
@@ -87,6 +105,9 @@ walk_dir(const char *root, const char *d
 	char		*name, *rp;
 	int		dot, len;
 
+	fsnode **list, **listptr;
+	int num = 0;
+
 	assert(root != NULL);
 	assert(dir != NULL);
 
@@ -241,7 +262,36 @@ walk_dir(const char *root, const char *d
 			cur->first = first;
 	if (closedir(dirp) == -1)
 		err(EXIT_FAILURE, "Can't closedir `%s/%s'", root, dir);
-	return (first);
+
+	/*
+	 * Sort entries.
+	 */
+	/* Create a plain list: Count, alloc, add.  */
+	for (fsnode *tmp = first; tmp; tmp = tmp->next) {
+		num++;
+		if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
+			printf ("pre sort: %s %s %s\n", root, dir, tmp->name);
+	}
+	list = listptr = ecalloc (num, sizeof (*list));
+	for (fsnode *tmp = first; tmp; tmp = tmp->next)
+		*listptr++ = tmp;
+	/* Sort plain list.  */
+	qsort (list, num, sizeof (*list), _cmp);
+	/* Rewire.  */
+	for (int i = 0; i < num - 1; ++i)
+		list[i]->next = list[i+1];
+	list[num - 1]->next = NULL;
+	first = list[0];
+	/* Check `first` to be ".".  */
+	assert (strcmp (first->name, ".") == 0);
+	/* Free.  */
+	free (list);
+	/* Dump sorted state.  */
+	if (debug & DEBUG_DUMP_FSNODES_VERBOSE)
+		for (fsnode *tmp = first; tmp; tmp = tmp->next)
+			printf ("post sort: %s %s %s\n", root, dir, tmp->name);
+
+	return first;
 }
 
 static fsnode *



CVS commit: src/usr.sbin/makefs

2024-02-29 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Feb 29 08:13:52 UTC 2024

Modified Files:
src/usr.sbin/makefs: msdos.c

Log Message:
makefs/msdos: Fix broken [extra-directory ...] case

"path + cur->name" is not same as "cur->root + cur->path + cur->name"
for extra-directory files, as extra-directory files are
in different location. Do what makefs ffs code does.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/msdos.c

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

Modified files:

Index: src/usr.sbin/makefs/msdos.c
diff -u src/usr.sbin/makefs/msdos.c:1.24 src/usr.sbin/makefs/msdos.c:1.25
--- src/usr.sbin/makefs/msdos.c:1.24	Sun Feb 18 16:58:51 2024
+++ src/usr.sbin/makefs/msdos.c	Thu Feb 29 08:13:52 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdos.c,v 1.24 2024/02/18 16:58:51 christos Exp $	*/
+/*	$NetBSD: msdos.c,v 1.25 2024/02/29 08:13:52 tkusumi Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: msdos.c,v 1.24 2024/02/18 16:58:51 christos Exp $");
+__RCSID("$NetBSD: msdos.c,v 1.25 2024/02/29 08:13:52 tkusumi Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -226,8 +226,8 @@ msdos_populate_dir(const char *path, str
 	assert(fsopts != NULL);
 
 	for (cur = root->next; cur != NULL; cur = cur->next) {
-		if ((size_t)snprintf(pbuf, sizeof(pbuf), "%s/%s", path,
-		cur->name) >= sizeof(pbuf)) {
+		if ((size_t)snprintf(pbuf, sizeof(pbuf), "%s/%s/%s",
+		cur->root, cur->path, cur->name) >= sizeof(pbuf)) {
 			warnx("path %s too long", pbuf);
 			return -1;
 		}



CVS commit: src/usr.sbin/makefs

2024-02-29 Thread Tomohiro Kusumi
Module Name:src
Committed By:   tkusumi
Date:   Thu Feb 29 08:13:52 UTC 2024

Modified Files:
src/usr.sbin/makefs: msdos.c

Log Message:
makefs/msdos: Fix broken [extra-directory ...] case

"path + cur->name" is not same as "cur->root + cur->path + cur->name"
for extra-directory files, as extra-directory files are
in different location. Do what makefs ffs code does.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/msdos.c

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



CVS commit: src/usr.sbin/makefs

2024-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 18 16:59:16 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.c makefs.h

Log Message:
Add an options pretty-printer, pass some lint.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/makefs/makefs.h

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

Modified files:

Index: src/usr.sbin/makefs/makefs.c
diff -u src/usr.sbin/makefs/makefs.c:1.56 src/usr.sbin/makefs/makefs.c:1.57
--- src/usr.sbin/makefs/makefs.c:1.56	Thu Dec 28 07:13:55 2023
+++ src/usr.sbin/makefs/makefs.c	Sun Feb 18 11:59:16 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.c,v 1.56 2023/12/28 12:13:55 tsutsui Exp $	*/
+/*	$NetBSD: makefs.c,v 1.57 2024/02/18 16:59:16 christos Exp $	*/
 
 /*
  * Copyright (c) 2001-2003 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: makefs.c,v 1.56 2023/12/28 12:13:55 tsutsui Exp $");
+__RCSID("$NetBSD: makefs.c,v 1.57 2024/02/18 16:59:16 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -100,7 +100,8 @@ main(int argc, char *argv[])
 	fstype_t	*fstype;
 	fsinfo_t	 fsoptions;
 	fsnode		*root;
-	int	 	 ch, i, len;
+	int	 	 ch, i;
+	size_t		 len;
 	char		*specfile;
 
 	setprogname(argv[0]);
@@ -156,7 +157,7 @@ main(int argc, char *argv[])
 			len = strlen(optarg) - 1;
 			if (optarg[len] == '%') {
 optarg[len] = '\0';
-fsoptions.freeblockpc =
+fsoptions.freeblockpc = (int)
 strsuftoll("free block percentage",
 	optarg, 0, 99);
 			} else {
@@ -167,14 +168,14 @@ main(int argc, char *argv[])
 			break;
 
 		case 'd':
-			debug = strtoll(optarg, NULL, 0);
+			debug = (int)strtoll(optarg, NULL, 0);
 			break;
 
 		case 'f':
 			len = strlen(optarg) - 1;
 			if (optarg[len] == '%') {
 optarg[len] = '\0';
-fsoptions.freefilepc =
+fsoptions.freefilepc = (int)
 strsuftoll("free file percentage",
 	optarg, 0, 99);
 			} else {
@@ -351,6 +352,45 @@ set_option(const option_t *options, cons
 	return retval;
 }
 
+void
+print_options(FILE *fp, const option_t *options)
+{
+	for (size_t i = 0; options[i].name != NULL; i++) {
+		fprintf(fp, "%s=", options[i].name);
+		switch (options[i].type) {
+		case OPT_BOOL:
+			fputs(*(bool *)options[i].value ? "true\n" : "false\n",
+			fp); 
+			break;
+		case OPT_STRARRAY:
+		case OPT_STRPTR:
+		case OPT_STRBUF:
+			fprintf(fp, "%s\n", *(const char **)options[i].value);
+			break;
+		case OPT_INT64:
+			fprintf(fp, "%" PRIu64 "\n",
+			*(uint64_t *)options[i].value);
+			break;
+		case OPT_INT32:
+			fprintf(fp, "%" PRIu32 "\n",
+			*(uint32_t *)options[i].value);
+			break;
+		case OPT_INT16:
+			fprintf(fp, "%" PRIu16 "\n",
+			*(uint16_t *)options[i].value);
+			break;
+		case OPT_INT8:
+			fprintf(fp, "%" PRIu8 "\n",
+			*(uint8_t *)options[i].value);
+			break;
+		default:
+			warnx("Unknown type %d in option %s", options[i].type,
+			options[i].name);
+			return;
+		}
+	}
+}
+
 int
 set_option_var(const option_t *options, const char *var, const char *val,
 char *buf, size_t len)
@@ -402,7 +442,7 @@ set_option_var(const option_t *options, 
 			val);
 			return 0;
 		}
-		return i;
+		return (int)i;
 	}
 	warnx("Unknown option `%s'", var);
 	return -1;

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.40 src/usr.sbin/makefs/makefs.h:1.41
--- src/usr.sbin/makefs/makefs.h:1.40	Sun May  8 17:29:20 2022
+++ src/usr.sbin/makefs/makefs.h	Sun Feb 18 11:59:16 2024
@@ -49,6 +49,7 @@
 #define HAVE_FSTATVFS 1
 #endif
 
+#include 
 #include 
 #include 
 
@@ -179,6 +180,7 @@ void		apply_specfile(const char *, const
 void		dump_fsnodes(fsnode *);
 const char *	inode_type(mode_t);
 int		set_option(const option_t *, const char *, char *, size_t);
+void		print_options(FILE *, const option_t *);
 int		set_option_var(const option_t *, const char *, const char *,
 char *, size_t);
 fsnode *	walk_dir(const char *, const char *, fsnode *, fsnode *, int,



CVS commit: src/usr.sbin/makefs

2024-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 18 16:59:16 UTC 2024

Modified Files:
src/usr.sbin/makefs: makefs.c makefs.h

Log Message:
Add an options pretty-printer, pass some lint.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.40 -r1.41 src/usr.sbin/makefs/makefs.h

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



CVS commit: src/usr.sbin/makefs

2024-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 18 16:58:51 UTC 2024

Modified Files:
src/usr.sbin/makefs: msdos.c

Log Message:
PR/57945: Jan-Benedict Glaw: makefs: msdos filesystems with label not
reproducible.
When we specify a label, the volume label is used to create the root dir
and it gets stamped by the timestamp. We were trying to set the timestamp
in the fs-specific part of the options parsing which did not work since
the method was called only for fs_specific options. Move setting of the
timestamp just before we create the fs, where we reconcile the rest of
the options.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/msdos.c

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



CVS commit: src/usr.sbin/makefs

2024-02-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Feb 18 16:58:51 UTC 2024

Modified Files:
src/usr.sbin/makefs: msdos.c

Log Message:
PR/57945: Jan-Benedict Glaw: makefs: msdos filesystems with label not
reproducible.
When we specify a label, the volume label is used to create the root dir
and it gets stamped by the timestamp. We were trying to set the timestamp
in the fs-specific part of the options parsing which did not work since
the method was called only for fs_specific options. Move setting of the
timestamp just before we create the fs, where we reconcile the rest of
the options.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/msdos.c

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

Modified files:

Index: src/usr.sbin/makefs/msdos.c
diff -u src/usr.sbin/makefs/msdos.c:1.23 src/usr.sbin/makefs/msdos.c:1.24
--- src/usr.sbin/makefs/msdos.c:1.23	Thu Dec 28 07:13:55 2023
+++ src/usr.sbin/makefs/msdos.c	Sun Feb 18 11:58:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdos.c,v 1.23 2023/12/28 12:13:55 tsutsui Exp $	*/
+/*	$NetBSD: msdos.c,v 1.24 2024/02/18 16:58:51 christos Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: msdos.c,v 1.23 2023/12/28 12:13:55 tsutsui Exp $");
+__RCSID("$NetBSD: msdos.c,v 1.24 2024/02/18 16:58:51 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -121,7 +121,7 @@ msdos_parse_opts(const char *option, fsi
 	assert(msdos_opt != NULL);
 
 	if (debug & DEBUG_FS_PARSE_OPTS)
-		printf("msdos_parse_opts: got `%s'\n", option);
+		printf("%s: got `%s'\n", __func__, option);
 
 	rv = set_option(msdos_options, option, NULL, 0);
 	if (rv == -1)
@@ -134,10 +134,6 @@ msdos_parse_opts(const char *option, fsi
 	else if (strcmp(msdos_options[rv].name, "hidden_sectors") == 0)
 		msdos_opt->hidden_sectors_set = 1;
 
-	if (stampst.st_ino) {
-		msdos_opt->timestamp_set = 1;
-		msdos_opt->timestamp = stampst.st_mtime;
-	}
 
 	return 1;
 }
@@ -172,6 +168,10 @@ msdos_makefs(const char *image, const ch
 		"!= -o bytes_per_sector %u",
 		fsopts->sectorsize, msdos_opt->options.bytes_per_sector);
 	}
+	if (stampst.st_ino) {
+		msdos_opt->options.timestamp_set = 1;
+		msdos_opt->options.timestamp = stampst.st_mtime;
+	}
 
 		/* create image */
 	printf("Creating `%s'\n", image);



CVS commit: src/usr.sbin/makefs

2023-12-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Dec 28 12:13:56 UTC 2023

Modified Files:
src/usr.sbin/makefs: cd9660.c ffs.c makefs.c msdos.c udf.c walk.c
src/usr.sbin/makefs/cd9660: cd9660_debug.c cd9660_eltorito.c
cd9660_write.c

Log Message:
Use EXIT_SUCCESS and EXIT_FAILURE where appropriate per style guide.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/makefs/cd9660.c
cvs rdiff -u -r1.74 -r1.75 src/usr.sbin/makefs/ffs.c
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/makefs/msdos.c
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/makefs/udf.c
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/makefs/walk.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/makefs/cd9660/cd9660_debug.c
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makefs/cd9660/cd9660_write.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660.c
diff -u src/usr.sbin/makefs/cd9660.c:1.59 src/usr.sbin/makefs/cd9660.c:1.60
--- src/usr.sbin/makefs/cd9660.c:1.59	Tue Apr 18 23:05:51 2023
+++ src/usr.sbin/makefs/cd9660.c	Thu Dec 28 12:13:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660.c,v 1.59 2023/04/18 23:05:51 christos Exp $	*/
+/*	$NetBSD: cd9660.c,v 1.60 2023/12/28 12:13:55 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660.c,v 1.59 2023/04/18 23:05:51 christos Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.60 2023/12/28 12:13:55 tsutsui Exp $");
 #endif  /* !__lint */
 
 #include 
@@ -1188,7 +1188,7 @@ cd9660_copy_filenames(iso9660_disk *disk
 
 	if (TAILQ_FIRST(>cn_children)->isoDirRecord == NULL) {
 		debug_print_tree(diskStructure, diskStructure->rootNode, 0);
-		exit(1);
+		exit(EXIT_FAILURE);
 	}
 
 	TAILQ_FOREACH(cn, >cn_children, cn_next_child) {

Index: src/usr.sbin/makefs/ffs.c
diff -u src/usr.sbin/makefs/ffs.c:1.74 src/usr.sbin/makefs/ffs.c:1.75
--- src/usr.sbin/makefs/ffs.c:1.74	Sat Jan  7 19:41:30 2023
+++ src/usr.sbin/makefs/ffs.c	Thu Dec 28 12:13:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs.c,v 1.74 2023/01/07 19:41:30 chs Exp $	*/
+/*	$NetBSD: ffs.c,v 1.75 2023/12/28 12:13:55 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -71,7 +71,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.74 2023/01/07 19:41:30 chs Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.75 2023/12/28 12:13:55 tsutsui Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -276,7 +276,7 @@ ffs_makefs(const char *image, const char
 		/* create image */
 	TIMER_START(start);
 	if (ffs_create_image(image, fsopts) == -1)
-		errx(1, "Image file `%s' not created.", image);
+		errx(EXIT_FAILURE, "Image file `%s' not created.", image);
 	TIMER_RESULTS(start, "ffs_create_image");
 
 	fsopts->curinode = UFS_ROOTINO;
@@ -288,7 +288,7 @@ ffs_makefs(const char *image, const char
 	printf("Populating `%s'\n", image);
 	TIMER_START(start);
 	if (! ffs_populate_dir(dir, root, fsopts))
-		errx(1, "Image file `%s' not populated.", image);
+		errx(EXIT_FAILURE, "Image file `%s' not populated.", image);
 	TIMER_RESULTS(start, "ffs_populate_dir");
 
 		/* ensure no outstanding buffers remain */
@@ -306,7 +306,7 @@ ffs_makefs(const char *image, const char
 		/* write out superblock; image is now complete */
 	ffs_write_superblock(fsopts->superblock, fsopts);
 	if (close(fsopts->fd) == -1)
-		err(1, "Closing `%s'", image);
+		err(EXIT_FAILURE, "Closing `%s'", image);
 	fsopts->fd = -1;
 	printf("Image `%s' complete\n", image);
 }
@@ -423,7 +423,8 @@ ffs_validate(const char *dir, fsnode *ro
 	}
 		/* now check calculated sizes vs requested sizes */
 	if (fsopts->maxsize > 0 && fsopts->size > fsopts->maxsize) {
-		errx(1, "`%s' size of %lld is larger than the maxsize of %lld.",
+		errx(EXIT_FAILURE,
+		"`%s' size of %lld is larger than the maxsize of %lld.",
 		dir, (long long)fsopts->size, (long long)fsopts->maxsize);
 	}
 }
@@ -811,7 +812,7 @@ ffs_populate_dir(const char *dir, fsnode
 
 		if ((size_t)snprintf(path, sizeof(path), "%s/%s/%s", cur->root,
 		cur->path, cur->name) >= sizeof(path))
-			errx(1, "Pathname too long.");
+			errx(EXIT_FAILURE, "Pathname too long.");
 
 		if (cur->child != NULL)
 			continue;		/* child creates own inode */
@@ -852,7 +853,7 @@ ffs_populate_dir(const char *dir, fsnode
 			continue;
 		if ((size_t)snprintf(path, sizeof(path), "%s/%s", dir,
 		cur->name) >= sizeof(path))
-			errx(1, "Pathname too long.");
+			errx(EXIT_FAILURE, "Pathname too long.");
 		if (! ffs_populate_dir(path, cur->child, fsopts))
 			return (0);
 	}
@@ -956,7 +957,7 @@ ffs_write_file(union dinode *din, uint32
 		errno = ffs_balloc(, offset, chunk, );
  bad_ffs_write_file:
 		if (errno != 0)
-			err(1,
+			

CVS commit: src/usr.sbin/makefs

2023-12-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Dec 28 12:13:56 UTC 2023

Modified Files:
src/usr.sbin/makefs: cd9660.c ffs.c makefs.c msdos.c udf.c walk.c
src/usr.sbin/makefs/cd9660: cd9660_debug.c cd9660_eltorito.c
cd9660_write.c

Log Message:
Use EXIT_SUCCESS and EXIT_FAILURE where appropriate per style guide.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/makefs/cd9660.c
cvs rdiff -u -r1.74 -r1.75 src/usr.sbin/makefs/ffs.c
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/makefs/msdos.c
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/makefs/udf.c
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/makefs/walk.c
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/makefs/cd9660/cd9660_debug.c
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makefs/cd9660/cd9660_write.c

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



CVS commit: src/usr.sbin/makefs

2023-12-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Dec 20 15:07:16 UTC 2023

Modified Files:
src/usr.sbin/makefs: msdos.c

Log Message:
Return a proper exit status on failure on creating msdosfs.

No particular comment in PR bin/57752.
Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makefs/msdos.c

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

Modified files:

Index: src/usr.sbin/makefs/msdos.c
diff -u src/usr.sbin/makefs/msdos.c:1.21 src/usr.sbin/makefs/msdos.c:1.22
--- src/usr.sbin/makefs/msdos.c:1.21	Sat Apr  9 10:05:35 2022
+++ src/usr.sbin/makefs/msdos.c	Wed Dec 20 15:07:16 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdos.c,v 1.21 2022/04/09 10:05:35 riastradh Exp $	*/
+/*	$NetBSD: msdos.c,v 1.22 2023/12/20 15:07:16 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: msdos.c,v 1.21 2022/04/09 10:05:35 riastradh Exp $");
+__RCSID("$NetBSD: msdos.c,v 1.22 2023/12/20 15:07:16 tsutsui Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -177,7 +177,7 @@ msdos_makefs(const char *image, const ch
 	printf("Creating `%s'\n", image);
 	TIMER_START(start);
 	if (mkfs_msdos(image, NULL, _opt->options) == -1)
-		return;
+		errx(1, "Image file `%s' not created.", image);
 	TIMER_RESULTS(start, "mkfs_msdos");
 
 	fsopts->fd = open(image, O_RDWR);
@@ -201,7 +201,7 @@ msdos_makefs(const char *image, const ch
 	printf("Populating `%s'\n", image);
 	TIMER_START(start);
 	if (msdos_populate_dir(dir, VTODE(), root, root, fsopts) == -1)
-		errx(1, "Image file `%s' not created.", image);
+		errx(1, "Image file `%s' not populated.", image);
 	TIMER_RESULTS(start, "msdos_populate_dir");
 
 	if (debug & DEBUG_FS_MAKEFS)



CVS commit: src/usr.sbin/makefs

2023-12-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Dec 20 15:07:16 UTC 2023

Modified Files:
src/usr.sbin/makefs: msdos.c

Log Message:
Return a proper exit status on failure on creating msdosfs.

No particular comment in PR bin/57752.
Should be pulled up to netbsd-10 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makefs/msdos.c

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



CVS commit: src/usr.sbin/makefs

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 23:05:51 UTC 2023

Modified Files:
src/usr.sbin/makefs: cd9660.c

Log Message:
Move date setting into cd9660_populate_iso_dir_record so there is no
path that leaves it unset.

>From FreeBSD https://reviews.freebsd.org/D39258


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/makefs/cd9660.c

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



CVS commit: src/usr.sbin/makefs

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 23:05:51 UTC 2023

Modified Files:
src/usr.sbin/makefs: cd9660.c

Log Message:
Move date setting into cd9660_populate_iso_dir_record so there is no
path that leaves it unset.

>From FreeBSD https://reviews.freebsd.org/D39258


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/makefs/cd9660.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660.c
diff -u src/usr.sbin/makefs/cd9660.c:1.58 src/usr.sbin/makefs/cd9660.c:1.59
--- src/usr.sbin/makefs/cd9660.c:1.58	Tue Dec 21 16:28:31 2021
+++ src/usr.sbin/makefs/cd9660.c	Tue Apr 18 19:05:51 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660.c,v 1.58 2021/12/21 21:28:31 andvar Exp $	*/
+/*	$NetBSD: cd9660.c,v 1.59 2023/04/18 23:05:51 christos Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660.c,v 1.58 2021/12/21 21:28:31 andvar Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.59 2023/04/18 23:05:51 christos Exp $");
 #endif  /* !__lint */
 
 #include 
@@ -737,7 +737,10 @@ cd9660_populate_iso_dir_record(struct _i
 			   u_char ext_attr_length, u_char flags,
 			   u_char name_len, const char * name)
 {
+	time_t tstamp = stampst.st_ino ? stampst.st_mtime : time(NULL);
+
 	record->ext_attr_length[0] = ext_attr_length;
+	cd9660_time_915(record->date, tstamp);
 	record->flags[0] = ISO_FLAG_CLEAR | flags;
 	record->file_unit_size[0] = 0;
 	record->interleave[0] = 0;
@@ -824,7 +827,6 @@ cd9660_fill_extended_attribute_record(cd
 static int
 cd9660_translate_node_common(iso9660_disk *diskStructure, cd9660node *newnode)
 {
-	time_t tstamp = stampst.st_ino ? stampst.st_mtime : time(NULL);
 	u_char flag;
 	char temp[ISO_FILENAME_MAXLENGTH_WITH_PADDING];
 
@@ -841,12 +843,6 @@ cd9660_translate_node_common(iso9660_dis
 	cd9660_populate_iso_dir_record(newnode->isoDirRecord, 0,
 	flag, strlen(temp), temp);
 
-	/* Set the various dates */
-
-	/* If we want to use the current date and time */
-
-	cd9660_time_915(newnode->isoDirRecord->date, tstamp);
-
 	cd9660_bothendian_dword(newnode->fileDataLength,
 	newnode->isoDirRecord->size);
 	/* If the file is a link, we want to set the size to 0 */



CVS commit: src/usr.sbin/makefs/cd9660

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 23:02:51 UTC 2023

Modified Files:
src/usr.sbin/makefs/cd9660: iso9660_rrip.c

Log Message:
We previously attempted to emit Rock Ridge NM records only when the name
represented by the Rock Ridge extensions would actually differ. We would
omit the record for an all-upper-case directory name, however Linux (and
perhaps other operating systems) map names with no NM record to
lowercase.

This affected only directories, as file names have an implicit ";1"
version number appended and thus always differ.  To solve, just emit NM
records for all entries other than DOT and DOTDOT .

We could continue to omit the NM record for directories that would avoid
mapping (for example, one named 1234.567) but this does not seem worth
the complexity.

>From FreeBSD https://reviews.freebsd.org/D39258


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/makefs/cd9660/iso9660_rrip.c

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



CVS commit: src/usr.sbin/makefs/cd9660

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 23:00:02 UTC 2023

Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_eltorito.c

Log Message:
The boot catalog pointer is a DWord, but we previously populated it via
cd9660_bothendian_dword which overwrote four unused bytes following it.
See El Torito 1.0 (1995) Figure 7 for details.

Found by Coverity on FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660/cd9660_eltorito.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.25 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.26
--- src/usr.sbin/makefs/cd9660/cd9660_eltorito.c:1.25	Sat Apr  9 06:05:35 2022
+++ src/usr.sbin/makefs/cd9660/cd9660_eltorito.c	Tue Apr 18 19:00:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_eltorito.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $	*/
+/*	$NetBSD: cd9660_eltorito.c,v 1.26 2023/04/18 23:00:02 christos Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -40,7 +40,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660_eltorito.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $");
+__RCSID("$NetBSD: cd9660_eltorito.c,v 1.26 2023/04/18 23:00:02 christos Exp $");
 #endif  /* !__lint */
 
 #ifdef DEBUG
@@ -377,8 +377,8 @@ cd9660_setup_boot(iso9660_disk *diskStru
 	/* Point to catalog: For now assume it consumes one sector */
 	ELTORITO_DPRINTF(("Boot catalog will go in sector %d\n", first_sector));
 	diskStructure->boot_catalog_sector = first_sector;
-	cd9660_bothendian_dword(first_sector,
-		diskStructure->boot_descriptor->boot_catalog_pointer);
+	cd9660_731(first_sector,
+	diskStructure->boot_descriptor->boot_catalog_pointer);
 
 	/*
 	 * Use system type of default image for validation entry. Fallback to



CVS commit: src/usr.sbin/makefs/cd9660

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 23:00:02 UTC 2023

Modified Files:
src/usr.sbin/makefs/cd9660: cd9660_eltorito.c

Log Message:
The boot catalog pointer is a DWord, but we previously populated it via
cd9660_bothendian_dword which overwrote four unused bytes following it.
See El Torito 1.0 (1995) Figure 7 for details.

Found by Coverity on FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c

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



CVS commit: src/usr.sbin/makefs/cd9660

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 22:58:14 UTC 2023

Modified Files:
src/usr.sbin/makefs/cd9660: iso9660_rrip.h

Log Message:
See RRIP 4.1.4 Description of the "NM" System Use Entry for details.

>From FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/cd9660/iso9660_rrip.h

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

Modified files:

Index: src/usr.sbin/makefs/cd9660/iso9660_rrip.h
diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.h:1.7 src/usr.sbin/makefs/cd9660/iso9660_rrip.h:1.8
--- src/usr.sbin/makefs/cd9660/iso9660_rrip.h:1.7	Tue Apr 18 18:56:41 2023
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.h	Tue Apr 18 18:58:14 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso9660_rrip.h,v 1.7 2023/04/18 22:56:41 christos Exp $	*/
+/*	$NetBSD: iso9660_rrip.h,v 1.8 2023/04/18 22:58:14 christos Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -58,9 +58,9 @@
 #define	 TF_EFFECTIVE	   0x40
 #define	 TF_LONGFORM	   0x80
 
-#define	 NM_CONTINUE	   0x80
-#define	 NM_CURRENT	   0x100
-#define	 NM_PARENT	   0x200
+#define	 NM_CONTINUE	   0x01
+#define	 NM_CURRENT	   0x02
+#define	 NM_PARENT	   0x04
 
 
 #define	 SUSP_LOC_ENTRY	   0x01



CVS commit: src/usr.sbin/makefs/cd9660

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 22:58:14 UTC 2023

Modified Files:
src/usr.sbin/makefs/cd9660: iso9660_rrip.h

Log Message:
See RRIP 4.1.4 Description of the "NM" System Use Entry for details.

>From FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/cd9660/iso9660_rrip.h

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



CVS commit: src/usr.sbin/makefs/cd9660

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 22:56:41 UTC 2023

Modified Files:
src/usr.sbin/makefs/cd9660: iso9660_rrip.c iso9660_rrip.h

Log Message:
The bit definitions for the TF_* timestamp bits (TF_MODIFY, etc.) were
incorrect, and timestamps were written in the wrong order.

See RRIP 4.1.6 Description of the "TF" System Use Entry for details.

From: https://reviews.freebsd.org/D39221


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/makefs/cd9660/iso9660_rrip.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/makefs/cd9660/iso9660_rrip.h

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



CVS commit: src/usr.sbin/makefs/cd9660

2023-04-18 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr 18 22:56:41 UTC 2023

Modified Files:
src/usr.sbin/makefs/cd9660: iso9660_rrip.c iso9660_rrip.h

Log Message:
The bit definitions for the TF_* timestamp bits (TF_MODIFY, etc.) were
incorrect, and timestamps were written in the wrong order.

See RRIP 4.1.6 Description of the "TF" System Use Entry for details.

From: https://reviews.freebsd.org/D39221


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/makefs/cd9660/iso9660_rrip.c
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/makefs/cd9660/iso9660_rrip.h

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

Modified files:

Index: src/usr.sbin/makefs/cd9660/iso9660_rrip.c
diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.14 src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.15
--- src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.14	Fri May 30 09:14:47 2014
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c	Tue Apr 18 18:56:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso9660_rrip.c,v 1.14 2014/05/30 13:14:47 martin Exp $	*/
+/*	$NetBSD: iso9660_rrip.c,v 1.15 2023/04/18 22:56:41 christos Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -44,7 +44,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: iso9660_rrip.c,v 1.14 2014/05/30 13:14:47 martin Exp $");
+__RCSID("$NetBSD: iso9660_rrip.c,v 1.15 2023/04/18 22:56:41 christos Exp $");
 #endif  /* !__lint */
 
 static void cd9660_rrip_initialize_inode(cd9660node *);
@@ -697,11 +697,11 @@ cd9660node_rrip_tf(struct ISO_SUSP_ATTRI
 	 */
 
 	cd9660_time_915(p->attr.rr_entry.TF.timestamp,
-		_node->inode->st.st_atime);
+		_node->inode->st.st_mtime);
 	p->attr.rr_entry.TF.h.length[0] += 7;
 
 	cd9660_time_915(p->attr.rr_entry.TF.timestamp + 7,
-		_node->inode->st.st_mtime);
+		_node->inode->st.st_atime);
 	p->attr.rr_entry.TF.h.length[0] += 7;
 
 	cd9660_time_915(p->attr.rr_entry.TF.timestamp + 14,

Index: src/usr.sbin/makefs/cd9660/iso9660_rrip.h
diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.h:1.6 src/usr.sbin/makefs/cd9660/iso9660_rrip.h:1.7
--- src/usr.sbin/makefs/cd9660/iso9660_rrip.h:1.6	Mon Jan 28 16:03:28 2013
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.h	Tue Apr 18 18:56:41 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso9660_rrip.h,v 1.6 2013/01/28 21:03:28 christos Exp $	*/
+/*	$NetBSD: iso9660_rrip.h,v 1.7 2023/04/18 22:56:41 christos Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -48,15 +48,17 @@
 
 #define	 PX_LENGTH	   0x2C
 #define	 PN_LENGTH	   0x14
-#define	 TF_CREATION	   0x00
-#define	 TF_MODIFY	   0x01
-#define	 TF_ACCESS	   0x02
-#define	 TF_ATTRIBUTES	   0x04
-#define	 TF_BACKUP	   0x08
-#define	 TF_EXPIRATION	   0x10
-#define	 TF_EFFECTIVE	   0x20
-#define	 TF_LONGFORM	   0x40
-#define  NM_CONTINUE	   0x80
+
+#define	 TF_CREATION	   0x01
+#define	 TF_MODIFY	   0x02
+#define	 TF_ACCESS	   0x04
+#define	 TF_ATTRIBUTES	   0x08
+#define	 TF_BACKUP	   0x10
+#define	 TF_EXPIRATION	   0x20
+#define	 TF_EFFECTIVE	   0x40
+#define	 TF_LONGFORM	   0x80
+
+#define	 NM_CONTINUE	   0x80
 #define	 NM_CURRENT	   0x100
 #define	 NM_PARENT	   0x200
 



CVS commit: src/usr.sbin/makefs/ffs

2023-03-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 14 10:36:07 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: buf.c

Log Message:
In bwrite() if the write() returned -1, the associated errno was
being used after a (possible) call to printf (only happens when
debugging) and a certain call to free() (via brelse()).
Make a copy, and use that instead.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/makefs/ffs/buf.c

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

Modified files:

Index: src/usr.sbin/makefs/ffs/buf.c
diff -u src/usr.sbin/makefs/ffs/buf.c:1.27 src/usr.sbin/makefs/ffs/buf.c:1.28
--- src/usr.sbin/makefs/ffs/buf.c:1.27	Tue Mar 14 09:25:13 2023
+++ src/usr.sbin/makefs/ffs/buf.c	Tue Mar 14 10:36:06 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.27 2023/03/14 09:25:13 kre Exp $	*/
+/*	$NetBSD: buf.c,v 1.28 2023/03/14 10:36:06 kre Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: buf.c,v 1.27 2023/03/14 09:25:13 kre Exp $");
+__RCSID("$NetBSD: buf.c,v 1.28 2023/03/14 10:36:06 kre Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -149,6 +149,7 @@ bwrite(struct buf *bp)
 	off_t	offset;
 	ssize_t	rv;
 	size_t	bytes;
+	int	e;
 	fsinfo_t *fs = bp->b_fs;
 
 	assert (bp != NULL);
@@ -160,6 +161,7 @@ bwrite(struct buf *bp)
 	if (lseek(bp->b_fs->fd, offset, SEEK_SET) == -1)
 		return errno;
 	rv = write(bp->b_fs->fd, bp->b_data, bytes);
+	e = errno;
 	if (debug & DEBUG_BUF_BWRITE)
 		printf("%s: write %ld (offset %jd) returned %jd\n", __func__,
 		bp->b_bcount, (intmax_t)offset, (intmax_t)rv);
@@ -167,7 +169,7 @@ bwrite(struct buf *bp)
 	if (rv == (ssize_t)bytes)
 		return 0;
 	if (rv == -1)		/* write error */
-		return errno;
+		return e;
 	return EAGAIN;
 }
 



CVS commit: src/usr.sbin/makefs/ffs

2023-03-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 14 10:36:07 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: buf.c

Log Message:
In bwrite() if the write() returned -1, the associated errno was
being used after a (possible) call to printf (only happens when
debugging) and a certain call to free() (via brelse()).
Make a copy, and use that instead.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/makefs/ffs/buf.c

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



CVS commit: src/usr.sbin/makefs/ffs

2023-03-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 14 09:25:13 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: buf.c

Log Message:
Use %zd to print ssize_t (%z[uxo] for size_t), rather than %jd
(just like the other adjacent printfs do)

Should fix i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/ffs/buf.c

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

Modified files:

Index: src/usr.sbin/makefs/ffs/buf.c
diff -u src/usr.sbin/makefs/ffs/buf.c:1.26 src/usr.sbin/makefs/ffs/buf.c:1.27
--- src/usr.sbin/makefs/ffs/buf.c:1.26	Mon Mar 13 22:10:30 2023
+++ src/usr.sbin/makefs/ffs/buf.c	Tue Mar 14 09:25:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.26 2023/03/13 22:10:30 christos Exp $	*/
+/*	$NetBSD: buf.c,v 1.27 2023/03/14 09:25:13 kre Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: buf.c,v 1.26 2023/03/13 22:10:30 christos Exp $");
+__RCSID("$NetBSD: buf.c,v 1.27 2023/03/14 09:25:13 kre Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -91,7 +91,7 @@ bread(struct vnode *vp, daddr_t blkno, i
 		printf("%s: read %ld (%jd) returned %zd\n", __func__,
 		(*bpp)->b_bcount, (intmax_t)offset, rv);
 	if (rv == -1) {/* read error */
-		warn("%s: read %ld (%jd) returned %jd", __func__,
+		warn("%s: read %ld (%jd) returned %zd", __func__,
 		(*bpp)->b_bcount, (intmax_t)offset, rv);
 		goto out;
 	}



CVS commit: src/usr.sbin/makefs/ffs

2023-03-14 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Mar 14 09:25:13 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: buf.c

Log Message:
Use %zd to print ssize_t (%z[uxo] for size_t), rather than %jd
(just like the other adjacent printfs do)

Should fix i386 build.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/ffs/buf.c

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



CVS commit: src/usr.sbin/makefs/ffs

2023-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 13 22:17:24 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: ffs_alloc.c ffs_balloc.c

Log Message:
Don't brelse() if bread() fails. The kernel does this for us. Our bread()
implementation just exits on failure, but if it didn't we would double-free.
>From Ed Maste (https://reviews.freebsd.org/D39069)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/makefs/ffs/ffs_alloc.c
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/makefs/ffs/ffs_balloc.c

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

Modified files:

Index: src/usr.sbin/makefs/ffs/ffs_alloc.c
diff -u src/usr.sbin/makefs/ffs/ffs_alloc.c:1.31 src/usr.sbin/makefs/ffs/ffs_alloc.c:1.32
--- src/usr.sbin/makefs/ffs/ffs_alloc.c:1.31	Sat Jan  7 14:41:30 2023
+++ src/usr.sbin/makefs/ffs/ffs_alloc.c	Mon Mar 13 18:17:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_alloc.c,v 1.31 2023/01/07 19:41:30 chs Exp $	*/
+/*	$NetBSD: ffs_alloc.c,v 1.32 2023/03/13 22:17:24 christos Exp $	*/
 /* From: NetBSD: ffs_alloc.c,v 1.50 2001/09/06 02:16:01 lukem Exp */
 
 /*
@@ -47,7 +47,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs_alloc.c,v 1.31 2023/01/07 19:41:30 chs Exp $");
+__RCSID("$NetBSD: ffs_alloc.c,v 1.32 2023/03/13 22:17:24 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -453,7 +453,6 @@ ffs_blkfree(struct inode *ip, daddr_t bn
 	error = bread(ip->i_devvp, FFS_FSBTODB(fs, cgtod(fs, cg)),
 	(int)fs->fs_cgsize, 0, );
 	if (error) {
-		brelse(bp, 0);
 		return;
 	}
 	cgp = (struct cg *)bp->b_data;

Index: src/usr.sbin/makefs/ffs/ffs_balloc.c
diff -u src/usr.sbin/makefs/ffs/ffs_balloc.c:1.22 src/usr.sbin/makefs/ffs/ffs_balloc.c:1.23
--- src/usr.sbin/makefs/ffs/ffs_balloc.c:1.22	Thu Nov 17 01:40:41 2022
+++ src/usr.sbin/makefs/ffs/ffs_balloc.c	Mon Mar 13 18:17:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_balloc.c,v 1.22 2022/11/17 06:40:41 chs Exp $	*/
+/*	$NetBSD: ffs_balloc.c,v 1.23 2023/03/13 22:17:24 christos Exp $	*/
 /* From NetBSD: ffs_balloc.c,v 1.25 2001/08/08 08:36:36 lukem Exp */
 
 /*
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs_balloc.c,v 1.22 2022/11/17 06:40:41 chs Exp $");
+__RCSID("$NetBSD: ffs_balloc.c,v 1.23 2023/03/13 22:17:24 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -142,7 +142,6 @@ ffs_balloc_ufs1(struct inode *ip, off_t 
 error = bread(ip->i_devvp, lbn, fs->fs_bsize,
 0, bpp);
 if (error) {
-	brelse(*bpp, 0);
 	return (error);
 }
 			}
@@ -168,8 +167,7 @@ ffs_balloc_ufs1(struct inode *ip, off_t 
 	error = bread(ip->i_devvp, lbn, osize,
 	0, bpp);
 	if (error) {
-		brelse(*bpp, 0);
-		return (error);
+		return error;
 	}
 }
 return 0;
@@ -254,7 +252,6 @@ ffs_balloc_ufs1(struct inode *ip, off_t 
 		error = bread(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize,
 		0, );
 		if (error) {
-			brelse(bp, 0);
 			return error;
 		}
 		bap = (int32_t *)bp->b_data;
@@ -324,7 +321,6 @@ ffs_balloc_ufs1(struct inode *ip, off_t 
 	if (bpp != NULL) {
 		error = bread(ip->i_devvp, lbn, (int)fs->fs_bsize, 0, );
 		if (error) {
-			brelse(nbp, 0);
 			return error;
 		}
 		*bpp = nbp;
@@ -392,7 +388,6 @@ ffs_balloc_ufs2(struct inode *ip, off_t 
 error = bread(ip->i_devvp, lbn, fs->fs_bsize,
 0, bpp);
 if (error) {
-	brelse(*bpp, 0);
 	return (error);
 }
 			}
@@ -418,7 +413,6 @@ ffs_balloc_ufs2(struct inode *ip, off_t 
 	error = bread(ip->i_devvp, lbn, osize,
 	0, bpp);
 	if (error) {
-		brelse(*bpp, 0);
 		return (error);
 	}
 }
@@ -504,7 +498,6 @@ ffs_balloc_ufs2(struct inode *ip, off_t 
 		error = bread(ip->i_devvp, indirs[i].in_lbn, fs->fs_bsize,
 		0, );
 		if (error) {
-			brelse(bp, 0);
 			return error;
 		}
 		bap = (int64_t *)bp->b_data;



CVS commit: src/usr.sbin/makefs/ffs

2023-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 13 22:17:24 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: ffs_alloc.c ffs_balloc.c

Log Message:
Don't brelse() if bread() fails. The kernel does this for us. Our bread()
implementation just exits on failure, but if it didn't we would double-free.
>From Ed Maste (https://reviews.freebsd.org/D39069)


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/makefs/ffs/ffs_alloc.c
cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/makefs/ffs/ffs_balloc.c

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



CVS commit: src/usr.sbin/makefs/ffs

2023-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 13 22:10:30 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: buf.c

Log Message:
modernize; release bpp and set it to NULL as the kernel does even if we
never return here.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/ffs/buf.c

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

Modified files:

Index: src/usr.sbin/makefs/ffs/buf.c
diff -u src/usr.sbin/makefs/ffs/buf.c:1.25 src/usr.sbin/makefs/ffs/buf.c:1.26
--- src/usr.sbin/makefs/ffs/buf.c:1.25	Sat Apr  9 06:05:35 2022
+++ src/usr.sbin/makefs/ffs/buf.c	Mon Mar 13 18:10:30 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $	*/
+/*	$NetBSD: buf.c,v 1.26 2023/03/13 22:10:30 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: buf.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $");
+__RCSID("$NetBSD: buf.c,v 1.26 2023/03/13 22:10:30 christos Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -66,32 +66,51 @@ bread(struct vnode *vp, daddr_t blkno, i
 	off_t	offset;
 	ssize_t	rv;
 	fsinfo_t *fs = vp->fs;
+	int saved_errno;
 
 	assert (bpp != NULL);
 
 	if (debug & DEBUG_BUF_BREAD)
-		printf("bread: blkno %lld size %d\n", (long long)blkno, size);
+		printf("%s: blkno %jd size %d\n", __func__,
+		(intmax_t)blkno, size);
 	*bpp = getblk(vp, blkno, size, 0, 0);
 	offset = (*bpp)->b_blkno * fs->sectorsize + fs->offset;
 	if (debug & DEBUG_BUF_BREAD)
-		printf("bread: blkno %lld offset %lld bcount %ld\n",
-		(long long)(*bpp)->b_blkno, (long long) offset,
+		printf("%s: blkno %jd offset %jd bcount %ld\n", __func__,
+		(intmax_t)(*bpp)->b_blkno, (intmax_t) offset,
 		(*bpp)->b_bcount);
-	if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1)
-		err(EXIT_FAILURE, "%s: lseek %lld (%lld)", __func__,
-		(long long)(*bpp)->b_blkno, (long long)offset);
+	if (lseek((*bpp)->b_fs->fd, offset, SEEK_SET) == -1) {
+		saved_errno = errno;
+		warn("%s: lseek %jd (%jd)", __func__,
+		(intmax_t)(*bpp)->b_blkno, (intmax_t)offset);
+		goto out;
+	}
 	rv = read((*bpp)->b_fs->fd, (*bpp)->b_data, (size_t)(*bpp)->b_bcount);
+	saved_errno = errno;
 	if (debug & DEBUG_BUF_BREAD)
-		printf("bread: read %ld (%lld) returned %zd\n",
-		(*bpp)->b_bcount, (long long)offset, rv);
-	if (rv == -1)/* read error */
-		err(EXIT_FAILURE, "%s: read %ld (%lld) returned %zd", __func__,
-		(*bpp)->b_bcount, (long long)offset, rv);
-	else if (rv != (*bpp)->b_bcount)	/* short read */
-		errx(EXIT_FAILURE, "%s: read %ld (%lld) returned %zd", __func__,
-		(*bpp)->b_bcount, (long long)offset, rv);
-	else
-		return (0);
+		printf("%s: read %ld (%jd) returned %zd\n", __func__,
+		(*bpp)->b_bcount, (intmax_t)offset, rv);
+	if (rv == -1) {/* read error */
+		warn("%s: read %ld (%jd) returned %jd", __func__,
+		(*bpp)->b_bcount, (intmax_t)offset, rv);
+		goto out;
+	}
+	if (rv != (*bpp)->b_bcount) {	/* short read */
+		saved_errno = ENOSPC;
+		warn("%s: read %ld (%jd) returned %zd", __func__,
+		(*bpp)->b_bcount, (intmax_t)offset, rv);
+		goto out;
+	}
+	return 0;
+out:
+	brelse(*bpp, 0);
+	*bpp = NULL;
+#if 1
+	__USE(saved_errno);
+	exit(EXIT_FAILURE);
+#else
+	return saved_errno;
+#endif
 }
 
 void
@@ -136,21 +155,20 @@ bwrite(struct buf *bp)
 	offset = bp->b_blkno * fs->sectorsize + fs->offset;
 	bytes  = (size_t)bp->b_bcount;
 	if (debug & DEBUG_BUF_BWRITE)
-		printf("bwrite: blkno %lld offset %lld bcount %zu\n",
-		(long long)bp->b_blkno, (long long) offset, bytes);
+		printf("%s: blkno %jd offset %jd bcount %zu\n", __func__,
+		(intmax_t)bp->b_blkno, (intmax_t) offset, bytes);
 	if (lseek(bp->b_fs->fd, offset, SEEK_SET) == -1)
-		return (errno);
+		return errno;
 	rv = write(bp->b_fs->fd, bp->b_data, bytes);
 	if (debug & DEBUG_BUF_BWRITE)
-		printf("bwrite: write %ld (offset %lld) returned %lld\n",
-		bp->b_bcount, (long long)offset, (long long)rv);
+		printf("%s: write %ld (offset %jd) returned %jd\n", __func__,
+		bp->b_bcount, (intmax_t)offset, (intmax_t)rv);
 	brelse(bp, 0);
 	if (rv == (ssize_t)bytes)
-		return (0);
-	else if (rv == -1)		/* write error */
-		return (errno);
-	else/* short write ? */
-		return (EAGAIN);
+		return 0;
+	if (rv == -1)		/* write error */
+		return errno;
+	return EAGAIN;
 }
 
 void
@@ -167,13 +185,13 @@ bcleanup(void)
 	if (TAILQ_EMPTY())
 		return;
 
-	printf("bcleanup: unflushed buffers:\n");
+	printf("%s: unflushed buffers:\n", __func__);
 	TAILQ_FOREACH(bp, , b_tailq) {
-		printf("\tlblkno %10lld  blkno %10lld  count %6ld  bufsize %6ld\n",
-		(long long)bp->b_lblkno, (long long)bp->b_blkno,
+		printf("\tlblkno %10jd blkno %10jd count %6ld  bufsize %6ld\n",
+		(intmax_t)bp->b_lblkno, (intmax_t)bp->b_blkno,
 		bp->b_bcount, bp->b_bufsize);
 	}
-	printf("bcleanup: done\n");
+	printf("%s: 

CVS commit: src/usr.sbin/makefs/ffs

2023-03-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 13 22:10:30 UTC 2023

Modified Files:
src/usr.sbin/makefs/ffs: buf.c

Log Message:
modernize; release bpp and set it to NULL as the kernel does even if we
never return here.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/ffs/buf.c

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



CVS commit: src/usr.sbin/makefs

2022-05-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun May  8 21:29:20 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Revert, sorry this was not intended to be committed.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/makefs.h

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

Modified files:

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.39 src/usr.sbin/makefs/makefs.h:1.40
--- src/usr.sbin/makefs/makefs.h:1.39	Sat May  7 08:54:02 2022
+++ src/usr.sbin/makefs/makefs.h	Sun May  8 21:29:20 2022
@@ -44,7 +44,7 @@
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
 #define HAVE_STRUCT_STAT_ST_GEN 1
 #define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
-//#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
+#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
 #define HAVE_STRUCT_STAT_BIRTHTIME 1
 #define HAVE_FSTATVFS 1
 #endif



CVS commit: src/usr.sbin/makefs

2022-05-08 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sun May  8 21:29:20 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h

Log Message:
Revert, sorry this was not intended to be committed.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/makefs.h

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



CVS commit: src/usr.sbin/makefs

2022-05-07 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat May  7 08:54:02 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h udf.c

Log Message:
When creating disc images, keep the proposed size a multiple of the blockingnr
for good measure; this prevents possible burning/copying issues on packet
media.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/makefs.h
diff -u src/usr.sbin/makefs/makefs.h:1.38 src/usr.sbin/makefs/makefs.h:1.39
--- src/usr.sbin/makefs/makefs.h:1.38	Sat Apr  9 10:05:35 2022
+++ src/usr.sbin/makefs/makefs.h	Sat May  7 08:54:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: makefs.h,v 1.38 2022/04/09 10:05:35 riastradh Exp $	*/
+/*	$nEtBSD: makefs.h,v 1.38 2022/04/09 10:05:35 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -44,7 +44,7 @@
 #define HAVE_STRUCT_STAT_ST_FLAGS 1
 #define HAVE_STRUCT_STAT_ST_GEN 1
 #define HAVE_STRUCT_STAT_ST_MTIMENSEC 1
-#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
+//#define HAVE_STRUCT_STATVFS_F_IOSIZE 1
 #define HAVE_STRUCT_STAT_BIRTHTIME 1
 #define HAVE_FSTATVFS 1
 #endif

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.29 src/usr.sbin/makefs/udf.c:1.30
--- src/usr.sbin/makefs/udf.c:1.29	Tue Apr 26 15:18:08 2022
+++ src/usr.sbin/makefs/udf.c	Sat May  7 08:54:02 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.30 2022/05/07 08:54:02 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.30 2022/05/07 08:54:02 reinoud Exp $");
 
 #include 
 #include 
@@ -1130,7 +1130,24 @@ udf_enumerate_and_estimate(const char *d
 		stats->ndatablocks += (n - nblk);
 		nblk += n - nblk;
 	}
+
+	/* keep proposed size a multiple of blockingnr for image creation */
+	if (S_ISREG(dev_fd_stat.st_mode)) {
+		struct mmc_trackinfo ti;
+		int blockingnr;
+		int error;
+
+		/* adjust proposed size to be a multiple of the blockingnr */
+		udf_update_discinfo();
+		ti.tracknr = mmc_discinfo.first_track_last_session;
+		error = udf_update_trackinfo();
+		assert(!error);
+		blockingnr = udf_get_blockingnr();
+		nblk = UDF_ROUNDUP(nblk, blockingnr);
+	}
+
 	proposed_size = (off_t) nblk * fsopts->sectorsize;
+
 	/* sanity size */
 	if (proposed_size < 512*1024)
 		proposed_size = 512*1024;



CVS commit: src/usr.sbin/makefs

2022-05-07 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Sat May  7 08:54:02 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.h udf.c

Log Message:
When creating disc images, keep the proposed size a multiple of the blockingnr
for good measure; this prevents possible burning/copying issues on packet
media.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/udf.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:18:08 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Avoid warning by clang of unused variable

While here, use the computated obj_size even though it's always the same as
its information length since we don't use extended attribute files or
stream directories.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.28 src/usr.sbin/makefs/udf.c:1.29
--- src/usr.sbin/makefs/udf.c:1.28	Tue Apr 26 14:59:37 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 15:18:08 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.29 2022/04/26 15:18:08 reinoud Exp $");
 
 #include 
 #include 
@@ -473,6 +473,7 @@ udf_file_inject_blob(union dscrptr *dscr
 	dscr->tag.desc_crc_len = udf_rw16(crclen);
 	udf_validate_tag_and_crc_sums(dscr);
 
+	(void) obj_size;
 	return 0;
 }
 
@@ -617,7 +618,7 @@ udf_append_file_mapping(union dscrptr *d
 	} else if (udf_rw16(dscr->tag.id) == TAGID_EXTFENTRY) {
 		efe->l_ad = udf_rw32(l_ad);
 		efe->inf_len  = udf_rw64(inf_len);
-		efe->obj_size = udf_rw64(inf_len);
+		efe->obj_size = udf_rw64(obj_size);
 		efe->logblks_rec = udf_rw64(logblks_rec);
 	}
 }



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 15:18:08 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Avoid warning by clang of unused variable

While here, use the computated obj_size even though it's always the same as
its information length since we don't use extended attribute files or
stream directories.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/makefs/udf.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 14:59:37 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug that resulted in UniqueIDs of 0 in file identifiers; note that
the the unique ID in a longad stored in a FID is 32 bit where in the file
descriptor (fe/efe) its 64 bits long.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/makefs/udf.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 14:59:37 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug that resulted in UniqueIDs of 0 in file identifiers; note that
the the unique ID in a longad stored in a FID is 32 bit where in the file
descriptor (fe/efe) its 64 bits long.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.27 src/usr.sbin/makefs/udf.c:1.28
--- src/usr.sbin/makefs/udf.c:1.27	Tue Apr 26 13:27:24 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 14:59:37 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.28 2022/04/26 14:59:37 reinoud Exp $");
 
 #include 
 #include 
@@ -666,13 +666,13 @@ udf_create_new_file(struct stat *st, uni
 		if (error)
 			errx(error, "can't create fe");
 		*dscr = (union dscrptr *) fe;
-		icb->longad_uniqueid = fe->unique_id;
+		icb->longad_uniqueid = udf_rw32(udf_rw64(fe->unique_id));
 	} else {
 		error = udf_create_new_efe(, filetype, st);
 		if (error)
 			errx(error, "can't create fe");
 		*dscr = (union dscrptr *) efe;
-		icb->longad_uniqueid = efe->unique_id;
+		icb->longad_uniqueid = udf_rw32(udf_rw64(efe->unique_id));
 	}
 
 	return 0;



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:27:24 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
No need to use ceilf() when ceil() is already used


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/udf.c

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



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:27:24 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
No need to use ceilf() when ceil() is already used


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.26 src/usr.sbin/makefs/udf.c:1.27
--- src/usr.sbin/makefs/udf.c:1.26	Tue Apr 26 13:26:30 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 13:27:24 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.27 2022/04/26 13:27:24 reinoud Exp $");
 
 #include 
 #include 
@@ -1218,7 +1218,7 @@ udf_makefs(const char *image, const char
 	if (context.format_flags & FORMAT_META)
 		printf("Metadata percentage  %d%% (%d%% used)\n",
 			context.meta_perc,
-			(int) ceilf(100.0*stats.nmetadatablocks/stats.ndatablocks));
+			(int) ceil(100.0*stats.nmetadatablocks/stats.ndatablocks));
 	printf("\n");
 
 	/* prefix */



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:26:30 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug in makefs for udf


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/udf.c

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

Modified files:

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.25 src/usr.sbin/makefs/udf.c:1.26
--- src/usr.sbin/makefs/udf.c:1.25	Sat Apr  9 10:05:35 2022
+++ src/usr.sbin/makefs/udf.c	Tue Apr 26 13:26:30 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $ */
+/* $NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.25 2022/04/09 10:05:35 riastradh Exp $");
+__RCSID("$NetBSD: udf.c,v 1.26 2022/04/26 13:26:30 reinoud Exp $");
 
 #include 
 #include 
@@ -505,7 +505,7 @@ udf_append_file_mapping(union dscrptr *d
 	if (udf_rw16(dscr->tag.id) == TAGID_FENTRY) {
 		fe  = >fe;
 		data= fe->data;
-		l_ea= fe->l_ea;
+		l_ea= udf_rw32(fe->l_ea);
 		l_ad= udf_rw32(fe->l_ad);
 		icb = >icbtag;
 		inf_len = udf_rw64(fe->inf_len);
@@ -514,7 +514,7 @@ udf_append_file_mapping(union dscrptr *d
 	} else if (udf_rw16(dscr->tag.id) == TAGID_EXTFENTRY) {
 		efe = >efe;
 		data= efe->data;
-		l_ea= efe->l_ea;
+		l_ea= udf_rw32(efe->l_ea);
 		l_ad= udf_rw32(efe->l_ad);
 		icb = >icbtag;
 		inf_len = udf_rw64(efe->inf_len);



CVS commit: src/usr.sbin/makefs

2022-04-26 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Apr 26 13:26:30 UTC 2022

Modified Files:
src/usr.sbin/makefs: udf.c

Log Message:
Fix endian bug in makefs for udf


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/makefs/udf.c

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



CVS commit: src/usr.sbin/makefs/udf

2022-04-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 10 09:22:35 UTC 2022

Modified Files:
src/usr.sbin/makefs/udf: Makefile.inc

Log Message:
makefs(8): Fix tool build -- no libutil DPADD if HOSTPROG.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makefs/udf/Makefile.inc

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

Modified files:

Index: src/usr.sbin/makefs/udf/Makefile.inc
diff -u src/usr.sbin/makefs/udf/Makefile.inc:1.5 src/usr.sbin/makefs/udf/Makefile.inc:1.6
--- src/usr.sbin/makefs/udf/Makefile.inc:1.5	Wed Apr  6 13:29:16 2022
+++ src/usr.sbin/makefs/udf/Makefile.inc	Sun Apr 10 09:22:35 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.5 2022/04/06 13:29:16 reinoud Exp $
+#	$NetBSD: Makefile.inc,v 1.6 2022/04/10 09:22:35 riastradh Exp $
 #
 
 UDF=	${NETBSDSRCDIR}/sys/fs/udf
@@ -11,8 +11,10 @@ CPPFLAGS+= -I${UDF} -I${UDF_NEWFS} -I${F
 
 SRCS += udf_core.c udf_osta.c
 
+.if !defined(HOSTPROG)
 DPADD+=${LIBUTIL}
 LDADD+=-lutil -lprop
+.endif
 
 CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member -Wno-error=constant-conversion
 CWARNFLAGS.gcc+=	${GCC_NO_ADDR_OF_PACKED_MEMBER}



CVS commit: src/usr.sbin/makefs/udf

2022-04-10 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 10 09:22:35 UTC 2022

Modified Files:
src/usr.sbin/makefs/udf: Makefile.inc

Log Message:
makefs(8): Fix tool build -- no libutil DPADD if HOSTPROG.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/makefs/udf/Makefile.inc

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



CVS commit: src/usr.sbin/makefs

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 14:38:47 UTC 2022

Modified Files:
src/usr.sbin/makefs: Makefile

Log Message:
makefs(8): Needs -lm for ceil in udf as a host tool too.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/Makefile

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

Modified files:

Index: src/usr.sbin/makefs/Makefile
diff -u src/usr.sbin/makefs/Makefile:1.38 src/usr.sbin/makefs/Makefile:1.39
--- src/usr.sbin/makefs/Makefile:1.38	Wed Apr  6 22:25:00 2022
+++ src/usr.sbin/makefs/Makefile	Sat Apr  9 14:38:47 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2022/04/06 22:25:00 hauke Exp $
+#	$NetBSD: Makefile,v 1.39 2022/04/09 14:38:47 riastradh Exp $
 #
 
 WARNS?=	5
@@ -28,7 +28,9 @@ CPPFLAGS+=	-I${.CURDIR} -I${MKNODSRC} -I
 .include "${.CURDIR}/msdos/Makefile.inc"
 .include "${.CURDIR}/udf/Makefile.inc"
 
-.if !defined(HOSTPROG)
+.if defined(HOSTPROG)
+LDADD+=	-lm
+.else
 DPADD+= ${LIBUTIL} ${LIBM}
 LDADD+= -lutil -lm
 



CVS commit: src/usr.sbin/makefs

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 14:38:47 UTC 2022

Modified Files:
src/usr.sbin/makefs: Makefile

Log Message:
makefs(8): Needs -lm for ceil in udf as a host tool too.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/usr.sbin/makefs/Makefile

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



CVS commit: src/usr.sbin/makefs

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 10:05:35 UTC 2022

Modified Files:
src/usr.sbin/makefs: chfs.c ffs.c makefs.c makefs.h msdos.c udf.c
walk.c
src/usr.sbin/makefs/cd9660: cd9660_archimedes.c cd9660_archimedes.h
cd9660_eltorito.c
src/usr.sbin/makefs/chfs: chfs_mkfs.c
src/usr.sbin/makefs/ffs: buf.c ffs_alloc.c ffs_extern.h ufs_bmap.c
src/usr.sbin/makefs/msdos: msdosfs_vfsops.c msdosfs_vnops.c
src/usr.sbin/makefs/udf: cdio_mmc_structs.h

Log Message:
makefs(8): Nix trailing whitespace.

Computed by machine, eyeballed by hand, so to speak.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/makefs/chfs.c
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/makefs/ffs.c
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/makefs/msdos.c
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/udf.c
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/makefs/walk.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/cd9660/cd9660_archimedes.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/cd9660/cd9660_archimedes.h
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/makefs/chfs/chfs_mkfs.c
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/ffs/buf.c
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/ffs/ffs_alloc.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/ffs/ffs_extern.h
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/makefs/ffs/ufs_bmap.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makefs/msdos/msdosfs_vnops.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/udf/cdio_mmc_structs.h

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

Modified files:

Index: src/usr.sbin/makefs/chfs.c
diff -u src/usr.sbin/makefs/chfs.c:1.8 src/usr.sbin/makefs/chfs.c:1.9
--- src/usr.sbin/makefs/chfs.c:1.8	Tue Jan 29 15:52:25 2013
+++ src/usr.sbin/makefs/chfs.c	Sat Apr  9 10:05:35 2022
@@ -102,7 +102,7 @@ chfs_makefs(const char *image, const cha
 	assert(image != NULL);
 	assert(dir != NULL);
 	assert(root != NULL);
-	assert(fsopts != NULL);	
+	assert(fsopts != NULL);
 
 	TIMER_START(start);
 	chfs_validate(dir, root, fsopts);
@@ -114,7 +114,7 @@ chfs_makefs(const char *image, const cha
 		errx(EXIT_FAILURE, "Image file `%s' not created", image);
 	}
 	TIMER_RESULTS(start, "chfs_create_image");
-	
+
 	fsopts->curinode = CHFS_ROOTINO;
 	root->inode->ino = CHFS_ROOTINO;
 
@@ -162,7 +162,7 @@ chfs_create_image(const char *image, fsi
 {
 	assert(image != NULL);
 	assert(fsopts != NULL);
-	
+
 	if ((fsopts->fd = open(image, O_RDWR | O_CREAT | O_TRUNC, 0666)) == -1) {
 		warn("Can't open `%s' for writing", image);
 		return -1;
@@ -180,8 +180,8 @@ chfs_populate_dir(const char *dir, fsnod
 
 	assert(dir != NULL);
 	assert(root != NULL);
-	assert(fsopts != NULL);	
-	
+	assert(fsopts != NULL);
+
 	for (cur = root->next; cur != NULL; cur = cur->next) {
 		if ((cur->inode->flags & FI_ALLOCATED) == 0) {
 			cur->inode->flags |= FI_ALLOCATED;
@@ -203,7 +203,7 @@ chfs_populate_dir(const char *dir, fsnod
 			write_file(fsopts, cur, dir);
 		}
 	}
-	
+
 	for (cur = root; cur != NULL; cur = cur->next) {
 		if (cur->child == NULL) {
 			continue;
@@ -219,4 +219,3 @@ chfs_populate_dir(const char *dir, fsnod
 
 	return 1;
 }
-

Index: src/usr.sbin/makefs/ffs.c
diff -u src/usr.sbin/makefs/ffs.c:1.71 src/usr.sbin/makefs/ffs.c:1.72
--- src/usr.sbin/makefs/ffs.c:1.71	Wed Apr  6 13:44:25 2022
+++ src/usr.sbin/makefs/ffs.c	Sat Apr  9 10:05:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs.c,v 1.71 2022/04/06 13:44:25 wiz Exp $	*/
+/*	$NetBSD: ffs.c,v 1.72 2022/04/09 10:05:35 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -71,7 +71,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.71 2022/04/06 13:44:25 wiz Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.72 2022/04/09 10:05:35 riastradh Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -387,11 +387,11 @@ ffs_validate(const char *dir, fsnode *ro
 		/* add space needed to store inodes, x3 for blockmaps, etc */
 	if (ffs_opts->version == 1)
 		fsopts->size += ncg * DINODE1_SIZE *
-		roundup(fsopts->inodes / ncg, 
+		roundup(fsopts->inodes / ncg,
 			ffs_opts->bsize / DINODE1_SIZE);
 	else
 		fsopts->size += ncg * DINODE2_SIZE *
-		roundup(fsopts->inodes / ncg, 
+		roundup(fsopts->inodes / ncg,
 			ffs_opts->bsize / DINODE2_SIZE);
 
 		/* add minfree */
@@ -966,7 +966,7 @@ ffs_write_file(union dinode *din, uint32
 		if (!isfile)
 			p += chunk;
 	}
-  
+
  write_inode_and_leave:
 	ffs_write_inode(_din, in.i_number, fsopts);
 
@@ -1108,7 +1108,7 @@ ffs_write_inode(union dinode *dp, uint32
 	if (S_ISDIR(DIP(dp, mode))) {
 		ufs_add32(cgp->cg_cs.cs_ndir, 1, fsopts->needswap);
 		fs->fs_cstotal.cs_ndir++;
-		

CVS commit: src/usr.sbin/makefs

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 10:05:35 UTC 2022

Modified Files:
src/usr.sbin/makefs: chfs.c ffs.c makefs.c makefs.h msdos.c udf.c
walk.c
src/usr.sbin/makefs/cd9660: cd9660_archimedes.c cd9660_archimedes.h
cd9660_eltorito.c
src/usr.sbin/makefs/chfs: chfs_mkfs.c
src/usr.sbin/makefs/ffs: buf.c ffs_alloc.c ffs_extern.h ufs_bmap.c
src/usr.sbin/makefs/msdos: msdosfs_vfsops.c msdosfs_vnops.c
src/usr.sbin/makefs/udf: cdio_mmc_structs.h

Log Message:
makefs(8): Nix trailing whitespace.

Computed by machine, eyeballed by hand, so to speak.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/makefs/chfs.c
cvs rdiff -u -r1.71 -r1.72 src/usr.sbin/makefs/ffs.c
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/makefs/makefs.c
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/makefs/makefs.h
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/makefs/msdos.c
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/udf.c
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/makefs/walk.c
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makefs/cd9660/cd9660_archimedes.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/cd9660/cd9660_archimedes.h
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/cd9660/cd9660_eltorito.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/makefs/chfs/chfs_mkfs.c
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/makefs/ffs/buf.c
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/makefs/ffs/ffs_alloc.c
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/makefs/ffs/ffs_extern.h
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/makefs/ffs/ufs_bmap.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/makefs/msdos/msdosfs_vfsops.c
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makefs/msdos/msdosfs_vnops.c
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makefs/udf/cdio_mmc_structs.h

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



CVS commit: src/usr.sbin/makefs

2022-04-06 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Wed Apr  6 22:25:00 UTC 2022

Modified Files:
src/usr.sbin/makefs: Makefile

Log Message:
udf.c uses math library functions.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/makefs/Makefile

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

Modified files:

Index: src/usr.sbin/makefs/Makefile
diff -u src/usr.sbin/makefs/Makefile:1.37 src/usr.sbin/makefs/Makefile:1.38
--- src/usr.sbin/makefs/Makefile:1.37	Sun Oct 13 07:28:19 2019
+++ src/usr.sbin/makefs/Makefile	Wed Apr  6 22:25:00 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.37 2019/10/13 07:28:19 mrg Exp $
+#	$NetBSD: Makefile,v 1.38 2022/04/06 22:25:00 hauke Exp $
 #
 
 WARNS?=	5
@@ -29,8 +29,8 @@ CPPFLAGS+=	-I${.CURDIR} -I${MKNODSRC} -I
 .include "${.CURDIR}/udf/Makefile.inc"
 
 .if !defined(HOSTPROG)
-DPADD+= ${LIBUTIL}
-LDADD+= -lutil
+DPADD+= ${LIBUTIL} ${LIBM}
+LDADD+= -lutil -lm
 
 COPTS.cd9660.c+=		${GCC_NO_STRINGOP_TRUNCATION} ${GCC_NO_FORMAT_TRUNCATION}
 COPTS.cd9660_conversion.c+=	${GCC_NO_FORMAT_TRUNCATION}



CVS commit: src/usr.sbin/makefs

2022-04-06 Thread Hauke Fath
Module Name:src
Committed By:   hauke
Date:   Wed Apr  6 22:25:00 UTC 2022

Modified Files:
src/usr.sbin/makefs: Makefile

Log Message:
udf.c uses math library functions.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/usr.sbin/makefs/Makefile

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



CVS commit: src/usr.sbin/makefs

2022-04-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  6 13:44:25 UTC 2022

Modified Files:
src/usr.sbin/makefs: ffs.c udf.c walk.c

Log Message:
makefs: fix some typos


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/makefs/ffs.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/udf.c
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/makefs/walk.c

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

Modified files:

Index: src/usr.sbin/makefs/ffs.c
diff -u src/usr.sbin/makefs/ffs.c:1.70 src/usr.sbin/makefs/ffs.c:1.71
--- src/usr.sbin/makefs/ffs.c:1.70	Sat Dec 16 23:08:40 2017
+++ src/usr.sbin/makefs/ffs.c	Wed Apr  6 13:44:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs.c,v 1.70 2017/12/16 23:08:40 christos Exp $	*/
+/*	$NetBSD: ffs.c,v 1.71 2022/04/06 13:44:25 wiz Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -71,7 +71,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: ffs.c,v 1.70 2017/12/16 23:08:40 christos Exp $");
+__RCSID("$NetBSD: ffs.c,v 1.71 2022/04/06 13:44:25 wiz Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -149,7 +149,7 @@ static  void	*ffs_build_dinode2(struct u
 
 
 
-	/* publically visible functions */
+	/* publicly visible functions */
 void
 ffs_prep_opts(fsinfo_t *fsopts)
 {

Index: src/usr.sbin/makefs/udf.c
diff -u src/usr.sbin/makefs/udf.c:1.23 src/usr.sbin/makefs/udf.c:1.24
--- src/usr.sbin/makefs/udf.c:1.23	Wed Apr  6 13:29:15 2022
+++ src/usr.sbin/makefs/udf.c	Wed Apr  6 13:44:25 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: udf.c,v 1.23 2022/04/06 13:29:15 reinoud Exp $ */
+/* $NetBSD: udf.c,v 1.24 2022/04/06 13:44:25 wiz Exp $ */
 
 /*
  * Copyright (c) 2006, 2008, 2013, 2021, 2022 Reinoud Zandijk
@@ -30,7 +30,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: udf.c,v 1.23 2022/04/06 13:29:15 reinoud Exp $");
+__RCSID("$NetBSD: udf.c,v 1.24 2022/04/06 13:44:25 wiz Exp $");
 
 #include 
 #include 
@@ -130,7 +130,7 @@ udf_prep_opts(fsinfo_t *fsopts)
 		OPT_BOOL('c', "checksurface", check_surface,
 			"perform crude surface check on rewritable media"),
 		OPT_BOOL('F', "forceformat", create_new_session,
-			"force file system contruction on non-empty recordable media"),
+			"force file system construction on non-empty recordable media"),
 		{ .name = NULL }
 	};
 
@@ -1235,7 +1235,7 @@ udf_makefs(const char *image, const char
 	error = udf_populate(dir, root, fsopts, );
 
 	if (!error) {
-		/* update values for integrety sequence */
+		/* update values for integrity sequence */
 		context.num_files = stats.nfiles;
 		context.num_directories = stats.ndirs;
 

Index: src/usr.sbin/makefs/walk.c
diff -u src/usr.sbin/makefs/walk.c:1.30 src/usr.sbin/makefs/walk.c:1.31
--- src/usr.sbin/makefs/walk.c:1.30	Sat Apr  3 14:10:56 2021
+++ src/usr.sbin/makefs/walk.c	Wed Apr  6 13:44:25 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: walk.c,v 1.30 2021/04/03 14:10:56 simonb Exp $	*/
+/*	$NetBSD: walk.c,v 1.31 2022/04/06 13:44:25 wiz Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: walk.c,v 1.30 2021/04/03 14:10:56 simonb Exp $");
+__RCSID("$NetBSD: walk.c,v 1.31 2022/04/06 13:44:25 wiz Exp $");
 #endif	/* !__lint */
 
 #include 
@@ -277,7 +277,7 @@ create_fsnode(const char *root, const ch
 /*
  * free_fsnodes --
  *	Removes node from tree and frees it and all of
- *   its decendents.
+ *   its descendents.
  */
 void
 free_fsnodes(fsnode *node)



CVS commit: src/usr.sbin/makefs

2022-04-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  6 13:44:25 UTC 2022

Modified Files:
src/usr.sbin/makefs: ffs.c udf.c walk.c

Log Message:
makefs: fix some typos


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.sbin/makefs/ffs.c
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/makefs/udf.c
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/makefs/walk.c

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



CVS commit: src/usr.sbin/makefs

2022-04-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  6 13:39:06 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.8

Log Message:
new sentence, new line


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/makefs/makefs.8

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

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.69 src/usr.sbin/makefs/makefs.8:1.70
--- src/usr.sbin/makefs/makefs.8:1.69	Wed Apr  6 13:29:15 2022
+++ src/usr.sbin/makefs/makefs.8	Wed Apr  6 13:39:06 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.69 2022/04/06 13:29:15 reinoud Exp $
+.\"	$NetBSD: makefs.8,v 1.70 2022/04/06 13:39:06 wiz Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -490,7 +490,8 @@ population.
 .Ss UDF-specific options
 .Nm
 supports besides writing to image files also direct formatting of disc
-partitions and optical media. Optical media will auto configure settings.
+partitions and optical media.
+Optical media will auto configure settings.
 The following udf-specific optional parameters may be provided.
 Each of the options consists of a keyword, an equal sign
 .Pq Ql = ,
@@ -511,8 +512,10 @@ create a rewritable fs on once recordabl
 create a rewritable fs with sparing for defective sectors
 .El
 The sectorsize is set for the selected media and the default maximum disc size
-is assumed unless overridden. For cdrom, dvdrom and bdrom images, the disc
-size is the minimum size needed. Note that the size estimator can
+is assumed unless overridden.
+For CD-ROM, DVD-ROM and BD-ROM images, the disc
+size is the minimum size needed.
+Note that the size estimator can
 under-estimate in some cases; specify extra free blocks if encountering this.
 .It Sy loglabel
 Set the logical volume label of the disc to the specified argument.
@@ -525,22 +528,22 @@ manually unless it has an unique hex num
 positions.
 .It Sy minver
 Set the minimum UDF version to be used.
-Choose UDF version numbers from 0x102, 0x150, 0x200, 0x201 and 0x250.
+Choose UDF version numbers from 0x102, 0x150, 0x200, 0x201, and 0x250.
 Version 0x260 is currently not supported
 in
 .Nm .
 .It Sy maxver
 Set the maximum UDF version to be used.
-Choose UDF version numbers from 0x102, 0x150, 0x200, 0x201 and 0x250.
+Choose UDF version numbers from 0x102, 0x150, 0x200, 0x201, and 0x250.
 Version 0x260 is currently not supported
 in
 .Nm .
 .It Sy metaperc
-Set the minimum amount of free metadata space. This is only applicable on UDF
-0x250 on rewritable media.
+Set the minimum amount of free metadata space.
+This is only applicable on UDF 0x250 on rewritable media.
 .It Sy checksurface
-Check the surface of non error-free rewritable media for remapping. Note this
-is a destructive test and can take quite a while!
+Check the surface of non error-free rewritable media for remapping.
+Note this is a destructive test and can take quite a while!
 .It Sy forceformat
 Force formatting on non-empty recordable media.
 .El



CVS commit: src/usr.sbin/makefs

2022-04-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr  6 13:39:06 UTC 2022

Modified Files:
src/usr.sbin/makefs: makefs.8

Log Message:
new sentence, new line


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/usr.sbin/makefs/makefs.8

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



CVS commit: src/usr.sbin/makefs/ffs

2022-04-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr  2 19:16:49 UTC 2022

Modified Files:
src/usr.sbin/makefs/ffs: mkfs.c

Log Message:
Avoid integer overflow on systems with 32bit disk addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/ffs/mkfs.c

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



CVS commit: src/usr.sbin/makefs/ffs

2022-04-02 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Apr  2 19:16:49 UTC 2022

Modified Files:
src/usr.sbin/makefs/ffs: mkfs.c

Log Message:
Avoid integer overflow on systems with 32bit disk addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/usr.sbin/makefs/ffs/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/usr.sbin/makefs/ffs/mkfs.c
diff -u src/usr.sbin/makefs/ffs/mkfs.c:1.39 src/usr.sbin/makefs/ffs/mkfs.c:1.40
--- src/usr.sbin/makefs/ffs/mkfs.c:1.39	Thu Mar 26 04:25:28 2020
+++ src/usr.sbin/makefs/ffs/mkfs.c	Sat Apr  2 19:16:49 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkfs.c,v 1.39 2020/03/26 04:25:28 kre Exp $	*/
+/*	$NetBSD: mkfs.c,v 1.40 2022/04/02 19:16:49 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -48,7 +48,7 @@
 static char sccsid[] = "@(#)mkfs.c	8.11 (Berkeley) 5/3/95";
 #else
 #ifdef __RCSID
-__RCSID("$NetBSD: mkfs.c,v 1.39 2020/03/26 04:25:28 kre Exp $");
+__RCSID("$NetBSD: mkfs.c,v 1.40 2022/04/02 19:16:49 mlelstv Exp $");
 #endif
 #endif
 #endif /* not lint */
@@ -796,7 +796,7 @@ ffs_rdfs(daddr_t bno, int size, void *bf
 	int n;
 	off_t offset;
 
-	offset = bno * fsopts->sectorsize + fsopts->offset;
+	offset = bno * (off_t)fsopts->sectorsize + fsopts->offset;
 	if (lseek(fsopts->fd, offset, SEEK_SET) < 0)
 		err(EXIT_FAILURE, "%s: seek error for sector %lld", __func__,
 		(long long)bno);
@@ -819,7 +819,7 @@ ffs_wtfs(daddr_t bno, int size, void *bf
 	int n;
 	off_t offset;
 
-	offset = bno * fsopts->sectorsize + fsopts->offset;
+	offset = bno * (off_t)fsopts->sectorsize + fsopts->offset;
 	if (lseek(fsopts->fd, offset, SEEK_SET) == -1)
 		err(EXIT_FAILURE, "%s: seek error @%jd for sector %jd",
 		__func__, (intmax_t)offset, (intmax_t)bno);



Re: CVS commit: src/usr.sbin/makefs/ffs

2022-03-07 Thread Izumi Tsutsui
> Module Name:  src
> Committed By: hgutch
> Date: Sun Mar  6 08:31:54 UTC 2022
> 
> Modified Files:
>   src/usr.sbin/makefs/ffs: buf.h newfs_extern.h
> Added Files:
>   src/usr.sbin/makefs/ffs: namespace.h
> 
> Log Message:
> Make sure daddr_t is a 64 bit type when building tools.
> (see also PR sw-bug/56742 ).

I wonder this target type definition should rather be defined in
src/tools/compat/compat_defs.h (and src/tools/compat/configure.ac).

---
Izumi Tsutsui


CVS commit: src/usr.sbin/makefs/ffs

2022-03-06 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sun Mar  6 08:31:54 UTC 2022

Modified Files:
src/usr.sbin/makefs/ffs: buf.h newfs_extern.h
Added Files:
src/usr.sbin/makefs/ffs: namespace.h

Log Message:
Make sure daddr_t is a 64 bit type when building tools.
(see also PR sw-bug/56742 ).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/makefs/ffs/buf.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/makefs/ffs/namespace.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makefs/ffs/newfs_extern.h

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

Modified files:

Index: src/usr.sbin/makefs/ffs/buf.h
diff -u src/usr.sbin/makefs/ffs/buf.h:1.13 src/usr.sbin/makefs/ffs/buf.h:1.14
--- src/usr.sbin/makefs/ffs/buf.h:1.13	Mon Sep  3 16:29:37 2018
+++ src/usr.sbin/makefs/ffs/buf.h	Sun Mar  6 08:31:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: buf.h,v 1.13 2018/09/03 16:29:37 riastradh Exp $	*/
+/*	$NetBSD: buf.h,v 1.14 2022/03/06 08:31:54 hgutch Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -49,6 +49,7 @@
 #include 
 #include 
 #include 
+#include "namespace.h"
 
 struct componentname {
 	char *cn_nameptr;

Index: src/usr.sbin/makefs/ffs/newfs_extern.h
diff -u src/usr.sbin/makefs/ffs/newfs_extern.h:1.4 src/usr.sbin/makefs/ffs/newfs_extern.h:1.5
--- src/usr.sbin/makefs/ffs/newfs_extern.h:1.4	Mon Dec 21 00:58:08 2015
+++ src/usr.sbin/makefs/ffs/newfs_extern.h	Sun Mar  6 08:31:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs_extern.h,v 1.4 2015/12/21 00:58:08 christos Exp $	*/
+/*	$NetBSD: newfs_extern.h,v 1.5 2022/03/06 08:31:54 hgutch Exp $	*/
 /* From: NetBSD: extern.h,v 1.3 2000/12/01 12:03:27 simonb Exp $ */
 
 /*
@@ -25,6 +25,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "namespace.h"
+
 /* prototypes */
 struct fs	*ffs_mkfs(const char *, const fsinfo_t *, time_t);
 void		ffs_write_superblock(struct fs *, const fsinfo_t *);

Added files:

Index: src/usr.sbin/makefs/ffs/namespace.h
diff -u /dev/null src/usr.sbin/makefs/ffs/namespace.h:1.1
--- /dev/null	Sun Mar  6 08:31:55 2022
+++ src/usr.sbin/makefs/ffs/namespace.h	Sun Mar  6 08:31:54 2022
@@ -0,0 +1,5 @@
+/*	$Id: namespace.h,v 1.1 2022/03/06 08:31:54 hgutch Exp $	*/
+
+#ifndef daddr_t
+#define daddr_t int64_t
+#endif



CVS commit: src/usr.sbin/makefs/ffs

2022-03-06 Thread Harold Gutch
Module Name:src
Committed By:   hgutch
Date:   Sun Mar  6 08:31:54 UTC 2022

Modified Files:
src/usr.sbin/makefs/ffs: buf.h newfs_extern.h
Added Files:
src/usr.sbin/makefs/ffs: namespace.h

Log Message:
Make sure daddr_t is a 64 bit type when building tools.
(see also PR sw-bug/56742 ).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/makefs/ffs/buf.h
cvs rdiff -u -r0 -r1.1 src/usr.sbin/makefs/ffs/namespace.h
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/makefs/ffs/newfs_extern.h

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



CVS commit: src/usr.sbin/makefs

2021-12-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec 21 21:28:31 UTC 2021

Modified Files:
src/usr.sbin/makefs: cd9660.c

Log Message:
s/filname/filename/


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/cd9660.c

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

Modified files:

Index: src/usr.sbin/makefs/cd9660.c
diff -u src/usr.sbin/makefs/cd9660.c:1.57 src/usr.sbin/makefs/cd9660.c:1.58
--- src/usr.sbin/makefs/cd9660.c:1.57	Tue Nov 10 20:48:29 2020
+++ src/usr.sbin/makefs/cd9660.c	Tue Dec 21 21:28:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660.c,v 1.57 2020/11/10 20:48:29 reinoud Exp $	*/
+/*	$NetBSD: cd9660.c,v 1.58 2021/12/21 21:28:31 andvar Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(__lint)
-__RCSID("$NetBSD: cd9660.c,v 1.57 2020/11/10 20:48:29 reinoud Exp $");
+__RCSID("$NetBSD: cd9660.c,v 1.58 2021/12/21 21:28:31 andvar Exp $");
 #endif  /* !__lint */
 
 #include 
@@ -1011,7 +1011,7 @@ cd9660_sorted_child_insert(cd9660node *p
 
 /*
  * Called After cd9660_sorted_child_insert
- * handles file collisions by suffixing each filname with ~n
+ * handles file collisions by suffixing each filename with ~n
  * where n represents the files respective place in the ordering
  */
 static int



CVS commit: src/usr.sbin/makefs

2021-12-21 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Dec 21 21:28:31 UTC 2021

Modified Files:
src/usr.sbin/makefs: cd9660.c

Log Message:
s/filname/filename/


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/usr.sbin/makefs/cd9660.c

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



CVS commit: src/usr.sbin/makefs

2021-11-11 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Nov 12 07:41:55 UTC 2021

Modified Files:
src/usr.sbin/makefs: makefs.8

Log Message:
Explain cd9660 and udf exceptions on the rule that the default sectorsize is
512.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/makefs/makefs.8

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

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.67 src/usr.sbin/makefs/makefs.8:1.68
--- src/usr.sbin/makefs/makefs.8:1.67	Sat Apr  3 14:10:56 2021
+++ src/usr.sbin/makefs/makefs.8	Fri Nov 12 07:41:55 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.67 2021/04/03 14:10:56 simonb Exp $
+.\"	$NetBSD: makefs.8,v 1.68 2021/11/12 07:41:55 reinoud Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -197,8 +197,11 @@ When merging multiple directories replac
 .It Fl S Ar sector-size
 Set the file system sector size to
 .Ar sector-size .
-.\" XXX: next line also true for cd9660?
-Defaults to 512.
+Defaults to 512 for most file systems, but is 2048 for
+.Sy cd9660
+and
+.Sy udf
+for CD/DVD/BD optical media types.
 .It Fl s Ar image-size
 Set the size of the file system image to
 .Ar image-size .



CVS commit: src/usr.sbin/makefs

2021-11-11 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Fri Nov 12 07:41:55 UTC 2021

Modified Files:
src/usr.sbin/makefs: makefs.8

Log Message:
Explain cd9660 and udf exceptions on the rule that the default sectorsize is
512.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/usr.sbin/makefs/makefs.8

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



CVS commit: src/usr.sbin/makefs

2019-11-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  6 21:04:23 UTC 2019

Modified Files:
src/usr.sbin/makefs: makefs.8

Log Message:
Correct documentation of -m and -M.
>From Ed Maste @ FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/makefs/makefs.8

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



CVS commit: src/usr.sbin/makefs

2019-11-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  6 21:04:23 UTC 2019

Modified Files:
src/usr.sbin/makefs: makefs.8

Log Message:
Correct documentation of -m and -M.
>From Ed Maste @ FreeBSD


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/makefs/makefs.8

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

Modified files:

Index: src/usr.sbin/makefs/makefs.8
diff -u src/usr.sbin/makefs/makefs.8:1.63 src/usr.sbin/makefs/makefs.8:1.64
--- src/usr.sbin/makefs/makefs.8:1.63	Fri Apr 14 03:09:43 2017
+++ src/usr.sbin/makefs/makefs.8	Wed Nov  6 16:04:22 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: makefs.8,v 1.63 2017/04/14 07:09:43 wiz Exp $
+.\"	$NetBSD: makefs.8,v 1.64 2019/11/06 21:04:22 christos Exp $
 .\"
 .\" Copyright (c) 2001-2003 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -33,7 +33,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 13, 2017
+.Dd November 6, 2019
 .Dt MAKEFS 8
 .Os
 .Sh NAME
@@ -201,9 +201,9 @@ Defaults to 512.
 Set the size of the file system image to
 .Ar image-size .
 This is equivalent of setting both the minimum
-.Fl ( m )
-and the maximum
 .Fl ( M )
+and the maximum
+.Fl ( m )
 sizes to
 .Ar image-size .
 For



Re: CVS commit: src/usr.sbin/makefs

2017-02-11 Thread Christos Zoulas
In article <28149.1486810...@splode.eterna.com.au>,
matthew green   wrote:
>"Christos Zoulas" writes:
>> Module Name: src
>> Committed By:christos
>> Date:Wed Feb  8 21:33:12 UTC 2017
>> 
>> Modified Files:
>>  src/usr.sbin/makefs: udf.c
>>  src/usr.sbin/makefs/cd9660: cd9660_conversion.c
>> 
>> Log Message:
>> If we are using a timestamp from the command line, don't pay attention to
>> the user timezone, use UTC instead (for reproducible builds).
>
>seems a little user-unfriendly -- the build could just
>set TZ to fix this.
>
>either way, please document this.

Well, it does not make a lot of sense to have a timestamp that floats
depending on $TZ, so I documented the change.

Thanks,

christos



re: CVS commit: src/usr.sbin/makefs

2017-02-11 Thread matthew green
"Christos Zoulas" writes:
> Module Name:  src
> Committed By: christos
> Date: Wed Feb  8 21:33:12 UTC 2017
> 
> Modified Files:
>   src/usr.sbin/makefs: udf.c
>   src/usr.sbin/makefs/cd9660: cd9660_conversion.c
> 
> Log Message:
> If we are using a timestamp from the command line, don't pay attention to
> the user timezone, use UTC instead (for reproducible builds).

seems a little user-unfriendly -- the build could just
set TZ to fix this.

either way, please document this.


.mrg.


Re: CVS commit: src/usr.sbin/makefs

2013-08-07 Thread David Young
On Mon, Aug 05, 2013 at 02:41:57PM +, Reinoud Zandijk wrote:
 Module Name:  src
 Committed By: reinoud
 Date: Mon Aug  5 14:41:57 UTC 2013
 
 Modified Files:
   src/usr.sbin/makefs: Makefile makefs.8 makefs.c makefs.h
 Added Files:
   src/usr.sbin/makefs: udf.c
   src/usr.sbin/makefs/udf: Makefile.inc
 
 Log Message:
 Implement `makefs -t udf'.

Great!  Thanks.

Dave

-- 
David Young
dyo...@pobox.comUrbana, IL(217) 721-9981


Re: CVS commit: src/usr.sbin/makefs/ffs

2012-04-23 Thread Christos Zoulas
On Apr 23,  9:05pm, dholland-sourcechan...@netbsd.org (David Holland) wrote:
-- Subject: Re: CVS commit: src/usr.sbin/makefs/ffs

| On Mon, Apr 23, 2012 at 05:04:45PM -0400, Christos Zoulas wrote:
|   | I was wondering if maybe ino_t isn't reliable for tools...
|   
|   Looks like it is there on:
|   /usr/src/usr.sbin/makefs/ffs/ufs_inode.h:   ino_t   i_number;  
 /* The identity of the inode. */
|   
|   so it should be ok.
| 
| Yeah but is it going to turn out to e.g. be signed if building on some
| random broken host OS?

I don't think it will work at all if it is not a 64 bit quantity, will it?

christos


Re: CVS commit: src/usr.sbin/makefs

2011-07-18 Thread UCHIYAMA Yasushi
From: Matthias Scheler t...@netbsd.org
Subject: CVS commit: src/usr.sbin/makefs
Date: Mon, 18 Jul 2011 22:52:37 +

 Module Name:  src
 Committed By: tron
 Date: Mon Jul 18 22:52:37 UTC 2011
 
 Modified Files:
   src/usr.sbin/makefs: Makefile makefs.c makefs.h
 
 Log Message:
 Re-enable v7fs support in the tools version of makefs after the
 issues have been fixed by Alan Barrett. Tested under Mac OS X.
 
 
 To generate a diff of this commit:
 cvs rdiff -u -r1.28 -r1.29 src/usr.sbin/makefs/Makefile \
 src/usr.sbin/makefs/makefs.c
 cvs rdiff -u -r1.22 -r1.23 src/usr.sbin/makefs/makefs.h
 
 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.
 

Thank you!


Re: CVS commit: src/usr.sbin/makefs

2011-05-29 Thread Izumi Tsutsui
  I think the problem is that the final ISO9660 output including
  embeded MD boot fs and partition maps still has to be iso9660 compliant.
  There is no public space to store MD parameters for postprocessing
  in output image, ...
 
 Could the extra parameters be put into a file within the image?
 Then the postprocessing phase would have the required data.
 
 Or even in a separate file !

It might be possible, but I doubt fdisk(8) or pdisk(8)
can handle iso images as is.
(Especailly Apple partition map has variable sizes)

If we have to add some tweaks to fdisk/pdisk to handle ISO9660 quirks,
I'm not sure if it's realy worth to remove MBR/APM stuff from makefs(8),
which really knows about ISO9660 internal structures.

IMO current makefs(8) implementation is acceptable compromise.
---
Izumi Tsutsui


Re: CVS commit: src/usr.sbin/makefs

2011-05-25 Thread David Laight
On Tue, May 24, 2011 at 11:01:42PM +0900, Izumi Tsutsui wrote:
  On Tue, May 24, 2011 at 09:52:18PM +0900, Izumi Tsutsui wrote:
   It looks mandatory to make makefs(8) handle partition maps for CD images.
  
  I'm not sure I understand exactly what you mean and why makefs is the right
  tool here. Postprocessing the image is fine 
 
 I think the problem is that the final ISO9660 output including
 embeded MD boot fs and partition maps still has to be iso9660 compliant.
 There is no public space to store MD parameters for postprocessing
 in output image, ...

Could the extra parameters be put into a file within the image?
Then the postprocessing phase would have the required data.

Or even in a separate file !

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/usr.sbin/makefs

2011-05-24 Thread Martin Husemann
Is this enough to replace mkisofs when building macppc releases?
Or are there more hfs/hybrid things missing?

I tend to like the sunlabel(8) approach better (a manipulation that neither
fits fdisk nor makefs) - but I don't understand the macppc side to know if
this is realy similar.

Martin


Re: CVS commit: src/usr.sbin/makefs

2011-05-24 Thread Izumi Tsutsui
 Is this enough to replace mkisofs when building macppc releases?
 Or are there more hfs/hybrid things missing?

FreeBSD seems to have HFS image file:
http://www.freebsd.org/cgi/cvsweb.cgi/src/release/powerpc/hfs-boot.bz2.uu
so I'm afraid we still needs some tool to create HFS which has
at least one file for complete builds.
(for OF2 machines I think we also need some installboot support btw)

 I tend to like the sunlabel(8) approach better (a manipulation that neither
 fits fdisk nor makefs) - but I don't understand the macppc side to know if
 this is realy similar.

On creating HDD images, size of the image is first,
partitioning is next, and creating file system at last.
So we can use fdisk/pdisk first.

On creating CD/DVD images, a boot file (or image) is first,
creating ISO9660 is next (it includes absolute block numbers?),
then filling MD partition map as a part of boot file of the whole image.

It looks mandatory to make makefs(8) handle partition maps for CD images.
---
Izumi Tsutsui


Re: CVS commit: src/usr.sbin/makefs

2011-05-24 Thread Martin Husemann
On Tue, May 24, 2011 at 09:52:18PM +0900, Izumi Tsutsui wrote:
 It looks mandatory to make makefs(8) handle partition maps for CD images.

I'm not sure I understand exactly what you mean and why makefs is the right
tool here. Postprocessing the image is fine (I'm sure you know how sgimips
works with the volume header, the sparc64 case is even simpler by just
postprocessing the image filling in the sun label.)

What is the content of the pre-generated HFS piece? Is it relatively static?

Martin


Re: CVS commit: src/usr.sbin/makefs

2011-05-24 Thread Martin Husemann
On Tue, May 24, 2011 at 11:01:42PM +0900, Izumi Tsutsui wrote:
 On sgimips case, sgimipscd.iso has SGI specific format
 and it can't be mounted by non-SGI machines, IIRC.
 (while we can mount hybrid mac68kcd.iso and macppccd.iso on i386)

Indeed, and in this case I think support by an additional tool
like sgivol is fine.

 No idea about sparc64, but maybe it works because
 it appends MD bootfs at the end of iso9660 fs and
 Sun's label which has offsets of the bootfs is small enough
 to put it into unused part at the top of iso9660.

Exactly - it adds an ffs partition (with padding) behind the iso9660
part and uses a spare sector early in the image (ignored by iso9660)
to store the sun label. Here too it is fine to use a postprocessing tool
IMHO.

  What is the content of the pre-generated HFS piece? Is it relatively static?
 
 I have not checked FreeBSD's one, but it may have at least ofwboot.elf
 and one kernel, which should be updated during build.

Ok, so this differs from both sparc64 and sgimips significantly. Now, what is
the purpose of the change starting this thread if it only does the minor step
but leaves out the complex one that realy fits well into makefs?

Martin


Re: CVS commit: src/usr.sbin/makefs

2011-05-24 Thread Izumi Tsutsui
 Ok, so this differs from both sparc64 and sgimips significantly. Now, what is
 the purpose of the change starting this thread if it only does the minor step
 but leaves out the complex one that realy fits well into makefs?

Hmm.

Now I've checked macppccd.iso and FreeBSD's hfs-boot, and
it seems they have a small HFS behind of iso9660.
http://www.freebsd.org/cgi/cvsweb.cgi/src/release/powerpc/generate-hfs.sh?rev=1.1
(though I'm not sure if MacOS (for mac68k bootstrap) can mount FreeBSD's one)

Probably your question is now why we have put emul-boot and ElTorito
boot support into makefs(8)?

The answer might be that they were heavily tied to ISO9660 spec?
Other MD (Apple, CHRP, Acorn etc) formats as well?
(and Sun's format is simple enough to handle with shell script?)
---
Izumi Tsutsui


Re: CVS commit: src/usr.sbin/makefs

2011-05-23 Thread Christos Zoulas
In article 20110523141313.gp20...@ojctech.com,
David Young  dyo...@pobox.com wrote:
On Sun, May 22, 2011 at 05:51:40PM -0400, Christos Zoulas wrote:
 Module Name: src
 Committed By:christos
 Date:Sun May 22 21:51:40 UTC 2011
 
 Modified Files:
  src/usr.sbin/makefs: cd9660.c cd9660.h makefs.8
  src/usr.sbin/makefs/cd9660: cd9660_eltorito.c
 
 Log Message:
 From Nathan Whitehorn (nwhitehorn at freebsd dot org):
 Add code to generate bootable ISOs on Powermac and CHRP systems.
 Synthesize some partition maps (APM and MBR, respectively) pointing
 to (a) the whole disk, and (b) relevant El Torito boot images that
 have been added by other code. These partition maps are a little
 bit funny looking, but they seem to work. FreeBSD has been using
 this successfully in their release generation on powerpc, as well
 as generating all non-SPARC install media. SPARC support could
 probably be added as an extension of this patch.

This sounds like the job of fdisk or pdisk, not makefs.

There was similar code there already.

Have you tested this on a Power Macintosh or CHRP system?

No I don't have any machines to test, but I think that there is
a large benefit of having the code synchronized between the two projeccts.

christos