[Devel] Re: mktree.c does not compile with v14 ?

Dan Smith danms at us.ibm.com
Mon Mar 30 18:47:06 PDT 2009


Hi Suka,

SB> I am trying to compile mktree.c with [v14-rc1] but get this:

I had the same problem and had to fix up mktree.c a bit.  Oren said he
had a fix for this, but I haven't seen it yet.  So, I've included mine
at the bottom in case it helps.

-- 
Dan Smith
IBM Linux Technology Center
email: danms at us.ibm.com

Signed-off-by: Dan Smith <danms at us.ibm.com>
---
 mktree.c |   27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/mktree.c b/mktree.c
index c97c2de..65a0fdc 100644
--- a/mktree.c
+++ b/mktree.c
@@ -560,18 +560,24 @@ static int cr_read_head(struct cr_ctx *ctx)
 	if (ret < 0)
 		return ret;
 
-	len = hh->uts_len;
+	len = hh->uts_release_len + hh->uts_version_len + hh->uts_machine_len;
 	if (len < 0 || len > BUFSIZE / 4)
 		return -EINVAL;
 	ptr = (char *) (hh + 1);
 
-	ret = cr_read_obj_buffer(ctx, ptr, len);
+	len = 0;
+
+	ret = cr_read_obj_buffer(ctx, ptr, hh->uts_release_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_read_obj_buffer(ctx, ptr + len, len);
+	len += hh->uts_release_len;
+
+	ret = cr_read_obj_buffer(ctx, ptr + len, hh->uts_version_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_read_obj_buffer(ctx, ptr + 2*len, len);
+	len += hh->uts_version_len;
+
+	ret = cr_read_obj_buffer(ctx, ptr + len, hh->uts_machine_len);
 	if (ret < 0)
 		return ret;
 
@@ -627,7 +633,7 @@ static int cr_write_head(struct cr_ctx *ctx)
 	struct cr_hdr h;
 	struct cr_hdr_head *hh;
 	char *ptr;
-	int len, ret;
+	int len = 0, ret;
 
 	h.type = CR_HDR_HEAD;
 	h.len = sizeof(*hh);
@@ -636,16 +642,19 @@ static int cr_write_head(struct cr_ctx *ctx)
 	if (ret < 0)
 		return ret;
 
-	len = hh->uts_len;
 	ptr = (char *) (hh + 1);
 
-	ret = cr_write_obj_buffer(ctx, ptr, len);
+	ret = cr_write_obj_buffer(ctx, ptr, hh->uts_release_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_write_obj_buffer(ctx, ptr + len, len);
+	len += hh->uts_release_len;
+
+	ret = cr_write_obj_buffer(ctx, ptr + len, hh->uts_version_len);
 	if (ret < 0)
 		return ret;
-	ret = cr_write_obj_buffer(ctx, ptr + 2*len, len);
+	len += hh->uts_version_len;
+
+	ret = cr_write_obj_buffer(ctx, ptr + len, hh->uts_machine_len);
 
 	return ret;
 }
-- 
1.5.6.3


_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list