All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Richardson <kb1pkl@aim.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Subject: kdev_t.h old major/minor numbers
Date: Wed, 10 Aug 2011 04:21:15 -0400	[thread overview]
Message-ID: <1312964160-sup-7942@hpsetup> (raw)


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

             reply	other threads:[~2011-08-10  8:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10  8:21 Corey Richardson [this message]
2011-08-10 15:19 ` kdev_t.h old major/minor numbers Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1312964160-sup-7942@hpsetup \
    --to=kb1pkl@aim.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.