Skip to content

Commit

Permalink
nullfs: Use an a_gen field to cast to vop_generic_args
Browse files Browse the repository at this point in the history
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
  • Loading branch information
kwitaszczyk committed Jul 26, 2024
1 parent 9776aba commit 5c3af1d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions sys/fs/nullfs/null_vnops.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/*
Expand All @@ -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];
Expand All @@ -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];
Expand Down Expand Up @@ -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
Expand All @@ -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));
}

/*
Expand Down

0 comments on commit 5c3af1d

Please sign in to comment.