On Wed, Sep 15, 2010 at 10:34 PM, matthias <mensch0815@xxxxxxxxxxxxxx> wrote:
Hi,
the problem is your bond_buffer and how you handle read and writes from it.
(see below)
Hi thanks I have read and re read the code and many other man pages from internet.
you just copy one byte to the buffer instead of count.> ssize_t bond_read(struct file *filp, char *buf, size_t count, loff_t *f_pos)
> {
>
> /* Transfering data to user space */
> copy_to_user(buf,bond_buffer,1);
Yes you are right here but I am not getting as how do I get the exact location from where I will copy data from kernel space to user space.
you just copy the last byte from buf (buf+count-1) to your
>
>
> /* Changing reading position as best suits */
> if (*f_pos == 0) {
> *f_pos+=1;
> return 1;
> } else {
> return 0;
> }
> };
>
>
>
>
> ssize_t bond_write(struct file *filp, char *buf, size_t count, loff_t
> *f_pos)
> {
>
>
> char *tmp;
>
>
> tmp=buf+count-1;
> copy_from_user(bond_buffer,tmp,1);
bond_buffer. you should copy count bytes, starting by buf.
Right I am not clear as how will I get the location of the region where user has written some thing in the above error you pointed out
so that I can copy the complete characters you mentioned.