lkml.org 
[lkml]   [2011]   [Aug]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subjectkdev_t.h old major/minor numbers
From
Date

While reading through some of the kernel stuff I noticed that the macros
at the end of include/linux/kdev_t.h were out-of-sync with the macros at
the top. I'm not certain when/if they would ever be defined and not the
other ones (I'm very new to the kernel), but I would assume that they
shouldn't be using the old 255-number system.

Was this just an oversight or is there something else going on?

Patch:

--- linux/include/linux/kdev_t.h 2011-05-19 00:06:34.000000000 -0400
+++ git/include/linux/kdev_t.h. 2011-08-10 03:19:10.228987057 -0400
@@ -93,8 +93,11 @@
Some programs want their definitions of MAJOR and MINOR and MKDEV
from the kernel sources. These must be the externally visible ones.
*/
-#define MAJOR(dev) ((dev)>>8)
-#define MINOR(dev) ((dev) & 0xff)
-#define MKDEV(ma,mi) ((ma)<<8 | (mi))
+#define MINORBITS 20
+#define MINORMASK ((1U << MINORBITS) - 1)
+
+#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
+#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
+#define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi))
#endif /* __KERNEL__ */
#endif
--
Corey Richardson
"Those who deny freedom to others, deserve it not for themselves"
-- Abraham Lincoln

\
 
 \ /
  Last update: 2011-08-10 10:25    [W:0.036 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site