PERFORCE change 31001 for review

Peter Wemm peter at FreeBSD.org
Sun May 11 22:51:12 PDT 2003


http://perforce.freebsd.org/chv.cgi?CH=31001

Change 31001 by peter at peter_daintree on 2003/05/11 22:51:05

	IFC @31000

Affected files ...

.. //depot/projects/hammer/release/i386/drivers.conf#10 integrate
.. //depot/projects/hammer/sbin/growfs/growfs.c#6 integrate
.. //depot/projects/hammer/sys/boot/common/load_elf.c#12 integrate
.. //depot/projects/hammer/sys/boot/i386/libi386/i386_module.c#5 integrate
.. //depot/projects/hammer/sys/compat/svr4/svr4.h#2 integrate
.. //depot/projects/hammer/sys/dev/usb/usbdevs.h#9 integrate
.. //depot/projects/hammer/sys/dev/usb/usbdevs_data.h#9 integrate
.. //depot/projects/hammer/sys/kern/kern_malloc.c#8 integrate

Differences ...

==== //depot/projects/hammer/release/i386/drivers.conf#10 (text+ko) ====

@@ -24,7 +24,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/release/i386/drivers.conf,v 1.26 2003/05/11 06:42:09 scottl Exp $
+# $FreeBSD: src/release/i386/drivers.conf,v 1.27 2003/05/12 02:40:24 scottl Exp $
 
 #
 # drv: driver name in kernel config file
@@ -42,6 +42,7 @@
 cue	if_cue		2	network	"CATC USB ethernet adapter"
 dc	if_dc		2	network	"DEC/Intel 21143 (and clones) PCI fast ethernet card"
 ed	if_ed		2	network	"NE[12]000, SMC Ultra, 3c503, DS8390 ISA ethernet cards"
+em	if_em		2	network	"Intel Pro/1000 PCI gigabit ethernet card"
 fe	if_fe		2	network	"Fujitsu MB8696x based cards"
 fxp	if_fxp		2	network	"Intel EtherExpress Pro/100B PCI Fast Ethernet card"
 kue	if_kue		2	network	"Kawasaki LSI USB ethernet adapter"
@@ -76,7 +77,6 @@
 an	if_an		3	network	"Aironet 4500/4800 802.11 PCMCIA/ISA/PCI card"
 awi	if_awi		3	network "BayStack 660 and others"
 de	if_de		3	network	"DEC DE435 PCI NIC or other DC21040-AA based card"
-em	if_em		3	network	"Intel Pro/1000 PCI gigabit ethernet card"
 ex	if_ex		3	network "Intel EtherExpress Pro/10 and Pro/10+"
 ie	if_ie		3	network "EtherExpress 8/16, 3C507, StarLAN 10 etc."
 plip	plip		3	network "TCP/IP over parallel"

==== //depot/projects/hammer/sbin/growfs/growfs.c#6 (text+ko) ====

@@ -48,7 +48,7 @@
 
 #ifndef lint
 static const char rcsid[] =
-  "$FreeBSD: src/sbin/growfs/growfs.c,v 1.14 2003/04/26 15:22:29 schweikh Exp $";
+  "$FreeBSD: src/sbin/growfs/growfs.c,v 1.15 2003/05/12 05:37:16 grog Exp $";
 #endif /* not lint */
 
 /* ********************************************************** INCLUDES ***** */
@@ -56,6 +56,7 @@
 #include <sys/disklabel.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
+#include <sys/disk.h>
 
 #include <stdio.h>
 #include <paths.h>
@@ -110,6 +111,7 @@
 static ufs2_daddr_t 	inoblk;			/* inode block address */
 static char		inobuf[MAXBSIZE];	/* inode block */
 static int		maxino;			/* last valid inode */
