Linux 4.2: Changes in link operation APIs

The follow_link and put_link operations are revised.
Test for the new signature and adapt the code.

Change-Id: I2834589cbe36c41924ab0505e6ca4ecd797a57fd
Reviewed-on: http://gerrit.openafs.org/11928
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
Marc Dionne 2015-07-06 13:01:38 -03:00 committed by Jeffrey Altman
parent c2c0b6bc86
commit 6c3ac6dc1e
2 changed files with 37 additions and 0 deletions

View File

@ -901,6 +901,16 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
LINUX_KBUILD_USES_EXTRA_CFLAGS
LINUX_KERNEL_COMPILE_WORKS
dnl Operation signature checks
AC_CHECK_LINUX_OPERATION([inode_operations], [follow_link], [no_nameidata],
[#include <linux/fs.h>],
[const char *],
[struct dentry *dentry, void **link_data])
AC_CHECK_LINUX_OPERATION([inode_operations], [put_link], [no_nameidata],
[#include <linux/fs.h>],
[void],
[struct inode *inode, void *link_data])
dnl Check for header files
AC_CHECK_LINUX_HEADER([config.h])
AC_CHECK_LINUX_HEADER([completion.h])

View File

@ -1902,14 +1902,22 @@ afs_linux_readlink(struct dentry *dp, char *target, int maxlen)
/* afs_linux_follow_link
* a file system dependent link following routine.
*/
#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
static const char *afs_linux_follow_link(struct dentry *dentry, void **link_data)
#else
static int afs_linux_follow_link(struct dentry *dentry, struct nameidata *nd)
#endif
{
int code;
char *name;
name = kmalloc(PATH_MAX, GFP_NOFS);
if (!name) {
#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
return ERR_PTR(-EIO);
#else
return -EIO;
#endif
}
AFS_GLOCK();
@ -1917,14 +1925,32 @@ static int afs_linux_follow_link(struct dentry *dentry, struct nameidata *nd)
AFS_GUNLOCK();
if (code < 0) {
#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
return ERR_PTR(code);
#else
return code;
#endif
}
name[code] = '\0';
#if defined(HAVE_LINUX_INODE_OPERATIONS_FOLLOW_LINK_NO_NAMEIDATA)
return *link_data = name;
#else
nd_set_link(nd, name);
return 0;
#endif
}
#if defined(HAVE_LINUX_INODE_OPERATIONS_PUT_LINK_NO_NAMEIDATA)
static void
afs_linux_put_link(struct inode *inode, void *link_data)
{
char *name = link_data;
if (name && !IS_ERR(name))
kfree(name);
}
#else
static void
afs_linux_put_link(struct dentry *dentry, struct nameidata *nd)
{
@ -1933,6 +1959,7 @@ afs_linux_put_link(struct dentry *dentry, struct nameidata *nd)
if (name && !IS_ERR(name))
kfree(name);
}
#endif /* HAVE_LINUX_INODE_OPERATIONS_PUT_LINK_NO_NAMEIDATA */
#endif /* USABLE_KERNEL_PAGE_SYMLINK_CACHE */