Skip to contentSkip to conversation

Problem in writing simple block device driver...

DISCUSSION shashank kharche 1 participant 1 message Sep 15, 2005

lore
Share & tools
lore
#0 lore raw

I have written a simple block device driver in which i m just displaying messages
in read & write part e.g " Device Reading .... " & " Device Writing .....".
I have succesfully loaded that module in memory using "insmod" .
& then use " mknod " command ...as :

mknod block_dev b 100 0
where , block_dev : name of device
b : as i m using block device driver
100 : major number
0 : minor number

Even this is also working without error, now after this command device "block_dev" is created (i have checked it wit ls command ).
But , now while using "cat" & "echo" i am getting error as :

[root@localhost root]# cat block_dev
cat: block_dev : No such device or address

[root@localhost root]# echo "hello" > block_dev
bash: block_dev : No such device or address

Is it ok to use 'b' in mknod command while working with block device driver,
as i hav used (shown above).

Im attaching C-code also,so plz help me....if you have another simple code for block device driver please send me : [email protected]

Please tell me what is going wrong in this code.....

__________________________________________________________
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com