Lines Matching refs:ubi
26 void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) in ubi_do_get_device_info() argument
28 di->ubi_num = ubi->ubi_num; in ubi_do_get_device_info()
29 di->leb_size = ubi->leb_size; in ubi_do_get_device_info()
30 di->leb_start = ubi->leb_start; in ubi_do_get_device_info()
31 di->min_io_size = ubi->min_io_size; in ubi_do_get_device_info()
32 di->max_write_size = ubi->max_write_size; in ubi_do_get_device_info()
33 di->ro_mode = ubi->ro_mode; in ubi_do_get_device_info()
34 di->cdev = ubi->cdev.dev; in ubi_do_get_device_info()
48 struct ubi_device *ubi; in ubi_get_device_info() local
52 ubi = ubi_get_device(ubi_num); in ubi_get_device_info()
53 if (!ubi) in ubi_get_device_info()
55 ubi_do_get_device_info(ubi, di); in ubi_get_device_info()
56 ubi_put_device(ubi); in ubi_get_device_info()
67 void ubi_do_get_volume_info(struct ubi_device *ubi, struct ubi_volume *vol, in ubi_do_get_volume_info() argument
71 vi->ubi_num = ubi->ubi_num; in ubi_do_get_volume_info()
92 ubi_do_get_volume_info(desc->vol->ubi, desc->vol, vi); in ubi_get_volume_info()
118 struct ubi_device *ubi; in ubi_open_volume() local
133 ubi = ubi_get_device(ubi_num); in ubi_open_volume()
134 if (!ubi) in ubi_open_volume()
137 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) { in ubi_open_volume()
152 spin_lock(&ubi->volumes_lock); in ubi_open_volume()
153 vol = ubi->volumes[vol_id]; in ubi_open_volume()
186 spin_unlock(&ubi->volumes_lock); in ubi_open_volume()
191 mutex_lock(&ubi->ckvol_mutex); in ubi_open_volume()
194 err = ubi_check_volume(ubi, vol_id); in ubi_open_volume()
196 mutex_unlock(&ubi->ckvol_mutex); in ubi_open_volume()
201 ubi_warn(ubi, "volume %d on UBI device %d is corrupted", in ubi_open_volume()
202 vol_id, ubi->ubi_num); in ubi_open_volume()
207 mutex_unlock(&ubi->ckvol_mutex); in ubi_open_volume()
212 spin_unlock(&ubi->volumes_lock); in ubi_open_volume()
217 ubi_err(ubi, "cannot open device %d, volume %d, error %d", in ubi_open_volume()
219 ubi_put_device(ubi); in ubi_open_volume()
236 struct ubi_device *ubi; in ubi_open_volume_nm() local
251 ubi = ubi_get_device(ubi_num); in ubi_open_volume_nm()
252 if (!ubi) in ubi_open_volume_nm()
255 spin_lock(&ubi->volumes_lock); in ubi_open_volume_nm()
257 for (i = 0; i < ubi->vtbl_slots; i++) { in ubi_open_volume_nm()
258 struct ubi_volume *vol = ubi->volumes[i]; in ubi_open_volume_nm()
265 spin_unlock(&ubi->volumes_lock); in ubi_open_volume_nm()
276 ubi_put_device(ubi); in ubi_open_volume_nm()
328 struct ubi_device *ubi = vol->ubi; in ubi_close_volume() local
331 ubi->ubi_num, vol->vol_id, desc->mode); in ubi_close_volume()
333 spin_lock(&ubi->volumes_lock); in ubi_close_volume()
349 spin_unlock(&ubi->volumes_lock); in ubi_close_volume()
353 ubi_put_device(ubi); in ubi_close_volume()
372 struct ubi_device *ubi = vol->ubi; in leb_read_sanity_check() local
375 if (vol_id < 0 || vol_id >= ubi->vtbl_slots || lnum < 0 || in leb_read_sanity_check()
426 struct ubi_device *ubi = vol->ubi; in ubi_leb_read() local
438 err = ubi_eba_read_leb(ubi, vol, lnum, buf, offset, len, check); in ubi_leb_read()
440 ubi_warn(ubi, "mark volume %d as corrupted", vol_id); in ubi_leb_read()
466 struct ubi_device *ubi = vol->ubi; in ubi_leb_read_sg() local
478 err = ubi_eba_read_leb_sg(ubi, vol, sgl, lnum, offset, len, check); in ubi_leb_read_sg()
480 ubi_warn(ubi, "mark volume %d as corrupted", vol_id); in ubi_leb_read_sg()
517 struct ubi_device *ubi = vol->ubi; in ubi_leb_write() local
522 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) in ubi_leb_write()
530 offset & (ubi->min_io_size - 1) || len & (ubi->min_io_size - 1)) in ubi_leb_write()
539 return ubi_eba_write_leb(ubi, vol, lnum, buf, offset, len); in ubi_leb_write()
562 struct ubi_device *ubi = vol->ubi; in ubi_leb_change() local
567 if (vol_id < 0 || vol_id >= ubi->vtbl_slots) in ubi_leb_change()
574 len > vol->usable_leb_size || len & (ubi->min_io_size - 1)) in ubi_leb_change()
583 return ubi_eba_atomic_leb_change(ubi, vol, lnum, buf, len); in ubi_leb_change()
602 struct ubi_device *ubi = vol->ubi; in ubi_leb_erase() local
616 err = ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_erase()
620 return ubi_wl_flush(ubi, vol->vol_id, lnum); in ubi_leb_erase()
663 struct ubi_device *ubi = vol->ubi; in ubi_leb_unmap() local
676 return ubi_eba_unmap_leb(ubi, vol, lnum); in ubi_leb_unmap()
699 struct ubi_device *ubi = vol->ubi; in ubi_leb_map() local
715 return ubi_eba_write_leb(ubi, vol, lnum, NULL, 0, 0); in ubi_leb_map()
761 struct ubi_device *ubi; in ubi_sync() local
763 ubi = ubi_get_device(ubi_num); in ubi_sync()
764 if (!ubi) in ubi_sync()
767 mtd_sync(ubi->mtd); in ubi_sync()
768 ubi_put_device(ubi); in ubi_sync()
787 struct ubi_device *ubi; in ubi_flush() local
790 ubi = ubi_get_device(ubi_num); in ubi_flush()
791 if (!ubi) in ubi_flush()
794 err = ubi_wl_flush(ubi, vol_id, lnum); in ubi_flush()
795 ubi_put_device(ubi); in ubi_flush()