EmbLogic's Blog

Module code showing how to read data in a single quantum using copy_to_user() function.

RCS file: readf.c,v
Working file: readf.c
head: 1.11
branch:
locks: strict
root: 1.11
access list:
symbolic names:
keyword substitution: kv
total revisions: 11;    selected revisions: 11
description:
chardev_read() function is implemented here in this file.
—————————-
revision 1.11    locked by: root;
date: 2014/03/04 00:31:32;  author: root;  state: Exp;  lines: +1 -1
Status : reading data from a single quantum is implemented successfully.
—————————-
revision 1.10
date: 2014/03/02 17:33:44;  author: root;  state: Exp;  lines: +1 -1
Typecasting is done.
—————————-
revision 1.9
date: 2014/03/02 17:32:15;  author: root;  state: Exp;  lines: +4 -0
Checking the data inside the quantum by printing it using lsculldev->scullqset->data[0].
—————————-
revision 1.8
date: 2014/03/02 17:30:51;  author: root;  state: Exp;  lines: +1 -0
Logical error while using copy_to_read().
Debugging……
—————————-
revision 1.7
date: 2014/03/02 17:27:23;  author: root;  state: Exp;  lines: +1 -1
Bug fixed.
Issue:type-casting not performed.
—————————-
revision 1.6
date: 2014/03/02 17:24:51;  author: root;  state: Exp;  lines: +11 -0
copy_to_user() function is used to copy the data from the quantum to the ubuff.It is similar to the copy_from_user() function.
Declared an ret variable which represents the number of characters not successfully read.
—————————-
revision 1.5
date: 2014/03/02 17:08:52;  author: root;  state: Exp;  lines: +7 -1
Printing the address contained inside the filep->private_data.
—————————-
revision 1.4
date: 2014/03/02 17:05:12;  author: root;  state: Exp;  lines: +2 -1
Declared a pointer of type struct Sculldev.
Assigning the filep->private_data to lsculldev.
—————————-
revision 1.3
date: 2014/03/02 16:53:58;  author: root;  state: Exp;  lines: +6 -1
ubuff is a user space pointer that points to the data in the application.Therefore, it cannot be directly dereferenced by kernel code.
Using this pointer the data inside the application and its size is printed here.
Checking…….
—————————-
revision 1.2
date: 2014/03/02 16:20:56;  author: root;  state: Exp;  lines: +13 -0
Gave two printk() statements inside chardev_read() function to mark the start and end of this function.Also included the prototype of this function using extern.
—————————-
revision 1.1
date: 2014/03/02 16:14:35;  author: root;  state: Exp;
Initial revision
=============================================================================

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>