+static int		unlabeled;     /* unlabeled partition, e.g. vinum volume etc. */
 
 /*
  * An array of elements of type struct gfs_bpp describes all blocks to
@@ -148,6 +150,7 @@
 static void	updrefs(int, ino_t, struct gfs_bpp *, int, int, unsigned int);
 static void	indirchk(ufs_lbn_t, ufs_lbn_t, ufs2_daddr_t, ufs_lbn_t,
 		    struct gfs_bpp *, int, int, unsigned int);
+static void	get_dev_size(int, int *);
 
 /* ************************************************************ growfs ***** */
 /*
@@ -1880,6 +1883,28 @@
 	return columns;
 }
 
+/* ****************************************************** get_dev_size ***** */
+/*
+ * Get the size of the partition if we can't figure it out from the disklabel,
+ * e.g. from vinum volumes.
+ */
+static void
+get_dev_size(int fd, int *size)
+{
+   int sectorsize;
+   off_t mediasize;
+
+   if (ioctl(fd, DIOCGSECTORSIZE, &sectorsize) == -1)
+        err(1,"DIOCGSECTORSIZE");
+   if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) == -1)
+        err(1,"DIOCGMEDIASIZE");
+
+   if (sectorsize <= 0)
+       errx(1, "bogus sectorsize: %d", sectorsize);
+
+   *size = mediasize / sectorsize;
+}
+
 /* ************************************************************** main ***** */
 /*
  * growfs(8)  is a utility which allows to increase the size of an existing
@@ -1917,6 +1942,7 @@
 	struct disklabel	*lp;
 	struct partition	*pp;
 	int	i,fsi,fso;
+    u_int32_t p_size;
 	char	reply[5];
 #ifdef FSMAXSNAP
 	int	j;
@@ -2016,25 +2042,25 @@
 	 */
 	cp=device+strlen(device)-1;
 	lp = get_disklabel(fsi);
-	if(lp->d_type == DTYPE_VINUM) {
-		pp = &lp->d_partitions[0];
-	} else if (isdigit(*cp)) {
-		pp = &lp->d_partitions[2];
-	} else if (*cp>='a' && *cp<='h') {
-		pp = &lp->d_partitions[*cp - 'a'];
-	} else {
-		errx(1, "unknown device");
-	}
+    if (lp != NULL) {
+        if (isdigit(*cp)) {
+            pp = &lp->d_partitions[2];
+        } else if (*cp>='a' && *cp<='h') {
+            pp = &lp->d_partitions[*cp - 'a'];
+        } else {
+            errx(1, "unknown device");
+        }
+        p_size = pp->p_size;
+    } else {
+        get_dev_size(fsi, &p_size);
+    }
 
 	/*
 	 * Check if that partition is suitable for growing a file system.
 	 */
-	if (pp->p_size < 1) {
+	if (p_size < 1) {
 		errx(1, "partition is unavailable");
 	}
-	if (pp->p_fstype != FS_BSDFFS) {
-		errx(1, "partition not 4.2BSD");
-	}
 
 	/*
 	 * Read the current superblock, and take a backup.
@@ -2063,11 +2089,11 @@
 	 * Determine size to grow to. Default to the full size specified in
 	 * the disk label.
 	 */
-	sblock.fs_size = dbtofsb(&osblock, pp->p_size);
+	sblock.fs_size = dbtofsb(&osblock, p_size);
 	if (size != 0) {
-		if (size > pp->p_size){
+		if (size > p_size){
 			errx(1, "There is not enough space (%d < %d)",
-			    pp->p_size, size);
+			    p_size, size);
 		}
 		sblock.fs_size = dbtofsb(&osblock, size);
 	}
@@ -2117,7 +2143,7 @@
 	 * later on realize we have to abort our operation, on that block
 	 * there should be no data, so we can't destroy something yet.
 	 */
-	wtfs((ufs2_daddr_t)pp->p_size-1, (size_t)DEV_BSIZE, (void *)&sblock,
+	wtfs((ufs2_daddr_t)p_size-1, (size_t)DEV_BSIZE, (void *)&sblock,
 	    fso, Nflag);
 
 	/*
@@ -2178,12 +2204,14 @@
 	/*
 	 * Update the disk label.
 	 */
-	pp->p_fsize = sblock.fs_fsize;
-	pp->p_frag = sblock.fs_frag;
-	pp->p_cpg = sblock.fs_fpg;
+    if (!unlabeled) {
+        pp->p_fsize = sblock.fs_fsize;
+        pp->p_frag = sblock.fs_frag;
+        pp->p_cpg = sblock.fs_fpg;
 
-	return_disklabel(fso, lp, Nflag);
-	DBG_PRINT0("label rewritten\n");
+        return_disklabel(fso, lp, Nflag);
+        DBG_PRINT0("label rewritten\n");
+    }
 
 	close(fsi);
 	if(fso>-1) close(fso);
@@ -2247,15 +2275,16 @@
 	DBG_ENTER;
 
 	lab=(struct disklabel *)malloc(sizeof(struct disklabel));
-	if (!lab) {
+	if (!lab)
 		errx(1, "malloc failed");
-	}
-	if (ioctl(fd, DIOCGDINFO, (char *)lab) < 0) {
-		errx(1, "DIOCGDINFO failed");
-	}
+
+    if (!ioctl(fd, DIOCGDINFO, (char *)lab))
+        return (lab);
+
+    unlabeled++;
 
 	DBG_LEAVE;
-	return (lab);
+	return (NULL);
 }
 
 

==== //depot/projects/hammer/sys/boot/common/load_elf.c#12 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/boot/common/load_elf.c,v 1.27 2003/05/01 03:56:29 peter Exp $
+ * $FreeBSD: src/sys/boot/common/load_elf.c,v 1.28 2003/05/12 05:48:09 peter Exp $
  */
 
 #include <sys/param.h>
@@ -568,23 +568,35 @@
     return fp;
 }
 
