mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/9] state: updates and cleanups to make code better sharable with linux
@ 2015-05-26 11:37 Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 1/9] state: mtd_get_meminfo: open path readonly instead of readwrite Marc Kleine-Budde
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

Hello,

this patch series makes the state code better shareable with linux.

Marc


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/9] state: mtd_get_meminfo: open path readonly instead of readwrite
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 2/9] state: mtd_get_meminfo: make usage of mtd's meminfo compatible to linux Marc Kleine-Budde
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/state.c b/common/state.c
index cc0e168a7b99..c13f7a00c98c 100644
--- a/common/state.c
+++ b/common/state.c
@@ -900,7 +900,7 @@ static int mtd_get_meminfo(const char *path, struct mtd_info_user *meminfo)
 {
 	int fd, ret;
 
-	fd = open(path, O_RDWR);
+	fd = open(path, O_RDONLY);
 	if (fd < 0)
 		return fd;
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/9] state: mtd_get_meminfo: make usage of mtd's meminfo compatible to linux
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 1/9] state: mtd_get_meminfo: open path readonly instead of readwrite Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 3/9] state: backend_raw: remove hard coded limit of two copies Marc Kleine-Budde
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

This patch makes it possible to share the code with linux.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/state.c b/common/state.c
index c13f7a00c98c..82a21e912206 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1019,7 +1019,7 @@ int state_backend_dtb_file(struct state *state, const char *of_path, const char
 	state->backend = backend;
 
 	ret = mtd_get_meminfo(backend->path, &meminfo);
-	if (!ret && !(meminfo.mtd->flags & MTD_NO_ERASE))
+	if (!ret && !(meminfo.flags & MTD_NO_ERASE))
 		backend_dtb->need_erase = true;
 
 	return 0;
@@ -1268,7 +1268,7 @@ int state_backend_raw_file(struct state *state, const char *of_path,
 	state->backend = backend;
 
 	ret = mtd_get_meminfo(backend->path, &meminfo);
-	if (!ret && !(meminfo.mtd->flags & MTD_NO_ERASE)) {
+	if (!ret && !(meminfo.flags & MTD_NO_ERASE)) {
 		backend_raw->need_erase = true;
 		backend_raw->step = ALIGN(backend_raw->size_full,
 					  meminfo.erasesize);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/9] state: backend_raw: remove hard coded limit of two copies
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 1/9] state: mtd_get_meminfo: open path readonly instead of readwrite Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 2/9] state: mtd_get_meminfo: make usage of mtd's meminfo compatible to linux Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 4/9] state: backend_raw: rename struct state_backend_raw::step -> stride Marc Kleine-Budde
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

Although there is the define RAW_BACKEND_COPIES, the state_backend_raw_save()
function silently assumes exactly two copies. This patch removes that assumtion
by looping over all copies, but saving the one we're read from at the end.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/common/state.c b/common/state.c
index 82a21e912206..79e7f4cc6849 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1167,7 +1167,7 @@ static int state_backend_raw_save(struct state_backend *backend,
 {
 	struct state_backend_raw *backend_raw = container_of(backend,
 			struct state_backend_raw, backend);
-	int ret = 0, size, fd;
+	int ret = 0, size, fd, i;
 	void *buf, *data;
 	struct backend_raw_header *header;
 	struct state_variable *sv;
@@ -1192,10 +1192,17 @@ static int state_backend_raw_save(struct state_backend *backend,
 	if (fd < 0)
 		goto out_free;
 
-	ret = backend_raw_write_one(backend_raw, state, fd,
-				    !backend_raw->num_copy_read, buf, size);
-	if (ret)
-		goto out_close;
+	/* save other slots first */
+	for (i = 0; i < RAW_BACKEND_COPIES; i++) {
+		if (i == backend_raw->num_copy_read)
+			continue;
+
+		ret = backend_raw_write_one(backend_raw, state, fd,
+					    i, buf, size);
+		if (ret)
+			goto out_close;
+
+	}
 
 	ret = backend_raw_write_one(backend_raw, state, fd,
 				    backend_raw->num_copy_read, buf, size);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/9] state: backend_raw: rename struct state_backend_raw::step -> stride
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2015-05-26 11:37 ` [PATCH 3/9] state: backend_raw: remove hard coded limit of two copies Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 5/9] state: backend_raw: properly align write and erase size Marc Kleine-Budde
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

This patch renames the member "step" of the struct state_backend_raw to
"stride" and tries to clarifies its meaning.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/common/state.c b/common/state.c
index 79e7f4cc6849..4dae3409049a 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1032,7 +1032,7 @@ struct state_backend_raw {
 	struct state_backend backend;
 	unsigned long size_data; /* The raw data size (without magic and crc) */
 	unsigned long size_full;
-	unsigned long step; /* The step in bytes between two copies */
+	unsigned long stride; /* The stride size in bytes of the copies */
 	off_t offset; /* offset in the storage file */
 	size_t size; /* size of the storage area */
 	int num_copy_read; /* The first successfully read copy */
@@ -1120,7 +1120,7 @@ static int state_backend_raw_load(struct state_backend *backend,
 		return fd;
 
 	for (i = 0; i < RAW_BACKEND_COPIES; i++) {
-		off_t offset = backend_raw->offset + i * backend_raw->step;
+		off_t offset = backend_raw->offset + i * backend_raw->stride;
 
 		ret = backend_raw_load_one(backend_raw, state, fd, offset);
 		if (!ret) {
@@ -1140,7 +1140,7 @@ static int backend_raw_write_one(struct state_backend_raw *backend_raw,
 		struct state *state, int fd, int num, void *buf, size_t size)
 {
 	int ret;
-	off_t offset = backend_raw->offset + num * backend_raw->step;
+	off_t offset = backend_raw->offset + num * backend_raw->stride;
 
 	dev_dbg(&state->dev, "%s: 0x%08lx 0x%08zx\n",
 			__func__, offset, size);
@@ -1277,15 +1277,15 @@ int state_backend_raw_file(struct state *state, const char *of_path,
 	ret = mtd_get_meminfo(backend->path, &meminfo);
 	if (!ret && !(meminfo.flags & MTD_NO_ERASE)) {
 		backend_raw->need_erase = true;
-		backend_raw->step = ALIGN(backend_raw->size_full,
-					  meminfo.erasesize);
+		backend_raw->stride = ALIGN(backend_raw->size_full,
+					    meminfo.erasesize);
 		dev_dbg(&state->dev, "is a mtd, adjust stepsize to %ld\n",
-			backend_raw->step);
+			backend_raw->stride);
 	} else {
-		backend_raw->step = backend_raw->size_full;
+		backend_raw->stride = backend_raw->size_full;
 	}
 
-	if (backend_raw->size / backend_raw->step < RAW_BACKEND_COPIES) {
+	if (backend_raw->size / backend_raw->stride < RAW_BACKEND_COPIES) {
 		dev_err(&state->dev, "not enough space for two copies\n");
 		ret = -ENOSPC;
 		goto err;
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 5/9] state: backend_raw: properly align write and erase size
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
                   ` (3 preceding siblings ...)
  2015-05-26 11:37 ` [PATCH 4/9] state: backend_raw: rename struct state_backend_raw::step -> stride Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 6/9] state: backend_raw: factor out state_backend_raw_file_get_size() into separate function Marc Kleine-Budde
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

This patch makes it easier to share the code with linux, on Linux the ease and
write size have to be aligned. Use stride (which is already aligned to erase
block size) during erase, align size_full to writesize and use it while
writing.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/common/state.c b/common/state.c
index 4dae3409049a..7e5a31ae00a5 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1150,7 +1150,7 @@ static int backend_raw_write_one(struct state_backend_raw *backend_raw,
 		return ret;
 
 	if (backend_raw->need_erase) {
-		ret = erase(fd, backend_raw->size_full, offset);
+		ret = erase(fd, backend_raw->stride, offset);
 		if (ret)
 			return ret;
 	}
@@ -1167,14 +1167,12 @@ static int state_backend_raw_save(struct state_backend *backend,
 {
 	struct state_backend_raw *backend_raw = container_of(backend,
 			struct state_backend_raw, backend);
-	int ret = 0, size, fd, i;
+	int ret = 0, fd, i;
 	void *buf, *data;
 	struct backend_raw_header *header;
 	struct state_variable *sv;
 
-	size = backend_raw->size_data + sizeof(struct backend_raw_header);
-
-	buf = xzalloc(size);
+	buf = xzalloc(backend_raw->size_full);
 
 	header = buf;
 	data = buf + sizeof(*header);
@@ -1198,14 +1196,14 @@ static int state_backend_raw_save(struct state_backend *backend,
 			continue;
 
 		ret = backend_raw_write_one(backend_raw, state, fd,
-					    i, buf, size);
+					    i, buf, backend_raw->size_full);
 		if (ret)
 			goto out_close;
 
 	}
 
 	ret = backend_raw_write_one(backend_raw, state, fd,
-				    backend_raw->num_copy_read, buf, size);
+				    backend_raw->num_copy_read, buf, backend_raw->size_full);
 	if (ret)
 		goto out_close;
 
@@ -1277,6 +1275,8 @@ int state_backend_raw_file(struct state *state, const char *of_path,
 	ret = mtd_get_meminfo(backend->path, &meminfo);
 	if (!ret && !(meminfo.flags & MTD_NO_ERASE)) {
 		backend_raw->need_erase = true;
+		backend_raw->size_full = ALIGN(backend_raw->size_full,
+					       meminfo.writesize);
 		backend_raw->stride = ALIGN(backend_raw->size_full,
 					    meminfo.erasesize);
 		dev_dbg(&state->dev, "is a mtd, adjust stepsize to %ld\n",
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6/9] state: backend_raw: factor out state_backend_raw_file_get_size() into separate function
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
                   ` (4 preceding siblings ...)
  2015-05-26 11:37 ` [PATCH 5/9] state: backend_raw: properly align write and erase size Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 7/9] state: backend_raw: rename backend_raw_write_one() -> backend_raw_save_one() Marc Kleine-Budde
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

This patch factors out the state_backend_raw_file_get_size() into a separate
function and adds some ifdefs to make this code work under Linux aswell.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 64 insertions(+), 9 deletions(-)

diff --git a/common/state.c b/common/state.c
index 7e5a31ae00a5..749c8e906851 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1216,6 +1216,60 @@ out_free:
 	return ret;
 }
 
+#ifdef __BAREBOX__
+#define STAT_GIVES_SIZE(s) (S_ISREG(s.st_mode) || S_ISCHR(s.st_mode))
+#define BLKGET_GIVES_SIZE(s) 0
+#ifndef BLKGETSIZE64
+#define BLKGETSIZE64 -1
+#endif
+#else
+#define STAT_GIVES_SIZE(s) (S_ISREG(s.st_mode))
+#define BLKGET_GIVES_SIZE(s) (S_ISBLK(s.st_mode))
+#endif
+
+static int state_backend_raw_file_get_size(const char *path, size_t *out_size)
+{
+	struct mtd_info_user meminfo;
+	struct stat s;
+	int ret;
+
+	ret = stat(path, &s);
+	if (ret)
+		return -errno;
+
+	/*
+	 * under Linux, stat() gives the size only on regular files
+	 * under barebox, it works on char dev, too
+	 */
+	if (STAT_GIVES_SIZE(s)) {
+		*out_size = s.st_size;
+		return 0;
+	}
+
+	/* this works under Linux on block devs */
+	if (BLKGET_GIVES_SIZE(s)) {
+		int fd;
+
+		fd = open(path, O_RDONLY);
+		if (fd < 0)
+			return -errno;
+
+		ret = ioctl(fd, BLKGETSIZE64, out_size);
+		close(fd);
+		if (!ret)
+			return 0;
+	}
+
+	/* try mtd next */
+	ret = mtd_get_meminfo(path, &meminfo);
+	if (!ret) {
+		*out_size = meminfo.size;
+		return 0;
+	}
+
+	return ret;
+}
+
 /*
  * state_backend_raw_file - create a raw file backend store for a state instance
  *
@@ -1239,20 +1293,21 @@ int state_backend_raw_file(struct state *state, const char *of_path,
 	struct state_backend_raw *backend_raw;
 	struct state_backend *backend;
 	struct state_variable *sv;
-	int ret;
-	struct stat s;
 	struct mtd_info_user meminfo;
+	size_t path_size = 0;
+	int ret;
 
 	if (state->backend)
 		return -EBUSY;
 
-	ret = stat(path, &s);
-	if (!ret && S_ISCHR(s.st_mode)) {
-		if (size == 0)
-			size = s.st_size;
-		else if (offset + size > s.st_size)
-			return -EINVAL;
-	}
+	ret = state_backend_raw_file_get_size(path, &path_size);
+	if (ret)
+		return ret;
+
+	if (size == 0)
+		size = path_size;
+	else if (offset + size > path_size)
+		return -EINVAL;
 
 	backend_raw = xzalloc(sizeof(*backend_raw));
 	backend = &backend_raw->backend;
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 7/9] state: backend_raw: rename backend_raw_write_one() -> backend_raw_save_one()
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
                   ` (5 preceding siblings ...)
  2015-05-26 11:37 ` [PATCH 6/9] state: backend_raw: factor out state_backend_raw_file_get_size() into separate function Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 8/9] state: backend_raw: add sanity check of data_len during load Marc Kleine-Budde
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

Use a consistent naming scheme: backend_raw_save_one() is called from
backend_raw_save().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/state.c b/common/state.c
index 749c8e906851..8f6d14c98255 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1136,7 +1136,7 @@ static int state_backend_raw_load(struct state_backend *backend,
 	return ret;
 }
 
-static int backend_raw_write_one(struct state_backend_raw *backend_raw,
+static int backend_raw_save_one(struct state_backend_raw *backend_raw,
 		struct state *state, int fd, int num, void *buf, size_t size)
 {
 	int ret;
@@ -1195,15 +1195,15 @@ static int state_backend_raw_save(struct state_backend *backend,
 		if (i == backend_raw->num_copy_read)
 			continue;
 
-		ret = backend_raw_write_one(backend_raw, state, fd,
-					    i, buf, backend_raw->size_full);
+		ret = backend_raw_save_one(backend_raw, state, fd,
+					   i, buf, backend_raw->size_full);
 		if (ret)
 			goto out_close;
 
 	}
 
-	ret = backend_raw_write_one(backend_raw, state, fd,
-				    backend_raw->num_copy_read, buf, backend_raw->size_full);
+	ret = backend_raw_save_one(backend_raw, state, fd,
+				   backend_raw->num_copy_read, buf, backend_raw->size_full);
 	if (ret)
 		goto out_close;
 
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 8/9] state: backend_raw: add sanity check of data_len during load
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
                   ` (6 preceding siblings ...)
  2015-05-26 11:37 ` [PATCH 7/9] state: backend_raw: rename backend_raw_write_one() -> backend_raw_save_one() Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 11:37 ` [PATCH 9/9] state: backend_raw: update documentation of struct state_backend_raw members Marc Kleine-Budde
  2015-05-26 12:33 ` [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Sascha Hauer
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

The length of the data must fit into the remaining available space until the
next copy of the data.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/common/state.c b/common/state.c
index 8f6d14c98255..4a1e935a3b86 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1053,14 +1053,18 @@ static int backend_raw_load_one(struct state_backend_raw *backend_raw,
 	uint32_t crc;
 	struct state_variable *sv;
 	struct backend_raw_header header = {};
+	unsigned long max_len;
 	int ret;
 	void *buf;
 
+	max_len = backend_raw->stride;
+
 	ret = lseek(fd, offset, SEEK_SET);
 	if (ret < 0)
 		return ret;
 
 	ret = read_full(fd, &header, sizeof(header));
+	max_len -= sizeof(header);
 	if (ret < 0)
 		return ret;
 
@@ -1079,6 +1083,13 @@ static int backend_raw_load_one(struct state_backend_raw *backend_raw,
 		return -EINVAL;
 	}
 
+	if (header.data_len > max_len) {
+		dev_err(&state->dev,
+			"invalid data_len %u in header, max is %lu\n",
+			header.data_len, max_len);
+		return -EINVAL;
+	}
+
 	buf = xzalloc(header.data_len);
 
 	ret = read_full(fd, buf, header.data_len);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 9/9] state: backend_raw: update documentation of struct state_backend_raw members
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
                   ` (7 preceding siblings ...)
  2015-05-26 11:37 ` [PATCH 8/9] state: backend_raw: add sanity check of data_len during load Marc Kleine-Budde
@ 2015-05-26 11:37 ` Marc Kleine-Budde
  2015-05-26 12:33 ` [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Sascha Hauer
  9 siblings, 0 replies; 11+ messages in thread
From: Marc Kleine-Budde @ 2015-05-26 11:37 UTC (permalink / raw)
  To: barebox

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 common/state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/state.c b/common/state.c
index 4a1e935a3b86..edbfb95fbb5f 100644
--- a/common/state.c
+++ b/common/state.c
@@ -1030,8 +1030,8 @@ int state_backend_dtb_file(struct state *state, const char *of_path, const char
  */
 struct state_backend_raw {
 	struct state_backend backend;
-	unsigned long size_data; /* The raw data size (without magic and crc) */
-	unsigned long size_full;
+	unsigned long size_data; /* The raw data size (without header) */
+	unsigned long size_full; /* The size header + raw data */
 	unsigned long stride; /* The stride size in bytes of the copies */
 	off_t offset; /* offset in the storage file */
 	size_t size; /* size of the storage area */
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/9] state: updates and cleanups to make code better sharable with linux
  2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
                   ` (8 preceding siblings ...)
  2015-05-26 11:37 ` [PATCH 9/9] state: backend_raw: update documentation of struct state_backend_raw members Marc Kleine-Budde
@ 2015-05-26 12:33 ` Sascha Hauer
  9 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2015-05-26 12:33 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: barebox

On Tue, May 26, 2015 at 01:37:44PM +0200, Marc Kleine-Budde wrote:
> Hello,
> 
> this patch series makes the state code better shareable with linux.

Applied, thanks

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-05-26 12:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-26 11:37 [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 1/9] state: mtd_get_meminfo: open path readonly instead of readwrite Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 2/9] state: mtd_get_meminfo: make usage of mtd's meminfo compatible to linux Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 3/9] state: backend_raw: remove hard coded limit of two copies Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 4/9] state: backend_raw: rename struct state_backend_raw::step -> stride Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 5/9] state: backend_raw: properly align write and erase size Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 6/9] state: backend_raw: factor out state_backend_raw_file_get_size() into separate function Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 7/9] state: backend_raw: rename backend_raw_write_one() -> backend_raw_save_one() Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 8/9] state: backend_raw: add sanity check of data_len during load Marc Kleine-Budde
2015-05-26 11:37 ` [PATCH 9/9] state: backend_raw: update documentation of struct state_backend_raw members Marc Kleine-Budde
2015-05-26 12:33 ` [PATCH 0/9] state: updates and cleanups to make code better sharable with linux Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox