From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 5/7] memory commands: make rw_buf global
Date: Wed, 17 Apr 2013 13:39:06 +0200 [thread overview]
Message-ID: <1366198748-22717-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1366198748-22717-1-git-send-email-s.hauer@pengutronix.de>
The rw_buf is used by several memory commands. Make it global since
we want to split the memory commands into separate files. Also rename
it to mem_rw_buf.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
commands/mem.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/commands/mem.c b/commands/mem.c
index 5bef3f7..a531bd5 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -39,7 +39,7 @@
#define PRINTF(fmt,args...)
#endif
-static char *rw_buf;
+char *mem_rw_buf;
static char *DEVMEM = "/dev/mem";
@@ -135,7 +135,7 @@ static int do_mem_md(int argc, char *argv[])
do {
now = min(size, (loff_t)RW_BUF_SIZE);
- r = read(fd, rw_buf, now);
+ r = read(fd, mem_rw_buf, now);
if (r < 0) {
perror("read");
goto out;
@@ -143,7 +143,7 @@ static int do_mem_md(int argc, char *argv[])
if (!r)
goto out;
- if ((ret = memory_display(rw_buf, start, r,
+ if ((ret = memory_display(mem_rw_buf, start, r,
mode >> O_RWSIZE_SHIFT, swab)))
goto out;
@@ -306,7 +306,7 @@ static int do_mem_cmp(int argc, char *argv[])
now = min((loff_t)RW_BUF_SIZE, count);
- r1 = read(sourcefd, rw_buf, now);
+ r1 = read(sourcefd, mem_rw_buf, now);
if (r1 < 0) {
perror("read");
goto out;
@@ -324,7 +324,7 @@ static int do_mem_cmp(int argc, char *argv[])
}
for (i = 0; i < now; i++) {
- if (rw_buf[i] != rw_buf1[i]) {
+ if (mem_rw_buf[i] != rw_buf1[i]) {
printf("files differ at offset %d\n", offset);
goto out;
}
@@ -412,7 +412,7 @@ static int do_mem_cp(int argc, char *argv[])
now = min((loff_t)RW_BUF_SIZE, count);
- r = read(sourcefd, rw_buf, now);
+ r = read(sourcefd, mem_rw_buf, now);
if (r < 0) {
perror("read");
goto out;
@@ -424,7 +424,7 @@ static int do_mem_cp(int argc, char *argv[])
tmp = 0;
now = r;
while (now) {
- w = write(destfd, rw_buf + tmp, now);
+ w = write(destfd, mem_rw_buf + tmp, now);
if (w < 0) {
perror("write");
goto out;
@@ -566,8 +566,8 @@ static struct driver_d mem_drv = {
static int mem_init(void)
{
- rw_buf = malloc(RW_BUF_SIZE);
- if(!rw_buf)
+ mem_rw_buf = malloc(RW_BUF_SIZE);
+ if(!mem_rw_buf)
return -ENOMEM;
add_mem_device("mem", 0, ~0, IORESOURCE_MEM_WRITEABLE);
--
1.8.2.rc2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-04-17 11:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-17 11:39 [PATCH] memory commands Sascha Hauer
2013-04-17 11:39 ` [PATCH 1/7] memory commands: export common functions Sascha Hauer
2013-04-17 11:39 ` [PATCH 2/7] memory commands: move memory_display to separate file Sascha Hauer
2013-04-17 11:39 ` [PATCH 3/7] Use a common define for RW_BUF_SIZE Sascha Hauer
2013-04-17 11:39 ` [PATCH 4/7] memory commands: cleanup initialization Sascha Hauer
2013-04-17 11:39 ` Sascha Hauer [this message]
2013-04-17 11:39 ` [PATCH 6/7] memory commands: separate into one file per command Sascha Hauer
2013-04-17 11:39 ` [PATCH 7/7] Add memory modify command (mm) Sascha Hauer
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=1366198748-22717-6-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/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