EmbLogic's Blog

Avtar Singh E- 30.01.30

RCS file: new_lkm.c,v
Working file: new_lkm.c
head: 1.10
branch:
locks: strict
root: 1.10
access list:
symbolic names:
keyword substitution: kv
total revisions: 11; selected revisions: 11
description:
in this i register many no. of devices that we can provide at the time of insmod as command line argument.
use setup_struct_cdev() function i.e user defined to setup of the struct cdev,in this we use cdev_init() & cdev_add().
in cleanup we use cdev_del to delete the cdev setup for all devices.
also used kmalloc() & kfree() to allocate & deallocate the memory to scull_dev (pointer of struct Sculldev).
—————————-
revision 1.10 locked by: root;
date: 2013/07/11 15:05:36; author: root; state: Exp; lines: +36 -8
gave response to read call of application.
scull_read() function is taking request of read call.
use copy_to_user() function to copy no. of bytes requested by application from kernel space i.e quantums to the user buffer.
rbuff is our user buffer in our case.
successfully jumping from one scullqset to another when one scullqset fills.
overall successfully writing to user buffer is performing.
—————————-
revision 1.9
date: 2013/07/11 12:09:24; author: root; state: Exp; lines: +40 -2
to read call driver is comming in scull
scull_read().
here copy_to_user() is working properly only to write first quantum from kernel space to user buffer i.e rbuff in my case.
it is successfully writing upto this.
—————————-
revision 1.8
date: 2013/07/11 10:48:47; author: root; state: Exp; lines: +47 -8
in scull_write(),use copy_from_user() to copy data from user buffer i.e wbuff in our case to the quantums that was allocated.
also after copying data from ubuff to kernel buffer i.e quantums i link the fscullqset with the scullqset of the sculldev that was stored in the filep->private_data .
till now it is successfully working.
it can also move from one scullqset to next when all the quantums of the present scullqset fills.
—————————-
revision 1.7
date: 2013/07/10 10:20:09; author: root; state: Exp; lines: +11 -8
in create_scullqset(),make fscullqset->next = NULL.
sometimes without doing this result in kernel crash in create_quantum().
—————————-
revision 1.6
date: 2013/07/10 07:40:20; author: root; state: Exp; lines: +215 -3
declaire variable noq & nosqs for no. of quantum & no. of scullqset respectively.
from the given info. in header ,found the value of noq & nosqs.
now to create nosqs called function create_scullqset(), &to create no. of qsets i called function create_qset() .
at last i called create_quantum() to create requirted no. of quantums.value in size comes from application app.c ,i.e 3rd argument of write.
till now working successfully.
—————————-
revision 1.5
date: 2013/07/08 11:15:20; author: emblogic; state: Exp; lines: +97 -18
defined read & write function for reading & writing to & from the kernel buffer to user space buffer.
only control is going to read & write when called by application .
noting is performing in the read & write function.
—————————-
revision 1.4
date: 2013/07/08 11:14:01; author: emblogic; state: Exp; lines: +0 -3
2 lines deleted.
—————————-
revision 1.3
date: 2013/07/08 11:12:58; author: emblogic; state: Exp; lines: +2 -0
2 lines added.
—————————-
revision 1.2
date: 2013/07/02 12:25:03; author: root; state: Exp; lines: +57 -7
branches: 1.2.1;
driver comming in the open_file function after receiving the open call from the application ,app.c.
initialize struct Sculldev elements like qset_size,quantum_size,device_size & data_size.
added open_file() & close_file() function to give response yo the open & close call of app.c program.
in script ,we make node to interface b/w US & KS by using mknod command.
—————————-
revision 1.1
date: 2013/07/02 08:50:13; author: root; state: Exp;
Initial revision
—————————-
revision 1.2.1.1
date: 2013/07/05 06:49:09; author: emblogic; state: Exp; lines: +48 -17
in open_file function i use container_of() function to map the machine memory & device memory.
this function return address of that mapped memory whis i am storing in the lsculldev i.e pointer to struct Sculldev.
now this address is put in the private data of struct file .
now i check the requested permission by anding the f_flags member of struct file with O_ACCMODE .
now accordingly control goes to the scull_trim function.
=============================================================================

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>