Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions device_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ static ssize_t device_file_read(
struct file *file_ptr
, char __user *user_buffer
, size_t count
, loff_t *possition)
, loff_t *position)
{
printk( KERN_NOTICE "Simple-driver: Device file is read at offset = %i, read bytes count = %u\n"
, (int)*possition
, (int)*position
, (unsigned int)count );

if( *possition >= g_s_Hello_World_size )
if( *position >= g_s_Hello_World_size )
return 0;

if( *possition + count > g_s_Hello_World_size )
count = g_s_Hello_World_size - *possition;
if( *position + count > g_s_Hello_World_size )
count = g_s_Hello_World_size - *position;

if( copy_to_user(user_buffer, g_s_Hello_World_string + *possition, count) != 0 )
if( copy_to_user(user_buffer, g_s_Hello_World_string + *position, count) != 0 )
return -EFAULT;

*possition += count;
*position += count;
return count;
}

Expand Down