summaryrefslogtreecommitdiff
path: root/jni/node_test.cpp
diff options
context:
space:
mode:
author Zim <zezeozue@google.com> 2021-01-15 10:36:17 +0000
committer Zim <zezeozue@google.com> 2021-01-18 13:08:46 +0000
commitded1ab908733dc7ab0ac62ba76be453916b3f59b (patch)
treee2e897fe95908cbb373e88fb8d58088076dd7891 /jni/node_test.cpp
parenta53174b0eafd4ca391dae7368858633d528a0543 (diff)
Add fields to FileLookupResult and improve node invalidation logic
1. transforms_supported field replaces the FLAG_TRANSFORM_SUPPORTED flag that was added to the transforms field to indicate that transforms are supported on an inode but the node itself might not need any transforms. This allows the FUSE daemon to avoid caching that node for *any* uid. Extracting this flag is a cleaner design. 2. uid field represents the original uid requesting IO. This is useful when the MediaProvider does a FUSE open on behalf of another app and we need to know the original uid in the FUSE daemon. This change just adds the field, the logic for the original uid will be added in later cl. 3. Refactored the logic to decide if a node should be invalidated in the VFS dentry cache. Now the node itself contains that information as a combination of case-insensitivity and transforms_supported signals Bug: 174655855 Test: presubmit Change-Id: I3a1b3f5e239289f8d972642e00ec66e6908894bd
Diffstat (limited to 'jni/node_test.cpp')
-rw-r--r--jni/node_test.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/jni/node_test.cpp b/jni/node_test.cpp
index 8c3406e3c..6496f8084 100644
--- a/jni/node_test.cpp
+++ b/jni/node_test.cpp
@@ -32,8 +32,9 @@ class NodeTest : public ::testing::Test {
typedef std::unique_ptr<node, decltype(&NodeTest::destroy)> unique_node_ptr;
unique_node_ptr CreateNode(node* parent, const std::string& path, const int transforms = 0) {
- return unique_node_ptr(node::Create(parent, path, "", true, transforms, &lock_, &tracker_),
- &NodeTest::destroy);
+ return unique_node_ptr(
+ node::Create(parent, path, "", true, true, transforms, &lock_, &tracker_),
+ &NodeTest::destroy);
}
static class node* ForChild(class node* node, const std::string& name,
@@ -67,7 +68,7 @@ TEST_F(NodeTest, TestCreate_withParent) {
}
TEST_F(NodeTest, TestRelease) {
- node* node = node::Create(nullptr, "/path", "", true, 0, &lock_, &tracker_);
+ node* node = node::Create(nullptr, "/path", "", false, true, 0, &lock_, &tracker_);
acquire(node);
acquire(node);
ASSERT_EQ(3, GetRefCount(node));
@@ -277,10 +278,10 @@ TEST_F(NodeTest, DeleteTree) {
unique_node_ptr parent = CreateNode(nullptr, "/path");
// This is the tree that we intend to delete.
- node* child = node::Create(parent.get(), "subdir", "", true, 0, &lock_, &tracker_);
- node::Create(child, "s1", "", true, 0, &lock_, &tracker_);
- node* subchild2 = node::Create(child, "s2", "", true, 0, &lock_, &tracker_);
- node::Create(subchild2, "sc2", "", true, 0, &lock_, &tracker_);
+ node* child = node::Create(parent.get(), "subdir", "", false, true, 0, &lock_, &tracker_);
+ node::Create(child, "s1", "", false, true, 0, &lock_, &tracker_);
+ node* subchild2 = node::Create(child, "s2", "", false, true, 0, &lock_, &tracker_);
+ node::Create(subchild2, "sc2", "", false, true, 0, &lock_, &tracker_);
ASSERT_EQ(child, parent->LookupChildByName("subdir", false /* acquire */));
node::DeleteTree(child);