lkml.org 
[lkml]   [2000]   [Oct]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: mapping user space buffer to kernel address space
Date
From
Linus Torvalds wrote:
>
>
> On Sat, 14 Oct 2000, Rogier Wolff wrote:
> > > Note that it is usually MUCH better to do this the other way around:
> > > having a kernel-side buffer, and mapping that into user space. I don't
> > > understand why so many people always want to do it the wrong way around..
> >
> > Provided this wasn't a retorical question, I'll answer it for you.
> >
> > It seems easier to people. Allocing megabytes of memory is "easy" from
> > userspace, and there are all kinds of restrictions on the kernel side.
>
> Yeah.
>
> It's "easier".
>
> Until you want to actually _map_ the thing.
>
> At which point it turns a hell of a lot harder.

Right. So YOU the kernel-god have the overview that in a flash you see
this as the "hard" approach.

A way to design a good interface is to first start thinking about (or
even coding) the USER of the interface. If you start with the library
or "support functions" that you think you'll need, you're likely to
offload stuff to the user that could've been done in "behind the
scenes" in the library or whatever.

Thus these people start by thinking about their user-level program.
They would like to do

buf = malloc (BUFSIZE);
read (dev, buf, BUFSIZE);

but due to kernel-considerations this is not as easy as you'd like it
to be.

> In short, it's a classic case of being STUPID. Taking something that
> looks easy, and staying with the wrong approach long after it turns
> out that the "easy" case wasn't the easy one after all.

This IS the umptieth time that you answer this question. However, it's
a different person every time. If I or Alan or David would attempt this
it'd be STUPID.

People try to design the interface, and when they get to implementing
it, the first hurdle they can't take by themselves is the first one
they post a question for on linux-kernel. That's always the same
question. It's not that they keep on trying when you tell them its the
wrong approach.

I'm just saying that I understand how different people bump into the
same problem every time, and ask the same question. If you don't
understand it, that's fine with me. You understand the kernel better
than I do.


Roger.

--
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
* Common sense is the collection of *
****** prejudices acquired by age eighteen. -- Albert Einstein ********
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.093 / U:32.280 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site