pf_stat CacheBase::GetAttr(std::string path) { BlockLockMutex lock(this); FileEntry* file = Path2File(path); if(!file) throw NoSuchFileOrDir(); return file->GetAttr(); }
void CacheBase::ChMod(std::string path, mode_t mode) { BlockLockMutex lock(this); FileEntry* file = Path2File(path); if(!file) throw NoSuchFileOrDir(); pf_stat stat = file->GetAttr(); stat.mode = mode; stat.meta_mtime = time(NULL); SetAttr(path, stat); }
void CacheBase::ChOwn(std::string path, uid_t uid, gid_t gid) { BlockLockMutex lock(this); FileEntry* file = Path2File(path); if(!file) throw NoSuchFileOrDir(); pf_stat stat = file->GetAttr(); stat.uid = uid; stat.gid = gid; stat.meta_mtime = time(NULL); SetAttr(path, stat); }