Re: file_operations

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Fri, 2007-09-21 at 11:32 -0500, Sachin Gaikwad wrote:
 ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
> ...
So what does extra __user specify here.
> 
It's a reminder that you have to use copy_to_user when you want to write
to this buffer. The memory area may be non-existant or swapped out.
copy_to_user deals with that. (There is also a possible race when one
user-space Thread calls read and another calls free - copy_to_user also
deals with that?)

If I have to use this function of reading file inside the kernel, then
> shall I pass kernel buffer to it or user space buffer ?
> 
> I know that it is VERY BAD idea to read from kernel.
> 
Yes, it is. Why do you want that?

But how are we suppposed to do it if at all.
> 
I've heard from http://lwn.net/Articles/248430/ that you can do it
sys_open() and sys_read().

Michael Blizek
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFG9Bg/1o5nKJ0vLIQRAi5iAJ4z0idpJMAM5ymiJQP9zjuU4qezDgCghzHZ
AOfHgn976UI0qbVwn4nP9IU=
=Uifx
-----END PGP SIGNATURE-----



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux