git: eb574ba0b61a - main - vfs: replace VFS_NOTIFY_UPPER_* macros with an enum

From: Mateusz Guzik <mjg_at_FreeBSD.org>
Date: Sat, 19 Mar 2022 13:18:58 UTC
The branch main has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=eb574ba0b61a992e83dc96133ecfbcd4718b9131

commit eb574ba0b61a992e83dc96133ecfbcd4718b9131
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-03-19 13:15:55 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-03-19 13:15:55 +0000

    vfs: replace VFS_NOTIFY_UPPER_* macros with an enum
---
 sys/kern/vfs_subr.c |  5 +----
 sys/sys/mount.h     | 10 ++++++----
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 3bdf1bdc855b..c498c9193754 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -3942,7 +3942,7 @@ vgone(struct vnode *vp)
  * Notify upper mounts about reclaimed or unlinked vnode.
  */
 void
-vfs_notify_upper(struct vnode *vp, int event)
+vfs_notify_upper(struct vnode *vp, enum vfs_notify_upper_type event)
 {
 	struct mount *mp;
 	struct mount_upper_node *ump;
@@ -3966,9 +3966,6 @@ vfs_notify_upper(struct vnode *vp, int event)
 		case VFS_NOTIFY_UPPER_UNLINK:
 			VFS_UNLINK_LOWERVP(ump->mp, vp);
 			break;
-		default:
-			KASSERT(0, ("invalid event %d", event));
-			break;
 		}
 		MNT_ILOCK(mp);
 	}
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index 0434aeaa38c5..6941048656d1 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -939,9 +939,6 @@ vfs_statfs_t	__vfs_statfs;
 	VN_KNOTE((vp), (hint), 0);					\
 } while (0)
 
-#define	VFS_NOTIFY_UPPER_RECLAIM	1
-#define	VFS_NOTIFY_UPPER_UNLINK		2
-
 #include <sys/module.h>
 
 /*
@@ -967,6 +964,11 @@ vfs_statfs_t	__vfs_statfs;
 	};							\
 	DECLARE_MODULE(fsname, fsname ## _mod, SI_SUB_VFS, SI_ORDER_MIDDLE)
 
+enum vfs_notify_upper_type {
+	VFS_NOTIFY_UPPER_RECLAIM,
+	VFS_NOTIFY_UPPER_UNLINK,
+};
+
 /*
  * exported vnode operations
  */
@@ -1020,7 +1022,7 @@ int	vfs_modevent(module_t, int, void *);
 void	vfs_mount_error(struct mount *, const char *, ...);
 void	vfs_mountroot(void);			/* mount our root filesystem */
 void	vfs_mountedfrom(struct mount *, const char *from);
-void	vfs_notify_upper(struct vnode *, int);
+void	vfs_notify_upper(struct vnode *, enum vfs_notify_upper_type);
 struct mount *vfs_ref_from_vp(struct vnode *);
 void	vfs_ref(struct mount *);
 void	vfs_rel(struct mount *);