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/43607e413db6
branches:  trunk
changeset: 1021313:43607e413db6
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 3df82ae39278 -r 43607e413db6 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