Date: Sun, 10 Jan 2016 17:44:01 +0000 (UTC) From: Garrett Cooper <ngie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r293638 - in user/ngie/stable-10-fix-LINT-NOINET: sbin/geom/class/part sys/boot/common sys/geom/part usr.bin/netstat Message-ID: <201601101744.u0AHi145097122@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ngie Date: Sun Jan 10 17:44:01 2016 New Revision: 293638 URL: https://svnweb.freebsd.org/changeset/base/293638 Log: MFstable/10 @ r293637 Modified: user/ngie/stable-10-fix-LINT-NOINET/sbin/geom/class/part/gpart.8 user/ngie/stable-10-fix-LINT-NOINET/sys/boot/common/part.c user/ngie/stable-10-fix-LINT-NOINET/sys/geom/part/g_part_gpt.c user/ngie/stable-10-fix-LINT-NOINET/usr.bin/netstat/inet.c Directory Properties: user/ngie/stable-10-fix-LINT-NOINET/ (props changed) Modified: user/ngie/stable-10-fix-LINT-NOINET/sbin/geom/class/part/gpart.8 ============================================================================== --- user/ngie/stable-10-fix-LINT-NOINET/sbin/geom/class/part/gpart.8 Sun Jan 10 17:39:49 2016 (r293637) +++ user/ngie/stable-10-fix-LINT-NOINET/sbin/geom/class/part/gpart.8 Sun Jan 10 17:44:01 2016 (r293638) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 14, 2015 +.Dd December 10, 2015 .Dt GPART 8 .Os .Sh NAME @@ -1107,15 +1107,6 @@ and .Cm recover are the only operations allowed on corrupt tables. .Pp -If the first sector of a provider is corrupt, the kernel can not detect GPT -even if the partition table itself is not corrupt. -The protective MBR can be rewritten using the -.Xr dd 1 -command, to restore the ability to detect the GPT. -The copy of the protective MBR is usually located in the -.Pa /boot/pmbr -file. -.Pp If one GPT header appears to be corrupt but the other copy remains intact, the kernel will log the following: .Bd -literal -offset indent @@ -1330,7 +1321,6 @@ and /sbin/gpart backup ada0 | /sbin/gpart restore -F ada1 ada2 .Ed .Sh SEE ALSO -.Xr dd 1 , .Xr geom 4 , .Xr boot0cfg 8 , .Xr geom 8 , Modified: user/ngie/stable-10-fix-LINT-NOINET/sys/boot/common/part.c ============================================================================== --- user/ngie/stable-10-fix-LINT-NOINET/sys/boot/common/part.c Sun Jan 10 17:39:49 2016 (r293637) +++ user/ngie/stable-10-fix-LINT-NOINET/sys/boot/common/part.c Sun Jan 10 17:44:01 2016 (r293638) @@ -306,6 +306,7 @@ ptable_gptread(struct ptable *table, voi table->type = PTABLE_NONE; goto out; } + DEBUG("GPT detected"); size = MIN(hdr.hdr_entries * hdr.hdr_entsz, MAXTBLSZ * table->sectorsize); for (i = 0; i < size / hdr.hdr_entsz; i++) { @@ -631,6 +632,11 @@ ptable_open(void *dev, off_t sectors, ui if (buf[DOSMAGICOFFSET] != 0x55 || buf[DOSMAGICOFFSET + 1] != 0xaa) { DEBUG("magic sequence not found"); +#if defined(LOADER_GPT_SUPPORT) + /* There is no PMBR, check that we have backup GPT */ + table->type = PTABLE_GPT; + table = ptable_gptread(table, dev, dread); +#endif goto out; } /* Check that we have PMBR. Also do some validation. */ Modified: user/ngie/stable-10-fix-LINT-NOINET/sys/geom/part/g_part_gpt.c ============================================================================== --- user/ngie/stable-10-fix-LINT-NOINET/sys/geom/part/g_part_gpt.c Sun Jan 10 17:39:49 2016 (r293637) +++ user/ngie/stable-10-fix-LINT-NOINET/sys/geom/part/g_part_gpt.c Sun Jan 10 17:44:01 2016 (r293638) @@ -823,22 +823,23 @@ g_part_gpt_probe(struct g_part_table *ta return (error); res = le16dec(buf + DOSMAGICOFFSET); pri = G_PART_PROBE_PRI_LOW; - for (index = 0; index < NDOSPART; index++) { - if (buf[DOSPARTOFF + DOSPARTSIZE * index + 4] == 0xee) - pri = G_PART_PROBE_PRI_HIGH; - } - g_free(buf); - if (res != DOSMAGIC) - return (ENXIO); + if (res == DOSMAGIC) { + for (index = 0; index < NDOSPART; index++) { + if (buf[DOSPARTOFF + DOSPARTSIZE * index + 4] == 0xee) + pri = G_PART_PROBE_PRI_HIGH; + } + g_free(buf); - /* Check that there's a primary header. */ - buf = g_read_data(cp, pp->sectorsize, pp->sectorsize, &error); - if (buf == NULL) - return (error); - res = memcmp(buf, GPT_HDR_SIG, 8); - g_free(buf); - if (res == 0) - return (pri); + /* Check that there's a primary header. */ + buf = g_read_data(cp, pp->sectorsize, pp->sectorsize, &error); + if (buf == NULL) + return (error); + res = memcmp(buf, GPT_HDR_SIG, 8); + g_free(buf); + if (res == 0) + return (pri); + } else + g_free(buf); /* No primary? Check that there's a secondary. */ buf = g_read_data(cp, pp->mediasize - pp->sectorsize, pp->sectorsize, Modified: user/ngie/stable-10-fix-LINT-NOINET/usr.bin/netstat/inet.c ============================================================================== --- user/ngie/stable-10-fix-LINT-NOINET/usr.bin/netstat/inet.c Sun Jan 10 17:39:49 2016 (r293637) +++ user/ngie/stable-10-fix-LINT-NOINET/usr.bin/netstat/inet.c Sun Jan 10 17:44:01 2016 (r293638) @@ -1039,47 +1039,6 @@ icmp_stats(u_long off, const char *name, } } -#ifndef BURN_BRIDGES -/* - * Dump IGMP statistics structure (pre 8.x kernel). - */ -static void -igmp_stats_live_old(const char *name) -{ - struct oigmpstat oigmpstat, zerostat; - size_t len = sizeof(oigmpstat); - - if (zflag) - memset(&zerostat, 0, len); - if (sysctlbyname("net.inet.igmp.stats", &oigmpstat, &len, - zflag ? &zerostat : NULL, zflag ? len : 0) < 0) { - warn("sysctl: net.inet.igmp.stats"); - return; - } - - printf("%s:\n", name); - -#define p(f, m) if (oigmpstat.f || sflag <= 1) \ - printf(m, oigmpstat.f, plural(oigmpstat.f)) -#define py(f, m) if (oigmpstat.f || sflag <= 1) \ - printf(m, oigmpstat.f, oigmpstat.f != 1 ? "ies" : "y") - p(igps_rcv_total, "\t%u message%s received\n"); - p(igps_rcv_tooshort, "\t%u message%s received with too few bytes\n"); - p(igps_rcv_badsum, "\t%u message%s received with bad checksum\n"); - py(igps_rcv_queries, "\t%u membership quer%s received\n"); - py(igps_rcv_badqueries, - "\t%u membership quer%s received with invalid field(s)\n"); - p(igps_rcv_reports, "\t%u membership report%s received\n"); - p(igps_rcv_badreports, - "\t%u membership report%s received with invalid field(s)\n"); - p(igps_rcv_ourreports, -"\t%u membership report%s received for groups to which we belong\n"); - p(igps_snd_reports, "\t%u membership report%s sent\n"); -#undef p -#undef py -} -#endif /* !BURN_BRIDGES */ - /* * Dump IGMP statistics structure. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601101744.u0AHi145097122>