diff options
| author | chs <chs@NetBSD.org> | 2022-11-17 06:40:38 +0000 |
|---|---|---|
| committer | chs <chs@NetBSD.org> | 2022-11-17 06:40:38 +0000 |
| commit | fc045a9d183f85bd23de76a1f7fd30f941ccc178 (patch) | |
| tree | 5404f15a8224e3aad20068954d19c826a62f850e /sys/lib | |
| parent | f281a463874081e49743e76f8c259f85052d3627 (diff) | |
Restore backward compatibility of UFS2 with previous NetBSD releases by
disabling support in UFS2 for extended attributes (including ACLs).
Add a new variant of UFS2 called "UFS2ea" that does support extended attributes.
Add new fsck_ffs operations "-c ea" and "-c no-ea" to convert file systems
from UFS2 to UFS2ea and vice-versa (both of which delete all existing extended
attributes in the process).
Diffstat (limited to 'sys/lib')
| -rw-r--r-- | sys/lib/libsa/ffsv1.c | 7 | ||||
| -rw-r--r-- | sys/lib/libsa/ffsv2.c | 7 | ||||
| -rw-r--r-- | sys/lib/libsa/lfsv1.c | 4 | ||||
| -rw-r--r-- | sys/lib/libsa/lfsv2.c | 4 | ||||
| -rw-r--r-- | sys/lib/libsa/ufs.c | 46 |
5 files changed, 44 insertions, 24 deletions
diff --git a/sys/lib/libsa/ffsv1.c b/sys/lib/libsa/ffsv1.c index c3197c669d1..779bc2fdafa 100644 --- a/sys/lib/libsa/ffsv1.c +++ b/sys/lib/libsa/ffsv1.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffsv1.c,v 1.9 2022/04/24 06:52:59 mlelstv Exp $ */ +/* $NetBSD: ffsv1.c,v 1.10 2022/11/17 06:40:39 chs Exp $ */ #define LIBSA_FFSv1 @@ -17,9 +17,4 @@ #define ufs_indp_swap bswap32 #define indp_t int32_t -#define FS_MAGIC FS_UFS1_MAGIC - -/* #define FSMOD "wapbl/ufs/ffs" */ -#define FSMOD NULL - #include "ufs.c" diff --git a/sys/lib/libsa/ffsv2.c b/sys/lib/libsa/ffsv2.c index 90b7cae30a1..390b3763046 100644 --- a/sys/lib/libsa/ffsv2.c +++ b/sys/lib/libsa/ffsv2.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffsv2.c,v 1.9 2022/04/24 06:52:59 mlelstv Exp $ */ +/* $NetBSD: ffsv2.c,v 1.10 2022/11/17 06:40:39 chs Exp $ */ #define LIBSA_FFSv2 @@ -17,9 +17,4 @@ #define ufs_indp_swap bswap64 #define indp_t int64_t -#define FS_MAGIC FS_UFS2_MAGIC - -/* #define FSMOD "wapbl/ufs/ffs" */ -#define FSMOD NULL - #include "ufs.c" diff --git a/sys/lib/libsa/lfsv1.c b/sys/lib/libsa/lfsv1.c index 1c361c23bd8..825c457a2c2 100644 --- a/sys/lib/libsa/lfsv1.c +++ b/sys/lib/libsa/lfsv1.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfsv1.c,v 1.15 2021/05/27 06:54:44 mrg Exp $ */ +/* $NetBSD: lfsv1.c,v 1.16 2022/11/17 06:40:39 chs Exp $ */ #define LIBSA_LFS #define REQUIRED_LFS_VERSION 1 @@ -25,8 +25,6 @@ #define dblksize(a, b, c) lfs_dblksize((a), (b), (c)) #define FSBTODB(fs, daddr) (daddr) /* LFSv1 uses sectors for addresses */ -#define FS_MAGIC LFS_MAGIC - #define FSMOD "lfs" #include "lib/libsa/ufs.c" diff --git a/sys/lib/libsa/lfsv2.c b/sys/lib/libsa/lfsv2.c index 0eb0583854b..089f763d875 100644 --- a/sys/lib/libsa/lfsv2.c +++ b/sys/lib/libsa/lfsv2.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfsv2.c,v 1.15 2021/05/27 06:54:44 mrg Exp $ */ +/* $NetBSD: lfsv2.c,v 1.16 2022/11/17 06:40:40 chs Exp $ */ #define LIBSA_LFS #define REQUIRED_LFS_VERSION 2 @@ -29,8 +29,6 @@ #define dblksize(a, b, c) lfs_dblksize((a), (b), (c)) #define FSBTODB(a, b) LFS_FSBTODB((a), (b)) -#define FS_MAGIC LFS_MAGIC - #define FSMOD "lfs" #include "lib/libsa/ufs.c" diff --git a/sys/lib/libsa/ufs.c b/sys/lib/libsa/ufs.c index adf464e6d79..5641c5f018a 100644 --- a/sys/lib/libsa/ufs.c +++ b/sys/lib/libsa/ufs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs.c,v 1.86 2022/04/29 07:42:07 rin Exp $ */ +/* $NetBSD: ufs.c,v 1.87 2022/11/17 06:40:40 chs Exp $ */ /*- * Copyright (c) 1993 @@ -156,9 +156,6 @@ typedef uint32_t ino32_t; #ifndef FSBTODB #define FSBTODB(fs, indp) FFS_FSBTODB(fs, indp) #endif -#ifndef FS_MAGIC -#define FS_MAGIC FS_UFS1_MAGIC -#endif #ifndef UFS_NINDIR #define UFS_NINDIR FFS_NINDIR #endif @@ -214,17 +211,54 @@ static int search_directory(const char *, int, struct open_file *, ino32_t *); static void ffs_oldfscompat(FS *); #endif +#ifdef LIBSA_FFSv1 static __inline__ bool ffs_is_magic(FS *fs) { - return fs->fs_magic == FS_MAGIC; + return fs->fs_magic == FS_UFS1_MAGIC; +} + +static __inline__ bool +ffs_is_magic_swapped(FS *fs) +{ + return fs->fs_magic == bswap32(FS_UFS1_MAGIC); } +#endif + +#ifdef LIBSA_FFSv2 +static __inline__ bool +ffs_is_magic(FS *fs) +{ + return fs->fs_magic == FS_UFS2_MAGIC || fs->fs_magic == FS_UFS2EA_MAGIC; +} + +static __inline__ bool +ffs_is_magic_swapped(FS *fs) +{ + return fs->fs_magic == bswap32(FS_UFS2_MAGIC) || + fs->fs_magic == bswap32(FS_UFS2EA_MAGIC); +} +#endif + +#ifdef LIBSA_LFS +static __inline__ bool +ffs_is_magic(FS *fs) +{ + return fs->fs_magic == LFS_MAGIC; +} + +static __inline__ bool +ffs_is_magic_swapped(FS *fs) +{ + return fs->fs_magic == bswap32(LFS_MAGIC); +} +#endif static __inline__ void ffs_fix_magic_swapped(struct file *fp, FS *fs) { #ifdef LIBSA_FFS_EI - fp->f_swapped = fs->fs_magic == bswap32(FS_MAGIC); + fp->f_swapped = ffs_is_magic_swapped(fs); if (fp->f_swapped) { ffs_sb_swap(fs, fs); |
