Lines Matching refs:gluebi

68 	struct gluebi_device *gluebi;  in find_gluebi_nolock()  local
70 list_for_each_entry(gluebi, &gluebi_devices, list) in find_gluebi_nolock()
71 if (gluebi->ubi_num == ubi_num && gluebi->vol_id == vol_id) in find_gluebi_nolock()
72 return gluebi; in find_gluebi_nolock()
86 struct gluebi_device *gluebi; in gluebi_get_device() local
92 gluebi = container_of(mtd, struct gluebi_device, mtd); in gluebi_get_device()
94 if (gluebi->refcnt > 0) { in gluebi_get_device()
103 gluebi->refcnt += 1; in gluebi_get_device()
112 gluebi->desc = ubi_open_volume(gluebi->ubi_num, gluebi->vol_id, in gluebi_get_device()
114 if (IS_ERR(gluebi->desc)) { in gluebi_get_device()
116 return PTR_ERR(gluebi->desc); in gluebi_get_device()
118 gluebi->refcnt += 1; in gluebi_get_device()
132 struct gluebi_device *gluebi; in gluebi_put_device() local
134 gluebi = container_of(mtd, struct gluebi_device, mtd); in gluebi_put_device()
136 gluebi->refcnt -= 1; in gluebi_put_device()
137 if (gluebi->refcnt == 0) in gluebi_put_device()
138 ubi_close_volume(gluebi->desc); in gluebi_put_device()
157 struct gluebi_device *gluebi; in gluebi_read() local
159 gluebi = container_of(mtd, struct gluebi_device, mtd); in gluebi_read()
168 err = ubi_read(gluebi->desc, lnum, buf, offs, to_read); in gluebi_read()
197 struct gluebi_device *gluebi; in gluebi_write() local
199 gluebi = container_of(mtd, struct gluebi_device, mtd); in gluebi_write()
212 err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write); in gluebi_write()
237 struct gluebi_device *gluebi; in gluebi_erase() local
244 gluebi = container_of(mtd, struct gluebi_device, mtd); in gluebi_erase()
247 err = ubi_leb_unmap(gluebi->desc, lnum + i); in gluebi_erase()
258 err = ubi_leb_erase(gluebi->desc, lnum + i); in gluebi_erase()
281 struct gluebi_device *gluebi, *g; in gluebi_create() local
284 gluebi = kzalloc(sizeof(struct gluebi_device), GFP_KERNEL); in gluebi_create()
285 if (!gluebi) in gluebi_create()
288 mtd = &gluebi->mtd; in gluebi_create()
291 kfree(gluebi); in gluebi_create()
295 gluebi->vol_id = vi->vol_id; in gluebi_create()
296 gluebi->ubi_num = vi->ubi_num; in gluebi_create()
330 kfree(gluebi); in gluebi_create()
335 list_add_tail(&gluebi->list, &gluebi_devices); in gluebi_create()
352 struct gluebi_device *gluebi; in gluebi_remove() local
355 gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id); in gluebi_remove()
356 if (!gluebi) { in gluebi_remove()
360 } else if (gluebi->refcnt) in gluebi_remove()
363 list_del(&gluebi->list); in gluebi_remove()
368 mtd = &gluebi->mtd; in gluebi_remove()
372 mtd->index, gluebi->ubi_num, gluebi->vol_id, err); in gluebi_remove()
374 list_add_tail(&gluebi->list, &gluebi_devices); in gluebi_remove()
380 kfree(gluebi); in gluebi_remove()
396 struct gluebi_device *gluebi; in gluebi_updated() local
399 gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id); in gluebi_updated()
400 if (!gluebi) { in gluebi_updated()
408 gluebi->mtd.size = vi->used_bytes; in gluebi_updated()
423 struct gluebi_device *gluebi; in gluebi_resized() local
426 gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id); in gluebi_resized()
427 if (!gluebi) { in gluebi_resized()
433 gluebi->mtd.size = vi->used_bytes; in gluebi_resized()
479 struct gluebi_device *gluebi, *g; in ubi_gluebi_exit() local
481 list_for_each_entry_safe(gluebi, g, &gluebi_devices, list) { in ubi_gluebi_exit()
483 struct mtd_info *mtd = &gluebi->mtd; in ubi_gluebi_exit()
488 err, mtd->index, gluebi->ubi_num, in ubi_gluebi_exit()
489 gluebi->vol_id); in ubi_gluebi_exit()
491 kfree(gluebi); in ubi_gluebi_exit()