1 From: Damien Diederen <ddiederen@sinenomine.net>
2 Date: Mon, 18 Sep 2017 11:59:40 +0200
3 Subject: Linux: Test for __vfs_write rather than __vfs_read
7 commit eb031849d52e61d24ba54e9d27553189ff328174
8 Author: Christoph Hellwig <hch@lst.de>
9 Date: Fri Sep 1 17:39:23 2017 +0200
11 fs: unexport __vfs_read/__vfs_write
13 unexports both __vfs_read and __vfs_write, but keeps the former in
14 fs.h--as it is is still being used by another part of the tree.
16 This situation results in a false positive in our Autoconf check,
17 which does not see the export statements, and ends up marking the
18 corresponding API as available.
20 That, in turn, causes some code which assumes symmetry with
21 __vfs_write to fail to compile.
23 Switch to testing for __vfs_write, which correctly marks the API as
26 Change-Id: I392f2b17b4de7bd81d549c84e6f7b5ef05e1b999
27 Reviewed-on: https://gerrit.openafs.org/12728
28 Tested-by: BuildBot <buildbot@rampaginggeek.com>
29 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
32 src/afs/LINUX/osi_compat.h | 4 ++--
33 src/afs/LINUX/osi_vnodeops.c | 2 +-
34 3 files changed, 5 insertions(+), 5 deletions(-)
36 diff --git a/acinclude.m4 b/acinclude.m4
37 index d80cacd..8353ca5 100644
40 @@ -939,9 +939,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
42 dnl Function existence checks
44 - AC_CHECK_LINUX_FUNC([__vfs_read],
45 + AC_CHECK_LINUX_FUNC([__vfs_write],
46 [#include <linux/fs.h>],
47 - [__vfs_read(NULL, NULL, 0, NULL);])
48 + [__vfs_write(NULL, NULL, 0, NULL);])
49 AC_CHECK_LINUX_FUNC([bdi_init],
50 [#include <linux/backing-dev.h>],
52 diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
53 index 8e72161..9ebe9c1 100644
54 --- a/src/afs/LINUX/osi_compat.h
55 +++ b/src/afs/LINUX/osi_compat.h
56 @@ -595,7 +595,7 @@ afs_d_invalidate(struct dentry *dp)
58 afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos)
60 -#if defined(HAVE_LINUX___VFS_READ)
61 +#if defined(HAVE_LINUX___VFS_WRITE)
62 return __vfs_read(filp, buf, len, pos);
64 return filp->f_op->read(filp, buf, len, pos);
65 @@ -605,7 +605,7 @@ afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos)
67 afs_file_write(struct file *filp, char __user *buf, size_t len, loff_t *pos)
69 -#if defined(HAVE_LINUX___VFS_READ)
70 +#if defined(HAVE_LINUX___VFS_WRITE)
71 return __vfs_write(filp, buf, len, pos);
73 return filp->f_op->write(filp, buf, len, pos);
74 diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
75 index f46d8dd..3d9d717 100644
76 --- a/src/afs/LINUX/osi_vnodeops.c
77 +++ b/src/afs/LINUX/osi_vnodeops.c
78 @@ -807,7 +807,7 @@ struct file_operations afs_file_fops = {
79 #ifdef STRUCT_FILE_OPERATIONS_HAS_READ_ITER
80 .read_iter = afs_linux_read_iter,
81 .write_iter = afs_linux_write_iter,
82 -# if !defined(HAVE_LINUX___VFS_READ)
83 +# if !defined(HAVE_LINUX___VFS_WRITE)
84 .read = new_sync_read,
85 .write = new_sync_write,