9
0
Fork 0

libmtd: rename functions from mtd_* to libmtd_*

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>
This commit is contained in:
Sascha Hauer 2013-02-14 10:16:15 +01:00
parent a40e76cebc
commit 3930f38028
4 changed files with 16 additions and 16 deletions

View File

@ -338,7 +338,7 @@ static int flash_image(const struct mtd_dev_info *mtd,
normsg_cont("eraseblock %d: erase", eb); 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 (err) {
if (!args.quiet) if (!args.quiet)
printf("\n"); 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); 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) { if (err) {
sys_errmsg("cannot write eraseblock %d", eb); 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); 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 (err) {
if (!args.quiet) if (!args.quiet)
printf("\n"); printf("\n");
@ -484,7 +484,7 @@ static int format(const struct mtd_dev_info *mtd,
printf(", write EC %lld\n", ec); 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 (err) {
if (!args.quiet && !args.verbose) if (!args.quiet && !args.verbose)
printf("\n"); printf("\n");

View File

@ -69,7 +69,7 @@ struct mtd_dev_info
int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd); 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 * @desc: MTD library descriptor
* @mtd: MTD device description object * @mtd: MTD device description object
* @fd: MTD device node file descriptor * @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 * This function erases eraseblock @eb of MTD device described by @fd. Returns
* %0 in case of success and %-1 in case of failure. * %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. * 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. * 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. * 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); 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 * of the MTD device defined by @mtd. Returns %0 in case of success and %-1 in
* case of failure. * 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); void *buf, int len);
#endif /* __LIBMTD_H__ */ #endif /* __LIBMTD_H__ */

View File

@ -56,7 +56,7 @@ static int mtd_valid_erase_block(const struct mtd_dev_info *mtd, int eb)
return 0; 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; int ret;
struct erase_info_user ei; 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); buf = xmalloc(mtd->eb_size);
for (i = 0; i < patt_count; i++) { for (i = 0; i < patt_count; i++) {
err = mtd_erase(mtd, fd, eb); err = libmtd_erase(mtd, fd, eb);
if (err) if (err)
goto out; goto out;
/* Make sure the PEB contains only 0xFF bytes */ /* 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) if (err)
goto out; 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 */ /* Write a pattern and check it */
memset(buf, patterns[i], mtd->eb_size); 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) if (err)
goto out; goto out;
memset(buf, ~patterns[i], mtd->eb_size); 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) if (err)
goto out; goto out;
@ -191,7 +191,7 @@ int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb)
return 0; 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) void *buf, int len)
{ {
int ret, rd = 0; 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; 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) void *buf, int len)
{ {
int ret; int ret;

View File

@ -90,7 +90,7 @@ int libscan_ubi_scan(struct mtd_dev_info *mtd, int fd, struct ubi_scan_info **in
continue; 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) if (ret < 0)
goto out_ec; goto out_ec;