EmbLogic's Blog

Program to count the number of nodes in the singly linked list in C

RCS file: countnodes.c,v
Working file: countnodes.c
head: 1.6
branch:
locks: strict
root: 1.6
access list:
symbolic names:
keyword substitution: kv
total revisions: 6;    selected revisions: 6
description:
Count the total number of nodes in the linked list.
—————————-
revision 1.6    locked by: root;
date: 2014/01/09 14:29:53;  author: root;  state: Exp;  lines: +3 -1
statement to print the number of nodes in the linked list is added.
Function to count the number of nodes is working successfully.
—————————-
revision 1.5
date: 2014/01/09 14:25:03;  author: root;  state: Exp;  lines: +14 -0
Function to count the number of nodes in the linked list
is implemented checking if it is working fine or not.
—————————-
revision 1.4
date: 2014/01/09 14:18:41;  author: root;  state: Exp;  lines: +1 -0
Header file <stdlib.h> is included to support the malloc() and exit() function,
—————————-
revision 1.3
date: 2014/01/09 14:16:27;  author: root;  state: Exp;  lines: +28 -1
Warning occurs due to the usage of malloc() in the program without using
header file <stdlib.h>.
—————————-
revision 1.2
date: 2014/01/09 14:08:45;  author: root;  state: Exp;  lines: +12 -1
A layout is prepared by making a MAIN MENU to assist the user what type
of operations are available.
—————————-
revision 1.1
date: 2014/01/09 14:07:20;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Data Structures with C | Leave a comment

Reversing a Linked list using four pointers in C Language

RCS file: reverse_linked_list.c,v
Working file: reverse_linked_list.c
head: 1.16
branch:
locks: strict
root: 1.16
access list:
symbolic names:
keyword substitution: kv
total revisions: 16;    selected revisions: 16
description:
Program for reverse of a linked list in C language.
—————————-
revision 1.16    locked by: root;
date: 2014/01/09 13:20:36;  author: root;  state: Exp;  lines: +1 -1
Program working absolutely correctly.
Appropriate comments are included in the program.
—————————-
revision 1.15
date: 2014/01/09 13:16:29;  author: root;  state: Exp;  lines: +3 -3
Bug fixed:Checking the output of the program.
—————————-
revision 1.14
date: 2014/01/09 13:15:06;  author: root;  state: Exp;  lines: +19 -1
Declaration error in the reverse_list() function.
Checking…..
—————————-
revision 1.13
date: 2014/01/07 23:27:25;  author: root;  state: Exp;  lines: +1 -1
Logical error is fixed.
—————————-
revision 1.12
date: 2014/01/07 23:25:19;  author: root;  state: Exp;  lines: +10 -2
Display function is declared and defined in the program.
Logical error:display function is not working properly.
—————————-
revision 1.11
date: 2014/01/07 23:14:43;  author: root;  state: Exp;  lines: +5 -0
Problem fixed by adding message in the else part of the case 1 in switch.
—————————-
revision 1.10
date: 2014/01/07 23:09:56;  author: root;  state: Exp;  lines: +2 -0
Both the logical and the syntax error are debugged.
Issue:loop is not included and missing parenthesis.
Another problem if the user is entering case 1 the next time it is not displaying the
message to the user that the linked list is already created.
—————————-
revision 1.9
date: 2014/01/07 23:08:21;  author: root;  state: Exp;  lines: +35 -33
Syntax error occurred in the program checking.
—————————-
revision 1.8
date: 2014/01/07 23:05:40;  author: root;  state: Exp;  lines: +2 -1
Logical error:Program is exiting after a choice is entered and the menu is not
displayed to the user the next time.
Checking…………..
—————————-
revision 1.7
date: 2014/01/07 23:02:24;  author: root;  state: Exp;  lines: +1 -1
Appropriate message is included in the program when the linked list
is created successfully.
—————————-
revision 1.6
date: 2014/01/07 23:00:51;  author: root;  state: Exp;  lines: +1 -0
Prototype of the insert_value() function is added in the program.
—————————-
revision 1.5
date: 2014/01/07 22:59:14;  author: root;  state: Exp;  lines: +8 -1
insert_value() function is created successfully created so that the
user can insert its own number in the linked list.
—————————-
revision 1.4
date: 2014/01/07 22:55:42;  author: root;  state: Exp;  lines: +5 -1
Linked list is created successfully with a single node.
create_node function is declared and defined.
—————————-
revision 1.3
date: 2014/01/07 22:52:03;  author: root;  state: Exp;  lines: +12 -0
Header file:<stdlib.h> is included in the C program to support exit() and malloc() function.
—————————-
revision 1.2
date: 2014/01/07 22:42:20;  author: root;  state: Exp;  lines: +29 -2
Layout is prepared for the user with the help of which
the user can choose the appropriate operation.
—————————-
revision 1.1
date: 2014/01/07 22:34:48;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Data Structures with C | Leave a comment

