Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Mar 2001 10:57:55 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Greg Lehey <grog@lemis.com>
Cc:        leclercn@videotron.ca, freebsd-alpha@FreeBSD.org, Mike Smith <msmith@FreeBSD.org>, phk@FreeBSD.org
Subject:   Re: dev_t size mismatch kernel / userland
Message-ID:  <XFMail.010326105755.jhb@FreeBSD.org>
In-Reply-To: <20010326103622.H40349@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 26-Mar-01 Greg Lehey wrote:
> On Friday, 23 March 2001 at 21:45:12 -0800, John Baldwin wrote:
>>
>> On 24-Mar-01 Mike Smith wrote:
>>>>   Already tried vinum, works fine after modification of dev_t to
>>>> u_int64_t.  I'll change it to uintptr_t tough (cleaner).  Hope this gets
>>>> fixed!
>>>
>>> This is wrong.  In the kernel or in a module, dev_t is an opaque type.
>>> In userspace, you use udev_t, not dev_t.
>>>
>>> It sounds like vinum is failing to perform the required conversions when
>>> exchanging a dev_t with userland, and the correct fix is going to be to
>>> add these.
>>
>> struct drive, struct plex, etc. are shared between userland and the kernel. 
>> It
>> looks like they need to use a udev_t, and the kernel will always have to do
>> udev2dev() before using them.  Either that or don't export the structures to
>> userland.
> 
> I already had code under way to export expurgated versions of these
> structs.  But that's a separate issue.  It seems to me that if dev_t
> is even visible in userland header files, it should be correct.  We
> should either fix it or remove it.

This will probably make Poul's head spin, but one idea might be to have a
kdev_t type. :-P  In the kernel kdev_t == dev_t, and in userland, kdev_t is a
void *.  This would work in this case I think because you never use the dev_t's
while in userland.  I do like exporting trimmed down structures, however. 
Please don't export mutexes while you are at it. :-P

-- 

John Baldwin <jhb@FreeBSD.org> -- 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




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