Changeset View
Changeset View
Standalone View
Standalone View
sys/geom/label/g_label_flashmap.c
Show All 33 Lines | |||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/slicer.h> | #include <sys/slicer.h> | ||||
#include <geom/geom.h> | #include <geom/geom.h> | ||||
#include <geom/geom_flashmap.h> | #include <geom/geom_flashmap.h> | ||||
#include <geom/geom_slice.h> | #include <geom/geom_slice.h> | ||||
#include <geom/label/g_label.h> | #include <geom/label/g_label.h> | ||||
#define G_LABEL_FLASHMAP_SLICE_DIR "flash" | |||||
static void | static void | ||||
g_label_flashmap_taste(struct g_consumer *cp, char *label, size_t size) | g_label_flashmap_taste(struct g_consumer *cp, char *label, size_t size) | ||||
{ | { | ||||
struct g_flashmap *gfp; | struct g_flashmap *gfp; | ||||
struct g_slicer *gsp; | struct g_slicer *gsp; | ||||
struct g_provider *pp; | struct g_provider *pp; | ||||
g_topology_assert_not(); | g_topology_assert_not(); | ||||
Show All 13 Lines | g_label_flashmap_taste(struct g_consumer *cp, char *label, size_t size) | ||||
if (gfp->labels[pp->index] == NULL) | if (gfp->labels[pp->index] == NULL) | ||||
return; | return; | ||||
strlcpy(label, gfp->labels[pp->index], size); | strlcpy(label, gfp->labels[pp->index], size); | ||||
} | } | ||||
struct g_label_desc g_label_flashmap = { | struct g_label_desc g_label_flashmap = { | ||||
.ld_taste = g_label_flashmap_taste, | .ld_taste = g_label_flashmap_taste, | ||||
.ld_dir = G_LABEL_FLASHMAP_SLICE_DIR, | .ld_dirprefix = "flash/", | ||||
.ld_enabled = 1 | .ld_enabled = 1 | ||||
}; | }; | ||||
G_LABEL_INIT(flashmap, g_label_flashmap, "Create device nodes for Flashmap labels"); | G_LABEL_INIT(flashmap, g_label_flashmap, "Create device nodes for Flashmap labels"); |