[Virtio-fs] [PATCH 2/4] virtiofsd: Use macros for write_flag parsing

Vivek Goyal vgoyal at redhat.com
Tue Aug 13 19:29:42 UTC 2019


Use macros instead of hard coded bit positions.

Signed-off-by: Vivek Goyal <vgoyal at redhat.com>
---
 contrib/virtiofsd/fuse_lowlevel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/virtiofsd/fuse_lowlevel.c b/contrib/virtiofsd/fuse_lowlevel.c
index 8d3f141d23..417f99e8dc 100644
--- a/contrib/virtiofsd/fuse_lowlevel.c
+++ b/contrib/virtiofsd/fuse_lowlevel.c
@@ -1161,7 +1161,7 @@ static void do_write(fuse_req_t req, fuse_ino_t nodeid,
 
 	memset(&fi, 0, sizeof(fi));
 	fi.fh = arg->fh;
-	fi.writepage = (arg->write_flags & 1) != 0;
+	fi.writepage = (arg->write_flags & FUSE_WRITE_CACHE) != 0;
 
 	if (!compat) {
 		fi.lock_owner = arg->lock_owner;
@@ -1208,7 +1208,7 @@ static void do_write_buf(fuse_req_t req, fuse_ino_t nodeid,
 	}
 
 	fi.fh = arg->fh;
-	fi.writepage = arg->write_flags & 1;
+	fi.writepage = !!(arg->write_flags & FUSE_WRITE_CACHE);
 
         if (ibufv->count == 1) {
 		assert(!(tmpbufv.buf[0].flags & FUSE_BUF_IS_FD));
-- 
2.17.2




More information about the Virtio-fs mailing list