Stack implementation using an array.

RCS file: stack_using_array.c,v
Working file: stack_using_array.c
head: 1.9
branch:
locks: strict
root: 1.9
access list:
symbolic names:
keyword substitution: kv
total revisions: 9;    selected revisions: 9
description:
Stack implementation using array….
MAIN MENU is prepared for the user.
—————————-
revision 1.9    locked by: root;
date: 2014/01/09 01:41:47;  author: root;  state: Exp;  lines: +1 -1
Bug fixed.
Issue:prototype of the display function is mismatched.
—————————-
revision 1.8
date: 2014/01/09 01:39:52;  author: root;  state: Exp;  lines: +10 -1
pop() function is added in the program to delete the elements from the stack.
—————————-
revision 1.7
date: 2014/01/09 01:36:37;  author: root;  state: Exp;  lines: +11 -1
Underflow condition is included in the display() function to indicate the
user that there is no element in the stack.
—————————-
revision 1.6
date: 2014/01/09 01:32:23;  author: root;  state: Exp;  lines: +1 -1
\n character is added in the program to make the output more readable.
—————————-
revision 1.5
date: 2014/01/09 01:28:36;  author: root;  state: Exp;  lines: +1 -1
Logical error:Only the element at the top of the stack is getting displayed.
Checking.
—————————-
revision 1.4
date: 2014/01/09 01:26:50;  author: root;  state: Exp;  lines: +10 -2
Display function is added in the program.
—————————-
revision 1.3
date: 2014/01/09 01:18:20;  author: root;  state: Exp;  lines: +3 -0
Header file:<stdlib.h> is included to support the exit() function,
—————————-
revision 1.2
date: 2014/01/09 01:13:24;  author: root;  state: Exp;  lines: +48 -8
Push operation on the stack is implemented.
Checking.
—————————-
revision 1.1
date: 2014/01/09 00:58:52;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Data Structures with C | Leave a comment

DEVICE DRIVER

head    1.3;
access;
symbols;
locks
root:1.3; strict;
comment @ * @;

1.3
date    2014.01.07.05.55.57;    author root;    state Exp;
branches;
next    1.2;

1.2
date    2014.01.07.04.44.27;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.07.03.22.24;    author root;    state Exp;
branches;
next    ;

desc
@device driver registerd using alloc_chrdev_region
@

1.3
log
@device structure cdev initialized and cdev is added to device table
@

Posted in Character Driver | Tagged | Leave a comment

DEVICE DRIVER SCULLDEV ALLOCATION & DEALLOCATION

module initialization log_file

head    1.2;
access;
symbols;
locks
root:1.2; strict;
comment @ * @;

1.2
date    2014.01.07.04.44.27;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.07.03.22.24;    author root;    state Exp;
branches;
next    ;

desc
@device driver registerd using alloc_chrdev_region
@

1.2
log
@device driver structure(Sculldev) represented & memory allocated using kmalloc
@
_______________________________________________________________________________________________________

module clean_up log_file

head    1.2;
access;
symbols;
locks; strict;
comment @ * @;

1.2
date    2014.01.07.04.46.28;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.07.03.26.40;    author root;    state Exp;
branches;
next    ;

desc
@device driver unregisterd using unregister_chrdev_region
@

1.2
log
@device driver structure(Sculldev) deallocated using kfree & device driver unregistered
@

 

Posted in Character Driver | Tagged | Leave a comment

ALLOCATION AND DEALLOCATION OF SCULLDEV STRUCTURE IN DRIVERS

head    1.2;
access;
symbols;
locks; strict;
comment @ * @;

