Const correctness handle / RedactionInfo.
Helps us CHECK that they're always constructed with valid
RedactionInfo etc.
Test: atest FuseDaemonHostTest
Test: atest fuse_node_test
Bug: 147274248
Change-Id: I2cc369574d14136521201b4c8b99fe22e7ec0463
diff --git a/jni/node-inl.h b/jni/node-inl.h
index 5db1413..487583c 100644
--- a/jni/node-inl.h
+++ b/jni/node-inl.h
@@ -34,17 +34,21 @@
namespace fuse {
struct handle {
- explicit handle(const std::string& path) : path(path), fd(-1), ri(nullptr), cached(true){};
+ explicit handle(const std::string& path, int fd, const RedactionInfo* ri, bool cached)
+ : path(path), fd(fd), ri(ri), cached(cached) {
+ CHECK(ri != nullptr);
+ }
+
const std::string path;
- int fd;
- std::unique_ptr<RedactionInfo> ri;
- bool cached;
+ const int fd;
+ const std::unique_ptr<const RedactionInfo> ri;
+ const bool cached;
~handle() { close(fd); }
};
struct dirhandle {
- explicit dirhandle(DIR* dir) : d(dir), next_off(0){};
+ explicit dirhandle(DIR* dir) : d(dir), next_off(0) { CHECK(dir != nullptr); }
DIR* const d;
off_t next_off;