[Cbe-oss-dev] [PATCH 1/9] Remove memsize from the ctx_info struct
Michael Ellerman
michael at ellerman.id.au
Fri Aug 17 17:19:08 EST 2007
We want to get rid of the ctx_info struct altogether, step 1 is to remove
the memsize. Just compute it on the two occasions we need it.
Signed-off-by: Michael Ellerman <michael at ellerman.id.au>
---
arch/powerpc/platforms/cell/spufs/coredump.c | 19 +++++--------------
1 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c
index 5e31799..1136c77 100644
--- a/arch/powerpc/platforms/cell/spufs/coredump.c
+++ b/arch/powerpc/platforms/cell/spufs/coredump.c
@@ -34,7 +34,6 @@
struct spufs_ctx_info {
struct list_head list;
int dfd;
- int memsize; /* in bytes */
struct spu_context *ctx;
};
@@ -73,24 +72,18 @@ static int spufs_dump_seek(struct file *file, loff_t off)
return 1;
}
-static void spufs_fill_memsize(struct spufs_ctx_info *ctx_info)
+static u64 ctx_ls_size(struct spu_context *ctx)
{
- struct spu_context *ctx;
- unsigned long long lslr;
-
- ctx = ctx_info->ctx;
- lslr = ctx->csa.priv2.spu_lslr_RW;
- ctx_info->memsize = lslr + 1;
+ return ctx->csa.priv2.spu_lslr_RW + 1;
}
static int spufs_ctx_note_size(struct spufs_ctx_info *ctx_info)
{
- int dfd, memsize, i, sz, total = 0;
+ int dfd, i, sz, total = 0;
char *name;
char fullname[80];
dfd = ctx_info->dfd;
- memsize = ctx_info->memsize;
for (i = 0; spufs_coredump_read[i].name; i++) {
name = spufs_coredump_read[i].name;
@@ -101,7 +94,7 @@ static int spufs_ctx_note_size(struct spufs_ctx_info *ctx_info)
total += sizeof(struct elf_note);
total += roundup(strlen(fullname) + 1, 4);
if (!strcmp(name, "mem"))
- total += roundup(memsize, 4);
+ total += roundup(ctx_ls_size(ctx_info->ctx), 4);
else
total += roundup(sz, 4);
}
@@ -126,8 +119,6 @@ static int spufs_add_one_context(struct file *file, int dfd)
ctx_info->dfd = dfd;
ctx_info->ctx = ctx;
- spufs_fill_memsize(ctx_info);
-
size = spufs_ctx_note_size(ctx_info);
list_add(&ctx_info->list, &ctx_info_list);
return size;
@@ -182,7 +173,7 @@ static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i,
name = spufs_coredump_read[i].name;
if (!strcmp(name, "mem"))
- sz = ctx_info->memsize;
+ sz = ctx_ls_size(ctx_info->ctx);
else
sz = spufs_coredump_read[i].size;
--
1.5.1.3.g7a33b
More information about the cbe-oss-dev
mailing list