Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Dec 2002 20:32:55 -0800 (PST)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 22905 for review
Message-ID:  <200212300432.gBU4WtZt099702@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22905

Change 22905 by marcel@marcel_vaio on 2002/12/29 20:32:51

	IFC @22904

Affected files ...

.. //depot/projects/ia64/lib/libc/gen/basename.c#4 integrate
.. //depot/projects/ia64/lib/libc/gen/dirname.c#4 integrate
.. //depot/projects/ia64/sys/netipsec/ipsec_mbuf.c#2 integrate
.. //depot/projects/ia64/sys/vm/vm_map.c#38 integrate
.. //depot/projects/ia64/usr.sbin/burncd/Makefile#3 integrate
.. //depot/projects/ia64/usr.sbin/burncd/burncd.c#11 integrate

Differences ...

==== //depot/projects/ia64/lib/libc/gen/basename.c#4 (text+ko) ====

@@ -31,10 +31,11 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/basename.c,v 1.6 2002/12/21 07:12:35 bbraun Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/basename.c,v 1.7 2002/12/30 01:41:14 marcel Exp $");
 
 #include <errno.h>
 #include <libgen.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/param.h>
 

==== //depot/projects/ia64/lib/libc/gen/dirname.c#4 (text+ko) ====

@@ -31,10 +31,11 @@
 #endif /* not lint */
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/dirname.c,v 1.6 2002/12/21 07:12:35 bbraun Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/dirname.c,v 1.7 2002/12/30 01:41:14 marcel Exp $");
 
 #include <errno.h>
 #include <libgen.h>
+#include <stdlib.h>
 #include <string.h>
 #include <sys/param.h>
 

==== //depot/projects/ia64/sys/netipsec/ipsec_mbuf.c#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/*	$FreeBSD: src/sys/netipsec/ipsec_mbuf.c,v 1.1 2002/10/16 02:10:07 sam Exp $	*/
+/*	$FreeBSD: src/sys/netipsec/ipsec_mbuf.c,v 1.2 2002/12/30 02:15:18 sam Exp $	*/
 
 /*
  * IPsec-specific mbuf routines.
@@ -88,13 +88,33 @@
 			 * Allocate a new page, copy the data to the front
 			 * and release the reference to the old page.
 			 */
