/* This function is called every time an UBI volume is updated. It does nothing if te volume @vol is dynamic, and changes MTD device size if the volume is static. This is needed because static volumes cannot be read past data they contain. This function returns zero in case of success and a negative error code in case of error.  */
static int gluebi_updated(struct ubi_volume_info *vi)
/* This function is called every time an UBI volume is updated. It does nothing if te volume @vol is dynamic, and changes MTD device size if the volume is static. This is needed because static volumes cannot be read past data they contain. This function returns zero in case of success and a negative error code in case of error.  */
static int gluebi_updated(struct ubi_volume_info *vi)
{
	struct gluebi_device *gluebi;
	mutex_lock(&devices_mutex);
	gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
	if (!gluebi) {
		mutex_unlock(&devices_mutex);
		err_msg("got update notification for unknown UBI device %d "
			"volume %d", vi->ubi_num, vi->vol_id);
		return -ENOENT;
	}
	if (vi->vol_type == UBI_STATIC_VOLUME)
		gluebi->mtd.size = vi->used_bytes;
	mutex_unlock(&devices_mutex);
	return 0;
}