summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-03-07 09:25:53 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-03-07 09:25:53 +0100
commit74213ed9a70f26a141ca3797e34c64f88a5cf090 (patch)
treeb4cc43aaddf0ea07ff626532f8d4f667402998f1 /include
parent144358e0aa102c84968443460c508eb3d65ccc90 (diff)
parent348deb7f9e7b0e25ee83085162251bfff28c4785 (diff)
downloadbarebox-74213ed9a70f26a141ca3797e34c64f88a5cf090.tar.gz
barebox-74213ed9a70f26a141ca3797e34c64f88a5cf090.tar.xz
Merge branch 'for-next/partitionhelper'
Conflicts: fs/devfs-core.c
Diffstat (limited to 'include')
-rw-r--r--include/driver.h41
-rw-r--r--include/nand.h4
2 files changed, 39 insertions, 6 deletions
diff --git a/include/driver.h b/include/driver.h
index cbb040170c..01b181ddbd 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -482,15 +482,48 @@ ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offs
int cdev_ioctl(struct cdev *cdev, int cmd, void *buf);
int cdev_erase(struct cdev *cdev, size_t count, loff_t offset);
-#define DEVFS_PARTITION_FIXED (1 << 0)
-#define DEVFS_PARTITION_READONLY (1 << 1)
+#define DEVFS_PARTITION_FIXED (1U << 0)
+#define DEVFS_PARTITION_READONLY (1U << 1)
#define DEVFS_IS_PARTITION (1 << 2)
#define DEVFS_IS_CHARACTER_DEV (1 << 3)
-struct cdev *devfs_add_partition(const char *devname, loff_t offset, loff_t size,
- int flags, const char *name);
+struct cdev *devfs_add_partition(const char *devname, loff_t offset,
+ loff_t size, unsigned int flags, const char *name);
int devfs_del_partition(const char *name);
+#define DEVFS_PARTITION_APPEND 0
+
+/**
+ * struct devfs_partition - defines parameters for a single partition
+ * @offset: start of partition
+ * a negative offset requests to start the partition relative to the
+ * device's end. DEVFS_PARTITION_APPEND (i.e. 0) means start directly at
+ * the end of the previous partition.
+ * @size: size of partition
+ * a non-positive value requests to use a size that keeps -size free space
+ * after the current partition. A special case of this is passing 0, which
+ * means "until end of device".
+ * @flags: flags passed to devfs_add_partition
+ * @name: name passed to devfs_add_partition
+ * @bbname: if non-NULL also dev_add_bb_dev() is called for the partition during
+ * devfs_create_partitions().
+ */
+struct devfs_partition {
+ loff_t offset;
+ loff_t size;
+ unsigned int flags;
+ const char *name;
+ const char *bbname;
+};
+/**
+ * devfs_create_partitions - create a set of partitions for a device
+ * @devname: name of the device to partition
+ * @partinfo: array of partition parameters
+ * The array is processed until an entry with .name = NULL is found.
+ */
+int devfs_create_partitions(const char *devname,
+ const struct devfs_partition partinfo[]);
+
#define DRV_OF_COMPAT(compat) \
IS_ENABLED(CONFIG_OFDEVICE) ? (compat) : NULL
diff --git a/include/nand.h b/include/nand.h
index b1762dfa45..a0e77cc8cd 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -5,10 +5,10 @@
struct nand_bb;
#ifdef CONFIG_NAND
-int dev_add_bb_dev(char *filename, const char *name);
+int dev_add_bb_dev(const char *filename, const char *name);
int dev_remove_bb_dev(const char *name);
#else
-static inline int dev_add_bb_dev(char *filename, const char *name) {
+static inline int dev_add_bb_dev(const char *filename, const char *name) {
return 0;
}
static inline int dev_remove_bb_dev(const char *name)