summaryrefslogtreecommitdiffhomepage
path: root/test/util/fuse_util.cc
diff options
context:
space:
mode:
authorCraig Chi <craigchi@google.com>2020-09-09 09:16:09 -0700
committerAndrei Vagin <avagin@gmail.com>2020-09-16 12:19:30 -0700
commit4181e8c97482a3c787c2b508e6d75a21323ba515 (patch)
tree70df02d5b3c1cb621210559b2ba82ce62330ac01 /test/util/fuse_util.cc
parent1146ab6bac7c4d34a9b78a6c318db3dae8150b4d (diff)
Add fh support for revise attr and fstat(2) test
According to Linux 4.4's FUSE behavior, the flags and fh attributes in FUSE_GETATTR are only used in read, write, and lseek. fstat(2) doesn't use them either. Add tests to ensure the requests sent from FUSE module are consistent with Linux's. Updates #3655
Diffstat (limited to 'test/util/fuse_util.cc')
-rw-r--r--test/util/fuse_util.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/util/fuse_util.cc b/test/util/fuse_util.cc
index 4db053335..595d0cebf 100644
--- a/test/util/fuse_util.cc
+++ b/test/util/fuse_util.cc
@@ -22,13 +22,13 @@
namespace gvisor {
namespace testing {
-// Create a default FuseAttr struct with specified mode and inode.
-fuse_attr DefaultFuseAttr(mode_t mode, uint64_t inode) {
+// Create a default FuseAttr struct with specified mode, inode, and size.
+fuse_attr DefaultFuseAttr(mode_t mode, uint64_t inode, uint64_t size) {
const int time_sec = 1595436289;
const int time_nsec = 134150844;
return (struct fuse_attr){
.ino = inode,
- .size = 512,
+ .size = size,
.blocks = 4,
.atime = time_sec,
.mtime = time_sec,
@@ -45,8 +45,8 @@ fuse_attr DefaultFuseAttr(mode_t mode, uint64_t inode) {
};
}
-// Create response body with specified mode and nodeID.
-fuse_entry_out DefaultEntryOut(mode_t mode, uint64_t node_id) {
+// Create response body with specified mode, nodeID, and size.
+fuse_entry_out DefaultEntryOut(mode_t mode, uint64_t node_id, uint64_t size) {
struct fuse_entry_out default_entry_out = {
.nodeid = node_id,
.generation = 0,
@@ -54,7 +54,7 @@ fuse_entry_out DefaultEntryOut(mode_t mode, uint64_t node_id) {
.attr_valid = 0,
.entry_valid_nsec = 0,
.attr_valid_nsec = 0,
- .attr = DefaultFuseAttr(mode, node_id),
+ .attr = DefaultFuseAttr(mode, node_id, size),
};
return default_entry_out;
};