[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copying linked lists structs to kernelland



On Sun, 06 Apr 2003 11:35:43 +0200
Jonathan Heusser <jonny@drugphish.ch> wrote:

> Hi,
> 
> How do I copy best a data structure which contains two or more linked 
> list heads (a la linux/list.h) plus
> some other fields to kernelland?
> Obviously a simple copy_from_user(new_struct,  (struct my_struct*) data, 
> sizeof(struct my_struct)).. does
> not work.

Sure it does. You'll just have to serialize your list and everything it
points to into a sequence of bytes. Then transfer the bytes and do the
opposite. It's not a very elegant thing to "copy linked list stucts" around
though.

Mike

-- 
A  program should be written to model the concepts of the task it
performs rather than the physical world or a process because this
maximizes  the  potential  for it to be applied to tasks that are
conceptually  similar and, more important, to tasks that have not
yet been conceived. 
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/