summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_flashmap.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-09-12 12:03:02 +0000
committerbapt <bapt@FreeBSD.org>2015-09-12 12:03:02 +0000
commit934c5c6da6753f906bc4a905e249449fd15b850d (patch)
tree38501bd60c958b3b5474368fc0834fe6d09c307a /sys/geom/geom_flashmap.c
parentef64c24c72a0a1e4bc5beba3e1c3d78af363773d (diff)
parentceb1e1488d523eff8fa06828cf0511fc2556c0ef (diff)
downloadFreeBSD-src-934c5c6da6753f906bc4a905e249449fd15b850d.zip
FreeBSD-src-934c5c6da6753f906bc4a905e249449fd15b850d.tar.gz
Finish merging from head, messed up in previous attempt
Diffstat (limited to 'sys/geom/geom_flashmap.c')
-rw-r--r--sys/geom/geom_flashmap.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/geom/geom_flashmap.c b/sys/geom/geom_flashmap.c
index 58d0b65..0383f69 100644
--- a/sys/geom/geom_flashmap.c
+++ b/sys/geom/geom_flashmap.c
@@ -70,6 +70,8 @@ static struct g_geom *g_flashmap_taste(struct g_class *,
static void g_flashmap_config(struct gctl_req *, struct g_class *,
const char *);
static int g_flashmap_load(device_t, struct g_flashmap_head *);
+static int (*flash_fill_slices)(device_t, struct flash_slice *, int *) =
+ fdt_flash_fill_slices;
MALLOC_DECLARE(M_FLASHMAP);
MALLOC_DEFINE(M_FLASHMAP, "geom_flashmap", "GEOM flash memory slicer class");
@@ -230,7 +232,8 @@ g_flashmap_load(device_t dev, struct g_flashmap_head *head)
buf_size = sizeof(struct flash_slice) * FLASH_SLICES_MAX_NUM;
slices = malloc(buf_size, M_FLASHMAP, M_WAITOK | M_ZERO);
- if (flash_fill_slices(dev, slices, &nslices) == 0) {
+ if (flash_fill_slices &&
+ flash_fill_slices(dev, slices, &nslices) == 0) {
for (i = 0; i < nslices; i++) {
slice = malloc(sizeof(struct g_flashmap_slice),
M_FLASHMAP, M_WAITOK);
@@ -247,6 +250,12 @@ g_flashmap_load(device_t dev, struct g_flashmap_head *head)
return (nslices);
}
+void flash_register_slicer(int (*slicer)(device_t, struct flash_slice *, int *))
+{
+
+ flash_fill_slices = slicer;
+}
+
static struct g_class g_flashmap_class = {
.name = FLASHMAP_CLASS_NAME,
.version = G_VERSION,
OpenPOWER on IntegriCloud