[lkml]   [2001]   [Jan]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectgeneric_file_write code segment in 2.2.18
hi everyone,
I was trying to understand following piece of code in
'generic_file_read' (mm/filemap.c) for 2.2.18 kernel. The code
is as follows:

dest = (char *) page_address(page) + offset;
if (dest != buf) { /* See comment in
update_vm_cache_cond. */
bytes -= copy_from_user(dest, buf, bytes);
status = -EFAULT;
if (bytes)
status = inode->i_op->updatepage(file, page,
offset, bytes, sync);

/* Mark it unlocked again and drop the page.. */
clear_bit(PG_locked, &page->flags);

if (status < 0)

written += status;
count -= status;
pos += status;
buf += status;
copy_from_user returns the number of bytes copied from userspace
to 'dest'. In case it succeeds, 'bytes' will be set to 0 after the
call. However, 'status' is set to -EFAULT. So wouldn't it break
out of the while loop (prematurely)?

Please post/CC your comments to me if this is not of general interest
to the list and is too silly to be answered there.

Asang Dani

Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

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