Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs the UFS_EXTATTR option was supposed to affect only U...
details: https://anonhg.NetBSD.org/src/rev/193074431b97
branches: trunk
changeset: 372438:193074431b97
user: chs <chs%NetBSD.org@localhost>
date: Mon Nov 28 04:52:04 2022 +0000
description:
the UFS_EXTATTR option was supposed to affect only UFS1 file systems,
but when the UFS2 extattr code was merged, the UFS_EXTATTR option was
mistakenly changed to affect UFS2 file systems as well. this commit
changes UFS_EXTATTR back to affecting only UFS1 file systems as originally
intended. in UFS2 (or rather UFS2ea in NetBSD), extattrs are a
native feature and are always supported.
diffstat:
sys/ufs/ffs/ffs_extattr.c | 44 ++++++++++++++++++++++++++++----------------
sys/ufs/ffs/ffs_extern.h | 12 +-----------
sys/ufs/files.ufs | 4 ++--
3 files changed, 31 insertions(+), 29 deletions(-)
diffs (184 lines):
diff -r 7054b090a81f -r 193074431b97 sys/ufs/ffs/ffs_extattr.c
--- a/sys/ufs/ffs/ffs_extattr.c Mon Nov 28 02:48:33 2022 +0000
+++ b/sys/ufs/ffs/ffs_extattr.c Mon Nov 28 04:52:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_extattr.c,v 1.9 2022/11/17 06:40:40 chs Exp $ */
+/* $NetBSD: ffs_extattr.c,v 1.10 2022/11/28 04:52:04 chs Exp $ */
/*-
* SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-3-Clause)
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.9 2022/11/17 06:40:40 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.10 2022/11/28 04:52:04 chs Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@@ -114,7 +114,7 @@
#define VI_UNLOCK(vp) mutex_exit((vp)->v_interlock)
#define UFS_INODE_SET_FLAG(ip, f) ((ip)->i_flag |= (f))
#define ASSERT_VOP_ELOCKED(vp, m) KASSERT(VOP_ISLOCKED(vp))
-#define I_IS_UFS2(ip) (ITOFS(ip)->fs_magic == FS_UFS2_MAGIC)
+#define I_IS_UFS2(ip) ((ip)->i_ump->um_fstype == UFS2)
#define lblktosize(fs, o) ffs_lblktosize(fs, o)
#define lblkno(fs, o) ffs_lblkno(fs, o)
#define blkoff(fs, o) ffs_blkoff(fs, o)
@@ -151,7 +151,7 @@
dp = ip->i_din2;
#ifdef INVARIANTS
- if (uio->uio_rw != UIO_READ || fs->fs_magic != FS_UFS2_MAGIC)
+ if (uio->uio_rw != UIO_READ || ip->i_ump->um_fstype != UFS2)
panic("ffs_extread: mode");
#endif
@@ -269,7 +269,7 @@
dp = ip->i_din2;
#ifdef INVARIANTS
- if (uio->uio_rw != UIO_WRITE || fs->fs_magic != FS_UFS2_MAGIC)
+ if (uio->uio_rw != UIO_WRITE || ip->i_ump->um_fstype != UFS2)
panic("ffs_extwrite: mode");
#endif
@@ -585,10 +585,9 @@
struct proc *a_p;
} */ *ap = v;
struct inode *ip = VTOI(ap->a_vp);
- struct fs *fs = ip->i_fs;
/* Not supported for UFS1 file systems. */
- if (fs->fs_magic == FS_UFS1_MAGIC)
+ if (ip->i_ump->um_fstype == UFS1)
return (EOPNOTSUPP);
#ifdef __FreeBSD__
@@ -612,10 +611,9 @@
struct proc *a_p;
} */ *ap = v;
struct inode *ip = VTOI(ap->a_vp);
- struct fs *fs = ip->i_fs;
/* Not supported for UFS1 file systems. */
- if (fs->fs_magic == FS_UFS1_MAGIC)
+ if (ip->i_ump->um_fstype == UFS1)
return (EOPNOTSUPP);
#ifdef __FreeBSD__
@@ -646,11 +644,15 @@
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
- struct fs *fs = ip->i_fs;
KASSERT(VOP_ISLOCKED(vp));
- if (fs->fs_magic == FS_UFS1_MAGIC) {
+
+ if (ip->i_ump->um_fstype == UFS1) {
+#ifdef UFS_EXTATTR
return ufs_getextattr(ap);
+#else
+ return EOPNOTSUPP;
+#endif
}
u_char *eae, *p;
@@ -708,8 +710,12 @@
struct fs *fs = ip->i_fs;
KASSERT(VOP_ISLOCKED(vp) == LK_EXCLUSIVE);
- if (fs->fs_magic == FS_UFS1_MAGIC) {
+ if (ip->i_ump->um_fstype == UFS1) {
+#ifdef UFS_EXTATTR
return ufs_setextattr(ap);
+#else
+ return EOPNOTSUPP;
+#endif
}
struct extattr *eap;
@@ -829,10 +835,13 @@
struct proc *a_p;
} */ *ap = v;
struct inode *ip = VTOI(ap->a_vp);
- struct fs *fs = ip->i_fs;
- if (fs->fs_magic == FS_UFS1_MAGIC) {
+ if (ip->i_ump->um_fstype == UFS1) {
+#ifdef UFS_EXTATTR
return ufs_listextattr(ap);
+#else
+ return EOPNOTSUPP;
+#endif
}
struct extattr *eap, *eaend;
@@ -890,10 +899,13 @@
} */ *ap = v;
struct vnode *vp = ap->a_vp;
struct inode *ip = VTOI(vp);
- struct fs *fs = ip->i_fs;
- if (fs->fs_magic == FS_UFS1_MAGIC) {
+ if (ip->i_ump->um_fstype == UFS1) {
+#ifdef UFS_EXTATTR
return ufs_deleteextattr(ap);
+#else
+ return EOPNOTSUPP;
+#endif
}
struct extattr *eap;
diff -r 7054b090a81f -r 193074431b97 sys/ufs/ffs/ffs_extern.h
--- a/sys/ufs/ffs/ffs_extern.h Mon Nov 28 02:48:33 2022 +0000
+++ b/sys/ufs/ffs/ffs_extern.h Mon Nov 28 04:52:04 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ffs_extern.h,v 1.86 2020/04/18 19:18:34 christos Exp $ */
+/* $NetBSD: ffs_extern.h,v 1.87 2022/11/28 04:52:04 chs Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -141,7 +141,6 @@
int ffs_full_fsync(struct vnode *, int);
/* ffs_extattr.c */
-#ifdef UFS_EXTATTR
int ffs_openextattr(void *);
int ffs_closeextattr(void *);
int ffs_getextattr(void *);
@@ -149,15 +148,6 @@
int ffs_listextattr(void *);
int ffs_deleteextattr(void *);
int ffsext_strategy(void *);
-#else
-#define ffs_openextattr genfs_eopnotsupp
-#define ffs_closeextattr genfs_eopnotsupp
-#define ffs_getextattr genfs_eopnotsupp
-#define ffs_setextattr genfs_eopnotsupp
-#define ffs_listextattr genfs_eopnotsupp
-#define ffs_deleteextattr genfs_eopnotsupp
-#define ffsext_strategy vn_fifo_bypass
-#endif
/*
* Snapshot function prototypes.
diff -r 7054b090a81f -r 193074431b97 sys/ufs/files.ufs
--- a/sys/ufs/files.ufs Mon Nov 28 02:48:33 2022 +0000
+++ b/sys/ufs/files.ufs Mon Nov 28 04:52:04 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.ufs,v 1.49 2020/09/24 17:20:53 riastradh Exp $
+# $NetBSD: files.ufs,v 1.50 2022/11/28 04:52:04 chs Exp $
deffs FFS
deffs EXT2FS
@@ -52,7 +52,7 @@
file ufs/ffs/ffs_alloc.c ffs
file ufs/ffs/ffs_balloc.c ffs
file ufs/ffs/ffs_bswap.c (ffs | mfs) & ffs_ei
-file ufs/ffs/ffs_extattr.c ffs & ufs_extattr
+file ufs/ffs/ffs_extattr.c ffs
file ufs/ffs/ffs_inode.c ffs
file ufs/ffs/ffs_snapshot.c ffs
file ufs/ffs/ffs_subr.c ffs
Home |
Main Index |
Thread Index |
Old Index