Lines Matching defs:gluebi

31 	pr_err("gluebi (pid %d): %s: " fmt "\n",            \
35 * struct gluebi_device - a gluebi device description data structure.
37 * @refcnt: gluebi device reference count
39 * @ubi_num: UBI device number this gluebi device works on
40 * @vol_id: ID of UBI volume this gluebi device works on
41 * @list: link in a list of gluebi devices
52 /* List of all gluebi devices */
57 * find_gluebi_nolock - find a gluebi device.
61 * This function seraches for gluebi device corresponding to UBI device
62 * @ubi_num and UBI volume @vol_id. Returns the gluebi device description
68 struct gluebi_device *gluebi;
70 list_for_each_entry(gluebi, &gluebi_devices, list)
71 if (gluebi->ubi_num == ubi_num && gluebi->vol_id == vol_id)
72 return gluebi;
86 struct gluebi_device *gluebi;
92 gluebi = container_of(mtd, struct gluebi_device, mtd);
94 if (gluebi->refcnt > 0) {
103 gluebi->refcnt += 1;
112 gluebi->desc = ubi_open_volume(gluebi->ubi_num, gluebi->vol_id,
114 if (IS_ERR(gluebi->desc)) {
116 return PTR_ERR(gluebi->desc);
118 gluebi->refcnt += 1;
132 struct gluebi_device *gluebi;
134 gluebi = container_of(mtd, struct gluebi_device, mtd);
136 gluebi->refcnt -= 1;
137 if (gluebi->refcnt == 0)
138 ubi_close_volume(gluebi->desc);
157 struct gluebi_device *gluebi;
159 gluebi = container_of(mtd, struct gluebi_device, mtd);
168 err = ubi_read(gluebi->desc, lnum, buf, offs, to_read);
197 struct gluebi_device *gluebi;
199 gluebi = container_of(mtd, struct gluebi_device, mtd);
212 err = ubi_leb_write(gluebi->desc, lnum, buf, offs, to_write);
237 struct gluebi_device *gluebi;
244 gluebi = container_of(mtd, struct gluebi_device, mtd);
247 err = ubi_leb_unmap(gluebi->desc, lnum + i);
258 err = ubi_leb_erase(gluebi->desc, lnum + i);
270 * gluebi_create - create a gluebi device for an UBI volume.
281 struct gluebi_device *gluebi, *g;
284 gluebi = kzalloc(sizeof(struct gluebi_device), GFP_KERNEL);
285 if (!gluebi)
288 mtd = &gluebi->mtd;
291 kfree(gluebi);
295 gluebi->vol_id = vi->vol_id;
296 gluebi->ubi_num = vi->ubi_num;
319 /* Just a sanity check - make sure this gluebi device does not exist */
323 err_msg("gluebi MTD device %d form UBI device %d volume %d already exists",
330 kfree(gluebi);
335 list_add_tail(&gluebi->list, &gluebi_devices);
341 * gluebi_remove - remove a gluebi device.
352 struct gluebi_device *gluebi;
355 gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
356 if (!gluebi) {
360 } else if (gluebi->refcnt)
363 list_del(&gluebi->list);
368 mtd = &gluebi->mtd;
372 mtd->index, gluebi->ubi_num, gluebi->vol_id, err);
374 list_add_tail(&gluebi->list, &gluebi_devices);
380 kfree(gluebi);
396 struct gluebi_device *gluebi;
399 gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
400 if (!gluebi) {
408 gluebi->mtd.size = vi->used_bytes;
423 struct gluebi_device *gluebi;
426 gluebi = find_gluebi_nolock(vi->ubi_num, vi->vol_id);
427 if (!gluebi) {
433 gluebi->mtd.size = vi->used_bytes;
479 struct gluebi_device *gluebi, *g;
481 list_for_each_entry_safe(gluebi, g, &gluebi_devices, list) {
483 struct mtd_info *mtd = &gluebi->mtd;
487 err_msg("error %d while removing gluebi MTD device %d, UBI device %d, volume %d - ignoring",
488 err, mtd->index, gluebi->ubi_num,
489 gluebi->vol_id);
491 kfree(gluebi);