summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authormlelstv <mlelstv@NetBSD.org>2023-01-24 08:05:07 +0000
committermlelstv <mlelstv@NetBSD.org>2023-01-24 08:05:07 +0000
commitbef2f1ecb63917147e198c992c559fc80844ffab (patch)
treeb4764570b6588b97683dd54dca5374c081609473 /sbin
parent59ddf36f12983121c19a1a0026e09567d2f157dd (diff)
Work on swapped-endian FFS.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/scan_ffs/Makefile6
-rw-r--r--sbin/scan_ffs/scan_ffs.c13
2 files changed, 14 insertions, 5 deletions
diff --git a/sbin/scan_ffs/Makefile b/sbin/scan_ffs/Makefile
index 37b48d6d6a7..ac73e0afcb6 100644
--- a/sbin/scan_ffs/Makefile
+++ b/sbin/scan_ffs/Makefile
@@ -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 @@ MLINKS= scan_ffs.8 scan_lfs.8
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 --git a/sbin/scan_ffs/scan_ffs.c b/sbin/scan_ffs/scan_ffs.c
index 4a4b0f21d54..8fbedfea2af 100644
--- a/sbin/scan_ffs/scan_ffs.c
+++ b/sbin/scan_ffs/scan_ffs.c
@@ -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 @@ __RCSID("$NetBSD: scan_ffs.c,v 1.36 2022/11/17 06:40:39 chs Exp $");
#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 @@ static int
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;