CVS commit: [netbsd-5-0] src/usr.sbin/makefs/cd9660

2010-01-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan  2 06:26:11 UTC 2010

Modified Files:
src/usr.sbin/makefs/cd9660 [netbsd-5-0]: iso9660_rrip.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1198):
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.5
When splitting a System Use Area between a System Use field and a
Continuation Area, be sure to insert the CE record at the correct
point in the chain of SUSP records.  Without this, makefs emits
an invalid image if any file needs a Continuation Area.  The bug
seems to have been introduced with the conversion to TAILQs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.20.1 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.

Modified files:

Index: src/usr.sbin/makefs/cd9660/iso9660_rrip.c
diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4 src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.1
--- src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4	Mon Dec 18 21:03:29 2006
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c	Sat Jan  2 06:26:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso9660_rrip.c,v 1.4 2006/12/18 21:03:29 christos Exp $	*/
+/*	$NetBSD: iso9660_rrip.c,v 1.4.20.1 2010/01/02 06:26:11 snj Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -43,7 +43,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: iso9660_rrip.c,v 1.4 2006/12/18 21:03:29 christos Exp $);
+__RCSID($NetBSD: iso9660_rrip.c,v 1.4.20.1 2010/01/02 06:26:11 snj Exp $);
 #endif  /* !__lint */
 
 static void cd9660_rrip_initialize_inode(cd9660node *);
@@ -228,7 +228,7 @@
 			SUSP_ENTRY_SUSP_CE, CE, SUSP_LOC_ENTRY);
 		cd9660_susp_ce(CE, node);
 		/* This will automatically insert at the appropriate location */
-		TAILQ_INSERT_TAIL(node-head, CE, rr_ll);
+		TAILQ_INSERT_AFTER(node-head, last, CE, rr_ll);
 		susp_used += 28;
 
 		/* Count how much CA data is necessary */



CVS commit: [netbsd-5-0] src/usr.sbin/makefs/cd9660

2010-01-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan  2 06:27:27 UTC 2010

Modified Files:
src/usr.sbin/makefs/cd9660 [netbsd-5-0]: iso9660_rrip.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1198):
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.6
Fix another bug in SUSP CE handling: when the SUSP records fit into
the System Use field with fewer then 28 bytes to spare, we were
remembering the wrong length for the System Use field and hence
emitting a corrupt directory entry.  This could be triggered by trying
to build a filesystem containing a regular file with a 120-byte name.
Now we're a little more careful.


To generate a diff of this commit:
cvs rdiff -u -r1.4.20.1 -r1.4.20.2 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.

Modified files:

Index: src/usr.sbin/makefs/cd9660/iso9660_rrip.c
diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.1 src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.2
--- src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.1	Sat Jan  2 06:26:11 2010
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c	Sat Jan  2 06:27:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso9660_rrip.c,v 1.4.20.1 2010/01/02 06:26:11 snj Exp $	*/
+/*	$NetBSD: iso9660_rrip.c,v 1.4.20.2 2010/01/02 06:27:27 snj Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -43,7 +43,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: iso9660_rrip.c,v 1.4.20.1 2010/01/02 06:26:11 snj Exp $);
+__RCSID($NetBSD: iso9660_rrip.c,v 1.4.20.2 2010/01/02 06:27:27 snj Exp $);
 #endif  /* !__lint */
 
 static void cd9660_rrip_initialize_inode(cd9660node *);
@@ -200,7 +200,7 @@
 static int
 cd9660_susp_handle_continuation_common(cd9660node *node, int space)
 {
-	int ca_used, susp_used, working;
+	int ca_used, susp_used, susp_used_last, working;
 	struct ISO_SUSP_ATTRIBUTES *temp, *last = NULL, *CE;
 
 	working = 254 - space;
@@ -216,9 +216,15 @@
 		 * CD9660_SUSP_ENTRY_SIZE(temp));
 		 */
 		working -= CD9660_SUSP_ENTRY_SIZE(temp);
+		if (working = 0)
+			susp_used += CD9660_SUSP_ENTRY_SIZE(temp);
 		if (working = 28) {
+			/*
+			 * Remember the last entry after which we
+			 * could insert a CE entry.
+			 */
 			last = temp;
-			susp_used += CD9660_SUSP_ENTRY_SIZE(temp);
+			susp_used_last = susp_used;
 		}
 	}
 
