mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/7] memory commands: export common functions
Date: Wed, 17 Apr 2013 13:39:02 +0200	[thread overview]
Message-ID: <1366198748-22717-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1366198748-22717-1-git-send-email-s.hauer@pengutronix.de>

The memory commands all use open_and_lseek and mem_parse_options. Export
them to be able to split the memory commands into separate files.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/mem.c   | 8 ++++++--
 include/common.h | 4 ++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/commands/mem.c b/commands/mem.c
index 51aa04d..f25c6b6 100644
--- a/commands/mem.c
+++ b/commands/mem.c
@@ -112,7 +112,7 @@ int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab)
 	return 0;
 }
 
-static int open_and_lseek(const char *filename, int mode, loff_t pos)
+int open_and_lseek(const char *filename, int mode, loff_t pos)
 {
 	int fd, ret;
 
@@ -135,7 +135,11 @@ static int open_and_lseek(const char *filename, int mode, loff_t pos)
 	return fd;
 }
 
-static int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
+/*
+ * Common function for parsing options for the 'md', 'mw', 'memcpy', 'memcmp'
+ * commands.
+ */
+int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
 		char **sourcefile, char **destfile, int *swab)
 {
 	int opt;
diff --git a/include/common.h b/include/common.h
index e559b94..2263c00 100644
--- a/include/common.h
+++ b/include/common.h
@@ -221,6 +221,10 @@ int run_shell(void);
 
 int memory_display(char *addr, loff_t offs, ulong nbytes, int size, int swab);
 
+int mem_parse_options(int argc, char *argv[], char *optstr, int *mode,
+		char **sourcefile, char **destfile, int *swab);
+int open_and_lseek(const char *filename, int mode, loff_t pos);
+
 extern const char version_string[];
 #ifdef CONFIG_BANNER
 void barebox_banner(void);
-- 
1.8.2.rc2


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

  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 ` Sascha Hauer [this message]
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 ` [PATCH 5/7] memory commands: make rw_buf global Sascha Hauer
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-2-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