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 /usr.sbin/makefs | |
| 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 'usr.sbin/makefs')
| -rw-r--r-- | usr.sbin/makefs/ffs.c | 7 | ||||
| -rw-r--r-- | usr.sbin/makefs/ffs.h | 3 | ||||
| -rw-r--r-- | usr.sbin/makefs/ffs/ffs_balloc.c | 7 | ||||
| -rw-r--r-- | usr.sbin/makefs/ffs/mkfs.c | 11 | ||||
| -rw-r--r-- | usr.sbin/makefs/makefs.8 | 4 |
5 files changed, 22 insertions, 10 deletions
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index 5875c5c95cf..333d508ab3d 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.c,v 1.72 2022/04/09 10:05:35 riastradh Exp $ */ +/* $NetBSD: ffs.c,v 1.73 2022/11/17 06:40:41 chs Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -71,7 +71,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs.c,v 1.72 2022/04/09 10:05:35 riastradh Exp $"); +__RCSID("$NetBSD: ffs.c,v 1.73 2022/11/17 06:40:41 chs Exp $"); #endif /* !__lint */ #include <sys/param.h> @@ -180,6 +180,8 @@ ffs_prep_opts(fsinfo_t *fsopts) 0, 0, "Optimization (time|space)" }, { 'l', "label", ffs_opts->label, OPT_STRARRAY, 1, sizeof(ffs_opts->label), "UFS label" }, + { 'e', "extattr", &ffs_opts->extattr, OPT_INT32, + 0, 1, "extattr support" }, { .name = NULL } }; @@ -194,6 +196,7 @@ ffs_prep_opts(fsinfo_t *fsopts) ffs_opts->avgfilesize= -1; ffs_opts->avgfpdir= -1; ffs_opts->version = 1; + ffs_opts->extattr = 1; fsopts->fs_specific = ffs_opts; fsopts->fs_options = copy_opts(ffs_options); diff --git a/usr.sbin/makefs/ffs.h b/usr.sbin/makefs/ffs.h index 79223bd54dd..0b8d6eef7e8 100644 --- a/usr.sbin/makefs/ffs.h +++ b/usr.sbin/makefs/ffs.h @@ -1,4 +1,4 @@ -/* $NetBSD: ffs.h,v 1.2 2011/10/09 21:33:43 christos Exp $ */ +/* $NetBSD: ffs.h,v 1.3 2022/11/17 06:40:41 chs Exp $ */ /* * Copyright (c) 2001-2003 Wasabi Systems, Inc. @@ -60,6 +60,7 @@ typedef struct { int avgfilesize; /* expected average file size */ int avgfpdir; /* expected # of files per directory */ int version; /* filesystem version (1 = FFS, 2 = UFS2) */ + int extattr; /* use UFS2ea magic */ int maxbsize; /* maximum extent size */ int maxblkspercg; /* max # of blocks per cylinder group */ /* XXX: support `old' file systems ? */ diff --git a/usr.sbin/makefs/ffs/ffs_balloc.c b/usr.sbin/makefs/ffs/ffs_balloc.c index bf135047077..84d1d5ff10d 100644 --- a/usr.sbin/makefs/ffs/ffs_balloc.c +++ b/usr.sbin/makefs/ffs/ffs_balloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ffs_balloc.c,v 1.21 2015/03/29 05:52:59 agc Exp $ */ +/* $NetBSD: ffs_balloc.c,v 1.22 2022/11/17 06:40:41 chs Exp $ */ /* From NetBSD: ffs_balloc.c,v 1.25 2001/08/08 08:36:36 lukem Exp */ /* @@ -38,7 +38,7 @@ #include <sys/cdefs.h> #if defined(__RCSID) && !defined(__lint) -__RCSID("$NetBSD: ffs_balloc.c,v 1.21 2015/03/29 05:52:59 agc Exp $"); +__RCSID("$NetBSD: ffs_balloc.c,v 1.22 2022/11/17 06:40:41 chs Exp $"); #endif /* !__lint */ #include <sys/param.h> @@ -74,7 +74,8 @@ static int ffs_balloc_ufs2(struct inode *, off_t, int, struct buf **); int ffs_balloc(struct inode *ip, off_t offset, int bufsize, struct buf **bpp) { - if (ip->i_fs->fs_magic == FS_UFS2_MAGIC) + if (ip->i_fs->fs_magic == FS_UFS2_MAGIC || + ip->i_fs->fs_magic == FS_UFS2EA_MAGIC) return ffs_balloc_ufs2(ip, offset, bufsize, bpp); else return ffs_balloc_ufs1(ip, offset, bufsize, bpp); diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index 6bfb9644d6c..95e61dfb880 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkfs.c,v 1.40 2022/04/02 19:16:49 mlelstv Exp $ */ +/* $NetBSD: mkfs.c,v 1.41 2022/11/17 06:40:41 chs Exp $ */ /* * Copyright (c) 2002 Networks Associates Technology, Inc. @@ -48,7 +48,7 @@ static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; #else #ifdef __RCSID -__RCSID("$NetBSD: mkfs.c,v 1.40 2022/04/02 19:16:49 mlelstv Exp $"); +__RCSID("$NetBSD: mkfs.c,v 1.41 2022/11/17 06:40:41 chs Exp $"); #endif #endif #endif /* not lint */ @@ -109,6 +109,7 @@ union { #define writebuf wb.pad static int Oflag; /* format as an 4.3BSD file system */ +static int extattr; /* use UFS2ea magic */ static int64_t fssize; /* file system size */ static int sectorsize; /* bytes/sector */ static int fsize; /* fragment size */ @@ -148,6 +149,7 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) ffs_opt_t *ffs_opts = fsopts->fs_specific; Oflag = ffs_opts->version; + extattr = ffs_opts->extattr; fssize = fsopts->size / fsopts->sectorsize; sectorsize = fsopts->sectorsize; fsize = ffs_opts->fsize; @@ -296,7 +298,10 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) sblock.fs_old_postblformat = 1; sblock.fs_old_nrpos = 1; } else { - sblock.fs_magic = FS_UFS2_MAGIC; + if (extattr) + sblock.fs_magic = FS_UFS2EA_MAGIC; + else + sblock.fs_magic = FS_UFS2_MAGIC; #if 0 /* XXX makefs is used for small filesystems. */ sblock.fs_sblockloc = SBLOCK_UFS2; #else diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8 index 529fbc43eef..83934adb08e 100644 --- a/usr.sbin/makefs/makefs.8 +++ b/usr.sbin/makefs/makefs.8 @@ -1,4 +1,4 @@ -.\" $NetBSD: makefs.8,v 1.70 2022/04/06 13:39:06 wiz Exp $ +.\" $NetBSD: makefs.8,v 1.71 2022/11/17 06:40:41 chs Exp $ .\" .\" Copyright (c) 2001-2003 Wasabi Systems, Inc. .\" All rights reserved. @@ -304,6 +304,8 @@ Expected number of files per directory. Block size. .It Sy density Bytes per inode. +.It Sy extattr +UFS2 with extended attributes. .It Sy extent Maximum extent size. .It Sy fsize |
