From bacf173c87a936858125d3248067329c5b069e58 Mon Sep 17 00:00:00 2001 From: Thomas Cannon Date: Mon, 9 Jan 2012 16:20:53 +0000 Subject: libmtd: Variable name same as function name causing compile to fail (Android) When compiling mtd-utils against Android's bionic libc using the supplied cross compiler environment it errors: lib/libmtd.c: In function 'dev_node2num': lib/libmtd.c:444: error: called object 'major' is not a function lib/libmtd.c:445: error: called object 'minor' is not a function lib/libmtd.c: In function 'mtd_probe_node': lib/libmtd.c:1384: error: called object 'major' is not a function lib/libmtd.c:1385: error: called object 'minor' is not a function This patch updates the variable names for "major" and "minor" in two places. It then compiles cleanly. Artem: pick different names, also rename major1/minor1 variables for consistency. Signed-off-by: Thomas Cannon Cc: linux-mtd at lists.infradead.org --- lib/libmtd.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lib') diff --git a/lib/libmtd.c b/lib/libmtd.c index 9b247ae..c6e5b20 100644 --- a/lib/libmtd.c +++ b/lib/libmtd.c @@ -429,7 +429,7 @@ static int type_str2int(const char *str) static int dev_node2num(struct libmtd *lib, const char *node, int *mtd_num) { struct stat st; - int i, major, minor; + int i, mjr, mnr; struct mtd_info info; if (stat(node, &st)) @@ -441,16 +441,16 @@ static int dev_node2num(struct libmtd *lib, const char *node, int *mtd_num) return -1; } - major = major(st.st_rdev); - minor = minor(st.st_rdev); + mjr = major(st.st_rdev); + mnr = minor(st.st_rdev); if (mtd_get_info((libmtd_t *)lib, &info)) return -1; for (i = info.lowest_mtd_num; i <= info.highest_mtd_num; i++) { - int major1, minor1, ret; + int mjr1, mnr1, ret; - ret = dev_get_major(lib, i, &major1, &minor1); + ret = dev_get_major(lib, i, &mjr1, &mnr1); if (ret) { if (errno == ENOENT) continue; @@ -459,7 +459,7 @@ static int dev_node2num(struct libmtd *lib, const char *node, int *mtd_num) return -1; } - if (major1 == major && minor1 == minor) { + if (mjr1 == mjr && mnr1 == mnr) { errno = 0; *mtd_num = i; return 0; @@ -1369,7 +1369,7 @@ int mtd_probe_node(libmtd_t desc, const char *node) { struct stat st; struct mtd_info info; - int i, major, minor; + int i, mjr, mnr; struct libmtd *lib = (struct libmtd *)desc; if (stat(node, &st)) @@ -1381,8 +1381,8 @@ int mtd_probe_node(libmtd_t desc, const char *node) return -1; } - major = major(st.st_rdev); - minor = minor(st.st_rdev); + mjr = major(st.st_rdev); + mnr = minor(st.st_rdev); if (mtd_get_info((libmtd_t *)lib, &info)) return -1; @@ -1391,9 +1391,9 @@ int mtd_probe_node(libmtd_t desc, const char *node) return 0; for (i = info.lowest_mtd_num; i <= info.highest_mtd_num; i++) { - int major1, minor1, ret; + int mjr1, mnr1, ret; - ret = dev_get_major(lib, i, &major1, &minor1); + ret = dev_get_major(lib, i, &mjr1, &mnr1); if (ret) { if (errno == ENOENT) continue; @@ -1402,7 +1402,7 @@ int mtd_probe_node(libmtd_t desc, const char *node) return -1; } - if (major1 == major && minor1 == minor) + if (mjr1 == mjr && mnr1 == mnr) return 1; } -- cgit v1.2.3