Patchwork [7/7] jffs2reader: use major() and minor() helpers

login
register
mail settings
Submitter Andy Shevchenko
Date Sept. 19, 2011, 11:25 a.m.
Message ID <61bffdc106e852ca1fe209942b057ece9e4e9c36.1316431431.git.andriy.shevchenko@linux.intel.com>
Download mbox | patch
Permalink /patch/115399/
State Accepted
Commit 36d8de81049c9c908740b690c664b5bd3703ccd6
Headers show

Comments

Andy Shevchenko - Sept. 19, 2011, 11:25 a.m.
There are major() and minor() helpers in the standard library. We can use them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 jffs2reader.c |    9 +--------
 1 files changed, 1 insertions(+), 8 deletions(-)

Patch

diff --git a/jffs2reader.c b/jffs2reader.c
index 238e617..11a46eb 100644
--- a/jffs2reader.c
+++ b/jffs2reader.c
@@ -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));
 		}