From: "Suzuki K. Poulose" <suzuki@in.ibm.com>
To: kumagai-atsushi@mxc.nes.nec.co.jp
Cc: kexec@lists.infradead.org
Subject: [PATCH v1 1/4] [makedumpfile] Add read_string routine
Date: Thu, 16 Feb 2012 09:05:40 +0530 [thread overview]
Message-ID: <20120216033535.7972.21257.stgit@suzukikp> (raw)
In-Reply-To: <20120216033411.7972.77705.stgit@suzukikp>
This patch adds a read_string() wrapper around readmem().
int read_string(int type_addr, unsigned long long addr, char *bufptr, size_t len);
The functionality is similar to that of readmem(), except that we stop reading
when we find an end-of-string marker than reading 'len' bytes.
This will be useful for reading the name of the 'powerpc' platform which is
needed for dynamic page address definition bits.
Signed-off-by: Suzuki K. Poulose <suzuki@in.ibm.com>
---
makedumpfile.c | 12 ++++++++++++
makedumpfile.h | 1 +
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index 901b85c..e978e1c 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -373,6 +373,18 @@ error:
return FALSE;
}
+int
+read_string(int type_addr, unsigned long long addr, char *buf, size_t len)
+{
+ int i;
+
+ memset(buf, 0, len);
+ for (i = 0; i < len; i ++)
+ if (!readmem(VADDR, addr + i, &buf[i], 1))
+ break;
+ return i;
+}
+
int32_t
get_kernel_version(char *release)
{
diff --git a/makedumpfile.h b/makedumpfile.h
index e43ea84..9dc254e 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -1243,6 +1243,7 @@ extern struct srcfile_table srcfile_table;
int readmem(int type_addr, unsigned long long addr, void *bufptr, size_t size);
+int read_string(int type_addr, unsigned long long addr, char *bufptr, size_t len);
int get_str_osrelease_from_vmlinux(void);
int read_vmcoreinfo_xen(void);
int exclude_xen_user_domain(void);
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2012-02-16 3:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-16 3:35 [PATCH v1 0/4][makedumpfile] vmalloc translation support for PPC32 Suzuki K. Poulose
2012-02-16 3:35 ` Suzuki K. Poulose [this message]
2012-04-20 1:47 ` [PATCH v1 1/4] [makedumpfile] Add read_string routine Atsushi Kumagai
2012-02-16 3:36 ` [PATCH v1 2/4] [makedumpfile][ppc] Generic vmalloc translation support Suzuki K. Poulose
2012-02-16 3:36 ` [PATCH v1 3/4] [makedumpfile][ppc] Define platform descriptors for page translation Suzuki K. Poulose
2012-02-16 3:37 ` [PATCH v1 4/4] [makedumpfile][ppc] PPC44x page translation definitions Suzuki K. Poulose
2012-02-17 0:32 ` [PATCH v1 0/4][makedumpfile] vmalloc translation support for PPC32 Atsushi Kumagai
2012-02-17 5:55 ` Suzuki K. Poulose
2012-02-17 8:39 ` Benjamin Herrenschmidt
2012-02-20 9:56 ` Atsushi Kumagai
2012-02-20 10:31 ` Suzuki K. Poulose
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=20120216033535.7972.21257.stgit@suzukikp \
--to=suzuki@in.ibm.com \
--cc=kexec@lists.infradead.org \
--cc=kumagai-atsushi@mxc.nes.nec.co.jp \
/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