Re: [CFT] more kdev_t-ectomy

Andries Brouwer (aebr@win.tue.nl)
Sun, 20 Apr 2003 18:00:34 +0200


On Sun, Apr 20, 2003, viro@parcelfarce.linux.theplanet.co.uk
wrote:

[lots of useful stuff].

Happy Easter!

Concerning kdev_t vs dev_t, probably I said this before, but just to be sure:

Long ago the purpose of kdev_t was to become a pointer. Roughly speaking
we got that pointer, only it is called struct gendisk * today.

Today the purpose of kdev_t is to be a form of dev_t: taking the minor
of a kdev_t is just taking the lower 32 bits, no tests, no branches;
taking the minor of a dev_t requires tests and branches - more code,
slower code.

So, the interface with filesystems and with userspace has dev_t.
For kernel-internal numbers kdev_t is better than dev_t.

Of course it may be possible to avoid kernel-internal numbers altogether.
Sometimes that is an improvement, sometimes not. Pointers are more
complicated than numbers - they point at something that must be allocated
and freed and reference counted. A number is like a pointer without the
reference counting.

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/