@@ -229,7 +235,7 @@
 		cd9660_susp_ce(CE, node);
 		/* This will automatically insert at the appropriate location */
 		TAILQ_INSERT_AFTER(node-head, last, CE, rr_ll);
-		susp_used += 28;
+		susp_used = susp_used_last + 28;
 
 		/* Count how much CA data is necessary */
 		for (temp = TAILQ_NEXT(CE, rr_ll); temp != NULL;



CVS commit: [netbsd-5-0] src/usr.sbin/makefs/cd9660

2010-01-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan  2 06:28:27 UTC 2010

Modified Files:
src/usr.sbin/makefs/cd9660 [netbsd-5-0]: iso9660_rrip.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1198):
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.7
Initialize a local variable to get rid of a may be used uninitialized
warning (turned into error by -Werror).


To generate a diff of this commit:
cvs rdiff -u -r1.4.20.2 -r1.4.20.3 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.

Modified files:

Index: src/usr.sbin/makefs/cd9660/iso9660_rrip.c
diff -u src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.2 src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.3
--- src/usr.sbin/makefs/cd9660/iso9660_rrip.c:1.4.20.2	Sat Jan  2 06:27:27 2010
+++ src/usr.sbin/makefs/cd9660/iso9660_rrip.c	Sat Jan  2 06:28:26 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso9660_rrip.c,v 1.4.20.2 2010/01/02 06:27:27 snj Exp $	*/
+/*	$NetBSD: iso9660_rrip.c,v 1.4.20.3 2010/01/02 06:28:26 snj Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -43,7 +43,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: iso9660_rrip.c,v 1.4.20.2 2010/01/02 06:27:27 snj Exp $);
+__RCSID($NetBSD: iso9660_rrip.c,v 1.4.20.3 2010/01/02 06:28:26 snj Exp $);
 #endif  /* !__lint */
 
 static void cd9660_rrip_initialize_inode(cd9660node *);
@@ -200,7 +200,7 @@
 static int
 cd9660_susp_handle_continuation_common(cd9660node *node, int space)
 {
-	int ca_used, susp_used, susp_used_last, working;
+	int ca_used, susp_used, susp_used_last = 0, working;
 	struct ISO_SUSP_ATTRIBUTES *temp, *last = NULL, *CE;
 
 	working = 254 - space;



CVS commit: [netbsd-5-0] src/usr.sbin/makefs

2010-01-01 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Sat Jan  2 06:34:15 UTC 2010

Modified Files:
src/usr.sbin/makefs [netbsd-5-0]: cd9660.c cd9660.h
src/usr.sbin/makefs/cd9660 [netbsd-5-0]: cd9660_write.c iso9660_rrip.c
iso9660_rrip.h

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1198):
usr.sbin/makefs/cd9660.c: revision 1.25 via patch
usr.sbin/makefs/cd9660.h: revision 1.13 via patch
usr.sbin/makefs/cd9660/cd9660_write.c: revision 1.10
usr.sbin/makefs/cd9660/iso9660_rrip.c: revision 1.8
usr.sbin/makefs/cd9660/iso9660_rrip.h: revision 1.5
Add support for encoding RISC OS metadata into ISO 9660 filesystems.
This is done by adding the general ability to stuff non-SUSP data into
the end of the System Use field of a Directory Record, which required
some amount of rewriting of the SUSP support.  I think the result is
at least as good as what came before, and I've fixed at least one bug
along the way.  Tested against RISC OS 3.70 on my Risc PC.
Oh, why do we want it?  It should allow us to make acorn{26,32} CDs that
can be booted directly from RISC OS without mucking around copying the
bootloader to a native filing system.


