Date: Wed, 26 Feb 2003 22:33:48 +0100 From: Poul-Henning Kamp <phk@phk.freebsd.dk> To: arch@freebsd.org Subject: (almost) Ready to ditch device major numbers. Message-ID: <28750.1046295228@critter.freebsd.dk>
next in thread | raw e-mail | index | archive | help
We are now (almost) ready to ditch device major numbers if we want to. For POSIXMISTAKE like reasons we cannot abolish major-minor numbers entirely, but at least we can automate them enough to make them a non-pain. There are some things we can _not_ do, the main one being assign the same major-minor tupple to two devices at the same time. Since the minor is under control of the device driver, this more or less means that we cannot automagically share major numbers between two or more different cdevsw structurs. We will therefore still have a limit of <256 device drivers until we also tackle minor-number assignment (something which is much harder and much more intrusive and therefore maybe not even feasible) but at least the limit will be "256 loaded drivers" and not "256 drivers for which we have assigned minor numbers. Here is a suggested sequence of events, not a timeline by any strech of the imagination, merely things we can do and the order we can do them in: 1) Build a bitmap of registered majors (from conf/majors) at kernel-compile so the kernel can know which majors we can risk KLD's to use. 2) Introduce "MAJOR_AUTO" or similar for use in cdevsw structures. This should autoallocate the highest free major number for that cdevsw without people having to go to the trouble of registering a number from sys/conf/majors. The major number will be non-persistent and will vary from boot to boot. Tools like tripwire will hate us for it, but such tools need to learn about DEVFS anyway. 3) Stop allocating major numbers from conf/majors, unless very special requirements mandate they have to be static across boots and systems. 4) Start actively revoking registrations from conf/majors for in-our-tree drivers which works just great with MAJOR_AUTO. 5) Remove the d_maj field from struct cdevsw entirely and make dynamic allocation the default. Comments welcome. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?28750.1046295228>