From owner-freebsd-alpha Fri Mar 23 21:20:13 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 0B5D037B718 for ; Fri, 23 Mar 2001 21:20:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2O5K2T88210; Fri, 23 Mar 2001 21:20:02 -0800 (PST) (envelope-from gnats) Date: Fri, 23 Mar 2001 21:20:02 -0800 (PST) Message-Id: <200103240520.f2O5K2T88210@freefall.freebsd.org> To: freebsd-alpha@freebsd.org Cc: From: John Baldwin Subject: RE: alpha/26042: dev_t size mismatch for DEC Alpha CPUs - kernel Reply-To: John Baldwin Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR alpha/26042; it has been noted by GNATS. From: John Baldwin To: leclercn@videotron.ca Cc: freebsd-gnats-submit@FreeBSD.org, phk@FreeBSD.org Subject: RE: alpha/26042: dev_t size mismatch for DEC Alpha CPUs - kernel Date: Fri, 23 Mar 2001 21:16:38 -0800 (PST) On 24-Mar-01 leclercn@videotron.ca wrote: > >>Number: 26042 >>Category: alpha >>Synopsis: dev_t size mismatch for DEC Alpha CPUs - kernel / userland >>Confidential: no >>Severity: serious >>Priority: medium >>Responsible: freebsd-alpha >>State: open >>Quarter: >>Keywords: >>Date-Required: >>Class: sw-bug >>Submitter-Id: current-users >>Arrival-Date: Fri Mar 23 20:50:00 PST 2001 >>Closed-Date: >>Last-Modified: >>Originator: Normand Leclerc >>Release: 4.2 stable cvsed 23rd March >>Organization: >>Environment: > FreeBSD atom.quanta.ca 4.3-RC FreeBSD 4.3-RC #3: Fri Mar 23 22:41:15 EST 2001 > root@atom.quanta.ca:/usr/src/sys/compile/ATOM alpha >>Description: > I Had problems with vinum. While debugging, I found that the disk > structure of vinum had a size mismatch between kernel module and userland. I > investigated and found that dev_t is a 64bits in kernel but 32 bits in > userland. (/usr/src/sys/sys/types.h). > > Once dev_t is converted to 64 bits for userland, vinum works perfectly. > This will affect more than just vinum. >>How-To-Repeat: > On an Alpha machine, vinum can't print configuration when one exists. When > vinum attempts to create a configuration, it will fail. >>Fix: > In /usr/src/sys/sys/types.h, I changed the line > > typedef u_int32_t dev_t; /* device number */ > > to > >#ifdef __alpha__ > typedef u_int64_t dev_t; /* device number */ >#else > typedef u_int32_t dev_t; /* device number */ >#endif Like Drew mentioned, it should be uintptr_t, but I'm curious how dev_t's could have ever worked on the alpha? Unless this is the user dev_t and thus shouldn't need changing? Poul? Is vinum not using udev2dev(), etc. properly or something? Hmm, that seems somewhat likely actually. Vinum should be using what is a udev_t in the kernel whenever it exports data to userland. dev_t in the kernel is a pointer: #ifdef _KERNEL typedef u_int32_t udev_t; /* device number */ typedef struct specinfo *dev_t; #else /* !_KERNEL */ typedef u_int32_t dev_t; /* device number */ #define udev_t dev_t #endif However, dev_t in userland == udev_t in the kernel, and they are both the same type, so if vinum is properly handling kernel -> userland transitions this shouldn't be a problem. This sounds more like a bug in vinum. I'm sure Poul will correct me if I'm wrong. :) (And it's probably a bug in the kernel side of vinum rather than the user side.) -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message