DirNode: add a few comments

...to make the code easier to understand.

No code changes!
This commit is contained in:
Jakob Unterwurzacher 2017-07-22 12:40:28 +02:00
parent 30000d8e2c
commit 282df21a49

View File

@ -630,9 +630,17 @@ std::shared_ptr<FileNode> DirNode::renameNode(const char *from, const char *to,
return node; 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<FileNode> DirNode::findOrCreate(const char *plainName) { std::shared_ptr<FileNode> DirNode::findOrCreate(const char *plainName) {
std::shared_ptr<FileNode> node; std::shared_ptr<FileNode> 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) { if (!node) {
uint64_t iv = 0; uint64_t iv = 0;
string cipherName = naming->encodePath(plainName, &iv); string cipherName = naming->encodePath(plainName, &iv);
@ -655,9 +663,11 @@ shared_ptr<FileNode> DirNode::lookupNode(const char *plainName,
/* /*
Similar to lookupNode, except that we also call open() and only return a 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. with the stored state of the file.
*/ std::shared_ptr<FileNode> DirNode::openNode(const char *plainName, "result" is set to -1 on failure, a value >= 0 on success.
*/
std::shared_ptr<FileNode> DirNode::openNode(const char *plainName,
const char *requestor, int flags, const char *requestor, int flags,
int *result) { int *result) {
(void)requestor; (void)requestor;