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);
}
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");

View File

@ -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__ */

View File

@ -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;

View File

@ -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;