]> www.infradead.org Git - mtd-utils.git/commitdiff
libmtd: Variable name same as function name causing compile to fail (Android)
authorThomas Cannon <mail@thomascannon.net>
Mon, 9 Jan 2012 16:20:53 +0000 (16:20 +0000)
committerArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Fri, 13 Jan 2012 21:56:56 +0000 (23:56 +0200)
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 <mail at thomascannon.net>
Cc: linux-mtd at lists.infradead.org
lib/libmtd.c

index 9b247ae8a65097a6520ebf8be73d1e67633eab9e..c6e5b208420d130895b390c53e1409d1b4104d77 100644 (file)
@@ -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;
        }