+#if defined(__i386__) && __ELF_WORD_SIZE == 64
+struct mod_metadata64 {
+	int		md_version;	/* structure version MDTV_* */  
+	int		md_type;	/* type of entry MDT_* */
+	u_int64_t	md_data;	/* specific data */
+	u_int64_t	md_cval;	/* common string label */
+};
+#endif
+
 int
 __elfN(parse_modmetadata)(struct preloaded_file *fp, elf_file_t ef)
 {
     struct mod_metadata md;
+#if defined(__i386__) && __ELF_WORD_SIZE == 64
+    struct mod_metadata64 md64;
+#endif
     struct mod_depend *mdepend;
     struct mod_version mver;
     Elf_Sym sym;
-    char *s, **p, **p_stop;
+    char *s;
     int modcnt, minfolen;
-    Elf_Addr v;
+    Elf_Addr v, p, p_stop;
 
     if (__elfN(lookup_symbol)(fp, ef, "__start_set_modmetadata_set", &sym) != 0)
 	return ENOENT;
-    p = (char **)(uintptr_t)(sym.st_value + ef->off);
+    p = sym.st_value + ef->off;
     if (__elfN(lookup_symbol)(fp, ef, "__stop_set_modmetadata_set", &sym) != 0)
 	return ENOENT;
-    p_stop = (char **)(uintptr_t)(sym.st_value + ef->off);
+    p_stop = sym.st_value + ef->off;
 
     modcnt = 0;
     while (p < p_stop) {
@@ -594,6 +606,13 @@
 #else
 	v += ef->off;
 #endif
+#if defined(__i386__) && __ELF_WORD_SIZE == 64
+	COPYOUT(v, &md64, sizeof(md64));
+	md.md_version = md64.md_version;
+	md.md_type = md64.md_type;
+	md.md_cval = (const char *)(uintptr_t)(md64.md_cval + ef->off);
+	md.md_data = (void *)(uintptr_t)(md64.md_data + ef->off);
+#else
 	COPYOUT(v, &md, sizeof(md));
 #ifdef __sparc64__
 	__elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md));
@@ -601,7 +620,8 @@
 	md.md_cval += ef->off;
 	md.md_data += ef->off;
 #endif