To generate a diff of this commit:
cvs rdiff -u -r1.22.2.1 -r1.22.2.1.2.1 src/usr.sbin/makefs/cd9660.c
cvs rdiff -u -r1.12 -r1.12.6.1 src/usr.sbin/makefs/cd9660.h
cvs rdiff -u -r1.9 -r1.9.6.1 src/usr.sbin/makefs/cd9660/cd9660_write.c
cvs rdiff -u -r1.4.20.3 -r1.4.20.4 src/usr.sbin/makefs/cd9660/iso9660_rrip.c
cvs rdiff -u -r1.4 -r1.4.28.1 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.c
diff -u src/usr.sbin/makefs/cd9660.c:1.22.2.1 src/usr.sbin/makefs/cd9660.c:1.22.2.1.2.1
--- src/usr.sbin/makefs/cd9660.c:1.22.2.1	Mon Feb  2 03:32:34 2009
+++ src/usr.sbin/makefs/cd9660.c	Sat Jan  2 06:34:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660.c,v 1.22.2.1 2009/02/02 03:32:34 snj Exp $	*/
+/*	$NetBSD: cd9660.c,v 1.22.2.1.2.1 2010/01/02 06:34:15 snj Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -103,7 +103,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: cd9660.c,v 1.22.2.1 2009/02/02 03:32:34 snj Exp $);
+__RCSID($NetBSD: cd9660.c,v 1.22.2.1.2.1 2010/01/02 06:34:15 snj Exp $);
 #endif  /* !__lint */
 
 #include string.h
@@ -187,6 +187,7 @@
 	temp-isoDirRecord = NULL;
 	temp-isoExtAttributes = NULL;
 	temp-rr_real_parent = temp-rr_relocated = NULL;
+	temp-su_tail_data = NULL;
 	return temp;
 }
 
@@ -1759,6 +1760,9 @@
 
 	if (diskStructure.rock_ridge_enabled)
 		size += node-susp_entry_size;
+	size += node-su_tail_size;
+	size += size  1; /* Ensure length of record is even. */
+	assert(size = 254);
 	return size;
 }
 

Index: src/usr.sbin/makefs/cd9660.h
diff -u src/usr.sbin/makefs/cd9660.h:1.12 src/usr.sbin/makefs/cd9660.h:1.12.6.1
--- src/usr.sbin/makefs/cd9660.h:1.12	Sun Jul 27 10:29:32 2008
+++ src/usr.sbin/makefs/cd9660.h	Sat Jan  2 06:34:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660.h,v 1.12 2008/07/27 10:29:32 reinoud Exp $	*/
+/*	$NetBSD: cd9660.h,v 1.12.6.1 2010/01/02 06:34:15 snj Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -208,6 +208,10 @@
 	int susp_dot_ce_length;
 	int susp_dot_dot_ce_length;
 
+	/* Data to put at the end of the System Use field */
+	int su_tail_size;
+	char *su_tail_data;
+
 	/*** PATH TABLE STUFF ***/
 	int level;			/*depth*/
 	int ptnumber;

Index: src/usr.sbin/makefs/cd9660/cd9660_write.c
diff -u src/usr.sbin/makefs/cd9660/cd9660_write.c:1.9 src/usr.sbin/makefs/cd9660/cd9660_write.c:1.9.6.1
--- src/usr.sbin/makefs/cd9660/cd9660_write.c:1.9	Sat May 10 19:00:07 2008
+++ src/usr.sbin/makefs/cd9660/cd9660_write.c	Sat Jan  2 06:34:15 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_write.c,v 1.9 2008/05/10 19:00:07 skrll Exp $	*/
+/*	$NetBSD: cd9660_write.c,v 1.9.6.1 2010/01/02 06:34:15 snj Exp $	*/
 
 /*
  * Copyright (c) 2005 Daniel Watt, Walter Deignan, Ryan Gabrys, Alan
@@ -37,7 +37,7 @@
 
 #include sys/cdefs.h
 #if defined(__RCSID)  !defined(__lint)
-__RCSID($NetBSD: cd9660_write.c,v 1.9 2008/05/10 19:00:07 skrll Exp $);
+__RCSID($NetBSD: cd9660_write.c,v 1.9.6.1 2010/01/02 06:34:15 snj Exp $);
 #endif  /* !__lint */
 
 static int cd9660_write_volume_descriptors(FILE *);
@@ -48,7 +48,7 @@
 #if 0
 static int cd9660_write_buffered(FILE *, int, int, const unsigned char*);
 #endif
-static int cd9660_write_rr(FILE *, cd9660node *, int, int);
+static void cd9660_write_rr(FILE *, cd9660node *, int, int);
 
 /*
  * Write the image
@@ -271,7 +271,7 @@
 	int written;
 	iso_directory_record_cd9660 temp_record;
 	cd9660node *temp;
-	int ca = 0, rv = 0;
+	int rv = 0;
 
 	/* Todo : clean up variables */
 
@@ -343,31 +343,27 @@
 working_sector * diskStructure.sectorSize,
 SEEK_SET);
 			}
-
-