Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Aug 2010 14:29:28 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 182846 for review
Message-ID:  <201008241429.o7OETSWM029603@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@182846?ac=10

Change 182846 by jhb@jhb_jhbbsd on 2010/08/24 14:28:52

	Put some hacks to handle older records under an #ifdef since they
	don't work for stock FreeBSD.

Affected files ...

.. //depot/projects/mcelog/mcelog.c#5 edit

Differences ...

==== //depot/projects/mcelog/mcelog.c#5 (text) ====

@@ -1264,6 +1264,7 @@
 #endif
 
 #ifdef __FreeBSD__
+#ifdef LOCAL_HACK
 struct mca_record_old {
 	uint64_t	mr_status;
 	uint64_t	mr_addr;
@@ -1272,6 +1273,7 @@
 	int		mr_apic_id;
 	int		mr_bank;
 };
+#endif
 
 struct mca_record_internal {
 	struct mca_record rec;
@@ -1279,17 +1281,21 @@
 	STAILQ_ENTRY(mca_internal) link;
 };
 
+#ifdef LOCAL_HACK
 struct mca_record_internal_old {
 	struct mca_record_old rec;
 	int		logged;
 	STAILQ_ENTRY(mca_internal) link;
 };
+#endif
 
 static struct nlist nl[] = {
 #define	X_MCA_RECORDS		0
 	{ .n_name = "_mca_records" },
+#ifdef LOCAL_HACK
 #define	X_SNAPDATE		1
 	{ .n_name = "_snapdate" },
+#endif
 	{ .n_name = NULL },
 };
 
@@ -1322,7 +1328,10 @@
 	char errbuf[_POSIX2_LINE_MAX];
 	kvm_t *kvm;
 	size_t record_size, link_offset;
-	int i, snapdate;
+	int i;
+#ifdef LOCAL_HACK
+	int snapdate;
+#endif
 
 	kvm = kvm_openfiles(execfile, corefile, NULL, O_RDONLY, errbuf);
 	if (kvm == NULL)
@@ -1335,15 +1344,19 @@
 	/* stqh_first is the first pointer at this address. */
 	if (kread_symbol(kvm, X_MCA_RECORDS, &mrp, sizeof(mrp)) < 0)
 		errx(1, "kvm_read(mca_records) failed");
+#ifdef LOCAL_HACK
 	if (snapdate >= 20100329) {
+#endif
 		record_size = sizeof(struct mca_record);
 		link_offset = __offsetof(struct mca_record_internal,
 		    link.stqe_next);
+#ifdef LOCAL_HACK
 	} else {
 		record_size = sizeof(struct mca_record_old);
 		link_offset = __offsetof(struct mca_record_internal_old,
 		    link.stqe_next);
 	}
+#endif
 
 	for (i = 0; mrp != NULL; i++) {
 		memset(&mr, 0, sizeof(mr));



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