-			n = m_getcl(M_DONTWAIT, m->m_type, m->m_flags);
-			if (n == NULL) {
-				m_freem(m0);
-				return (NULL);
+			if (mprev == NULL && (m->m_flags & M_PKTHDR)) {
+				/*
+				 * NB: if a packet header is present we
+				 * must allocate the mbuf separately from
+				 * the cluster 'cuz M_COPY_PKTHDR will
+				 * smash the data pointer and drop the
+				 * M_EXT marker.
+				 */
+				MGETHDR(n, M_DONTWAIT, m->m_type);
+				if (n == NULL) {
+					m_freem(m0);
+					return (NULL);
+				}
+				M_COPY_PKTHDR(n, m);
+				MCLGET(n, M_DONTWAIT);
+				if ((n->m_flags & M_EXT) == 0) {
+					m_free(n);
+					m_freem(m0);
+					return (NULL);
+				}
+			} else {
+				n = m_getcl(M_DONTWAIT, m->m_type, m->m_flags);
+				if (n == NULL) {
+					m_freem(m0);
+					return (NULL);
+				}
 			}
-			if (mprev == NULL && (m->m_flags & M_PKTHDR))
-				M_COPY_PKTHDR(n, m);
 			memcpy(mtod(n, caddr_t), mtod(m, caddr_t), m->m_len);
 			n->m_len = m->m_len;
 			n->m_next = m->m_next;
@@ -148,11 +168,12 @@
 	 * the contents of m as needed.
 	 */
 	remain = m->m_len - skip;		/* data to move */
-	/* XXX code doesn't handle clusters XXX */
-	KASSERT(remain < MLEN, ("m_makespace: remainder too big: %u", remain));
 	if (hlen > M_TRAILINGSPACE(m)) {
 		struct mbuf *n;
 
+		/* XXX code doesn't handle clusters XXX */
+		KASSERT(remain < MLEN,
+			("m_makespace: remainder too big: %u", remain));
 		/*
 		 * Not enough space in m, split the contents
 		 * of m, inserting new mbufs as required.

==== //depot/projects/ia64/sys/vm/vm_map.c#38 (text+ko) ====

@@ -61,7 +61,7 @@
  * any improvements or extensions that they make and grant Carnegie the
  * rights to redistribute these changes.
  *
- * $FreeBSD: src/sys/vm/vm_map.c,v 1.276 2002/12/29 21:01:14 alc Exp $
+ * $FreeBSD: src/sys/vm/vm_map.c,v 1.277 2002/12/30 00:41:33 alc Exp $
  */
 
 /*
@@ -133,6 +133,7 @@
  *	maps and requires map entries.
  */
 
+static struct mtx map_sleep_mtx;
 static uma_zone_t mapentzone;
 static uma_zone_t kmapentzone;
 static uma_zone_t mapzone;
@@ -152,6 +153,7 @@
 void
 vm_map_startup(void)
 {
+	mtx_init(&map_sleep_mtx, "vm map sleep mutex", NULL, MTX_DEF);
 	mapzone = uma_zcreate("MAP", sizeof(struct vm_map), NULL,
 #ifdef INVARIANTS
 	    vm_map_zdtor,
@@ -412,6 +414,8 @@
 	if (map->system_map)
 		GIANT_REQUIRED;
 	error = lockmgr(&map->lock, LK_EXCLUSIVE | LK_NOWAIT, NULL, curthread);
+	if (error == 0)
+		map->timestamp++;
 	return (error == 0);
 }
 
@@ -439,13 +443,10 @@
 int
 vm_map_unlock_and_wait(vm_map_t map, boolean_t user_wait)
 {
-	int retval;
 
-	mtx_lock(&Giant);
+	mtx_lock(&map_sleep_mtx);
 	vm_map_unlock(map);
-	retval = tsleep(&map->root, PVM, "vmmapw", 0);
-	mtx_unlock(&Giant);
-	return (retval);
+	return (msleep(&map->root, &map_sleep_mtx, PDROP | PVM, "vmmaps", 0));
 }
 
 /*
@@ -456,12 +457,12 @@
 {
 
 	/*
-	 * Acquire and release Giant to prevent a wakeup() from being
-	 * performed (and lost) between the vm_map_unlock() and the
-	 * tsleep() in vm_map_unlock_and_wait().
+	 * Acquire and release map_sleep_mtx to prevent a wakeup()
+	 * from being performed (and lost) between the vm_map_unlock()
+	 * and the msleep() in vm_map_unlock_and_wait().
 	 */
-	mtx_lock(&Giant);
-	mtx_unlock(&Giant);
+	mtx_lock(&map_sleep_mtx);
+	mtx_unlock(&map_sleep_mtx);
 	wakeup(&map->root);
 }
 

==== //depot/projects/ia64/usr.sbin/burncd/Makefile#3 (text+ko) ====

@@ -1,7 +1,7 @@
-# $FreeBSD: src/usr.sbin/burncd/Makefile,v 1.6 2001/12/24 03:24:28 mikeh Exp $
+# $FreeBSD: src/usr.sbin/burncd/Makefile,v 1.7 2002/12/29 22:28:51 wollman Exp $
 
 PROG=	burncd
-WARNS?=	2
+WARNS?=	5
 NO_WERROR=	yes
 MAN=	burncd.8
 

==== //depot/projects/ia64/usr.sbin/burncd/burncd.c#11 (text+ko) ====

@@ -25,10 +25,11 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/usr.sbin/burncd/burncd.c,v 1.31 2002/12/18 07:43:42 sos Exp $
+ * $FreeBSD: src/usr.sbin/burncd/burncd.c,v 1.32 2002/12/29 22:28:51 wollman Exp $
  */
 
 #include <unistd.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -56,13 +57,13 @@
 	int	addr;
 };
 static struct track_info tracks[100];
-static int fd, quiet, verbose, saved_block_size, notracks;
+static int global_fd_for_cleanup, quiet, verbose, saved_block_size, notracks;
 
 void add_track(char *, int, int, int);
-void do_DAO(int, int);
-void do_TAO(int, int, int);
+void do_DAO(int fd, int, int);
+void do_TAO(int fd, int, int, int);
 void do_format(int, int, char *);
-int write_file(struct track_info *);
+int write_file(int fd, struct track_info *);
 int roundup_blocks(struct track_info *);
 void cue_ent(struct cdr_cue_entry *, int, int, int, int, int, int, int);
 void cleanup(int);
@@ -71,7 +72,7 @@
 int
 main(int argc, char **argv)
 {
-	int ch, arg, addr;
+	int arg, addr, ch, fd;
 	int dao = 0, eject = 0, fixate = 0, list = 0, multi = 0, preemp = 0;
 	int nogap = 0, speed = 4 * 177, test_write = 0, force = 0;
 	int block_size = 0, block_type = 0, cdopen = 0, dvdrw = 0;
@@ -151,6 +152,7 @@
 	if (ioctl(fd, CDRIOCWRITESPEED, &speed) < 0) 
        		err(EX_IOERR, "ioctl(CDRIOCWRITESPEED)");
 
+	global_fd_for_cleanup = fd;
 	err_set_exit(cleanup);
 
 	for (arg = 0; arg < argc; arg++) {
@@ -291,9 +293,9 @@
 			cdopen = 1;
 		}
 		if (dao) 
-			do_DAO(test_write, multi);
+			do_DAO(fd, test_write, multi);
 		else
-			do_TAO(test_write, preemp, dvdrw);
+			do_TAO(fd, test_write, preemp, dvdrw);
 	}
 	if (fixate && !dao) {
 		if (!quiet)
@@ -367,7 +369,7 @@
 }
 
 void
-do_DAO(int test_write, int multi)
+do_DAO(int fd, int test_write, int multi)
 {
 	struct cdr_cuesheet sheet;
 	struct cdr_cue_entry cue[100];
@@ -459,7 +461,7 @@
 		err(EX_IOERR, "ioctl(CDRIOCSENDCUE)");
 
 	for (i = 0; i < notracks; i++) {
-		if (write_file(&tracks[i]))
+		if (write_file(fd, &tracks[i]))
 			err(EX_IOERR, "write_file");
 	}
 
@@ -467,7 +469,7 @@
 }
 
 void
-do_TAO(int test_write, int preemp, int dvdrw)
+do_TAO(int fd, int test_write, int preemp, int dvdrw)
 {
 	struct cdr_track track;
 	int i;
@@ -489,7 +491,7 @@
 		if (!quiet)
 			fprintf(stderr, "next writeable LBA %d\n",
 				tracks[i].addr);
-		if (write_file(&tracks[i]))
+		if (write_file(fd, &tracks[i]))
 			err(EX_IOERR, "write_file");
 		if (ioctl(fd, CDRIOCFLUSH) < 0)
 			err(EX_IOERR, "ioctl(CDRIOCFLUSH)");
@@ -509,7 +511,7 @@
 		err(EX_IOERR, "ioctl(CDRIOCREADFORMATCAPS)");
 
 	if (verbose) {
-		fprintf(stderr, "format list entries=%d\n", 
+		fprintf(stderr, "format list entries=%zd\n", 
 			capacities.length / sizeof(struct cdr_format_capacity));
 		fprintf(stderr, "current format: blocks=%u type=0x%x block_size=%u\n",
 			ntohl(capacities.blocks), capacities.type, 
@@ -576,7 +578,7 @@
 }
 
 int
-write_file(struct track_info *track_info)
+write_file(int fd, struct track_info *track_info)
 {
 	off_t size, count, filesize;
 	char buf[2352*BLOCKS];
@@ -591,8 +593,8 @@
 		lseek(fd, track_info->addr * track_info->block_size, SEEK_SET);
 
 	if (verbose)
-		fprintf(stderr, "addr = %d size = %qd blocks = %d\n",
-			track_info->addr, track_info->file_size,
+		fprintf(stderr, "addr = %d size = %jd blocks = %d\n",
+			track_info->addr, (intmax_t)track_info->file_size,
 			roundup_blocks(track_info));
 
 	if (!quiet) {
@@ -600,8 +602,8 @@
 			fprintf(stderr, "writing from stdin\n");
 		else
 			fprintf(stderr, 
-				"writing from file %s size %qd KB\n",
-				track_info->file_name, filesize);
+				"writing from file %s size %jd KB\n",
+				track_info->file_name, (intmax_t)filesize);
 	}
 	size = 0;
 
@@ -618,8 +620,8 @@
 				track_info->block_size;
 		}
 		if ((res = write(fd, buf, count)) != count) {
-			fprintf(stderr, "\nonly wrote %d of %qd bytes err=%d\n",
-				res, count, errno);
+			fprintf(stderr, "\nonly wrote %d of %jd bytes: %s\n",
+				res, (intmax_t)count, strerror(errno));
 			break;
 		}
 		size += count;
@@ -627,12 +629,14 @@
 		if (!quiet) {
 			int pct;
 
-			fprintf(stderr, "written this track %qd KB", size/1024);
+			fprintf(stderr, "written this track %jd KB",
+			    (intmax_t)size/1024);
 			if (track_info->file != STDIN_FILENO && filesize) {
 				pct = (size / 1024) * 100 / filesize;
 				fprintf(stderr, " (%d%%)", pct);
 			}
-			fprintf(stderr, " total %qd KB\r", tot_size/1024);
+			fprintf(stderr, " total %jd KB\r", 
+			    (intmax_t)tot_size / 1024);
 		}
 		if (size >= track_info->file_size)
 			break;
@@ -669,7 +673,8 @@
 void
 cleanup(int dummy __unused)
 {
-	if (ioctl(fd, CDRIOCSETBLOCKSIZE, &saved_block_size) < 0) 
+	if (ioctl(global_fd_for_cleanup, CDRIOCSETBLOCKSIZE,
+	    &saved_block_size) < 0) 
 		err(EX_IOERR, "ioctl(CDRIOCSETBLOCKSIZE)");
 }
 

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212300432.gBU4WtZt099702>