/** * \brief release tree buffers, call this function when unmount * \param[in] dev uffs device */ URET uffs_TreeRelease(uffs_Device *dev) { uffs_Pool *pool; pool = &(dev->mem.tree_pool); if (pool->mem && dev->mem.free) { dev->mem.free(dev, pool->mem); pool->mem = NULL; dev->mem.tree_nodes_pool_size = 0; } uffs_PoolRelease(pool); memset(pool, 0, sizeof(uffs_Pool)); return U_SUCC; }
/** * Release UFFS flash interface */ URET uffs_FlashInterfaceRelease(uffs_Device *dev) { uffs_Pool *pool; pool = SPOOL(dev); if (pool->mem && dev->mem.free) { dev->mem.free(dev, pool->mem); pool->mem = NULL; dev->mem.spare_pool_size = 0; } uffs_PoolRelease(pool); memset(pool, 0, sizeof(uffs_Pool)); // release flash driver if (dev->ops->ReleaseFlash) { if (dev->ops->ReleaseFlash(dev) < 0) return U_FAIL; } return U_SUCC; }
/** * Release uffs_DIR buffers, called by UFFS internal */ URET uffs_ReleaseDirEntryBuf(void) { return uffs_PoolRelease(&_dir_pool); }
/** * Release object buffers, called by UFFS internal */ URET uffs_ReleaseObjectBuf(void) { return uffs_PoolRelease(&_object_pool); }