-	p++;
+#endif
+	p += sizeof(Elf_Addr);
 	switch(md.md_type) {
 	  case MDT_DEPEND:
 	    if (ef->kernel)		/* kernel must not depend on anything */

==== //depot/projects/hammer/sys/boot/i386/libi386/i386_module.c#5 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/boot/i386/libi386/i386_module.c,v 1.10 2003/04/30 22:02:39 peter Exp $
+ * $FreeBSD: src/sys/boot/i386/libi386/i386_module.c,v 1.11 2003/05/12 04:57:05 peter Exp $
  */
 
 /*
@@ -50,9 +50,6 @@
     /* XXX use PnP to locate stuff here */
 
     /* autoload ACPI support */
-    if (file_findfile(NULL, "elf64 kernel") != NULL)
-	return (0);	/* ACPI is mandatory */
-
     /* XXX should be in 4th keyed off acpi_load */
     disabled = 0;
     rv = getenv("hint.acpi.0.disabled");

==== //depot/projects/hammer/sys/compat/svr4/svr4.h#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * (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/sys/compat/svr4/svr4.h,v 1.6 2000/01/09 12:29:45 bde Exp $
+ * $FreeBSD: src/sys/compat/svr4/svr4.h,v 1.7 2003/05/12 05:08:38 phk Exp $
  */
 
 #include "opt_svr4.h"
@@ -34,8 +34,6 @@
 
 extern struct sysentvec svr4_sysvec;
 
-#define memset(x,y,z) bzero(x,z)
-
 #define COMPAT_SVR4_SOLARIS2
 #define KTRACE
 

==== //depot/projects/hammer/sys/dev/usb/usbdevs.h#9 (text+ko) ====

@@ -1,10 +1,10 @@
-/*	$FreeBSD: src/sys/dev/usb/usbdevs.h,v 1.132 2003/05/05 08:22:15 murray Exp $	*/
+/*	$FreeBSD: src/sys/dev/usb/usbdevs.h,v 1.133 2003/05/12 04:27:22 murray Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	FreeBSD: src/sys/dev/usb/usbdevs,v 1.123 2003/05/05 08:18:53 murray Exp 
+ *	FreeBSD: src/sys/dev/usb/usbdevs,v 1.124 2003/05/11 23:55:28 joe Exp 
  */
 
 /*
@@ -462,6 +462,7 @@
 
 /* Asahi Optical products */
 #define	USB_PRODUCT_ASAHIOPTICAL_OPTIO230	0x0004		/* Digital camera */
+#define	USB_PRODUCT_ASAHIOPTICAL_OPTIO330	0x0006		/* Digital camera */
 
 /* ASIX Electronics products */
 #define	USB_PRODUCT_ASIX_AX88172	0x1720		/* USB 2.0 10/100 ethernet controller */

==== //depot/projects/hammer/sys/dev/usb/usbdevs_data.h#9 (text+ko) ====

@@ -1,10 +1,10 @@
-/*	$FreeBSD: src/sys/dev/usb/usbdevs_data.h,v 1.132 2003/05/05 08:22:15 murray Exp $	*/
+/*	$FreeBSD: src/sys/dev/usb/usbdevs_data.h,v 1.133 2003/05/12 04:27:22 murray Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	FreeBSD: src/sys/dev/usb/usbdevs,v 1.123 2003/05/05 08:18:53 murray Exp 
+ *	FreeBSD: src/sys/dev/usb/usbdevs,v 1.124 2003/05/11 23:55:28 joe Exp 
  */
 
 /*
@@ -394,6 +394,12 @@
 	    "Digital camera",
 	},
 	{
+	    USB_VENDOR_ASAHIOPTICAL, USB_PRODUCT_ASAHIOPTICAL_OPTIO330,
+	    0,
+	    "Asahi Optical",
+	    "Digital camera",
+	},
+	{
 	    USB_VENDOR_ASIX, USB_PRODUCT_ASIX_AX88172,
 	    0,
 	    "ASIX Electronics",

==== //depot/projects/hammer/sys/kern/kern_malloc.c#8 (text+ko) ====

@@ -31,7 +31,7 @@
  * SUCH DAMAGE.
  *
  *	@(#)kern_malloc.c	8.3 (Berkeley) 1/4/94
- * $FreeBSD: src/sys/kern/kern_malloc.c,v 1.123 2003/05/05 08:32:53 phk Exp $
+ * $FreeBSD: src/sys/kern/kern_malloc.c,v 1.124 2003/05/12 05:09:56 phk Exp $
  */
 
 #include "opt_vm.h"
@@ -250,13 +250,12 @@
 		ksp->ks_maxused = ksp->ks_memuse;
 
 	mtx_unlock(&ksp->ks_mtx);
-	if (!(flags & M_NOWAIT))
+	if (flags & M_WAITOK)
 		KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL"));
-	if (va == NULL) {
+	else if (va == NULL)
 		t_malloc_fail = time_uptime;
-	}
 #ifdef DIAGNOSTIC
-	if (!(flags & M_ZERO)) {
+	if (va != NULL && !(flags & M_ZERO)) {
 		memset(va, 0x70, osize);
 	}
 #endif


More information about the p4-projects mailing list