From owner-cvs-all Thu Feb 27 10:56:20 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1E82B37B401; Thu, 27 Feb 2003 10:56:18 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2AA3C43FB1; Thu, 27 Feb 2003 10:56:17 -0800 (PST) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id h1RIuGaa009125; Thu, 27 Feb 2003 19:56:16 +0100 (CET) (envelope-from phk@phk.freebsd.dk) To: Alfred Perlstein 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 From: phk@phk.freebsd.dk In-Reply-To: Your message of "Thu, 27 Feb 2003 10:43:58 PST." <20030227184358.GC7206@elvis.mu.org> Date: Thu, 27 Feb 2003 19:56:16 +0100 Message-ID: <9124.1046372176@critter.freebsd.dk> Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <20030227184358.GC7206@elvis.mu.org>, Alfred Perlstein writes: >* Poul-Henning Kamp [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-all" in the body of the message