From patchwork Wed Oct 22 11:31:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 5131601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 335099F349 for ; Wed, 22 Oct 2014 11:37:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 134DD2017E for ; Wed, 22 Oct 2014 11:37:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD6F020155 for ; Wed, 22 Oct 2014 11:37:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XguCs-0001nO-Dr; Wed, 22 Oct 2014 11:35:58 +0000 Received: from szxga02-in.huawei.com ([119.145.14.65]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XguBo-0008FY-Jg for linux-arm-kernel@lists.infradead.org; Wed, 22 Oct 2014 11:34:58 +0000 Received: from 172.24.2.119 (EHLO lggeml425-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CBC48752; Wed, 22 Oct 2014 19:33:47 +0800 (CST) Received: from kernel-host.huawei (10.107.197.247) by lggeml425-hub.china.huawei.com (10.72.61.35) with Microsoft SMTP Server id 14.3.158.1; Wed, 22 Oct 2014 19:33:35 +0800 From: Wang Nan To: , , , , , , Ben Dooks , Christoph Lameter , Rabin Vincent , "David S. Miller" Subject: [PATCH v6 1/7] ARM: kprobes: replace 'union decode_action' to 'struct decode_action' Date: Wed, 22 Oct 2014 19:31:59 +0800 Message-ID: <1413977525-51480-2-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1413977525-51480-1-git-send-email-wangnan0@huawei.com> References: <1413977525-51480-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141022_043453_243278_10384B0E X-CRM114-Status: GOOD ( 11.85 ) X-Spam-Score: -2.1 (--) Cc: Li Zefan , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is generated simply using: $ sed -i "s/union decode_action/struct decode_action/g" `grep decode_action * -rl` Which allows futher expansion to decode_action. Signed-off-by: Wang Nan --- arch/arm/kernel/kprobes-arm.c | 2 +- arch/arm/kernel/kprobes-thumb.c | 4 ++-- arch/arm/kernel/kprobes.c | 2 +- arch/arm/kernel/kprobes.h | 8 ++++---- arch/arm/kernel/probes-arm.c | 2 +- arch/arm/kernel/probes-arm.h | 2 +- arch/arm/kernel/probes-thumb.c | 4 ++-- arch/arm/kernel/probes-thumb.h | 4 ++-- arch/arm/kernel/probes.c | 2 +- arch/arm/kernel/probes.h | 4 ++-- arch/arm/kernel/uprobes-arm.c | 2 +- arch/arm/kernel/uprobes.h | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/arm/kernel/kprobes-arm.c b/arch/arm/kernel/kprobes-arm.c index ac300c6..6df9f1f 100644 --- a/arch/arm/kernel/kprobes-arm.c +++ b/arch/arm/kernel/kprobes-arm.c @@ -301,7 +301,7 @@ emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(probes_opcode_t insn, regs->ARM_cpsr = (regs->ARM_cpsr & ~APSR_MASK) | (cpsr & APSR_MASK); } -const union decode_action kprobes_arm_actions[NUM_PROBES_ARM_ACTIONS] = { +const struct decode_action kprobes_arm_actions[NUM_PROBES_ARM_ACTIONS] = { [PROBES_EMULATE_NONE] = {.handler = probes_emulate_none}, [PROBES_SIMULATE_NOP] = {.handler = probes_simulate_nop}, [PROBES_PRELOAD_IMM] = {.handler = probes_simulate_nop}, diff --git a/arch/arm/kernel/kprobes-thumb.c b/arch/arm/kernel/kprobes-thumb.c index 9495d7f..0672457 100644 --- a/arch/arm/kernel/kprobes-thumb.c +++ b/arch/arm/kernel/kprobes-thumb.c @@ -611,7 +611,7 @@ t16_decode_pop(probes_opcode_t insn, struct arch_probes_insn *asi, return INSN_GOOD; } -const union decode_action kprobes_t16_actions[NUM_PROBES_T16_ACTIONS] = { +const struct decode_action kprobes_t16_actions[NUM_PROBES_T16_ACTIONS] = { [PROBES_T16_ADD_SP] = {.handler = t16_simulate_add_sp_imm}, [PROBES_T16_CBZ] = {.handler = t16_simulate_cbz}, [PROBES_T16_SIGN_EXTEND] = {.handler = t16_emulate_loregs_rwflags}, @@ -634,7 +634,7 @@ const union decode_action kprobes_t16_actions[NUM_PROBES_T16_ACTIONS] = { [PROBES_T16_BRANCH] = {.handler = t16_simulate_branch}, }; -const union decode_action kprobes_t32_actions[NUM_PROBES_T32_ACTIONS] = { +const struct decode_action kprobes_t32_actions[NUM_PROBES_T32_ACTIONS] = { [PROBES_T32_LDMSTM] = {.decoder = t32_decode_ldmstm}, [PROBES_T32_LDRDSTRD] = {.handler = t32_emulate_ldrdstrd}, [PROBES_T32_TABLE_BRANCH] = {.handler = t32_simulate_table_branch}, diff --git a/arch/arm/kernel/kprobes.c b/arch/arm/kernel/kprobes.c index 6d64420..028159c 100644 --- a/arch/arm/kernel/kprobes.c +++ b/arch/arm/kernel/kprobes.c @@ -59,7 +59,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) unsigned long addr = (unsigned long)p->addr; bool thumb; kprobe_decode_insn_t *decode_insn; - const union decode_action *actions; + const struct decode_action *actions; int is; if (in_exception_text(addr)) diff --git a/arch/arm/kernel/kprobes.h b/arch/arm/kernel/kprobes.h index 9a2712e..34db1eb 100644 --- a/arch/arm/kernel/kprobes.h +++ b/arch/arm/kernel/kprobes.h @@ -36,16 +36,16 @@ kprobe_decode_ldmstm(kprobe_opcode_t insn, struct arch_probes_insn *asi, typedef enum probes_insn (kprobe_decode_insn_t)(probes_opcode_t, struct arch_probes_insn *, bool, - const union decode_action *); + const struct decode_action *); #ifdef CONFIG_THUMB2_KERNEL -extern const union decode_action kprobes_t32_actions[]; -extern const union decode_action kprobes_t16_actions[]; +extern const struct decode_action kprobes_t32_actions[]; +extern const struct decode_action kprobes_t16_actions[]; #else /* !CONFIG_THUMB2_KERNEL */ -extern const union decode_action kprobes_arm_actions[]; +extern const struct decode_action kprobes_arm_actions[]; #endif diff --git a/arch/arm/kernel/probes-arm.c b/arch/arm/kernel/probes-arm.c index 8eaef81..3d00aa7 100644 --- a/arch/arm/kernel/probes-arm.c +++ b/arch/arm/kernel/probes-arm.c @@ -725,7 +725,7 @@ static void __kprobes arm_singlestep(probes_opcode_t insn, */ enum probes_insn __kprobes arm_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, - bool emulate, const union decode_action *actions) + bool emulate, const struct decode_action *actions) { asi->insn_singlestep = arm_singlestep; asi->insn_check_cc = probes_condition_checks[insn>>28]; diff --git a/arch/arm/kernel/probes-arm.h b/arch/arm/kernel/probes-arm.h index ace6572..6ecc25a 100644 --- a/arch/arm/kernel/probes-arm.h +++ b/arch/arm/kernel/probes-arm.h @@ -68,6 +68,6 @@ extern const union decode_item probes_decode_arm_table[]; enum probes_insn arm_probes_decode_insn(probes_opcode_t, struct arch_probes_insn *, bool emulate, - const union decode_action *actions); + const struct decode_action *actions); #endif diff --git a/arch/arm/kernel/probes-thumb.c b/arch/arm/kernel/probes-thumb.c index 4131351..72aa217 100644 --- a/arch/arm/kernel/probes-thumb.c +++ b/arch/arm/kernel/probes-thumb.c @@ -863,7 +863,7 @@ static void __kprobes thumb32_singlestep(probes_opcode_t opcode, enum probes_insn __kprobes thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, - bool emulate, const union decode_action *actions) + bool emulate, const struct decode_action *actions) { asi->insn_singlestep = thumb16_singlestep; asi->insn_check_cc = thumb_check_cc; @@ -873,7 +873,7 @@ thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, enum probes_insn __kprobes thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, - bool emulate, const union decode_action *actions) + bool emulate, const struct decode_action *actions) { asi->insn_singlestep = thumb32_singlestep; asi->insn_check_cc = thumb_check_cc; diff --git a/arch/arm/kernel/probes-thumb.h b/arch/arm/kernel/probes-thumb.h index 7c6f6eb..2658d95 100644 --- a/arch/arm/kernel/probes-thumb.h +++ b/arch/arm/kernel/probes-thumb.h @@ -89,9 +89,9 @@ extern const union decode_item probes_decode_thumb16_table[]; enum probes_insn __kprobes thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, - bool emulate, const union decode_action *actions); + bool emulate, const struct decode_action *actions); enum probes_insn __kprobes thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, - bool emulate, const union decode_action *actions); + bool emulate, const struct decode_action *actions); #endif diff --git a/arch/arm/kernel/probes.c b/arch/arm/kernel/probes.c index a8ab540..ec030b8 100644 --- a/arch/arm/kernel/probes.c +++ b/arch/arm/kernel/probes.c @@ -388,7 +388,7 @@ static const int decode_struct_sizes[NUM_DECODE_TYPES] = { int __kprobes probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, const union decode_item *table, bool thumb, - bool emulate, const union decode_action *actions) + bool emulate, const struct decode_action *actions) { const struct decode_header *h = (struct decode_header *)table; const struct decode_header *next; diff --git a/arch/arm/kernel/probes.h b/arch/arm/kernel/probes.h index dba9f24..739c2a2 100644 --- a/arch/arm/kernel/probes.h +++ b/arch/arm/kernel/probes.h @@ -309,7 +309,7 @@ typedef enum probes_insn (probes_custom_decode_t)(probes_opcode_t, struct arch_probes_insn *, const struct decode_header *); -union decode_action { +struct decode_action { probes_insn_handler_t *handler; probes_custom_decode_t *decoder; }; @@ -402,6 +402,6 @@ probes_insn_handler_t probes_emulate_none; int __kprobes probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi, const union decode_item *table, bool thumb, bool emulate, - const union decode_action *actions); + const struct decode_action *actions); #endif diff --git a/arch/arm/kernel/uprobes-arm.c b/arch/arm/kernel/uprobes-arm.c index d3b655f..0c0f299 100644 --- a/arch/arm/kernel/uprobes-arm.c +++ b/arch/arm/kernel/uprobes-arm.c @@ -194,7 +194,7 @@ uprobe_decode_ldmstm(probes_opcode_t insn, return INSN_GOOD; } -const union decode_action uprobes_probes_actions[] = { +const struct decode_action uprobes_probes_actions[] = { [PROBES_EMULATE_NONE] = {.handler = probes_simulate_nop}, [PROBES_SIMULATE_NOP] = {.handler = probes_simulate_nop}, [PROBES_PRELOAD_IMM] = {.handler = probes_simulate_nop}, diff --git a/arch/arm/kernel/uprobes.h b/arch/arm/kernel/uprobes.h index 1d0c12d..57b4373 100644 --- a/arch/arm/kernel/uprobes.h +++ b/arch/arm/kernel/uprobes.h @@ -30,6 +30,6 @@ enum probes_insn decode_pc_ro(probes_opcode_t insn, struct arch_probes_insn *asi, const struct decode_header *d); -extern const union decode_action uprobes_probes_actions[]; +extern const struct decode_action uprobes_probes_actions[]; #endif