From e6617b5e2e80c5ca74c5f87ecab44a22b78be9a5 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 13 Nov 2012 20:51:32 +0300 Subject: [PATCH] parasite: Macro for getting parasite symbols Same as previous patch -- easier to read and possible to use tags. Signed-off-by: Pavel Emelyanov --- include/parasite.h | 12 ++---------- parasite-syscall.c | 6 +++--- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/include/parasite.h b/include/parasite.h index a5dd9488f..3a586fc56 100644 --- a/include/parasite.h +++ b/include/parasite.h @@ -123,16 +123,8 @@ struct parasite_tty_args { int st_excl; }; -/* - * Some useful offsets - */ - -#define PARASITE_ARGS_ADDR(start) \ - ((start) + parasite_blob_offset____export_parasite_args) -#define PARASITE_CMD_ADDR(start) \ - ((start) + parasite_blob_offset____export_parasite_cmd) -#define PARASITE_HEAD_ADDR(start) \ - ((start) + parasite_blob_offset____export_parasite_head_start) +/* the parasite prefix is added by gen_offsets.sh */ +#define parasite_sym(pblob, name) ((void *)(pblob) + parasite_blob_offset__##name) #endif /* !__ASSEMBLY__ */ #endif /* CR_PARASITE_H_ */ diff --git a/parasite-syscall.c b/parasite-syscall.c index f057f4099..f9ced2147 100644 --- a/parasite-syscall.c +++ b/parasite-syscall.c @@ -850,9 +850,9 @@ struct parasite_ctl *parasite_infect_seized(pid_t pid, struct pstree_item *item, memcpy(ctl->local_map, parasite_blob, sizeof(parasite_blob)); /* Setup the rest of a control block */ - ctl->parasite_ip = PARASITE_HEAD_ADDR((unsigned long)ctl->remote_map); - ctl->addr_cmd = (unsigned int *)PARASITE_CMD_ADDR((unsigned long)ctl->local_map); - ctl->addr_args = (void *)PARASITE_ARGS_ADDR((unsigned long)ctl->local_map); + ctl->parasite_ip = (unsigned long)parasite_sym(ctl->remote_map, __export_parasite_head_start); + ctl->addr_cmd = parasite_sym(ctl->local_map, __export_parasite_cmd); + ctl->addr_args = parasite_sym(ctl->local_map, __export_parasite_args); ret = parasite_init(ctl, pid, item->nr_threads); if (ret) {