From def00ae8ba774f4d7290c29208484dda756dc0e0 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Sat, 3 Sep 2011 14:10:50 -0400 Subject: [PATCH] Linux: d_delete now takes a const argument The d_delete dentry operation now takes a const argument. Test for this and define our function accordingly to avoid warnings. Change-Id: I621f54d8e8182b29ccfdf82798773800f5870064 Reviewed-on: http://gerrit.openafs.org/5335 Reviewed-by: Simon Wilkinson Reviewed-by: Derrick Brashear Tested-by: BuildBot --- acinclude.m4 | 1 + src/afs/LINUX/osi_vnodeops.c | 4 ++++ src/cf/linux-test4.m4 | 14 ++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 5accdb552..17e553084 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -916,6 +916,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*) LINUX_IOP_I_PERMISSION_TAKES_FLAGS LINUX_IOP_I_PERMISSION_TAKES_NAMEIDATA LINUX_IOP_I_PUT_LINK_TAKES_COOKIE + LINUX_DOP_D_DELETE_TAKES_CONST LINUX_DOP_D_REVALIDATE_TAKES_NAMEIDATA LINUX_FOP_F_FLUSH_TAKES_FL_OWNER_T LINUX_FOP_F_FSYNC_TAKES_DENTRY diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c index 6bd43cfeb..f37acb879 100644 --- a/src/afs/LINUX/osi_vnodeops.c +++ b/src/afs/LINUX/osi_vnodeops.c @@ -1061,7 +1061,11 @@ afs_dentry_iput(struct dentry *dp, struct inode *ip) } static int +#if defined(DOP_D_DELETE_TAKES_CONST) +afs_dentry_delete(const struct dentry *dp) +#else afs_dentry_delete(struct dentry *dp) +#endif { if (dp->d_inode && (VTOAFS(dp->d_inode)->f.states & CUnlinked)) return 1; /* bad inode? */ diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index 8d401bec3..b7c90709d 100644 --- a/src/cf/linux-test4.m4 +++ b/src/cf/linux-test4.m4 @@ -610,3 +610,17 @@ AC_DEFUN([LINUX_D_COUNT_IS_INT], [ [define if dentry->d_count is an int], [-Werror]) ]) + + +AC_DEFUN([LINUX_DOP_D_DELETE_TAKES_CONST], [ + AC_CHECK_LINUX_BUILD([whether dentry.d_op->d_delete takes a const argument], + [ac_cv_linux_dop_d_delete_takes_const], + [#include + #include ], + [struct dentry_operations _d_ops; + int _d_del(const struct dentry *de) {return 0;}; + _d_ops.d_delete = _d_del;], + [DOP_D_DELETE_TAKES_CONST], + [define if dentry.d_op->d_delete takes a const argument], + [-Werror]) +]) -- 2.39.5