aboutsummaryrefslogtreecommitdiff
path: root/include/blkmap.h
diff options
context:
space:
mode:
authorTobias Waldekranz2023-02-16 16:33:49 +0100
committerTom Rini2023-04-05 10:54:47 -0400
commitc41e209ea67ee9be04519a3c7afda80a32253317 (patch)
tree71e36eef8d34bb097904a7c7d01b6824e8af452d /include/blkmap.h
parent3d2fc79714542702f55fc407f7e7885464c39cd2 (diff)
blk: blkmap: Add basic infrastructure
blkmaps are loosely modeled on Linux's device mapper subsystem. The basic idea is that you can create virtual block devices whose blocks can be backed by a plethora of sources that are user configurable. This change just adds the basic infrastructure for creating and removing blkmap devices. Subsequent changes will extend this to add support for actual mappings. Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/blkmap.h')
-rw-r--r--include/blkmap.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/blkmap.h b/include/blkmap.h
new file mode 100644
index 00000000000..3c7e36efabc
--- /dev/null
+++ b/include/blkmap.h
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2023 Addiva Elektronik
+ * Author: Tobias Waldekranz <tobias@waldekranz.com>
+ */
+
+#ifndef _BLKMAP_H
+#define _BLKMAP_H
+
+/**
+ * blkmap_from_label() - Find blkmap from label
+ *
+ * @label: Label of the requested blkmap
+ * Returns: A pointer to the blkmap on success, NULL on failure
+ */
+struct udevice *blkmap_from_label(const char *label);
+
+/**
+ * blkmap_create() - Create new blkmap
+ *
+ * @label: Label of the new blkmap
+ * @devp: If not NULL, updated with the address of the resulting device
+ * Returns: 0 on success, negative error code on failure
+ */
+int blkmap_create(const char *label, struct udevice **devp);
+
+/**
+ * blkmap_destroy() - Destroy blkmap
+ *
+ * @dev: The blkmap to be destroyed
+ * Returns: 0 on success, negative error code on failure
+ */
+int blkmap_destroy(struct udevice *dev);
+
+#endif /* _BLKMAP_H */