Lines Matching refs:ubi
31 void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) in ubi_do_get_device_info() argument
33 di->ubi_num = ubi->ubi_num; in ubi_do_get_device_info()
34 di->leb_size = ubi->leb_size; in ubi_do_get_device_info()
35 di->leb_start = ubi->leb_start; in ubi_do_get_device_info()
36 di->min_io_size = ubi->min_io_size; in ubi_do_get_device_info()
37 di->max_write_size = ubi->max_write_size; in ubi_do_get_device_info()
38 di->ro_mode = ubi->ro_mode; in ubi_do_get_device_info()
40 di->cdev = ubi->cdev.dev; in ubi_do_get_device_info()
55 struct ubi_device *ubi; in ubi_get_device_info() local
59 ubi = ubi_get_device(ubi_num); in ubi_get_device_info()
60 if (!ubi) in ubi_get_device_info()
62 ubi_do_get_device_info(ubi, di); in ubi_get_device_info()
63 ubi_put_device(ubi); in ubi_get_device_info()
74 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol, in ubi_do_get_volume_info() argument
78 vi->ubi_num = ubi->ubi_num; in ubi_do_get_volume_info()
99 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi); in ubi_get_volume_info()
125 struct ubi_device *ubi; in ubi_open_volume() local
140 ubi = ubi_get_device(ubi_num); in ubi_open_volume()
141 if (!ubi) in ubi_open_volume()
144 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) { in ubi_open_volume()
159 spin_lock(&ubi->volumes_lock); in ubi_open_volume()
160 vol = ubi->volumes[vol_id]; in ubi_open_volume()
193 spin_unlock(&ubi->volumes_lock); in ubi_open_volume()
198 mutex_lock(&ubi->ckvol_mutex); in ubi_open_volume()
201 err = ubi_check_volume(ubi, vol_id); in ubi_open_volume()
203 mutex_unlock(&ubi->ckvol_mutex); in ubi_open_volume()
208 ubi_warn(ubi, "volume %d on UBI device %d is corrupted", in ubi_open_volume()
209 vol_id, ubi->ubi_num); in ubi_open_volume()
214 mutex_unlock(&ubi->ckvol_mutex); in ubi_open_volume()
219 spin_unlock(&ubi->volumes_lock); in ubi_open_volume()
224 ubi_put_device(ubi); in ubi_open_volume()
225 ubi_err(ubi, "cannot open device %d, volume %d, error %d", in ubi_open_volume()
243 struct ubi_device *ubi; in ubi_open_volume_nm() local
258 ubi = ubi_get_device(ubi_num); in ubi_open_volume_nm()
259 if (!ubi) in ubi_open_volume_nm()
262 spin_lock(&ubi->volumes_lock); in ubi_open_volume_nm()
264 for (i = 0; i < ubi->vtbl_slots; i++) { in ubi_open_volume_nm()
265 struct ubi_volume *vol = ubi->volumes[i]; in ubi_open_volume_nm()
272 spin_unlock(&ubi->volumes_lock); in ubi_open_volume_nm()
283 ubi_put_device(ubi); in ubi_open_volume_nm()
334 struct ubi_device *ubi = vol->ubi; in ubi_close_volume() local
337 ubi->ubi_num, vol->vol_id, desc->mode); in ubi_close_volume()
339 spin_lock(&ubi->volumes_lock); in ubi_close_volume()
355 spin_unlock(&ubi->volumes_lock); in ubi_close_volume()
359 ubi_put_device(ubi); in ubi_close_volume()
378 struct ubi_device *ubi = vol->ubi; in leb_read_sanity_check() local
381 if (vol_id < 0 || vol_id >= ubi->vtbl_slots || lnum < 0 || in leb_read_sanity_check()
432 struct ubi_device *ubi = vol->ubi; in ubi_leb_read() local
444 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read()
446 ubi_warn(ubi, "mark volume %d as corrupted", vol_id); in ubi_leb_read()
472 struct ubi_device *ubi = vol->ubi; in ubi_leb_read_sg() local
484 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); in ubi_leb_read_sg()
486 ubi_warn(ubi, "mark volume %d as corrupted", vol_id); in ubi_leb_read_sg()
524 struct ubi_device *ubi = vol->ubi; in ubi_leb_write() local
529 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) in ubi_leb_write()
537 offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1)) in ubi_leb_write()
546 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); in ubi_leb_write()
569 struct ubi_device *ubi = vol->ubi; in ubi_leb_change() local
574 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) in ubi_leb_change()
581 len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) in ubi_leb_change()
590 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); in ubi_leb_change()
609 struct ubi_device *ubi = vol->ubi; in ubi_leb_erase() local
623 err = ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_erase()
627 return ubi_wl_flush(ubi, vol->vol_id, lnum); in ubi_leb_erase()
670 struct ubi_device *ubi = vol->ubi; in ubi_leb_unmap() local
683 return ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_unmap()
706 struct ubi_device *ubi = vol->ubi; in ubi_leb_map() local
722 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); in ubi_leb_map()
768 struct ubi_device *ubi; in ubi_sync() local
770 ubi = ubi_get_device(ubi_num); in ubi_sync()
771 if (!ubi) in ubi_sync()
774 mtd_sync(ubi->mtd); in ubi_sync()
775 ubi_put_device(ubi); in ubi_sync()
794 struct ubi_device *ubi; in ubi_flush() local
797 ubi = ubi_get_device(ubi_num); in ubi_flush()
798 if (!ubi) in ubi_flush()
801 err = ubi_wl_flush(ubi, vol_id, lnum); in ubi_flush()
802 ubi_put_device(ubi); in ubi_flush()