1.2
date    2014.01.06.16.46.49;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.06.15.17.49;    author root;    state Exp;
branches;
next    ;

desc
@Device driver unregistered using unregister_chrdev_region
@

1.2
log
@dealloction of memory using KFREE
@

Posted in Uncategorized | Leave a comment

implementation & demostration of character device driver

Implemented the following:

1.Register the driver by using the new mechanism, allocate the memory , initialise and add the cdev to device table.

head    1.2;
access;
symbols;
locks
root:1.2; strict;
comment    @ * @;

1.2
date    2014.01.06.11.00.57;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.06.10.57.33;    author root;    state Exp;
branches;
next    ;

desc
@this is source code for register device by the new mechnism and allocate the the memory by using kmalloc and add cdev to the device table.
@

1.2
log
@removed the  errors.
@

2.After registration, allocation, and adding the cdev to device table, delete the cdev form device table, deallocate the memory and unregister the driver.

head    1.2;
access;
symbols;
locks
root:1.2; strict;
comment    @ * @;

1.2
date    2014.01.06.11.03.44;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.06.10.58.52;    author root;    state Exp;
branches;
next    ;

desc
@this is souce code for cleanup function in which unregister the driver by new mechnism and deallocate the mem.& cdev remove it in cleanup function.
@

1.2
log
@removed the errors.
@

 

 

Posted in Uncategorized | Leave a comment

Character Device Driver 06/01/2014

log files

head    1.1;
access;
symbols;
locks; strict;
comment    @ * @;

1.1
date    2014.01.06.10.23.58;    author root;    state Exp;
branches;
next    ;

desc
@Header file for init.c and exit .c

—————————————————————————————————————————————————–

head    1.1;
access;
symbols;
locks; strict;
comment    @ * @;

1.1
date    2014.01.06.10.25.07;    author root;    state Exp;
branches;
next    ;

desc
@all the declerations are done in this file for init.c and exit.c

—————————————————————————————————————————————————–

head    1.1;
access;
symbols;
locks; strict;
comment    @ * @;

1.1
date    2014.01.06.10.29.02;    author root;    state Exp;
branches;
next    ;

desc
@source code for initialization function

—————————————————————————————————————————————————–

head    1.1;
access;
symbols;
locks; strict;
comment    @ * @;

1.1
date    2014.01.06.10.29.47;    author root;    state Exp;
branches;
next    ;

desc
@source code for clean-up function.

—————————————————————————————————————————————————–

head    1.1;
access;
symbols;
locks; strict;
comment    @# @;

1.1
date    2014.01.06.10.30.54;    author root;    state Exp;
branches;
next    ;

desc
@script file for the code

Posted in Character Driver, Device Drivers | Tagged | Leave a comment

Character Device Drivers.

Implemented the following:

1.Register the driver by using the new mechanism, allocate the memory and initialise and add the cdev to device table.

2.After registration, allocation, and adding the cdev to device table, delete the cdev form device table, deallocate the memory and unregister the driver.

Log file for init.c:

head    1.3;
access;
symbols;
locks
root:1.3; strict;
comment    @ * @;

1.3
date    2014.01.06.15.38.44;    author root;    state Exp;
branches;
next    1.2;

1.2
date    2014.01.06.14.16.20;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.06.13.06.31;    author root;    state Exp;
branches;
next    ;

desc
@This is the source file of initialization file of driver initialization by new mechanism.
@

1.3
log
@After register the driver and allocating the memory, initialize the cdev structure and add cdev to device table using cdev_init and cdev_add respectively.
@
1.2
log
@After registering the driver, allocate the memory using kmalloc by representing a structure in driver called ScullDev.
@

Log file for exit.c:

head    1.3;
access;
symbols;
locks; strict;
comment    @ * @;

1.3
date    2014.01.06.15.41.04;    author root;    state Exp;
branches;
next    1.2;

1.2
date    2014.01.06.14.20.34;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.06.13.07.52;    author root;    state Exp;
branches;
next    ;

desc
@This is the source file of exit file of driver initialization by new mechanism.
@

1.3
log
@After allocating the memory and adding the cdev to device table, remove the cdev from device table using cdev_del and deallocate the memory too and unregister the driver.
@
1.2
log
@After registering and allocating the size to driver, deallocate and unregister the driver.
@

Posted in Uncategorized | Leave a comment

