diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h index 4999b89b93..374e721864 100644 --- a/src/afs/LINUX/osi_compat.h +++ b/src/afs/LINUX/osi_compat.h @@ -722,4 +722,15 @@ afs_file_write(struct file *filp, char __user *buf, size_t len, loff_t *pos) #endif } +static inline char* +afs_d_path(struct dentry *dp, struct vfsmount *mnt, char *buf, int buflen) +{ +#ifdef D_PATH_TAKES_STRUCT_PATH + afs_linux_path_t p = { .mnt = mnt, .dentry = dp }; + return d_path(&p, buf, buflen); +#else + return d_path(dp, mnt, buf, buflen); +#endif +} + #endif /* AFS_LINUX_OSI_COMPAT_H */ diff --git a/src/afs/LINUX/osi_misc.c b/src/afs/LINUX/osi_misc.c index 0e9336db66..aa5d5fc936 100644 --- a/src/afs/LINUX/osi_misc.c +++ b/src/afs/LINUX/osi_misc.c @@ -138,13 +138,7 @@ int osi_abspath(char *aname, char *buf, int buflen, return -PTR_ERR(name); code = osi_lookupname_internal(name, followlink, &mnt, &dp); if (!code) { -#if defined(D_PATH_TAKES_STRUCT_PATH) - afs_linux_path_t p = { .mnt = mnt, .dentry = dp }; - path = d_path(&p, buf, buflen); -#else - path = d_path(dp, mnt, buf, buflen); -#endif - + path = afs_d_path(dp, mnt, buf, buflen); if (IS_ERR(path)) { code = -PTR_ERR(path); } else {