copy_to_user and copy_from_user
guruteck_at_gmail.com
Date: 01/18/05
- Next message: dumbo: "Re: mem mapped I/O"
- Previous message: David Schwartz: "Re: unable to post followups to my questions"
- Next in thread: Josef Moellers: "Re: copy_to_user and copy_from_user"
- Reply: Josef Moellers: "Re: copy_to_user and copy_from_user"
- Reply: David Schwartz: "Re: copy_to_user and copy_from_user"
- Reply: Kasper Dupont: "Re: copy_to_user and copy_from_user"
- Reply: Norm Dresner: "Re: copy_to_user and copy_from_user"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 18 Jan 2005 03:44:47 -0800
Hi Guys
I wrote a simple character driver with read and write functions
as below.I first used copy_to_user/copy_from_user .then replaced them
with simple coping as below.It just writes a word to device and gets a
word from device.
char *k;
int MyRead(struct file *filep,char *buf,size_t size,loff_t *offp)
{
int i;
/* copy_to_user(buf,k,4);*/
for(i=0;i<4;i++)
buf[i]=k[i];
}
int MyWrite(struct file *filp,char *buff,size_t count,loff_t *offp)
{
int i;
k=(char *)kmalloc(4,GFP_KERNEL);
/*copy_from_user(k,buff,4);*/
for(i=0;i<4;i++)
k[i]=buff[i];
}
But Without Using copy_to_user/copy_from_user this function is working
properly
I didnt get its behaviour.
Is this mean can we write driver without using
copy_to_user/copy_from_user functions???Then what is the use of these
functions..???
Thanx in advance for any help
Regards
- Next message: dumbo: "Re: mem mapped I/O"
- Previous message: David Schwartz: "Re: unable to post followups to my questions"
- Next in thread: Josef Moellers: "Re: copy_to_user and copy_from_user"
- Reply: Josef Moellers: "Re: copy_to_user and copy_from_user"
- Reply: David Schwartz: "Re: copy_to_user and copy_from_user"
- Reply: Kasper Dupont: "Re: copy_to_user and copy_from_user"
- Reply: Norm Dresner: "Re: copy_to_user and copy_from_user"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]