[PATCH] devfs-core: introduce devfs_append_partition

Jan Luebbe jlu at pengutronix.de
Tue Jun 18 08:50:50 EDT 2013


This simplifies board code for partition setup by keeping track of the
offset.

Signed-off-by: Jan Luebbe <jlu at pengutronix.de>
---
 fs/devfs-core.c  | 9 +++++++++
 include/driver.h | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/fs/devfs-core.c b/fs/devfs-core.c
index 262e0a2..f7d79ff 100644
--- a/fs/devfs-core.c
+++ b/fs/devfs-core.c
@@ -267,6 +267,15 @@ int devfs_add_partition(const char *devname, loff_t offset, loff_t size,
 	return 0;
 }
 
+int devfs_append_partition(const char *devname, loff_t *offset, loff_t size,
+		int flags, const char *name)
+{
+	int ret;
+	ret = devfs_add_partition(devname, *offset, size, flags, name);
+	*offset += size;
+	return ret;
+}
+
 int devfs_del_partition(const char *name)
 {
 	struct cdev *cdev;
diff --git a/include/driver.h b/include/driver.h
index 716f792..3f4f7b9 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -463,6 +463,8 @@ int cdev_erase(struct cdev *cdev, size_t count, loff_t offset);
 
 int devfs_add_partition(const char *devname, loff_t offset, loff_t size,
 		int flags, const char *name);
+int devfs_append_partition(const char *devname, loff_t *offset, loff_t size,
+		int flags, const char *name);
 int devfs_del_partition(const char *name);
 
 #define DRV_OF_COMPAT(compat) \
-- 
1.8.3.1




More information about the barebox mailing list