def rm(self, p_inode, name): f = BDFile.get_from_inode_name(p_inode, name) if not f: return self.__rm_with_path(f.path) BDFile.clear_f_cache(p_inode, f) rdx = f.path.rindex('/') path = '/' if rdx == 0 else f.path[:rdx] self.dir_cache(path, p_inode, force=True)
def mv(self, p_inode_old, name_old, p_inode_new, name_new): old_f = BDFile.get_from_inode_name(p_inode_old, name_old) new_path = '/' if p_inode_new == 1: self.__mv_with_path(old_f.path, new_path, name_new) else: new_f = BDFile.get_from_fs_id(p_inode_new) if new_f is not None: new_path = new_f.path self.__mv_with_path(old_f.path, new_path, name_new) BDFile.clear_f_cache(p_inode_new, new_f) BDFile.clear_f_cache(p_inode_old, old_f) rdx = old_f.path.rindex('/') path = '/' if rdx == 0 else old_f.path[:rdx] self.dir_cache(path, p_inode_old, force=True) self.dir_cache(new_path, p_inode_new, force=True)
def rename(self, p_inode_old, name_old, name_new): f = BDFile.get_from_inode_name(p_inode_old, name_old) path = '/' if p_inode_old == 1 else f.path + '/' self.__rename(path + name_old, name_new) BDFile.clear_f_cache(p_inode_old, f) self.dir_cache(path, p_inode_old, force=True)