static int farm_restore(const struct siocb *iocb) { int ret = SD_RES_EIO, epoch = iocb->epoch; sd_dprintf("try recover user epoch %d", epoch); /* Remove all the objects of WD and object cache */ for_each_object_in_wd(rm_object, true, NULL); if (sys->enable_object_cache) object_cache_format(); ret = restore_objects_from_snap(epoch); if (ret != SD_RES_SUCCESS) goto out; out: return ret; }
int default_format(void) { unsigned ret; sd_dprintf("try get a clean store\n"); ret = rmdir_r(obj_path); if (ret && ret != -ENOENT) { sd_eprintf("failed to remove %s: %s\n", obj_path, strerror(-ret)); return SD_RES_EIO; } if (mkdir(obj_path, def_dmode) < 0) { sd_eprintf("%m\n"); return SD_RES_EIO; } if (is_object_cache_enabled()) object_cache_format(); return SD_RES_SUCCESS; }