summaryrefslogtreecommitdiff
path: root/android-mainline/ANDROID-fs-Move-iocb_to_rw_flags-to-fuse-passthrough.patch
blob: 61c4d317262f908468c8cb6ff49603222308edbc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alessio Balsini <balsini@google.com>
Date: Fri, 5 Jan 2024 14:14:18 +0000
Subject: ANDROID: fs: Move iocb_to_rw_flags to fuse/passthrough

Fixup build error in aosp/2896080 by migrating iocb_to_rw_flags() to
FUSE passthrough, which depends on it.
To avoid possible name overlapping, the "fuse_" prefix is added to the
function name.

This change is meant to be a fixup for aosp/2896080.

Test: build
Bug: 168023149
Change-Id: I7696d22a0671cbd457084a17be4e7315109819a3
Signed-off-by: Alessio Balsini <balsini@google.com>
---
 fs/fuse/passthrough.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c
--- a/fs/fuse/passthrough.c
+++ b/fs/fuse/passthrough.c
@@ -15,6 +15,11 @@ struct fuse_aio_req {
 	struct kiocb *iocb_fuse;
 };
 
+static inline rwf_t fuse_iocb_to_rw_flags(int ifl, int iocb_mask)
+{
+	return ifl & iocb_mask;
+}
+
 static void fuse_file_accessed(struct file *dst_file, struct file *src_file)
 {
 	struct inode *dst_inode;
@@ -95,9 +100,10 @@ ssize_t fuse_passthrough_read_iter(struct kiocb *iocb_fuse,
 
 	old_cred = override_creds(ff->passthrough.cred);
 	if (is_sync_kiocb(iocb_fuse)) {
-		ret = vfs_iter_read(passthrough_filp, iter, &iocb_fuse->ki_pos,
-				    iocb_to_rw_flags(iocb_fuse->ki_flags,
-						     PASSTHROUGH_IOCB_MASK));
+		ret = vfs_iter_read(
+			passthrough_filp, iter, &iocb_fuse->ki_pos,
+			fuse_iocb_to_rw_flags(iocb_fuse->ki_flags,
+					      PASSTHROUGH_IOCB_MASK));
 	} else {
 		struct fuse_aio_req *aio_req;
 
@@ -139,9 +145,10 @@ ssize_t fuse_passthrough_write_iter(struct kiocb *iocb_fuse,
 	old_cred = override_creds(ff->passthrough.cred);
 	if (is_sync_kiocb(iocb_fuse)) {
 		file_start_write(passthrough_filp);
-		ret = vfs_iter_write(passthrough_filp, iter, &iocb_fuse->ki_pos,
-				     iocb_to_rw_flags(iocb_fuse->ki_flags,
-						      PASSTHROUGH_IOCB_MASK));
+		ret = vfs_iter_write(
+			passthrough_filp, iter, &iocb_fuse->ki_pos,
+			fuse_iocb_to_rw_flags(iocb_fuse->ki_flags,
+					      PASSTHROUGH_IOCB_MASK));
 		file_end_write(passthrough_filp);
 		if (ret > 0)
 			fuse_copyattr(fuse_filp, passthrough_filp);