From: Frederik Deweerdt <dev.deweerdt@laposte.net>
To: Andrew Morton <akpm@osdl.org>, maneesh@in.ibm.com
Cc: linux-kernel@vger.kernel.org
Subject: [-mm patch] kprobes: arch_supports_kretprobes cleanup
Date: Fri, 13 May 2005 20:12:19 +0200 [thread overview]
Message-ID: <20050513181219.GD26933@gilgamesh.home.res> (raw)
In-Reply-To: <20050512033100.017958f6.akpm@osdl.org>
Hi,
I felt that the arch_supports_kprobes use was a bit weird.
The constant is not capitalized and is used as a variable for a
C test.
I also added comments (CONFIG_KPROBES) to an #else and an #endif
This patch is against 2.6.12-rc4-mm1, i386 compile tested.
Regards,
Frederik Deweerdt
Signed-off-by: Frederik Deweerdt <frederik.deweerdt@laposte.net>
--
diff -uprN --exclude-from=diff.ignore linux-2.6.12-rc4-mm1/include/asm-i386/kprobes.h linux-2.6.12-rc4-mm1-def/include/asm-i386/kprobes.h
--- linux-2.6.12-rc4-mm1/include/asm-i386/kprobes.h 2005-05-12 16:48:00.000000000 +0200
+++ linux-2.6.12-rc4-mm1-def/include/asm-i386/kprobes.h 2005-05-13 00:05:00.000000000 +0200
@@ -39,7 +39,7 @@ typedef u8 kprobe_opcode_t;
: (((unsigned long)current_thread_info()) + THREAD_SIZE - (ADDR)))
#define JPROBE_ENTRY(pentry) (kprobe_opcode_t *)pentry
-#define arch_supports_kretprobes 1
+#define ARCH_SUPPORTS_KRETPROBES
void kretprobe_trampoline(void);
diff -uprN --exclude-from=diff.ignore linux-2.6.12-rc4-mm1/include/linux/kprobes.h linux-2.6.12-rc4-mm1-def/include/linux/kprobes.h
--- linux-2.6.12-rc4-mm1/include/linux/kprobes.h 2005-05-12 16:48:00.000000000 +0200
+++ linux-2.6.12-rc4-mm1-def/include/linux/kprobes.h 2005-05-13 10:21:07.000000000 +0200
@@ -93,15 +93,14 @@ struct jprobe {
kprobe_opcode_t *entry; /* probe handling code to jump to */
};
-#ifdef arch_supports_kretprobes
+#ifdef ARCH_SUPPORTS_KRETPROBES
extern int trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs);
extern void trampoline_post_handler(struct kprobe *p, struct pt_regs *regs,
unsigned long flags);
extern struct task_struct *arch_get_kprobe_task(void *ptr);
extern void arch_prepare_kretprobe(struct kretprobe *rp, struct pt_regs *regs);
extern void arch_kprobe_flush_task(struct task_struct *tk, spinlock_t *kp_lock);
-#else
-#define arch_supports_kretprobes 0
+#else /* ARCH_SUPPORTS_KRETPROBES */
static inline void kretprobe_trampoline(void)
{
}
@@ -123,7 +122,7 @@ static inline void arch_kprobe_flush_tas
{
}
#define arch_get_kprobe_task(ptr) ((struct task_struct *)NULL)
-#endif
+#endif /* ARCH_SUPPORTS_KRETPROBES */
/*
* Function-return probe -
* Note:
@@ -189,7 +188,7 @@ struct kretprobe_instance *get_rp_inst_t
void add_rp_inst(struct kretprobe_instance *ri);
void kprobe_flush_task(struct task_struct *tk);
void recycle_rp_inst(struct kretprobe_instance *ri);
-#else
+#else /* CONFIG_KPROBES */
static inline int kprobe_running(void)
{
return 0;
@@ -221,5 +220,5 @@ static inline void unregister_kretprobe(
static inline void kprobe_flush_task(struct task_struct *tk)
{
}
-#endif
+#endif /* CONFIG_KPROBES */
#endif /* _LINUX_KPROBES_H */
diff -uprN --exclude-from=diff.ignore linux-2.6.12-rc4-mm1/kernel/kprobes.c linux-2.6.12-rc4-mm1-def/kernel/kprobes.c
--- linux-2.6.12-rc4-mm1/kernel/kprobes.c 2005-05-12 16:48:00.000000000 +0200
+++ linux-2.6.12-rc4-mm1-def/kernel/kprobes.c 2005-05-12 23:27:04.000000000 +0200
@@ -390,15 +390,14 @@ void unregister_jprobe(struct jprobe *jp
unregister_kprobe(&jp->kp);
}
+#ifdef ARCH_SUPPORTS_KRETPROBES
+
int register_kretprobe(struct kretprobe *rp)
{
int ret = 0;
struct kretprobe_instance *inst;
int i;
- if (!arch_supports_kretprobes)
- return -ENOSYS;
-
rp->kp.pre_handler = pre_handler_kretprobe;
/* Pre-allocate memory for max kretprobe instances */
@@ -428,6 +427,15 @@ int register_kretprobe(struct kretprobe
return ret;
}
+#else /* ARCH_SUPPORTS_KRETPROBES */
+
+int register_kretprobe(struct kretprobe *rp)
+{
+ return -ENOSYS;
+}
+
+#endif /* ARCH_SUPPORTS_KRETPROBES */
+
void unregister_kretprobe(struct kretprobe *rp)
{
unsigned long flags;
next prev parent reply other threads:[~2005-05-13 18:07 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-12 10:31 2.6.12-rc4-mm1 Andrew Morton
2005-05-12 12:21 ` 2.6.12-rc4-mm1, build results compared to 2.6.12-rc3-mm3 Jan Dittmer
2005-05-13 6:19 ` Maneesh Soni
2005-05-12 12:39 ` 2.6.12-rc4-mm1 Reuben Farrelly
2005-05-12 15:09 ` 2.6.12-rc4-mm1 Andrew Morton
2005-05-14 21:19 ` 2.6.12-rc4-mm1 Andrew James Wade
2005-05-12 12:58 ` kobject_register failed for intelfb (-EACCES) (Re: 2.6.12-rc4-mm1) Alexey Dobriyan
2005-05-12 15:43 ` Greg KH
2005-05-12 15:59 ` Andrew Morton
2005-05-12 16:04 ` Greg KH
2005-05-12 16:20 ` Alexey Dobriyan
2005-05-12 18:14 ` [PATCH -mm] Print KBD and AUX irqs correctly Alexey Dobriyan
2005-05-12 21:42 ` [-mm patch] mm.h: fix page_zone compile error Adrian Bunk
2005-05-12 22:09 ` Dave Hansen
2005-05-12 22:26 ` Adrian Bunk
2005-05-13 13:26 ` Andy Whitcroft
2005-05-12 21:54 ` 2.6.12-rc4-mm1 Greg KH
2005-05-13 0:47 ` [-mm patch] drivers/cpufreq/cpufreq_conservative.c: make cpufreq_gov_dbs static Adrian Bunk
2005-05-13 7:24 ` 2.6.12-rc4-mm1 Dave Airlie
2005-05-13 7:25 ` 2.6.12-rc4-mm1 Dave Airlie
2005-05-13 14:53 ` 2.6.12-rc4-mm1 steve
2005-05-13 18:12 ` Frederik Deweerdt [this message]
2005-05-13 19:40 ` 2.6.12-rc4-mm1 Johannes Stezenbach
2005-05-14 11:27 ` 2.6.12-rc4-mm1 Richard Purdie
2005-05-16 11:27 ` 2.6.12-rc4-mm2 Richard Purdie
2005-05-15 1:20 ` 2.6.12-rc4-mm1 William Lee Irwin III
2005-05-15 1:30 ` 2.6.12-rc4-mm1 Andrew Morton
2005-05-15 9:44 ` 2.6.12-rc4-mm1 Jesper Juhl
2005-05-15 9:54 ` 2.6.12-rc4-mm1 Andrew Morton
2005-05-15 9:43 ` 2.6.12-rc4-mm1: drivers/usb/gadget/ether.c compile error Adrian Bunk
2005-05-16 15:26 ` David Brownell
2005-05-15 11:32 ` [-mm patch] arch/i386/Kconfig: SELECT_MEMORY_MODEL -> ARCH_SELECT_MEMORY_MODEL Adrian Bunk
2005-05-15 18:24 ` Dave Hansen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050513181219.GD26933@gilgamesh.home.res \
--to=dev.deweerdt@laposte.net \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maneesh@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).