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/6] libmtd: rename functions from mtd_* to libmtd_*
Date: Fri, 15 Feb 2013 09:04:54 +0100	[thread overview]
Message-ID: <1360915499-1659-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1360915499-1659-1-git-send-email-s.hauer@pengutronix.de>

The kernel nowadays has mtd_read/write and other functions. In
barebox we also have these functions, but with a different prototype,
namely they correspond to the libmtd userspace functions. Rename
these functions to libmtd_* to avoid name clashes with future mtd
updates.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/ubiformat.c |    8 ++++----
 include/mtd/libmtd.h |    8 ++++----
 lib/libmtd.c         |   14 +++++++-------
 lib/libscan.c        |    2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/commands/ubiformat.c b/commands/ubiformat.c
index 3bb2c9a..f47502f 100644
--- a/commands/ubiformat.c
+++ b/commands/ubiformat.c
@@ -338,7 +338,7 @@ static int flash_image(const struct mtd_dev_info *mtd,
 			normsg_cont("eraseblock %d: erase", eb);
 		}
 
-		err = mtd_erase(mtd, args.node_fd, eb);
+		err = libmtd_erase(mtd, args.node_fd, eb);
 		if (err) {
 			if (!args.quiet)
 				printf("\n");
@@ -384,7 +384,7 @@ static int flash_image(const struct mtd_dev_info *mtd,
 
 		new_len = drop_ffs(mtd, buf, mtd->eb_size);
 
-		err = mtd_write(mtd, args.node_fd, eb, 0, buf, new_len);
+		err = libmtd_write(mtd, args.node_fd, eb, 0, buf, new_len);
 		if (err) {
 			sys_errmsg("cannot write eraseblock %d", eb);
 
@@ -453,7 +453,7 @@ static int format(const struct mtd_dev_info *mtd,
 			normsg_cont("eraseblock %d: erase", eb);
 		}
 
-		err = mtd_erase(mtd, args.node_fd, eb);
+		err = libmtd_erase(mtd, args.node_fd, eb);
 		if (err) {
 			if (!args.quiet)
 				printf("\n");
@@ -484,7 +484,7 @@ static int format(const struct mtd_dev_info *mtd,
 			printf(", write EC %lld\n", ec);
 		}
 
-		err = mtd_write(mtd, args.node_fd, eb, 0, hdr, write_size);
+		err = libmtd_write(mtd, args.node_fd, eb, 0, hdr, write_size);
 		if (err) {
 			if (!args.quiet && !args.verbose)
 				printf("\n");
diff --git a/include/mtd/libmtd.h b/include/mtd/libmtd.h
index e88a9a2..65c390a 100644
--- a/include/mtd/libmtd.h
+++ b/include/mtd/libmtd.h
@@ -69,7 +69,7 @@ struct mtd_dev_info
 int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd);
 
 /**
- * mtd_erase - erase an eraseblock.
+ * libmtd_erase - erase an eraseblock.
  * @desc: MTD library descriptor
  * @mtd: MTD device description object
  * @fd: MTD device node file descriptor
@@ -78,7 +78,7 @@ int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd);
  * This function erases eraseblock @eb of MTD device described by @fd. Returns
  * %0 in case of success and %-1 in case of failure.
  */
-int mtd_erase(const struct mtd_dev_info *mtd, int fd, int eb);
+int libmtd_erase(const struct mtd_dev_info *mtd, int fd, int eb);
 
 /**
  * mtd_torture - torture an eraseblock.
@@ -127,7 +127,7 @@ int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb);
  * of the MTD device defined by @mtd and stores the read data at buffer @buf.
  * Returns %0 in case of success and %-1 in case of failure.
  */
-int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+int libmtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
 	     void *buf, int len);
 
 /**
@@ -143,7 +143,7 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
  * of the MTD device defined by @mtd. Returns %0 in case of success and %-1 in
  * case of failure.
  */
-int mtd_write(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+int libmtd_write(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
 	      void *buf, int len);
 
 #endif /* __LIBMTD_H__ */
diff --git a/lib/libmtd.c b/lib/libmtd.c
index 8c4152e..eecc760 100644
--- a/lib/libmtd.c
+++ b/lib/libmtd.c
@@ -56,7 +56,7 @@ static int mtd_valid_erase_block(const struct mtd_dev_info *mtd, int eb)
 	return 0;
 }
 
-int mtd_erase(const struct mtd_dev_info *mtd, int fd, int eb)
+int libmtd_erase(const struct mtd_dev_info *mtd, int fd, int eb)
 {
 	int ret;
 	struct erase_info_user ei;
@@ -107,12 +107,12 @@ int mtd_torture(const struct mtd_dev_info *mtd, int fd, int eb)
 	buf = xmalloc(mtd->eb_size);
 
 	for (i = 0; i < patt_count; i++) {
-		err = mtd_erase(mtd, fd, eb);
+		err = libmtd_erase(mtd, fd, eb);
 		if (err)
 			goto out;
 
 		/* Make sure the PEB contains only 0xFF bytes */
-		err = mtd_read(mtd, fd, eb, 0, buf, mtd->eb_size);
+		err = libmtd_read(mtd, fd, eb, 0, buf, mtd->eb_size);
 		if (err)
 			goto out;
 
@@ -125,12 +125,12 @@ int mtd_torture(const struct mtd_dev_info *mtd, int fd, int eb)
 
 		/* Write a pattern and check it */
 		memset(buf, patterns[i], mtd->eb_size);
-		err = mtd_write(mtd, fd, eb, 0, buf, mtd->eb_size);
+		err = libmtd_write(mtd, fd, eb, 0, buf, mtd->eb_size);
 		if (err)
 			goto out;
 
 		memset(buf, ~patterns[i], mtd->eb_size);
-		err = mtd_read(mtd, fd, eb, 0, buf, mtd->eb_size);
+		err = libmtd_read(mtd, fd, eb, 0, buf, mtd->eb_size);
 		if (err)
 			goto out;
 
@@ -191,7 +191,7 @@ int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb)
 	return 0;
 }
 
-int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+int libmtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
 	     void *buf, int len)
 {
 	int ret, rd = 0;
@@ -225,7 +225,7 @@ int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
 	return 0;
 }
 
-int mtd_write(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
+int libmtd_write(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
 	      void *buf, int len)
 {
 	int ret;
diff --git a/lib/libscan.c b/lib/libscan.c
index af55269..c59acfa 100644
--- a/lib/libscan.c
+++ b/lib/libscan.c
@@ -90,7 +90,7 @@ int libscan_ubi_scan(struct mtd_dev_info *mtd, int fd, struct ubi_scan_info **in
 			continue;
 		}
 
-		ret = mtd_read(mtd, fd, eb, 0, &ech, sizeof(struct ubi_ec_hdr));
+		ret = libmtd_read(mtd, fd, eb, 0, &ech, sizeof(struct ubi_ec_hdr));
 		if (ret < 0)
 			goto out_ec;
 
-- 
1.7.10.4


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

  reply	other threads:[~2013-02-15  8:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15  8:04 [PATCH] integrate CFI Flash driver into mtd Sascha Hauer
2013-02-15  8:04 ` Sascha Hauer [this message]
2013-02-15  8:04 ` [PATCH 2/6] mtd: rename mtd file operations callback functions Sascha Hauer
2013-02-15  8:04 ` [PATCH 3/6] mtd: Add mtd_* functions Sascha Hauer
2013-02-15  8:04 ` [PATCH 4/6] mtd: Use mtd_* functions where appropriate Sascha Hauer
2013-02-15  8:04 ` [PATCH 5/6] mtd: implement mtd_lock and mtd_unlock Sascha Hauer
2013-02-15  8:04 ` [PATCH 6/6] nor flash: integrate into mtd Sascha Hauer
2013-02-15  8:11 ` [PATCH] " Sascha Hauer
2013-02-15  8:12   ` Sascha Hauer
2013-02-17 10:59     ` Alexander Aring
2013-02-18 10:24       ` Sascha Hauer
2013-02-19 13:23         ` Alexander Aring
2013-02-19 18:45           ` 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=1360915499-1659-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