Beispiel #1
0
int OssFS::del_file(const char *path) 
{
	if (strcmp(path, "/") == 0) 
	{
		return -ENOENT;
	} 

	OssObject *obj = find_certain_path(path);
	if (obj == NULL)
	{
		return -ENOENT;
	}
	
	//先删除OSS对象
	obj->delete_oss_object();

	//删除meta_db中的记录
	string tmpPath = obj->get_path_name();
	cloudfs_sqlite_remove_file_meta(tmpPath);

	//删除父目录中的记录
	OssDirObject *parent_dir = (OssDirObject *)get_parent(path);
	if (parent_dir != NULL)
	{		
		parent_dir->remove_record(obj->get_file_name());
	}

	return 0;

}