added kernel version check for calling kernel_read vs vfs_read

added kernel version check for calling kernel_read vs vfs_read, as suggested here:
55d5699429
This commit is contained in:
Sarang S. Dalal 2018-01-23 00:18:18 +01:00 • committed by GitHub
commit 0af5a76743
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -313,7 +313,11 @@ static ssize_t ashmem_read(struct file *file, char __user *buf,
* be destroyed until all references to the file are dropped and
* ashmem_release is called.
*/
ret = kernel_read(asma->file, buf, len, pos);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)
ret = __vfs_read(asma->file, buf, len, pos);
#else
ret = kernel_read(asma->file, buf, len, pos);
#endif
if (ret >= 0)
/** Update backing file pos, since f_ops->read() doesn't */
asma->file->f_pos = *pos;