summaryrefslogtreecommitdiff
path: root/ubi-utils/include/libubi.h
diff options
context:
space:
mode:
authorMika Westerberg <ext-mika.1.westerberg@nokia.com>2010-02-01 10:03:47 +0100
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2010-02-18 15:42:50 +0200
commita341ac7d0d5c23dd859136018ea6f7ecdc5f65e8 (patch)
tree77109fbb3de946d5c507f29688af50a8aba6c1af /ubi-utils/include/libubi.h
parentacabf7fcea06b7a2926837523561861ed14cab31 (diff)
libubi: add support to attach/detach by MTD device path
struct ubi_attach_request now has additional field 'dev' that can contain path to the MTD device node in the filesystem. Also there are two new functions that are able to handle path to the MTD device node: ubi_attach() - attach MTD device by number or by path ubi_detach() - detach MTD device by path ubi_attach() works like ubi_attach_mtd() when it is passed empty req->dev, otherwise it looks up correct MTD device number based on the given device node path. Signed-off-by: Mika Westerberg <ext-mika.1.westerberg@nokia.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'ubi-utils/include/libubi.h')
-rw-r--r--ubi-utils/include/libubi.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/ubi-utils/include/libubi.h b/ubi-utils/include/libubi.h
index f52904d..64b5eed 100644
--- a/ubi-utils/include/libubi.h
+++ b/ubi-utils/include/libubi.h
@@ -44,6 +44,7 @@ typedef void * libubi_t;
* (%UBI_DEV_NUM_AUTO should be used to automatically assign the
* number)
* @mtd_num: MTD device number to attach
+ * @dev: path to device node to attach
* @vid_hdr_offset: VID header offset (%0 means default offset and this is what
* most of the users want)
*/
@@ -51,6 +52,7 @@ struct ubi_attach_request
{
int dev_num;
int mtd_num;
+ const char *dev;
int vid_hdr_offset;
};
@@ -219,6 +221,23 @@ int ubi_attach_mtd(libubi_t desc, const char *node,
struct ubi_attach_request *req);
/**
+ * ubi_attach - attach an MTD device by its node path.
+ * @desc: UBI library descriptor
+ * @node: name of the UBI control character device node
+ * @req: MTD attach request
+ *
+ * This function creates new UBI device by attaching an MTD device described by
+ * @req. If @req->dev is given it should contain path to the MTD device node.
+ * Otherwise functionality is similar than in function 'ubi_attach_mtd()' where
+ * @req->mtd_num is used.
+ *
+ * Returns %0 in case of success and %-1 in case of failure (errno is set). The
+ * newly created UBI device number is returned in @req->dev_num.
+ */
+int ubi_attach(libubi_t desc, const char *node,
+ struct ubi_attach_request *req);
+
+/**
* ubi_detach_mtd - detach an MTD device.
* @desc: UBI library descriptor
* @node: name of the UBI control character device node
@@ -231,6 +250,17 @@ int ubi_attach_mtd(libubi_t desc, const char *node,
int ubi_detach_mtd(libubi_t desc, const char *node, int mtd_num);
/**
+ * ubi_detach - detach an MTD device by its node path.
+ * @desc: UBI library descriptor
+ * @node: name of the UBI control character device node
+ * @dev: path to an MTD device node
+ *
+ * This function detaches an MTD device @dev from UBI. Returns zero in case of
+ * success and %-1 in case of failure.
+ */
+int ubi_detach(libubi_t desc, const char *node, const char *dev);
+
+/**
* ubi_remove_dev - remove an UBI device.
* @desc: UBI library descriptor
* @node: name of the UBI control character device node