login
Header Space

 
 

[PATCH 04/15] Use computed sizes/#defines rather than literals in SPU coredump code

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linuxppc-dev@...>
Cc: Jeremy Kerr <jk@...>, <linux-kernel@...>
Date: Wednesday, September 12, 2007 - 3:43 am

The spufs_coredump_reader array contains the size of the data that will be
returned by the read routine. Currently these are specified as literals, and
though some are obvious, sizeof(u32) == 4, others are not, 69 * 8 ==  ???

Instead, use sizeof() whatever type is returned by each routine, or in
the case of spufs_mem_read() the #define LS_SIZE.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/cell/spufs/file.c |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index a4a8770..18ddde8 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2231,23 +2231,24 @@ struct tree_descr spufs_dir_nosched_contents[] = {
 };
 
 struct spufs_coredump_reader spufs_coredump_read[] = {
-	{ "regs", __spufs_regs_read, NULL, 128 * 16 },
-	{ "fpcr", __spufs_fpcr_read, NULL, 16 },
+	{ "regs", __spufs_regs_read, NULL, sizeof(struct spu_reg128[128])},
+	{ "fpcr", __spufs_fpcr_read, NULL, sizeof(struct spu_reg128) },
 	{ "lslr", NULL, __spufs_lslr_get, 11 },
 	{ "decr", NULL, __spufs_decr_get, 11 },
 	{ "decr_status", NULL, __spufs_decr_status_get, 11 },
-	{ "mem", __spufs_mem_read, NULL, 256 * 1024, },
-	{ "signal1", __spufs_signal1_read, NULL, 4 },
+	{ "mem", __spufs_mem_read, NULL, LS_SIZE, },
+	{ "signal1", __spufs_signal1_read, NULL, sizeof(u32) },
 	{ "signal1_type", NULL, __spufs_signal1_type_get, 2 },
-	{ "signal2", __spufs_signal2_read, NULL, 4 },
+	{ "signal2", __spufs_signal2_read, NULL, sizeof(u32) },
 	{ "signal2_type", NULL, __spufs_signal2_type_get, 2 },
 	{ "event_mask", NULL, __spufs_event_mask_get, 8 },
 	{ "event_status", NULL, __spufs_event_status_get, 8 },
-	{ "mbox_info", __spufs_mbox_info_read, NULL, 4 },
-	{ "ibox_info", __spufs_ibox_info_read, NULL, 4 },
-	{ "wbox_info", __spufs_wbox_info_read, NULL, 16 },
-	{ "dma_info", __spufs_dma_info_read, NULL, 69 * 8 },
-	{ "proxydma_info", __spufs_proxydma_info_read, NULL, 35 * 8 },
+	{ "mbox_info", __spufs_mbox_info_read, NULL, sizeof(u32) },
+	{ "ibox_info", __spufs_ibox_info_read, NULL, sizeof(u32) },
+	{ "wbox_info", __spufs_wbox_info_read, NULL, 4 * sizeof(u32)},
+	{ "dma_info", __spufs_dma_info_read, NULL, sizeof(struct spu_dma_info)},
+	{ "proxydma_info", __spufs_proxydma_info_read,
+			   NULL, sizeof(struct spu_proxydma_info)},
 	{ "object-id", NULL, __spufs_object_id_get, 19 },
 	{ },
 };
-- 
1.5.1.3.g7a33b

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 14/15] Respect RLIMIT_CORE in spu coredump code, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Michael Ellerman, (Wed Sep 12, 3:43 am)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Michael Ellerman, (Wed Sep 12, 3:49 am)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Arnd Bergmann, (Wed Sep 12, 4:47 am)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Michael Ellerman, (Wed Sep 12, 10:05 pm)
Re: [PATCH 15/15] Add DEFINE_SPUFS_ATTRIBUTE(), Arnd Bergmann, (Thu Sep 13, 8:17 am)
[PATCH 11/15] Combine spufs_coredump_calls with spufs_calls, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 12/15] Cleanup ELF coredump extra notes logic, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 10/15] Add contents of npc file to SPU coredumps, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 05/15] Write some SPU coredump values as ASCII, Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 04/15] Use computed sizes/#defines rather than litera..., Michael Ellerman, (Wed Sep 12, 3:43 am)
[PATCH 02/15] Remove ctx_info and ctx_info_list, Michael Ellerman, (Wed Sep 12, 3:43 am)
speck-geostationary