All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: fenghua.yu@intel.com, tony.luck@intel.com,
	linux-ia64@vger.kernel.org, dyoung@redhat.com,
	kexec@lists.infradead.org,
	Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>,
	ebiederm@xmission.com, Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org, vgoyal@redhat.com
Subject: [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions
Date: Fri, 25 Nov 2016 17:24:03 +0530	[thread overview]
Message-ID: <148007484315.1053.12317233313990302812.stgit@hbathini.in.ibm.com> (raw)
In-Reply-To: <148007477669.1053.4107773905913128028.stgit@hbathini.in.ibm.com>

Get rid of multiple definitions of append_elf_note() & final_note()
functions. Reuse these functions compiled under CONFIG_CRASH_CORE.

Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
---
 arch/ia64/kernel/crash.c   |   22 ----------------------
 include/linux/crash_core.h |    4 ++++
 kernel/crash_core.c        |    6 +++---
 kernel/kexec_core.c        |   28 ----------------------------
 4 files changed, 7 insertions(+), 53 deletions(-)

diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 2955f35..75859a0 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -27,28 +27,6 @@ static int kdump_freeze_monarch;
 static int kdump_on_init = 1;
 static int kdump_on_fatal_mca = 1;
 
-static inline Elf64_Word
-*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
-		size_t data_len)
-{
-	struct elf_note *note = (struct elf_note *)buf;
-	note->n_namesz = strlen(name) + 1;
-	note->n_descsz = data_len;
-	note->n_type   = type;
-	buf += (sizeof(*note) + 3)/4;
-	memcpy(buf, name, note->n_namesz);
-	buf += (note->n_namesz + 3)/4;
-	memcpy(buf, data, data_len);
-	buf += (data_len + 3)/4;
-	return buf;
-}
-
-static void
-final_note(void *buf)
-{
-	memset(buf, 0, sizeof(struct elf_note));
-}
-
 extern void ia64_dump_cpu_regs(void *);
 
 static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus);
diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
index 9a4f4b0..2ae20b1 100644
--- a/include/linux/crash_core.h
+++ b/include/linux/crash_core.h
@@ -61,6 +61,10 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
 extern size_t vmcoreinfo_size;
 extern size_t vmcoreinfo_max_size;
 
+u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
+		     void *data, size_t data_len);
+void final_note(u32 *buf);
+
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base);
 int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 60a98fc..9223976 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -291,8 +291,8 @@ int __init parse_crashkernel_low(char *cmdline,
 				"crashkernel=", suffix_tbl[SUFFIX_LOW]);
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
-			    void *data, size_t data_len)
+u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
+		     void *data, size_t data_len)
 {
 	struct elf_note note;
 
@@ -309,7 +309,7 @@ static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
 	return buf;
 }
 
-static void final_note(u32 *buf)
+void final_note(u32 *buf)
 {
 	struct elf_note note;
 
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 3aa21f3..596cb32 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -988,34 +988,6 @@ int crash_shrink_memory(unsigned long new_size)
 	return ret;
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
-			    size_t data_len)
-{
-	struct elf_note note;
-
-	note.n_namesz = strlen(name) + 1;
-	note.n_descsz = data_len;
-	note.n_type   = type;
-	memcpy(buf, &note, sizeof(note));
-	buf += (sizeof(note) + 3)/4;
-	memcpy(buf, name, note.n_namesz);
-	buf += (note.n_namesz + 3)/4;
-	memcpy(buf, data, note.n_descsz);
-	buf += (note.n_descsz + 3)/4;
-
-	return buf;
-}
-
-static void final_note(u32 *buf)
-{
-	struct elf_note note;
-
-	note.n_namesz = 0;
-	note.n_descsz = 0;
-	note.n_type   = 0;
-	memcpy(buf, &note, sizeof(note));
-}
-
 void crash_save_cpu(struct pt_regs *regs, int cpu)
 {
 	struct elf_prstatus prstatus;

WARNING: multiple messages have this Message-ID (diff)
From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: fenghua.yu@intel.com, tony.luck@intel.com,
	linux-ia64@vger.kernel.org, kexec@lists.infradead.org,
	linuxppc-dev@lists.ozlabs.org, ebiederm@xmission.com,
	Michael Ellerman <mpe@ellerman.id.au>,
	dyoung@redhat.com, vgoyal@redhat.com
Subject: [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions
Date: Fri, 25 Nov 2016 17:24:03 +0530	[thread overview]
Message-ID: <148007484315.1053.12317233313990302812.stgit@hbathini.in.ibm.com> (raw)
In-Reply-To: <148007477669.1053.4107773905913128028.stgit@hbathini.in.ibm.com>

Get rid of multiple definitions of append_elf_note() & final_note()
functions. Reuse these functions compiled under CONFIG_CRASH_CORE.

Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
---
 arch/ia64/kernel/crash.c   |   22 ----------------------
 include/linux/crash_core.h |    4 ++++
 kernel/crash_core.c        |    6 +++---
 kernel/kexec_core.c        |   28 ----------------------------
 4 files changed, 7 insertions(+), 53 deletions(-)

diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 2955f35..75859a0 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -27,28 +27,6 @@ static int kdump_freeze_monarch;
 static int kdump_on_init = 1;
 static int kdump_on_fatal_mca = 1;
 
-static inline Elf64_Word
-*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
-		size_t data_len)
-{
-	struct elf_note *note = (struct elf_note *)buf;
-	note->n_namesz = strlen(name) + 1;
-	note->n_descsz = data_len;
-	note->n_type   = type;
-	buf += (sizeof(*note) + 3)/4;
-	memcpy(buf, name, note->n_namesz);
-	buf += (note->n_namesz + 3)/4;
-	memcpy(buf, data, data_len);
-	buf += (data_len + 3)/4;
-	return buf;
-}
-
-static void
-final_note(void *buf)
-{
-	memset(buf, 0, sizeof(struct elf_note));
-}
-
 extern void ia64_dump_cpu_regs(void *);
 
 static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus);
diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
index 9a4f4b0..2ae20b1 100644
--- a/include/linux/crash_core.h
+++ b/include/linux/crash_core.h
@@ -61,6 +61,10 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
 extern size_t vmcoreinfo_size;
 extern size_t vmcoreinfo_max_size;
 
+u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
+		     void *data, size_t data_len);
+void final_note(u32 *buf);
+
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base);
 int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 60a98fc..9223976 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -291,8 +291,8 @@ int __init parse_crashkernel_low(char *cmdline,
 				"crashkernel=", suffix_tbl[SUFFIX_LOW]);
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
-			    void *data, size_t data_len)
+u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
+		     void *data, size_t data_len)
 {
 	struct elf_note note;
 
@@ -309,7 +309,7 @@ static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
 	return buf;
 }
 
-static void final_note(u32 *buf)
+void final_note(u32 *buf)
 {
 	struct elf_note note;
 
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 3aa21f3..596cb32 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -988,34 +988,6 @@ int crash_shrink_memory(unsigned long new_size)
 	return ret;
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
-			    size_t data_len)
-{
-	struct elf_note note;
-
-	note.n_namesz = strlen(name) + 1;
-	note.n_descsz = data_len;
-	note.n_type   = type;
-	memcpy(buf, &note, sizeof(note));
-	buf += (sizeof(note) + 3)/4;
-	memcpy(buf, name, note.n_namesz);
-	buf += (note.n_namesz + 3)/4;
-	memcpy(buf, data, note.n_descsz);
-	buf += (note.n_descsz + 3)/4;
-
-	return buf;
-}
-
-static void final_note(u32 *buf)
-{
-	struct elf_note note;
-
-	note.n_namesz = 0;
-	note.n_descsz = 0;
-	note.n_type   = 0;
-	memcpy(buf, &note, sizeof(note));
-}
-
 void crash_save_cpu(struct pt_regs *regs, int cpu)
 {
 	struct elf_prstatus prstatus;


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Hari Bathini <hbathini@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: fenghua.yu@intel.com, tony.luck@intel.com,
	linux-ia64@vger.kernel.org, dyoung@redhat.com,
	kexec@lists.infradead.org,
	Mahesh J Salgaonkar <mahesh@linux.vnet.ibm.com>,
	ebiederm@xmission.com, Michael Ellerman <mpe@ellerman.id.au>,
	linuxppc-dev@lists.ozlabs.org, vgoyal@redhat.com
Subject: [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions
Date: Fri, 25 Nov 2016 11:54:24 +0000	[thread overview]
Message-ID: <148007484315.1053.12317233313990302812.stgit@hbathini.in.ibm.com> (raw)
In-Reply-To: <148007477669.1053.4107773905913128028.stgit@hbathini.in.ibm.com>

Get rid of multiple definitions of append_elf_note() & final_note()
functions. Reuse these functions compiled under CONFIG_CRASH_CORE.

Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
---
 arch/ia64/kernel/crash.c   |   22 ----------------------
 include/linux/crash_core.h |    4 ++++
 kernel/crash_core.c        |    6 +++---
 kernel/kexec_core.c        |   28 ----------------------------
 4 files changed, 7 insertions(+), 53 deletions(-)

diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 2955f35..75859a0 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -27,28 +27,6 @@ static int kdump_freeze_monarch;
 static int kdump_on_init = 1;
 static int kdump_on_fatal_mca = 1;
 
-static inline Elf64_Word
-*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
-		size_t data_len)
-{
-	struct elf_note *note = (struct elf_note *)buf;
-	note->n_namesz = strlen(name) + 1;
-	note->n_descsz = data_len;
-	note->n_type   = type;
-	buf += (sizeof(*note) + 3)/4;
-	memcpy(buf, name, note->n_namesz);
-	buf += (note->n_namesz + 3)/4;
-	memcpy(buf, data, data_len);
-	buf += (data_len + 3)/4;
-	return buf;
-}
-
-static void
-final_note(void *buf)
-{
-	memset(buf, 0, sizeof(struct elf_note));
-}
-
 extern void ia64_dump_cpu_regs(void *);
 
 static DEFINE_PER_CPU(struct elf_prstatus, elf_prstatus);
diff --git a/include/linux/crash_core.h b/include/linux/crash_core.h
index 9a4f4b0..2ae20b1 100644
--- a/include/linux/crash_core.h
+++ b/include/linux/crash_core.h
@@ -61,6 +61,10 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4];
 extern size_t vmcoreinfo_size;
 extern size_t vmcoreinfo_max_size;
 
