Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Feb 2003 19:56:16 +0100
From:      phk@phk.freebsd.dk
To:        Alfred Perlstein <bright@mu.org>
Cc:        src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern kern_conf.c src/sys/sys conf.h 
Message-ID:  <9124.1046372176@critter.freebsd.dk>
In-Reply-To: Your message of "Thu, 27 Feb 2003 10:43:58 PST." <20030227184358.GC7206@elvis.mu.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <20030227184358.GC7206@elvis.mu.org>, Alfred Perlstein writes:
>* Poul-Henning Kamp <phk@FreeBSD.org> [030227 06:47] wrote:
>> phk         2003/02/27 06:46:51 PST
>> 
>>   Modified files:
>>     sys/kern             kern_conf.c 
>>     sys/sys              conf.h 
>>   Log:
>>   
>>   Major numbers are not reclaimed, so loading/unloading the same
>>   device driver which uses MAJOR_AUTO will eventually deplete the
>>   pool of free major numbers and the system will panic when it can
>>   not allocate one.  Still undecided who to invonvenience with the
>>   solution to this.
>
>Perhaps if you remebered the name assigned and it came back again you
>could assign the old major?

The simple and effective solution is to refcount cdevsw structures
from make_dev(+) and destroy_dev(-) calls and when the count goes
to zero reclaim the major number.  I experiment with this already
here, but it has some locking implications which forces me to
reconsider the self-locking structure of kern_conf.c and devfs and
that makes the otherwise rather simple task non-simple.  I'll get
there eventually though.

The other issue which I am pondering is a way to share major# for
devices which don't care about which exact minor# they get.  Typical
examples being /dev/ccd.ctl and /dev/geom.ctl, wasting an entire
major number for each of those is silly.

I may introduce a different magic marker which says "allocate me
both a major and minor" which would allow these kinds of devices
to share one major number.

-- 
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 cvs-src" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9124.1046372176>