summaryrefslogtreecommitdiffhomepage
path: root/test/util
diff options
context:
space:
mode:
Diffstat (limited to 'test/util')
-rw-r--r--test/util/fuse_util.cc12
-rw-r--r--test/util/fuse_util.h5
2 files changed, 9 insertions, 8 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;
};
diff --git a/test/util/fuse_util.h b/test/util/fuse_util.h
index 6b5a8ce1f..544fe1b38 100644
--- a/test/util/fuse_util.h
+++ b/test/util/fuse_util.h
@@ -64,10 +64,11 @@ std::vector<struct iovec> FuseGenerateIovecs(T &first, Types &...args) {
}
// Create a fuse_attr filled with the specified mode and inode.
-fuse_attr DefaultFuseAttr(mode_t mode, uint64_t inode);
+fuse_attr DefaultFuseAttr(mode_t mode, uint64_t inode, uint64_t size = 512);
// Return a fuse_entry_out FUSE server response body.
-fuse_entry_out DefaultEntryOut(mode_t mode, uint64_t nodeId);
+fuse_entry_out DefaultEntryOut(mode_t mode, uint64_t node_id,
+ uint64_t size = 512);
} // namespace testing
} // namespace gvisor