mirror of
https://git.openafs.org/openafs.git
synced 2025-01-18 06:50:12 +00:00
Linux 4.1: Don't define or use ->write directly
We no longer have to define a ->write operation, and we can't expect the underlying disk cache filesystem to have one. Use the new __vfs_read/write helpers that will select the operation to use based on what's available for that particular filesystem. Change-Id: Iab923235308ff57348ffc2dc6d718dd64040656b Reviewed-on: http://gerrit.openafs.org/11849 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Chas Williams <3chas3@gmail.com> Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
This commit is contained in:
parent
fcfa5ae246
commit
5c1237432e
@ -966,6 +966,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
|
||||
|
||||
dnl Function existence checks
|
||||
|
||||
AC_CHECK_LINUX_FUNC([__vfs_read],
|
||||
[#include <linux/fs.h>],
|
||||
[__vfs_read(NULL, NULL, 0, NULL);])
|
||||
AC_CHECK_LINUX_FUNC([bdi_init],
|
||||
[#include <linux/backing-dev.h>],
|
||||
[bdi_init(NULL);])
|
||||
|
@ -631,4 +631,24 @@ afs_d_invalidate(struct dentry *dp)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
afs_file_read(struct file *filp, char __user *buf, size_t len, loff_t *pos)
|
||||
{
|
||||
#if defined(HAVE_LINUX___VFS_READ)
|
||||
return __vfs_read(filp, buf, len, pos);
|
||||
#else
|
||||
return filp->f_op->read(filp, buf, len, pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
afs_file_write(struct file *filp, char __user *buf, size_t len, loff_t *pos)
|
||||
{
|
||||
#if defined(HAVE_LINUX___VFS_READ)
|
||||
return __vfs_write(filp, buf, len, pos);
|
||||
#else
|
||||
return filp->f_op->write(filp, buf, len, pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* AFS_LINUX_OSI_COMPAT_H */
|
||||
|
@ -375,9 +375,9 @@ osi_rdwr(struct osi_file *osifile, struct uio *uiop, int rw)
|
||||
|
||||
pos = uiop->uio_offset;
|
||||
if (rw == UIO_READ)
|
||||
code = filp->f_op->read(filp, iov->iov_base, count, &pos);
|
||||
code = afs_file_read(filp, iov->iov_base, count, &pos);
|
||||
else
|
||||
code = filp->f_op->write(filp, iov->iov_base, count, &pos);
|
||||
code = afs_file_write(filp, iov->iov_base, count, &pos);
|
||||
|
||||
if (code < 0) {
|
||||
code = -code;
|
||||
|
@ -819,8 +819,10 @@ struct file_operations afs_file_fops = {
|
||||
#ifdef STRUCT_FILE_OPERATIONS_HAS_READ_ITER
|
||||
.read_iter = afs_linux_read_iter,
|
||||
.write_iter = afs_linux_write_iter,
|
||||
# if !defined(HAVE_LINUX___VFS_READ)
|
||||
.read = new_sync_read,
|
||||
.write = new_sync_write,
|
||||
# endif
|
||||
#elif defined(HAVE_LINUX_GENERIC_FILE_AIO_READ)
|
||||
.aio_read = afs_linux_aio_read,
|
||||
.aio_write = afs_linux_aio_write,
|
||||
|
Loading…
Reference in New Issue
Block a user