On Sun, Sep 26, 2010 at 3:43 AM, Venkatram Tummala <venkatram867@xxxxxxxxx> wrote:
Hey buddy, i took the module code in your first post & modified it to make it work . I am attaching the code. It works on the latest kernel 2.6.35. If you are using any other kernel, you may have to change the file_operations function pointers (memory_read & memory_write signatures) by looking at struct file_operations in include/linux/fs.h. Rest assured, the code does exactly what you want it do.
I am also using 2.6.35 and it did not worked on my machine.
echo -n somehing > /dev/bond
where as
ls -l /dev/bond
crw-rw-rw- 1 root root 60, 0 2010-09-26 09:32 /dev/bond
exists.
I see you modified the read and write functions and added __user to datatypes.
more over here
ssize_t memory_read(struct file *filp, char __user *buf,
size_t count, loff_t *f_pos)
{
if (*f_pos != 0)
return 0;
copy_to_user(buf,memory_buffer,1);
if(*f_pos == 0)
*f_pos = *f_pos + 1;
return 1;
}
you are always returning one byte on reading how can you say that the code will write complete thing on successful call of memory_read
similarly on memory_write you are returning one byte where as I am trying to attempt to write more than one byte at one time if I give a string
something it is 8 bytes so in that case memory_read will always return the number of bytes as 1 which I do not want.
Since on my machine it gave me error so I am not in a position to verify what you are saying.