EmbLogic's Blog

Character_Driver

RCS file: header.h,v
Working file: header.h
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;    selected revisions: 3
description:
include header files that are needed in this program
struct sculldev structure is included here
that include c_dev
—————————-
revision 1.3
date: 2014/05/12 11:24:48;  author: root;  state: Exp;  lines: +16 -2
given prototype for write_function
added scullqset,device_size,data_size,quantum_size in struct sculldev.
—————————-
revision 1.2
date: 2014/05/08 10:20:29;  author: root;  state: Exp;  lines: +1 -0
defination of scullopen and scullrelease is given here
—————————-
revision 1.1
date: 2014/05/08 10:00:06;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: dec.h,v
Working file: dec.h
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
we extern node number
dev_t dev
struct sculldev *sculldev
—————————-
revision 1.2
date: 2014/05/12 11:27:39;  author: root;  state: Exp;  lines: +4 -0
extern quantum from init file
extern device from init
extern data
extern qset from init function
—————————-
revision 1.1
date: 2014/05/08 10:00:06;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: init.c,v
Working file: init.c
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;    selected revisions: 3
description:
alloc_chrdev is done for registring the device
kmalloc is done to allocate memory to device
then memset is done
before kmalloc print major and minor no that are present in dev
now initilization is done means kernel provide memory
cdev_add is done to add on something
now again print major and minor no that are nor present in c_dev which is within struct sculldev
—————————-
revision 1.3
date: 2014/05/12 11:26:27;  author: root;  state: Exp;  lines: +3 -0
given size for device
given size for qset
given size for quantum
—————————-
revision 1.2
date: 2014/05/08 10:06:58;  author: root;  state: Exp;  lines: +2 -3
if number of devices are more in number then use for loop
module_param is used to pass command line arguments that is number of nodes is passed by user on the shell
—————————-
revision 1.1
date: 2014/05/08 10:00:06;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: cleanup.c,v
Working file: cleanup.c
head: 1.3
branch:
locks: strict
root: 1.3
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;    selected revisions: 3
description:
unregister_chrdev to unregister the device
free the memory that is allocated to device by kfree
print no of node that is no of devices
cdev_del to delete something
—————————-
revision 1.3    locked by: root;
date: 2014/05/08 10:09:08;  author: root;  state: Exp;  lines: +0 -2
same can done in clanup function if number of nodes are more in number
—————————-
revision 1.2
date: 2014/05/08 10:05:50;  author: root;  state: Exp;  lines: +2 -0
*** empty log message ***
—————————-
revision 1.1
date: 2014/05/08 10:00:06;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: app.c,v
Working file: app.c
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
in this function we make a application where we simply open a file
then close it
we provide node in open function to open the function created by ourself
—————————-
revision 1.2
date: 2014/05/12 11:29:53;  author: root;  state: Exp;  lines: +8 -5
changed the O_RDONLY mode to O_WRONLY in open function
write the string in the application space to the kernel
—————————-
revision 1.1
date: 2014/05/08 10:20:54;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: file_op.h,v
Working file: file_op.h
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
struct file_opeartion is created where mapping of open and release functon is done
include this in init functin
—————————-
revision 1.2
date: 2014/05/12 11:29:31;  author: root;  state: Exp;  lines: +1 -1
done mapping for write
—————————-
revision 1.1
date: 2014/05/08 10:20:54;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: sopen.c,v
Working file: sopen.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
open function is created
scullopen that have struct inode and struct file
__func__ is printed in it that gone tell us about current functin
—————————-
revision 1.2    locked by: root;
date: 2014/05/08 10:21:33;  author: root;  state: Exp;  lines: +1 -0
new struct sculldev *lscull_dev is created
container_of is done that provide the addresss of device
store that address in lscull_dev and print it
move that address to struct file private_data an print it
now assign premissions
means struct file f_flags do bitwise adding with O_ACCMODE
that provide us the mode means RDONLY,WRONLY ,RDWR
ans when we run the application .mode that is provided in open is called
—————————-
revision 1.1
date: 2014/05/08 10:20:54;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: swrite.c,v
Working file: swrite.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
printing the function name
finding the number of bytes written from the user space
using no of bytes written,finding the no of qsets required
allocate the memory for scullqset to store the data
printing the function name again
—————————-
revision 1.1    locked by: root;
date: 2014/05/12 11:31:41;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: srelease.c,v
Working file: srelease.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;    selected revisions: 1
description:
scullrelease is created that have struct inode nad struct file
—————————-
revision 1.1    locked by: root;
date: 2014/05/08 10:20:54;  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>