Date: Sun, 03 May 2026 19:59:12 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 48bf024f2ef5 - main - vfs: convert VFS_OPs from macros to static inlines Message-ID: <69f7a910.40fe6.368262c3@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=48bf024f2ef5afeba3500bd92a04283370479edf commit 48bf024f2ef5afeba3500bd92a04283370479edf Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-04-24 01:31:27 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-05-03 19:58:37 +0000 vfs: convert VFS_OPs from macros to static inlines Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D56611 --- sys/sys/mount.h | 230 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 121 insertions(+), 109 deletions(-) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 170201b82ac1..c96ce7d7b080 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -853,122 +853,134 @@ struct vfsops { vfs_statfs_t __vfs_statfs; -#define VFS_MOUNT(MP) ({ \ - int _rc; \ - \ - TSRAW(curthread, TS_ENTER, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\ - _rc = (*(MP)->mnt_op->vfs_mount)(MP); \ - TSRAW(curthread, TS_EXIT, "VFS_MOUNT", (MP)->mnt_vfc->vfc_name);\ - _rc; }) - -#define VFS_UNMOUNT(MP, FORCE) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_unmount)(MP, FORCE); \ - _rc; }) - -#define VFS_ROOT(MP, FLAGS, VPP) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_root)(MP, FLAGS, VPP); \ - _rc; }) - -#define VFS_CACHEDROOT(MP, FLAGS, VPP) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_cachedroot)(MP, FLAGS, VPP); \ - _rc; }) - -#define VFS_QUOTACTL(MP, C, U, A, MP_BUSY) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_quotactl)(MP, C, U, A, MP_BUSY); \ - _rc; }) - -#define VFS_STATFS(MP, SBP) ({ \ - int _rc; \ - \ - _rc = __vfs_statfs((MP), (SBP)); \ - _rc; }) - -#define VFS_SYNC(MP, WAIT) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_sync)(MP, WAIT); \ - _rc; }) - -#define VFS_VGET(MP, INO, FLAGS, VPP) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_vget)(MP, INO, FLAGS, VPP); \ - _rc; }) - -#define VFS_FHTOVP(MP, FIDP, FLAGS, VPP) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_fhtovp)(MP, FIDP, FLAGS, VPP); \ - _rc; }) - -#define VFS_CHECKEXP(MP, NAM, EXFLG, CRED, NUMSEC, SEC) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_checkexp)(MP, NAM, EXFLG, CRED, NUMSEC,\ - SEC); \ - _rc; }) - -#define VFS_EXTATTRCTL(MP, C, FN, NS, N) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_extattrctl)(MP, C, FN, NS, N); \ - _rc; }) - -#define VFS_SYSCTL(MP, OP, REQ) ({ \ - int _rc; \ - \ - _rc = (*(MP)->mnt_op->vfs_sysctl)(MP, OP, REQ); \ - _rc; }) - -#define VFS_SUSP_CLEAN(MP) do { \ - if (*(MP)->mnt_op->vfs_susp_clean != NULL) { \ - (*(MP)->mnt_op->vfs_susp_clean)(MP); \ - } \ -} while (0) +static inline int +VFS_MOUNT(struct mount *mp) +{ + int rc; -#define VFS_RECLAIM_LOWERVP(MP, VP) do { \ - if (*(MP)->mnt_op->vfs_reclaim_lowervp != NULL) { \ - (*(MP)->mnt_op->vfs_reclaim_lowervp)((MP), (VP)); \ - } \ -} while (0) + TSRAW(curthread, TS_ENTER, "VFS_MOUNT", mp->mnt_vfc->vfc_name); + rc = mp->mnt_op->vfs_mount(mp); + TSRAW(curthread, TS_EXIT, "VFS_MOUNT", mp->mnt_vfc->vfc_name); + return (rc); +} -#define VFS_UNLINK_LOWERVP(MP, VP) do { \ - if (*(MP)->mnt_op->vfs_unlink_lowervp != NULL) { \ - (*(MP)->mnt_op->vfs_unlink_lowervp)((MP), (VP)); \ - } \ -} while (0) +static inline int +VFS_UNMOUNT(struct mount *mp, int force) +{ + return (mp->mnt_op->vfs_unmount(mp, force)); +} -#define VFS_PURGE(MP) do { \ - if (*(MP)->mnt_op->vfs_purge != NULL) { \ - (*(MP)->mnt_op->vfs_purge)(MP); \ - } \ -} while (0) +static inline int +VFS_ROOT(struct mount *mp, int flags, struct vnode **vpp) +{ + return (mp->mnt_op->vfs_root(mp, flags, vpp)); +} + +static inline int +VFS_CACHEDROOT(struct mount *mp, int flags, struct vnode **vpp) +{ + return (mp->mnt_op->vfs_cachedroot(mp, flags, vpp)); +} + +static inline int +VFS_QUOTACTL(struct mount *mp, int cmds, uid_t uid, void *arg, bool *mp_busy) +{ + return (mp->mnt_op->vfs_quotactl(mp, cmds, uid, arg, mp_busy)); +} + +static inline int +VFS_STATFS(struct mount *mp, struct statfs *sbp) +{ + return (__vfs_statfs(mp, sbp)); +} + +static inline int +VFS_SYNC(struct mount *mp, int waitfor) +{ + return (mp->mnt_op->vfs_sync(mp, waitfor)); +} + +static inline int +VFS_VGET(struct mount *mp, ino_t ino, int flags, struct vnode **vpp) +{ + return (mp->mnt_op->vfs_vget(mp, ino, flags, vpp)); +} + +static inline int +VFS_FHTOVP(struct mount *mp, struct fid *fidp, int flags, struct vnode **vpp) +{ + return (mp->mnt_op->vfs_fhtovp(mp, fidp, flags, vpp)); +} + +static inline int +VFS_CHECKEXP(struct mount *mp, struct sockaddr *nam, uint64_t *extflagsp, + struct ucred **credanonp, int *numsecflavors, int *secflavors) +{ + return (mp->mnt_op->vfs_checkexp(mp, nam, extflagsp, credanonp, + numsecflavors, secflavors)); +} + +static inline int +VFS_EXTATTRCTL(struct mount *mp, int cmd, struct vnode *filename_vp, + int attrnamespace, const char *attrname) +{ + return (mp->mnt_op->vfs_extattrctl(mp, cmd, filename_vp, + attrnamespace, attrname)); +} + +static inline int +VFS_SYSCTL(struct mount *mp, fsctlop_t op, struct sysctl_req *req) +{ + return (mp->mnt_op->vfs_sysctl(mp, op, req)); +} + +static inline void +VFS_SUSP_CLEAN(struct mount *mp) +{ + if (mp->mnt_op->vfs_susp_clean != NULL) + mp->mnt_op->vfs_susp_clean(mp); +} + +static inline void +VFS_RECLAIM_LOWERVP(struct mount *mp, struct vnode *vp) +{ + if (mp->mnt_op->vfs_reclaim_lowervp != NULL) + mp->mnt_op->vfs_reclaim_lowervp(mp, vp); +} + +static inline void +VFS_UNLINK_LOWERVP(struct mount *mp, struct vnode *vp) +{ + if (mp->mnt_op->vfs_unlink_lowervp != NULL) + mp->mnt_op->vfs_unlink_lowervp(mp, vp); +} + +static inline void +VFS_PURGE(struct mount *mp) +{ + if (mp->mnt_op->vfs_purge != NULL) + mp->mnt_op->vfs_purge(mp); +} #include <sys/vnode.h> -#define VFS_KNOTE_LOCKED(vp, hint) do \ -{ \ - if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) { \ - KNOTE_LOCKED(&vp->v_pollinfo->vpi_selinfo.si_note, \ - hint); \ - } \ -} while (0) +static inline void +VFS_KNOTE_LOCKED(struct vnode *vp, int hint) +{ + if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) { + KNOTE_LOCKED(&vp->v_pollinfo->vpi_selinfo.si_note, + hint); + } +} -#define VFS_KNOTE_UNLOCKED(vp, hint) do \ -{ \ - if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) { \ - KNOTE_UNLOCKED(&vp->v_pollinfo->vpi_selinfo.si_note, \ - hint); \ - } \ -} while (0) +static inline void +VFS_KNOTE_UNLOCKED(struct vnode *vp, int hint) +{ + if ((vn_irflag_read(vp) & VIRF_KNOTE) != 0) { + KNOTE_UNLOCKED(&vp->v_pollinfo->vpi_selinfo.si_note, + hint); + } +} #include <sys/module.h>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f7a910.40fe6.368262c3>
