git: 5c3af1d697dc - main - nullfs: Use an a_gen field to cast to vop_generic_args

From: Konrad Witaszczyk <def_at_FreeBSD.org>
Date: Fri, 26 Jul 2024 11:15:59 UTC
The branch main has been updated by def:

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

commit 5c3af1d697dc9d1bfe8f0a5ab9206a6b88e4bfe7
Author:     Konrad Witaszczyk <def@FreeBSD.org>
AuthorDate: 2022-11-09 15:26:56 +0000
Commit:     Konrad Witaszczyk <def@FreeBSD.org>
CommitDate: 2024-07-26 11:14:32 +0000

    nullfs: Use an a_gen field to cast to vop_generic_args
    
    Instead of casting a vop_F_args object to vop_generic_args, use a
    vop_F_args.a_gen field when calling null_bypass(). This way we don't
    hardcode the vop_generic_args data type in the callers of null_bypass().
    
    Before this change, there were 3 null_bypass() calls using
    a vop_F_args.a_gen field and 5 null_bypass() calls using a cast to
    vop_generic_args. This change makes all null_bypass() calls consistent
    and easier to maintain.
    
    Pointed out by: jrtc27
    Reviewed by:    kib, oshogbo
    Accepted by:    oshogbo (mentor)
    Differential Revision: https://reviews.freebsd.org/D37359
---
 sys/fs/nullfs/null_vnops.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 4747b1dd5b82..bdf82432a2fb 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -528,7 +528,7 @@ null_setattr(struct vop_setattr_args *ap)
 		}
 	}
 
-	return (null_bypass((struct vop_generic_args *)ap));
+	return (null_bypass(&ap->a_gen));
 }
 
 /*
@@ -539,7 +539,7 @@ null_stat(struct vop_stat_args *ap)
 {
 	int error;
 
-	if ((error = null_bypass((struct vop_generic_args *)ap)) != 0)
+	if ((error = null_bypass(&ap->a_gen)) != 0)
 		return (error);
 
 	ap->a_sb->st_dev = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
@@ -551,7 +551,7 @@ null_getattr(struct vop_getattr_args *ap)
 {
 	int error;
 
-	if ((error = null_bypass((struct vop_generic_args *)ap)) != 0)
+	if ((error = null_bypass(&ap->a_gen)) != 0)
 		return (error);
 
 	ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
@@ -584,7 +584,7 @@ null_access(struct vop_access_args *ap)
 			break;
 		}
 	}
-	return (null_bypass((struct vop_generic_args *)ap));
+	return (null_bypass(&ap->a_gen));
 }
 
 static int
@@ -610,7 +610,7 @@ null_accessx(struct vop_accessx_args *ap)
 			break;
 		}
 	}
-	return (null_bypass((struct vop_generic_args *)ap));
+	return (null_bypass(&ap->a_gen));
 }
 
 /*