]> www.infradead.org Git - mtd-utils.git/commitdiff
jffs2reader: use major() and minor() helpers
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 19 Sep 2011 11:25:24 +0000 (14:25 +0300)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 21 Sep 2011 06:35:04 +0000 (09:35 +0300)
There are major() and minor() helpers in the standard library. We can use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
jffs2reader.c

index 501b6bf313699dee3a710d9df47274b45db3532e..5231ff0db04868590ce0dedadf7292ef397d8a03 100644 (file)
@@ -81,13 +81,6 @@ BUGS:
 
 #define SCRATCH_SIZE (5*1024*1024)
 
-#ifndef MAJOR
-/* FIXME:  I am using illicit insider knowledge of
- * kernel major/minor representation...  */
-#define MAJOR(dev) (((dev)>>8)&0xff)
-#define MINOR(dev) ((dev)&0xff)
-#endif
-
 /* macro to avoid "lvalue required as left operand of assignment" error */
 #define ADD_BYTES(p, n)                ((p) = (typeof(p))((char *)(p) + (n)))
 
@@ -362,7 +355,7 @@ void printdir(char *o, size_t size, struct dir *d, const char *path, int recurse
                        dev_t rdev;
                        size_t devsize;
                        putblock((char*)&rdev, sizeof(rdev), &devsize, ri);
-                       printf("%4d, %3d ", (int)MAJOR(rdev), (int)MINOR(rdev));
+                       printf("%4d, %3d ", major(rdev), minor(rdev));
                } else {
                        printf("%9ld ", (long)je32_to_cpu(ri->dsize));
                }