Working on compression .
i complite make and rcs file succesfully
here is the code
#include”header.h”
dev_t dev;
void bulk_request(struct request_queue *q)
{
struct request *req;
req = blk_fetch_request(q);
while (req != NULL)
{
if (req == NULL || (req->cmd_type != REQ_TYPE_FS))
{
printk (KERN_NOTICE “Skip non-CMD request\n”);
__blk_end_request_all(req, -EIO);
continue;
}
}
}
int __init start(void)
{
//int reg;
// struct request *disk;
static struct request_queue *Queue;
printk(KERN_INFO “Begin : %s\n”,__func__);
printk(KERN_INFO” HELLO KERNEL”);
sbullmajor=register_blkdev(sbullmajor,device_name);
if(sbullmajor)
{
#ifdef DEBUG
printk(KERN_INFO ” Registration Sucessful\n “);
printk(KERN_INFO”Major no is %d\n”,sbullmajor);
#endif
}
else
{
#ifdef DEBUG
printk(KERN_INFO “Registartion failed\n “);
#endif
}
sbulldev=kmalloc(sizeof(struct Sbulldev),GFP_KERNEL);
memset(sbulldev,”,sizeof(struct Sbulldev));
sbulldev->size=hardsect_size;
sbulldev->data=vmalloc(sbulldev->size);
if(sbulldev->data ==NULL )
{
#ifdef DEBUG
printk(KERN_INFO ” Memory allocation failed\n “);
#endif
}
else
{
#ifdef DEBUG
printk(KERN_INFO ” Memory allocation of block device sucessful\n “);
#endif
}
spin_lock_init(&sbulldev->lock);
#ifdef DEBUG
printk(KERN_INFO ” after spin_lock\n “);
#endif
sbulldev->gd=alloc_disk(16);
if(sbulldev->gd==NULL){ //no of minors is 1 no partioning;
#ifdef DEBUG
printk(KERN_INFO ” alloc_disk failed\n “);
#endif
goto OUT;
}
else
{
#ifdef DEBUG
printk(KERN_INFO ” alloc_disk sucessful\n “);
#endif
}
Queue=blk_init_queue(bulk_request,NULL);
blk_queue_logical_block_size(Queue,hardsect_size);
sbulldev->gd->major=sbullmajor;
#ifdef DEBUG
printk(KERN_INFO ” sbullmajor\n “);
#endif
sbulldev->gd->minors=sbullminor;
#ifdef DEBUG
printk(KERN_INFO ” sbullminor\n “);
#endif
sbulldev->gd->first_minor=1;
#ifdef DEBUG
printk(KERN_INFO ” first_minor\n “);
#endif
sbulldev->gd->fops=f_ops;
#ifdef DEBUG
printk(KERN_INFO ” file_operations\n “);
#endif
sbulldev->gd->queue=Queue;
#ifdef DEBUG
printk(KERN_INFO ” Queue\n “);
#endif
sbulldev->gd->private_data=sbulldev;
#ifdef DEBUG
printk(KERN_INFO ” private_data\n “);
#endif
strcpy(sbulldev->gd->disk_name ,”sbulla” );
#ifdef DEBUG
printk(KERN_INFO ” sbulla\n “);
#endif
set_capacity(sbulldev->gd,hardsect_size);
#ifdef DEBUG
printk(KERN_INFO ” set_capacity\n “);
#endif
add_disk(sbulldev->gd);
#ifdef DEBUG
printk(KERN_INFO ” add disk\n “);
#endif
#ifdef DEBUG
printk(KERN_INFO ” End of %s\n “,__func__);
#endif
OUT:
return -1;
return 0;
}
void __exit release(void)
{
//int i;
#ifdef DEBUG
printk(KERN_INFO “exit : %s\n”,__func__);
#endif
del_gendisk(sbulldev->gd);
printk(KERN_INFO ” add disk\n “);
blk_cleanup_queue(sbulldev->queue);
printk(KERN_INFO ” add disk\n “);
//put_disk(sbulldev->gd);
unregister_blkdev(sbullmajor,device_name);
printk(KERN_INFO “BYE KERNEL”);
}
module_init(start);
module_exit(release);
}
the driver crashes moment insmod ./modules/lkm.ko is done…..ha i have zero bytes of home drive does this effect
int arr[256]={0};
int c;
while((c=getchar())!=’\n’)
arr[c]=1;
printf(“%c \n”,c);
//printable characters
for(c=32;c<127;c++)
{
if(arr[c])
putchar(c);
}
i have made this but not able to understand this code what’s happeninf actually
BLOCK DRIVER implement successfully………
1) SOMESH
2)SAHIL KALIA
3) RITU
4) PRIYANKA
I have completed master array program.and calculation of ndc and bcl.
Respected Sir
Today entire team worked on data transfer through block driver on Ram Partition .
Please Every body from E2 must responded on blog about their progress on this issue.
Thanks and regards
Dharmendra Nath Shandilya
I have implemented the functions for master array generation and for calculation of no of distint character and code length.I have used switch case in main program.
Sucessfully done master array using fileio and malloc. Also find the number of distinct charcater and code length .
From :Suresh kumar
All E5 batch’s students are advised to update their current work status or progress in regard of character driver. Please all reply on same thread.
following error are occuring :
could not find module ndiswrapper & could not find module mperf
Successfully implemented structure project ,linear and binary search,sortings and queue is done….now implementing circular queue..