Index: ubifs-2.6/drivers/mtd/ubi/Kconfig
===================================================================
--- ubifs-2.6.orig/drivers/mtd/ubi/Kconfig
+++ ubifs-2.6/drivers/mtd/ubi/Kconfig
@@ -49,7 +49,7 @@ config MTD_UBI_BEB_RESERVE
 	  reserved. Leave the default value if unsure.
 
 config MTD_UBI_GLUEBI
-	bool "Emulate MTD devices"
+	tristate "Emulate MTD devices"
 	default n
 	depends on MTD_UBI
 	help
Index: ubifs-2.6/drivers/mtd/ubi/Makefile
===================================================================
--- ubifs-2.6.orig/drivers/mtd/ubi/Makefile
+++ ubifs-2.6/drivers/mtd/ubi/Makefile
@@ -4,4 +4,4 @@ ubi-y += vtbl.o vmt.o upd.o build.o cdev
 ubi-y += misc.o
 
 ubi-$(CONFIG_MTD_UBI_DEBUG) += debug.o
-ubi-$(CONFIG_MTD_UBI_GLUEBI) += gluebi.o
+obj-$(CONFIG_MTD_UBI_GLUEBI) += gluebi.o
Index: ubifs-2.6/drivers/mtd/ubi/gluebi.c
===================================================================
--- ubifs-2.6.orig/drivers/mtd/ubi/gluebi.c
+++ ubifs-2.6/drivers/mtd/ubi/gluebi.c
@@ -31,6 +31,37 @@
 #include <asm/div64.h>
 #include "ubi.h"
 
+struct ubi_gluebi_volume {
+	struct mtd_info gluebi_mtd;
+	int gluebi_refcount;
+	struct ubi_volume_desc *gluebi_desc;
+	int ubi_num;
+	int vol_id;
+	struct list_head list;
+};
+
+static LIST_HEAD(ubi_gluebi_mtds);
+
+static inline void ubi_gluebi_add(struct ubi_gluebi_volume *vol)
+{
+	list_add_tail(&vol->list, &ubi_gluebi_mtds);
+}
+
+static inline void ubi_gluebi_del(struct ubi_gluebi_volume *vol)
+{
+	list_del(&vol->list);
+}
+
+static struct ubi_gluebi_volume *ubi_gluebi_find(int ubi_num, int
vol_id)
+{
+	struct ubi_gluebi_volume *pos;
+
+	list_for_each_entry(pos, &ubi_gluebi_mtds, list)
+		if (pos->ubi_num == ubi_num && pos->vol_id == vol_id)
+			return pos;
+	return NULL;
+}
+
 /**
  * gluebi_get_device - get MTD device reference.
