int ObjectServer::createDir(ServerContext& s, const char *path, uint32_t mode) { string vfile; string epath = encodePath(s, path, vfile); return m_server->createDir(s, epath.c_str(), mode); }
int ObjectServer::wstat(ServerContext& s, const char *path, file_stat_t& fileStat, uint32_t mask) { string vfile; string epath = encodePath(s, path, vfile); if (!vfile.empty() || (mask & FS_SIZE) || (mask & FS_RENAME)) { // no wstat on vfiles, truncate and renames return -EACCES; } // TODO: add rename functionalit for object keys and containers return m_server->wstat(s, epath.c_str(), fileStat, mask); }
int ObjectServer::readDir(ServerContext& s, const char *dir, void *dirp, map<string,file_stat_t*>& files, bool& eof) { if (m_enable_readdir) { string vfile; string epath = encodePath(s, dir, vfile); return m_server->readDir(s, epath.c_str(), dirp, files, eof); } else { eof = true; return 0; } }
int ObjectServer::rstat(ServerContext& s, const char *path, file_stat_t& fileStat) { string vfile; string epath = encodePath(s, path, vfile); int status = m_server->rstat(s, epath.c_str(), fileStat); if (status >= 0 && !vfile.empty()) { string contents; if ((status = read(s, epath.c_str(), vfile.c_str(), contents)) > 0) { fileStat.fs_size = contents.length(); } } return status; }
void encodePath(QStringList & buffer) { for(auto & it : buffer) encodePath(it); }
void toString(const KviPixmap & pixmap, QString & szBuffer) { szBuffer = pixmap.path(); encodePath(szBuffer); }
int ObjectServer::openFile(ServerContext& s, const char *path, void **handle, const char *flags, int mode) { string vfile; string epath = encodePath(s, path, vfile); return m_server->openFile(s, epath.c_str(), handle, flags, mode); }
int ObjectServer::removeFile(ServerContext& s, const char *path) { string vfile; string epath = encodePath(s, path, vfile); return m_server->removeFile(s, epath.c_str()); }
string NameIO::encodePath(const string &plaintextPath) const { uint64_t iv = 0; return encodePath(plaintextPath, &iv); }