Lines Matching refs:ubi
32 void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) in ubi_do_get_device_info() argument
34 di->ubi_num = ubi->ubi_num; in ubi_do_get_device_info()
35 di->leb_size = ubi->leb_size; in ubi_do_get_device_info()
36 di->leb_start = ubi->leb_start; in ubi_do_get_device_info()
37 di->min_io_size = ubi->min_io_size; in ubi_do_get_device_info()
38 di->max_write_size = ubi->max_write_size; in ubi_do_get_device_info()
39 di->ro_mode = ubi->ro_mode; in ubi_do_get_device_info()
41 di->cdev = ubi->cdev.dev; in ubi_do_get_device_info()
56 struct ubi_device *ubi; in ubi_get_device_info() local
60 ubi = ubi_get_device(ubi_num); in ubi_get_device_info()
61 if (!ubi) in ubi_get_device_info()
63 ubi_do_get_device_info(ubi, di); in ubi_get_device_info()
64 ubi_put_device(ubi); in ubi_get_device_info()
75 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol, in ubi_do_get_volume_info() argument
79 vi->ubi_num = ubi->ubi_num; in ubi_do_get_volume_info()
100 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi); in ubi_get_volume_info()
126 struct ubi_device *ubi; in ubi_open_volume() local
141 ubi = ubi_get_device(ubi_num); in ubi_open_volume()
142 if (!ubi) in ubi_open_volume()
145 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) { in ubi_open_volume()
160 spin_lock(&ubi->volumes_lock); in ubi_open_volume()
161 vol = ubi->volumes[vol_id]; in ubi_open_volume()
194 spin_unlock(&ubi->volumes_lock); in ubi_open_volume()
199 mutex_lock(&ubi->ckvol_mutex); in ubi_open_volume()
202 err = ubi_check_volume(ubi, vol_id); in ubi_open_volume()
204 mutex_unlock(&ubi->ckvol_mutex); in ubi_open_volume()
209 ubi_warn(ubi, "volume %d on UBI device %d is corrupted", in ubi_open_volume()
210 vol_id, ubi->ubi_num); in ubi_open_volume()
215 mutex_unlock(&ubi->ckvol_mutex); in ubi_open_volume()
220 spin_unlock(&ubi->volumes_lock); in ubi_open_volume()
225 ubi_put_device(ubi); in ubi_open_volume()
226 ubi_err(ubi, "cannot open device %d, volume %d, error %d", in ubi_open_volume()
244 struct ubi_device *ubi; in ubi_open_volume_nm() local
259 ubi = ubi_get_device(ubi_num); in ubi_open_volume_nm()
260 if (!ubi) in ubi_open_volume_nm()
263 spin_lock(&ubi->volumes_lock); in ubi_open_volume_nm()
265 for (i = 0; i < ubi->vtbl_slots; i++) { in ubi_open_volume_nm()
266 struct ubi_volume *vol = ubi->volumes[i]; in ubi_open_volume_nm()
273 spin_unlock(&ubi->volumes_lock); in ubi_open_volume_nm()
284 ubi_put_device(ubi); in ubi_open_volume_nm()
335 struct ubi_device *ubi = vol->ubi; in ubi_close_volume() local
338 ubi->ubi_num, vol->vol_id, desc->mode); in ubi_close_volume()
340 spin_lock(&ubi->volumes_lock); in ubi_close_volume()
356 spin_unlock(&ubi->volumes_lock); in ubi_close_volume()
360 ubi_put_device(ubi); in ubi_close_volume()
379 struct ubi_device *ubi = vol->ubi; in leb_read_sanity_check() local
382 if (vol_id < 0 || vol_id >= ubi->vtbl_slots || lnum < 0 || in leb_read_sanity_check()
433 struct ubi_device *ubi = vol->ubi; in ubi_leb_read() local
445 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read()
447 ubi_warn(ubi, "mark volume %d as corrupted", vol_id); in ubi_leb_read()
473 struct ubi_device *ubi = vol->ubi; in ubi_leb_read_sg() local
485 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); in ubi_leb_read_sg()
487 ubi_warn(ubi, "mark volume %d as corrupted", vol_id); in ubi_leb_read_sg()
525 struct ubi_device *ubi = vol->ubi; in ubi_leb_write() local
530 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) in ubi_leb_write()
538 offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1)) in ubi_leb_write()
547 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); in ubi_leb_write()
570 struct ubi_device *ubi = vol->ubi; in ubi_leb_change() local
575 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) in ubi_leb_change()
582 len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) in ubi_leb_change()
591 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); in ubi_leb_change()
610 struct ubi_device *ubi = vol->ubi; in ubi_leb_erase() local
624 err = ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_erase()
628 return ubi_wl_flush(ubi, vol->vol_id, lnum); in ubi_leb_erase()
671 struct ubi_device *ubi = vol->ubi; in ubi_leb_unmap() local
684 return ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_unmap()
707 struct ubi_device *ubi = vol->ubi; in ubi_leb_map() local
723 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); in ubi_leb_map()
769 struct ubi_device *ubi; in ubi_sync() local
771 ubi = ubi_get_device(ubi_num); in ubi_sync()
772 if (!ubi) in ubi_sync()
775 mtd_sync(ubi->mtd); in ubi_sync()
776 ubi_put_device(ubi); in ubi_sync()
795 struct ubi_device *ubi; in ubi_flush() local
798 ubi = ubi_get_device(ubi_num); in ubi_flush()
799 if (!ubi) in ubi_flush()
802 err = ubi_wl_flush(ubi, vol_id, lnum); in ubi_flush()
803 ubi_put_device(ubi); in ubi_flush()