Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Feb 2003 21:17:48 -0800 (PST)
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 24869 for review
Message-ID:  <200302090517.h195Hm5n055941@repoman.freebsd.org>

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

Change 24869 by jmallett@jmallett_dalek on 2003/02/08 21:17:07

	Add checksum support, and a few more bootverbose messages.

Affected files ...

.. //depot/projects/mips/sys/geom/geom_fx.c#5 edit

Differences ...

==== //depot/projects/mips/sys/geom/geom_fx.c#5 (text+ko) ====

@@ -129,6 +129,7 @@
 } __packed;
 
 struct g_fx_softc {
+	struct volhdr	sc_volhdr;
 };
 
 static void
@@ -151,6 +152,21 @@
 }
 
 static int
+g_fx_cksum(struct volhdr *vh)
+{
+	int32_t *words;
+	int32_t sum;
+	int i;
+
+	sum = 0;
+	words = (int32_t *)vh;
+
+	for (i = 0; i < 512 / sizeof *words; i++)
+		sum += g_dec_be4((u_char *)&words[i]);
+	return sum;
+}
+
+static int
 g_fx_start(struct bio *bp)
 {
 	struct g_geom *gp;
@@ -220,6 +236,15 @@
 		label = (struct volhdr *)buf;
 		if (g_dec_be4((u_char *)&label->vh_magic) != FX_LABEL_MAGIC)
 			break;
+		error = g_fx_cksum(label);
+		if (error != 0) {
+			if (bootverbose) {
+				printf("Found a bad label on %s (sum %d)\n",
+				       pp->name, error);
+			}
+			break;
+		}
+		ms->sc_volhdr = *label;
 		for (i = 0; i < FX_NPARTS; i++) {
 			vp = &label->vh_part[i];
 			g_fx_swap_volpart(vp);
@@ -237,6 +262,10 @@
 			}
 			npart++;
 		}
+		if (bootverbose) {
+			printf("Configured %d partitions on %s\n",
+			       npart, pp->name);
+		}
 		break;
 	}
 	g_topology_lock();

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?200302090517.h195Hm5n055941>