From owner-freebsd-arch Sat Mar 9 20:56:41 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mass.dis.org (dhcp45-21.dis.org [216.240.45.21]) by hub.freebsd.org (Postfix) with ESMTP id 0B93F37B404 for ; Sat, 9 Mar 2002 20:56:38 -0800 (PST) Received: from mass.dis.org (localhost [127.0.0.1]) by mass.dis.org (8.11.6/8.11.6) with ESMTP id g2A4u2j01429; Sat, 9 Mar 2002 20:56:02 -0800 (PST) (envelope-from msmith@mass.dis.org) Message-Id: <200203100456.g2A4u2j01429@mass.dis.org> X-Mailer: exmh version 2.5 07/13/2001 with nmh-1.0.4 To: Luigi Rizzo Cc: arch@freebsd.org Subject: Re: For review: machdep.bootdev sysctl (for i386) In-reply-to: Your message of "Sat, 09 Mar 2002 04:27:28 PST." <20020309042728.A21016@iguana.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 09 Mar 2002 20:56:02 -0800 From: Michael Smith Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > Looking at a way to determine the boot device from userland, > I have come to the conclusion that the most reasonable way is to > export to userland whatever information the kernel has (and this > is machine dependent, sorry!), and let some userland program > (getbootdev(1)) convert it into a reasonable device name. What do you mean by "boot device"? The device from which the initial bootstrap was loaded? The device from which the loader was loaded? The device from which the kernel was loaded? There's really no such thing. > In the i386 case, the relevant information is in the "bootdev" > variable, defined in i386/i386/autoconf.c and initialized > in i386/i386/locore.s This is unreliable; it's usually but not always the BIOS unit number for the "current" disk, which may or may not be any of the above "boot devices". > In the Alpha case, there is no "bootdev" variable, so I need > feedback from Alpha experts on this. There is no way (that I am aware of) to extract the SRM name of the booted device. > Unless someone can suggest a better way (i.e. more general > and as little intrusive -- we are talking about a 3-line change > here!) I would like to commit this simple patch, moving bootdev > (which is currently written in locore.s and unused otherwise) to > machdep.c where the SYSCTL hook exports it. I think that this is not a good way to do things. Exporting this number is not useful, and based on my current reservations, I would strongly oppose any attempt to use it for anything. > As for the userland program to parse machdep.bootdev, for the time > being i am going to write it as part of the picobsd "tinyware", > pending suggestions on the best place to put it. I can't imagine how you plan to do this and make it reliable, since there is no mapping from BIOS unit numbers to BSD devices. In almost any case you are likely to care about, the "boot device" is also the root device. Detecting, let alone doing anything useful about, the other cases is IME an impossible proposition. = Mike -- To announce that there must be no criticism of the president, or that we are to stand by the president, right or wrong, is not only unpatriotic and servile, but is morally treasonable to the American public. - Theodore Roosevelt To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message