Source-Changes-HG archive

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

[src/trunk]: src/sbin/scan_ffs Work on swapped-endian FFS.



details:   https://anonhg.NetBSD.org/src/rev/ee3e2d893342
branches:  trunk
changeset: 373216:ee3e2d893342
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Tue Jan 24 08:05:07 2023 +0000

description:
Work on swapped-endian FFS.

diffstat:

 sbin/scan_ffs/Makefile   |   6 +++---
 sbin/scan_ffs/scan_ffs.c |  13 +++++++++++--
 2 files changed, 14 insertions(+), 5 deletions(-)

diffs (62 lines):

diff -r 8b3299e5a1f9 -r ee3e2d893342 sbin/scan_ffs/Makefile
--- a/sbin/scan_ffs/Makefile    Tue Jan 24 08:02:57 2023 +0000
+++ b/sbin/scan_ffs/Makefile    Tue Jan 24 08:05:07 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2020/09/07 03:09:53 mrg Exp $
+# $NetBSD: Makefile,v 1.11 2023/01/24 08:05:07 mlelstv Exp $
 
 .include <bsd.own.mk>
 
@@ -10,9 +10,9 @@
 LDADD= -lutil
 DPADD= ${LIBUTIL}
 
-SRCS=  scan_ffs.c lfs_cksum.c
+SRCS=  scan_ffs.c ffs_bswap.c lfs_cksum.c
 SCAN_FFS=${NETBSDSRCDIR}/sbin/scan_ffs
-.PATH:  ${NETBSDSRCDIR}/sys/ufs/lfs ${SCAN_FFS}
+.PATH:  ${NETBSDSRCDIR}/sys/ufs/ffs ${NETBSDSRCDIR}/sys/ufs/lfs ${SCAN_FFS}
 
 MAN=   scan_ffs.8
 
diff -r 8b3299e5a1f9 -r ee3e2d893342 sbin/scan_ffs/scan_ffs.c
--- a/sbin/scan_ffs/scan_ffs.c  Tue Jan 24 08:02:57 2023 +0000
+++ b/sbin/scan_ffs/scan_ffs.c  Tue Jan 24 08:05:07 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scan_ffs.c,v 1.36 2022/11/17 06:40:39 chs Exp $ */
+/* $NetBSD: scan_ffs.c,v 1.37 2023/01/24 08:05:07 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2005-2007 Juan Romero Pardines
@@ -33,7 +33,7 @@
  
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: scan_ffs.c,v 1.36 2022/11/17 06:40:39 chs Exp $");
+__RCSID("$NetBSD: scan_ffs.c,v 1.37 2023/01/24 08:05:07 mlelstv Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -50,6 +50,7 @@
 
 #include <ufs/ufs/dinode.h>
 #include <ufs/ffs/fs.h>
+#include <ufs/ffs/ffs_extern.h>
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -123,6 +124,14 @@
 ffs_checkver(struct sblockinfo *sbi)
 {
        switch (sbi->ffs->fs_magic) {
+               case FS_UFS1_MAGIC_SWAPPED:
+               case FS_UFS2_MAGIC_SWAPPED:
+               case FS_UFS2EA_MAGIC_SWAPPED:
+                       ffs_sb_swap(sbi->ffs, sbi->ffs);
+                       break;
+       }
+
+       switch (sbi->ffs->fs_magic) {
                case FS_UFS1_MAGIC:
                case FS_UFS1_MAGIC_SWAPPED:
                        sbi->ffs->fs_size = sbi->ffs->fs_old_size;



Home | Main Index | Thread Index | Old Index