Lines Matching refs:path
86 static uint64_t PathHash(const std::string &path, bool caseSense)
89 const char *kp = path.c_str();
102 static std::string GetDentryfileName(const std::string &path, bool caseSense)
104 // path should be like "/", "/dir/", "/dir/dir/" ...
107 uint64_t fileHash = PathHash(path, caseSense);
115 static std::string GetDentryfileByPath(uint32_t userId, const std::string &path, bool caseSense = false)
119 std::string dentryFileName = GetDentryfileName(path, caseSense);
124 std::string MetaFile::GetParentDir(const std::string &path)
126 if ((path == "/") || (path == "")) {
130 auto pos = path.find_last_of('/');
135 return path.substr(0, pos);
138 std::string MetaFile::GetFileName(const std::string &path)
140 if ((path == "/") || (path == "")) {
144 auto pos = path.find_last_of('/');
149 return path.substr(pos + 1);
152 static std::shared_ptr<MetaFile> GetParentMetaFile(uint32_t userId, const std::string &path)
154 std::string parentPath = MetaFile::GetParentDir(path);
162 MetaFile::MetaFile(uint32_t userId, const std::string &path)
164 path_ = path;
165 cacheFile_ = GetDentryfileByPath(userId, path);
172 int ret = fsetxattr(fd_, "user.hmdfs_cache", path.c_str(), path.size(), 0);
178 parentMetaFile_ = GetParentMetaFile(userId, path);
179 std::string dirName = GetFileName(path);
183 MetaBase m(dirName, std::to_string(PathHash(path, false)) + std::to_string(std::time(nullptr)));
673 std::shared_ptr<MetaFile> MetaFileMgr::GetMetaFile(uint32_t userId, const std::string &path)
678 MetaFileKey key(userId, path);
689 mFile = std::make_shared<MetaFile>(userId, path);