master array created ….in the process of implementation of encryption
master array created ….in the process of implementation of encryption
Implemented 2 way communication using reader and writer threads in 2 application !
1st system)Gives open call to server application i.e driver application
2nd system) Server app recieves open call and opens the node
3rd system) Executes read and write thread , and writes the data via node to driver and is recived by system 4 and vice versa.
4th system )Executes read and write thread , and writes the data which is recived by system 3 and vice versa.
int main(void)
{
char *ptr;
ptr = malloc(sizeof(char)*20);
printf(“%p\n”, ptr);
ptr = “hello”;
printf(“%p\n”, ptr);
printf(“The sting is %s\n”, ptr);
free(ptr);
return 0;
}
Check the above program. Ptr address is different in first and second case. Also free will give segmentation error. Because allocated mem and where hello string is there are different. So the correct way of copying string is strcpy(ptr, “hello”) and not by ptr = “hello”;
Working fine for singal Writer(Machine 1), Singal Reader(Machine 2), open/close file(Machine 3), and server(Machine 4).
using sockets for IPC.
My driver was working fine, but it now gives an error whaich goes as follows:
Error Inserting Module: Unknown symbols in module.
But on compiling the module its error free.
in write and read functions we are provided with a pointer to the file structure namely filp and we know this can change the position of the current read/write position namely the f_pos field in the struct file….but when in my write function i want to update the current read/write position using the statement filp->f_pos=nobsw(number of bytes successfully written),then this change is not visible in the f_pos field of the struct file,but when i do the same change using the last argument of the write function which is a pointer to the current read /write position using this statement *offp=nobsw,then the change is visible in the f_pos fileld of the struct file and i am able to read/write from SEEK_CUR and SEEK_END…why this happens….though both *offp(i.e the last argument of the write function in driver and filp->f_pos point to the same f_pos in the struct file. do they really point to the same f_pos in the struct file,a point to ponder upon….pls post if anybody knows why this happens
Ajay: Works on arrays, to making a master array from a simple array.And data-types of arrays is character(char) further continue…
Harshvardhan Singh: Initial problem solution(correctness),algorithm design and flow chart design concerning the TIME & SPACE trade-off.INITid design of the code continued…
Gaurav Vohra: Designed the algorithm.Working on the process to remove unique character for master array code further continue…
Jaiprakash: Created the buffer,and found the address and value stored in each address space of buffer further continue…
Jyotsana:Designed the algorithm and flow of the program.Implemented File I/O operation (Create,open and read a file). Working on the process to fetch unique character from an array and create a master array and stored that fetched unique character in master array code continue…
Sonal Purohit:Designed the algorithm,learant and implemented file I/O. And created a master array code continue…
Sandeep Yadav: File I/O,Input buffer and created a master array. Initially design the flow of program and further continue…
Multiple Data Compression & Encryption
We have been assigned the above project in a team of 10 members. This project is based on compression of a string and then decompression of the same string. Which includes use of File I/O , arrays, pointers.. etc. we have to complete the project by 7th May.
String to be compressed : she sells sea shells on the sea shore.
Deadline : 7 may 2012
PROJECT NAME-> Implementing Chating Across Multiple Systems Through Socket via Sculldriver
PROJECT HEAD-> Vaibhav sir
Specifications:
1.Used Socket_inet as an ipc mechanism
2.Used semaphore at thread level for each application
3.Send/receive data between applications via driver from sculldev
Description:
Machine 1->administrator
There will a administrator system which will give open,close and proc system calls to open and close the node into another system containing the driver.
Machine 2->Server
this system has the lkm which reads and writes the data on the scull using the node
Machine 3 and 4->reader and writers
These systems will execute read/write system calls.
Data flow from machine 3 to machine 4 is as follows:
machine 3(write)->socket->node->lkm->scull –>>node->socket->machine 4(read)
ssize_t scull_write ( struct file *filp, const char __user *buffer, size_t count , loff_t *offset)
{
struct ScullDev *lsculldev;
struct ScullQset *lscullqset;
int noq, nobsw,start_q,lcount,lv,ret;
int nobtw,noq_f,index,new_pos;
nobtw = count;
index = noq_f = 0;
lcount = noq = nobsw = start_q = lv = ret = 0;
#ifdef DEBUG
printk(KERN_INFO “Begin :%s\n”,__func__);
#endif
lsculldev = filp->private_data;
new_pos = filp->f_pos;
printk(KERN_INFO”value of filep=%d\n”,new_pos);
if(!lsculldev)
{
#ifdef DEBUG
printk(KERN_INFO “No Sculldev\n”);
#endif
goto OUT;
}
if(count size_of_device)
{
#ifdef DEBUG
printk(KERN_INFO “Not Enough Memory\n”);
#endif
goto OUT;
}
lscullqset = scull_follow(lsculldev);
if(!lscullqset)
{
lscullqset =(struct ScullQset *) kmalloc(sizeof(struct ScullQset),GFP_KERNEL);
if(!lscullqset)
{
#ifdef DEBUG
printk(KERN_INFO “Memory Allocation Failed\n”);
#endif
goto OUT;
}
lscullqset->data = kmalloc(sizeof(char*)*qset_size,GFP_KERNEL);
if(!lscullqset->data)
{
#ifdef DEBUG
printk(KERN_INFO “Memory Allocation Failed for qset array\n”);
#endif
goto OUT;
}
}
lsculldev->scullqset = lscullqset;
noq=count / quantum_size;
if(count % quantum_size)
{
noq++;
}
lsculldev->qset = noq;
printk(“noq = %d\n”,noq);
start_q = new_pos / quantum_size;
lv = start_q;
if(w_flag)
{
while(nobsw data[lv])
{
if(lv == start_q)
{
index = new_pos % quantum_size;
lcount = quantum_size – index;
ret = copy_from_user(lscullqset->data[lv]+index,buffer+nobsw,lcount);
#ifdef DEBUG
printk(KERN_INFO “data :%s\n”,(char*)lscullqset->data[lv]);
#endif
nobsw = nobsw + (lcount – ret);
lv++;
}
else
{
{
if(quantum_size count – nobsw)
lcount = count – nobsw;
printk(“ccc\n”);
ret = copy_from_user(lscullqset->data[lv],buffer+nobsw,lcount);
#ifdef DEBUG
printk(KERN_INFO “data :%s\n”,(char*)lscullqset->data[lv]);
#endif
nobsw = nobsw + (lcount – ret);
lv++;
}
printk(“~~~~\n\n”);
}
else
{
printk(“allocating memory for new quantum\n”);
noq_f++;
lscullqset->data[lv] = kmalloc(sizeof(char)*quantum_size,GFP_KERNEL);
if(!lscullqset->data[lv])
{
#ifdef DEBUG
printk(KERN_INFO “Memory Allocation Failed for new quantum\n”);
#endif
return -1;
}
#ifdef DEBUG
printk(KERN_INFO “Memory Allocated for new quantum\n”);
#endif
}
}
}
else
{
for(lv =0; lv data[lv] = kmalloc(sizeof(char)*quantum_size,GFP_KERNEL);
if(!lscullqset->data[lv])
{
#ifdef DEBUG
printk(KERN_INFO “Memory Allocation Failed for qset array\n”);
#endif
goto OUT;
}
}
for(lv=0; lv < noq; lv++)
{
if(quantum_size count – nobsw)
lcount = count – nobsw;
ret = copy_from_user(lscullqset->data[lv],buffer+nobsw,lcount);
#ifdef DEBUG
printk(KERN_INFO “data :%s\n”,(char*)lscullqset->data[lv]);
#endif
nobsw = nobsw + (lcount – ret);
w_flag = 1;
}
}
#ifdef DEBUG
printk(KERN_INFO “End :%s\n”,__func__);
#endif
return nobsw;
OUT:
#ifdef DEBUG
printk(KERN_INFO “End :%s\n”,__func__);
#endif
return -1;
}
would any one please let me know that what is rudimentary calculator………………………?
sir ,
i have compeletd the lseek,thread synchronization in character driver.
i have successed to creating an entry in proc file system.