Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa in getdisklabel() swap the other-endian diskla...



details:   https://anonhg.NetBSD.org/src/rev/70dcdbc5fc4a
branches:  trunk
changeset: 983466:70dcdbc5fc4a
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed May 26 04:28:15 2021 +0000

description:
in getdisklabel() swap the other-endian disklabel, #ifdef LIBSA_DISKLABEL_EI

diffstat:

 sys/lib/libsa/disklabel.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (22 lines):

diff -r e14a43195969 -r 70dcdbc5fc4a sys/lib/libsa/disklabel.c
--- a/sys/lib/libsa/disklabel.c Tue May 25 19:22:18 2021 +0000
+++ b/sys/lib/libsa/disklabel.c Wed May 26 04:28:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: disklabel.c,v 1.11 2021/05/17 08:50:36 mrg Exp $       */
+/*     $NetBSD: disklabel.c,v 1.12 2021/05/26 04:28:15 mrg Exp $       */
 
 /*-
  * Copyright (c) 1993
@@ -54,6 +54,12 @@
        elp = (const void *)(buf + DEV_BSIZE - sizeof(*dlp));
        for (dlp = (const void *)buf; dlp <= elp;
            dlp = (const void *)((const char *)dlp + sizeof(long))) {
+#if defined(LIBSA_DISKLABEL_EI)
+               if (dlp->d_magic == bswap32(DISKMAGIC) &&
+                   dlp->d_magic2 == bswap32(DISKMAGIC)) {
+                       disklabel_swap(__UNCONST(dlp), __UNCONST(dlp));
+               }
+#endif
                if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
                        if (msg == NULL)
                                msg = nolabel;



Home | Main Index | Thread Index | Old Index