From 282df21a49f9ab324ba1a95fe85f157afa74583e Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sat, 22 Jul 2017 12:40:28 +0200 Subject: [PATCH] DirNode: add a few comments ...to make the code easier to understand. No code changes! --- encfs/DirNode.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/encfs/DirNode.cpp b/encfs/DirNode.cpp index 3612d6d..ad9a6e7 100644 --- a/encfs/DirNode.cpp +++ b/encfs/DirNode.cpp @@ -630,9 +630,17 @@ std::shared_ptr DirNode::renameNode(const char *from, const char *to, return node; } + +// findOrCreate checks if we already have a FileNode for "plainName" and +// creates a new one if we don't. Returns the FileNode. std::shared_ptr DirNode::findOrCreate(const char *plainName) { std::shared_ptr node; - if (ctx) node = ctx->lookupNode(plainName); + + // See if we already have a FileNode for this path. + if (ctx) + node = ctx->lookupNode(plainName); + + // If we don't, create a new one. if (!node) { uint64_t iv = 0; string cipherName = naming->encodePath(plainName, &iv); @@ -655,9 +663,11 @@ shared_ptr DirNode::lookupNode(const char *plainName, /* Similar to lookupNode, except that we also call open() and only return a - node on sucess.. This is done in one step to avoid any race conditions + node on sucess. This is done in one step to avoid any race conditions with the stored state of the file. -*/ std::shared_ptr DirNode::openNode(const char *plainName, + "result" is set to -1 on failure, a value >= 0 on success. +*/ +std::shared_ptr DirNode::openNode(const char *plainName, const char *requestor, int flags, int *result) { (void)requestor;