+u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
+		     void *data, size_t data_len);
+void final_note(u32 *buf);
+
 int __init parse_crashkernel(char *cmdline, unsigned long long system_ram,
 		unsigned long long *crash_size, unsigned long long *crash_base);
 int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
diff --git a/kernel/crash_core.c b/kernel/crash_core.c
index 60a98fc..9223976 100644
--- a/kernel/crash_core.c
+++ b/kernel/crash_core.c
@@ -291,8 +291,8 @@ int __init parse_crashkernel_low(char *cmdline,
 				"crashkernel=", suffix_tbl[SUFFIX_LOW]);
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
-			    void *data, size_t data_len)
+u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
+		     void *data, size_t data_len)
 {
 	struct elf_note note;
 
@@ -309,7 +309,7 @@ static u32 *append_elf_note(u32 *buf, char *name, unsigned int type,
 	return buf;
 }
 
-static void final_note(u32 *buf)
+void final_note(u32 *buf)
 {
 	struct elf_note note;
 
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index 3aa21f3..596cb32 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -988,34 +988,6 @@ int crash_shrink_memory(unsigned long new_size)
 	return ret;
 }
 
-static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
-			    size_t data_len)
-{
-	struct elf_note note;
-
-	note.n_namesz = strlen(name) + 1;
-	note.n_descsz = data_len;
-	note.n_type   = type;
-	memcpy(buf, &note, sizeof(note));
-	buf += (sizeof(note) + 3)/4;
-	memcpy(buf, name, note.n_namesz);
-	buf += (note.n_namesz + 3)/4;
-	memcpy(buf, data, note.n_descsz);
-	buf += (note.n_descsz + 3)/4;
-
-	return buf;
-}
-
-static void final_note(u32 *buf)
-{
-	struct elf_note note;
-
-	note.n_namesz = 0;
-	note.n_descsz = 0;
-	note.n_type   = 0;
-	memcpy(buf, &note, sizeof(note));
-}
-
 void crash_save_cpu(struct pt_regs *regs, int cpu)
 {
 	struct elf_prstatus prstatus;


  parent reply	other threads:[~2016-11-25 11:54 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-25 11:53 [PATCH v2 0/5] kexec/fadump: remove dependency with CONFIG_KEXEC and reuse crashkernel parameter for fadump Hari Bathini
2016-11-25 11:53 ` [PATCH v2 0/5] kexec/fadump: remove dependency with CONFIG_KEXEC and reuse crashkernel parameter for Hari Bathini
2016-11-25 11:53 ` [PATCH v2 0/5] kexec/fadump: remove dependency with CONFIG_KEXEC and reuse crashkernel parameter for fadump Hari Bathini
2016-11-25 11:53 ` [PATCH v2 1/5] crash: move crashkernel parsing and vmcore related code under CONFIG_CRASH_CORE Hari Bathini
2016-11-25 11:54   ` Hari Bathini
2016-11-25 11:53   ` Hari Bathini
2016-11-25 11:54 ` Hari Bathini [this message]
2016-11-25 11:54   ` [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions Hari Bathini
2016-11-25 11:54   ` Hari Bathini
2016-12-01  4:56   ` Dave Young
2016-12-01  4:56     ` Dave Young
2016-12-01  4:56     ` Dave Young
2016-12-02 11:26     ` Hari Bathini
2016-12-02 11:38       ` Hari Bathini
2016-12-02 11:26       ` Hari Bathini
2016-12-02 19:22       ` Eric W. Biederman
2016-12-02 19:22         ` Eric W. Biederman
2016-12-02 19:22         ` Eric W. Biederman
2016-12-16  6:37         ` Hari Bathini
2016-12-16  6:49           ` Hari Bathini
2016-12-16  6:37           ` Hari Bathini
2016-11-25 11:54 ` [PATCH v2 3/5] powerpc/fadump: remove dependency with CONFIG_KEXEC Hari Bathini
2016-11-25 11:54   ` Hari Bathini
2016-11-25 11:54   ` Hari Bathini
2016-11-25 11:54 ` [PATCH v2 4/5] powerpc/fadump: reuse crashkernel parameter for fadump memory reservation Hari Bathini
2016-11-25 11:54   ` Hari Bathini
2016-11-25 11:54   ` Hari Bathini
2016-11-25 11:54 ` [PATCH v2 5/5] powerpc/fadump: update documentation about crashkernel parameter reuse Hari Bathini
2016-11-25 11:54   ` Hari Bathini
2016-11-25 11:54   ` Hari Bathini

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=148007484315.1053.12317233313990302812.stgit@hbathini.in.ibm.com \
    --to=hbathini@linux.vnet.ibm.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=fenghua.yu@intel.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mahesh@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=tony.luck@intel.com \
    --cc=vgoyal@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.