/* This function re-names or removes volumes specified in the re-name list. Returns zero in case of success and a negative error code in case of failure.  */
int ubi_rename_volumes(struct ubi_device *ubi, struct list_head *rename_list)
/* This function re-names or removes volumes specified in the re-name list. Returns zero in case of success and a negative error code in case of failure.  */
int ubi_rename_volumes(struct ubi_device *ubi, struct list_head *rename_list)
{
	int err;
	struct ubi_rename_entry *re;
	err = ubi_vtbl_rename_volumes(ubi, rename_list);
	if (err)
		return err;
	list_for_each_entry(re, rename_list, list) {
		if (re->remove) {
			err = ubi_remove_volume(re->desc, 1);
			if (err)
				break;
		} else {
			struct ubi_volume *vol = re->desc->vol;
			spin_lock(&ubi->volumes_lock);
			vol->name_len = re->new_name_len;
			memcpy(vol->name, re->new_name, re->new_name_len + 1);
			spin_unlock(&ubi->volumes_lock);
			ubi_volume_notify(ubi, vol, UBI_VOLUME_RENAMED);
		}
	}
	if (!err)
		self_check_volumes(ubi);
	return err;
}