From: Andries Brouwer <aebr@win.tue.nl>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Christoph Hellwig <hch@infradead.org>,
Dave Jones <davej@codemonkey.org.uk>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: Fwd: struct inode size reduction.
Date: Mon, 10 Mar 2003 13:05:34 +0100 [thread overview]
Message-ID: <20030310120534.GA4125@win.tue.nl> (raw)
In-Reply-To: <Pine.LNX.4.44.0303101100250.5042-100000@serv>
On Mon, Mar 10, 2003 at 11:58:17AM +0100, Roman Zippel wrote:
> > - error = register_chrdev(driver->major, driver->name, &tty_fops);
> > + error = register_chrdev_region(driver->major, driver->minor_start,
> > + driver->num, driver->name, &tty_fops);
>
> Are that much parameters really needed?
Yes.
If you want to follow Al you would write
MKDEV(driver->major, driver->minor_start)
instead of this
driver->major, driver->minor_start
and you would have one parameter less.
Andries
[I wrote Al and wanted to cc l-k but typoed. Let me copy this letter
for information purposes and to show that we do not want to write MKDEV.]
-------------------------------------------------------------------------
Some more comments on types and their structure.
As you know very well, I had a setup in the ancient times
with a kdev_t that was a pointer, and
#define MINOR(dev) (dev)->minor
That was nice and well - you thought that a refcount
was needed, I thought that with the given rules for use
it was possible to prove that no refcount was needed,
and the discussion was never settled.
If we ever meet FTF we can fight that fight.
In the below I will use kdev_t again, but now with an
entirely different meaning, not a pointer but an
arithmetic type.
User space (programs, file systems) has many dev_t
instances that must remain valid. So, when dev_t
changes size the 16-bit values must keep their old
major and minor. This means that for a dev_t the
operations MINOR, MAJOR, MKDEV are not completely trivial.
They involve tests on whether the value fits into 16 bits.
E.g.
#define MKDEV(ma,mi) ((dev_t)(((((ma) & ~0xff) == 0) && (((mi) & ~0xff) == 0
)) ? (((ma) << 8) | (mi)) : (((ma) << DEV_MINOR_BITS) | (mi))))
This is fine for communication with user space, but inside
the kernel itself we like something that is smaller and faster,
like
#define __mkdev(major, minor) (((major) << KDEV_MINOR_BITS) + (minor))
So inside the kernel we must use kdev_t where user space
uses dev_t. Now both are arithmetic, but the bits are packed
differently.
Now you understand why I would like to remove the MKDEV
that you have in every call of blk_register_region.
Andries
next prev parent reply other threads:[~2003-03-10 11:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-09 13:54 Fwd: struct inode size reduction Dave Jones
2003-03-09 17:13 ` Andries Brouwer
2003-03-09 20:33 ` Dave Jones
2003-03-09 19:55 ` Christoph Hellwig
2003-03-09 20:31 ` Andries Brouwer
2003-03-09 22:18 ` Roman Zippel
2003-03-09 23:08 ` Andries Brouwer
2003-03-10 2:23 ` Alexander Viro
2003-03-10 10:58 ` Roman Zippel
2003-03-10 12:05 ` Andries Brouwer [this message]
2003-03-10 16:25 ` Roman Zippel
2003-03-10 17:32 ` Andries Brouwer
2003-03-10 18:39 ` Roman Zippel
2003-03-09 22:45 ` J.A. Magallon
2003-03-10 0:11 ` Dave Jones
2003-03-09 23:59 ` J.A. Magallon
2003-03-10 5:04 ` Miles Bader
-- strict thread matches above, loose matches on Subject: below --
2003-03-10 9:30 Fwd: " Andries.Brouwer
2003-03-10 9:32 Andries.Brouwer
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=20030310120534.GA4125@win.tue.nl \
--to=aebr@win.tue.nl \
--cc=davej@codemonkey.org.uk \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zippel@linux-m68k.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox