Module Name: src
Committed By: chs
Date: Mon Nov 28 04:52:04 UTC 2022
Modified Files:
src/sys/ufs: files.ufs
src/sys/ufs/ffs: ffs_extattr.c ffs_extern.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/ufs/files.ufs
cvs rdiff -u -r1.9 -r1.10 src/sys/ufs/ffs/ffs_extattr.c
cvs rdiff -u -r1.86 -r1.87 src/sys/ufs/ffs/ffs_extern.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/ufs/files.ufs
diff -u src/sys/ufs/files.ufs:1.49 src/sys/ufs/files.ufs:1.50
--- src/sys/ufs/files.ufs:1.49 Thu Sep 24 17:20:53 2020
+++ src/sys/ufs/files.ufs Mon Nov 28 04:52:04 2022
@@ -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 @@ define ffs: vfs, ufs
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
Index: src/sys/ufs/ffs/ffs_extattr.c
diff -u src/sys/ufs/ffs/ffs_extattr.c:1.9 src/sys/ufs/ffs/ffs_extattr.c:1.10
--- src/sys/ufs/ffs/ffs_extattr.c:1.9 Thu Nov 17 06:40:40 2022
+++ src/sys/ufs/ffs/ffs_extattr.c Mon Nov 28 04:52:04 2022
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: ffs_extattr.
#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 @@ ffs_extread(struct vnode *vp, struct uio
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 @@ ffs_extwrite(struct vnode *vp, struct ui
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 @@ ffs_openextattr(void *v)
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 @@ ffs_closeextattr(void *v)
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 @@ ffs_getextattr(void *v)
} */ *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 @@ ffs_setextattr(void *v)
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 @@ ffs_listextattr(void *v)
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 @@ ffs_deleteextattr(void *v)
} */ *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;
Index: src/sys/ufs/ffs/ffs_extern.h
diff -u src/sys/ufs/ffs/ffs_extern.h:1.86 src/sys/ufs/ffs/ffs_extern.h:1.87
--- src/sys/ufs/ffs/ffs_extern.h:1.86 Sat Apr 18 19:18:34 2020
+++ src/sys/ufs/ffs/ffs_extern.h Mon Nov 28 04:52:04 2022
@@ -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_islocked(void *);
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_setextattr(void *);
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.