static int farm_format(struct siocb *iocb) { char path[PATH_MAX]; unsigned ret; const uint8_t name[] = "farm"; dprintf("try get a clean store\n"); snprintf(path, sizeof(path), "%s", obj_path); ret = rmdir_r(path); if (ret && ret != -ENOENT) { eprintf("failed to remove %s: %s\n", path, strerror(-ret)); return SD_RES_EIO; } if (mkdir(path, def_dmode) < 0) { eprintf("%m\n"); return SD_RES_EIO; } if (set_cluster_store(name) < 0) return SD_RES_EIO; trunk_reset(); return SD_RES_SUCCESS; }
static int farm_purge_obj(void) { if (cleanup_working_dir() < 0) return SD_RES_EIO; trunk_reset(); return SD_RES_SUCCESS; }
CALLSET_ENTRY (trunk_drv, init_complete) { trunk_reset (); }