From owner-freebsd-arch Sat Mar 9 4:27:33 2002 Delivered-To: freebsd-arch@freebsd.org Received: from iguana.icir.org (iguana.icir.org [192.150.187.36]) by hub.freebsd.org (Postfix) with ESMTP id 2B5A337B416 for ; Sat, 9 Mar 2002 04:27:29 -0800 (PST) Received: (from rizzo@localhost) by iguana.icir.org (8.11.6/8.11.3) id g29CRS321269; Sat, 9 Mar 2002 04:27:28 -0800 (PST) (envelope-from rizzo) Date: Sat, 9 Mar 2002 04:27:28 -0800 From: Luigi Rizzo To: arch@freebsd.org Subject: For review: machdep.bootdev sysctl (for i386) Message-ID: <20020309042728.A21016@iguana.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.23i 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. 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 In the Alpha case, there is no "bootdev" variable, so I need feedback from Alpha experts on this. 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. 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. There are several options I can think of, including putting some special code in sysctl to handle it, much in the same way that is used for some opaque sysctl variables. cheers luigi ndex: autoconf.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/autoconf.c,v retrieving revision 1.161 diff -u -r1.161 autoconf.c --- autoconf.c 28 Feb 2002 03:07:35 -0000 1.161 +++ autoconf.c 9 Mar 2002 11:57:21 -0000 @@ -238,8 +238,6 @@ } SYSINIT(cpu_rootconf, SI_SUB_ROOT_CONF, SI_ORDER_FIRST, cpu_rootconf, NULL) -u_long bootdev = 0; /* not a dev_t - encoding is different */ - #if defined(NFSCLIENT) && defined(NFS_ROOT) && !defined(BOOTP_NFSROOT) static int Index: machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v retrieving revision 1.501 diff -u -r1.501 machdep.c --- machdep.c 8 Mar 2002 14:31:12 -0000 1.501 +++ machdep.c 9 Mar 2002 12:13:55 -0000 @@ -985,6 +985,10 @@ SYSCTL_INT(_machdep, CPU_WALLCLOCK, wall_cmos_clock, CTLFLAG_RW, &wall_cmos_clock, 0, ""); +u_long bootdev; /* not a dev_t - encoding is different */ +SYSCTL_ULONG(_machdep, OID_AUTO, bootdev, + CTLFLAG_RD, &bootdev, 0, "Boot device (not in dev_t format)"); + /* * Initialize 386 and configure to run kernel */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message