DEVICE DRIVER REGISTRATION/UNREGISTRATION (ALLOC/UNREGISTER)

INITIALIZATION  LOG FILE

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment @ * @;

1.1
date    2014.01.06.15.15.50;    author root;    state Exp;
branches;
next    ;

desc
@Device Driver registration using alloc_chrdev_region
@

1.1
log
@Initial revision
@

CLEAN-UP LOG FILE
head    1.1;
access;
symbols;
locks; strict;
comment @ * @;

1.1
date    2014.01.06.15.17.49;    author root;    state Exp;
branches;
next    ;

desc
@Device driver unregistered using unregister_chrdev_region
@

1.1
log
@Initial revision
@

Posted in Uncategorized | Leave a comment

device driver module registration

module initialization log_file

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment @ * @;

1.1
date    2014.01.07.03.22.24;    author root;    state Exp;
branches;
next    ;

desc
@device driver registerd using alloc_chrdev_region
@

1.1
log
@Initial revision
@

______________________________________________________________________________________________________________________________________________________________________

module clean_up log_file

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment @ * @;

1.1
date    2014.01.07.03.26.40;    author root;    state Exp;
branches;
next    ;

desc
@device driver unregisterd using unregister_chrdev_region
@

1.1
log
@Initial revision
@

 

Posted in Character Driver | Tagged | Leave a comment

Server process handling the requests of a single Client using pipes.

RCS file: requesting_client.c,v
Working file: requesting_client.c
head: 1.6
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 6;    selected revisions: 6
description:
Requesting clients enter their data here.
Data includes the two operands and one operator.
—————————-
revision 1.6
date: 2014/01/06 00:33:13;  author: root;  state: Exp;  lines: +13 -5
Code is optimized by reducing the number of statements.
—————————-
revision 1.5
date: 2014/01/04 16:28:38;  author: root;  state: Exp;  lines: +7 -5
Final result is read by the requesting client from the pipe
—————————-
revision 1.4
date: 2014/01/03 18:46:50;  author: root;  state: Exp;  lines: +2 -2
Name of the variable is changed.
—————————-
revision 1.3
date: 2014/01/03 18:39:54;  author: root;  state: Exp;  lines: +2 -0
Statement is included to indicate that we are taking the data from requesting clients.
—————————-
revision 1.2
date: 2014/01/03 16:16:27;  author: root;  state: Exp;  lines: +6 -1
Previously arguments to main() function are incorrect.
Both error and warning are fixed.
file descriptor is collected from main() in string form and it is converted
back to integer.All the data from the structure is converted to a string using sprintf.
write() system call is used to write to the pipe.
Issue: Segmentation fault.
—————————-
revision 1.1
date: 2014/01/03 15:37:39;  author: root;  state: Exp;
Initial revision
=============================================================================
RCS file: processing_client.c,v
Working file: processing_client.c
head: 1.4
branch:
locks: strict
root: 1.4
access list:
symbolic names:
keyword substitution: kv
total revisions: 4;    selected revisions: 4
description:
Processing client is created for single client.
checking whether the functionality is correct or not.
—————————-
revision 1.4    locked by: root;
date: 2014/01/06 00:37:30;  author: root;  state: Exp;  lines: +0 -9
Code for processing client is optimized.
—————————-
revision 1.3
date: 2014/01/04 18:20:04;  author: root;  state: Exp;  lines: +17 -2
Subtract operation added in the processing client.
—————————-
revision 1.2
date: 2014/01/04 16:38:24;  author: root;  state: Exp;  lines: +1 -1
syntax error present.
bug fixed.
—————————-
revision 1.1
date: 2014/01/04 16:18:32;  author: root;  state: Exp;
Initial revision
=============================================================================

 
RCS file: server_process.c,v
Working file: server_process.c
head: 1.9
branch:
locks: strict
root: 1.9
access list:
symbolic names:
keyword substitution: kv
total revisions: 9;    selected revisions: 9
description:
Child process is created using fork() system call.
execl() is done in the child process and the file descriptor to write to pipe are passed.
—————————-
revision 1.9    locked by: root;
date: 2014/01/06 00:44:03;  author: root;  state: Exp;  lines: +20 -22
Code is optimized by reducing the number of redundant statements.
—————————-
revision 1.8
date: 2014/01/04 17:57:59;  author: root;  state: Exp;  lines: +8 -2
Logical error:Only one file descriptor is passed to the requesting client.
Bug fixed successfully result is coming as expected for the add operation.
—————————-
revision 1.7
date: 2014/01/04 17:24:38;  author: root;  state: Exp;  lines: +8 -4
Escape sequence \n is added to make the code more readable.
—————————-
revision 1.6
date: 2014/01/04 17:19:10;  author: root;  state: Exp;  lines: +8 -3
Segmentation fault was occurring earlier because of absence of & operator.
—————————-
revision 1.5
date: 2014/01/04 16:58:34;  author: root;  state: Exp;  lines: +6 -7
syntax error:Missing semicolon.
error fixed.
—————————-
revision 1.4
date: 2014/01/04 16:55:06;  author: root;  state: Exp;  lines: +7 -5
Requesting client is working properly to some extent but the
control is not coming back to the parent.
Logical error.
—————————-
revision 1.3
date: 2014/01/04 16:22:44;  author: root;  state: Exp;  lines: +11 -5
File descriptors are passed to processing clients.
A new child is created using fork() and then execl() is done.
The result is read by the server from the pipe.
—————————-
revision 1.2
date: 2014/01/03 18:47:55;  author: root;  state: Exp;  lines: +61 -4
Logical error is fixed.
—————————-
revision 1.1
date: 2014/01/03 16:22:40;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

character driver register implementation

log file of init function

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment    @ * @;

1.1
date    2014.01.04.11.18.09;    author root;    state Exp;
branches;
next    ;

desc
@this is the source code of init function for initialization in device driver
@

1.1
log
@Initial revision
@

log file of exit function

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment    @ * @;

1.1
date    2014.01.04.11.18.43;    author root;    state Exp;
branches;
next    ;

desc
@this is the source of exit function for clean up the device driver
@

1.1
log
@Initial revision

Posted in Uncategorized | Leave a comment

Character Driver.

Implemented the insertion and registration of basic device driver.

Log file for initialization:

head    1.2;
access;
symbols;
locks
root:1.2; strict;
comment    @ * @;

1.2
date    2014.01.04.16.35.51;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.04.16.04.11;    author root;    state Exp;
branches;
next    ;

desc
@This file contains source code for initialization of drivers while we insert our driver to kernel.
@

1.2
log
@The error are removed for initialisation file and the registration of simple driver is implemented.
@

Log file for clean_up:

head    1.2;
access;
symbols;
locks
root:1.2; strict;
comment    @ * @;

1.2
date    2014.01.04.16.37.11;    author root;    state Exp;
branches;
next    1.1;

1.1
date    2014.01.04.16.06.00;    author root;    state Exp;
branches;
next    ;

desc
@This file contains source code for cleanup  of drivers while we insert our driver to kernel.
@

1.2
log
@The error are removed for exit file and the registration of simple driver is implemented.
@

Posted in Uncategorized | Leave a comment

Catching signals SIGINT and SIGQUIT using system handler.

RCS file: SIGINTsignal.c,v
Working file: SIGINTsignal.c
head: 1.5
branch:
locks: strict
root: 1.5
access list:
symbolic names:
keyword substitution: kv
total revisions: 5;    selected revisions: 5
description:
Program to understand the functionality of signal.
In this program,signal is received and caught by the system handler.
User is intimated for the signal generated by the kernel.
—————————-
revision 1.5    locked by: root;
date: 2014/01/02 19:09:21;  author: root;  state: Exp;  lines: +3 -0
SIGKILL signal is added to test the functionality.
Ensuring that it is a special type of a message.
—————————-
revision 1.4
date: 2014/01/02 19:02:05;  author: root;  state: Exp;  lines: +4 -0
SIGQUIT signal is also added and handler function is changed.
It will display an appropriate message for the signal generated.
—————————-
revision 1.3
date: 2014/01/02 18:57:39;  author: root;  state: Exp;  lines: +1 -0
sleep() system call is introduced so that the message can be read easily.
—————————-
revision 1.2
date: 2014/01/02 18:56:20;  author: root;  state: Exp;  lines: +1 -0
Header file for supporting the signal system call is added to the program.
—————————-
revision 1.1
date: 2014/01/02 18:55:22;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment