differntiating between character and block devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




 Hi,

   I have a problem. In my module I am not able to differentiate between 
whether requests are coming from a block device or character device.

 I am running my module on vmware and the keyboard hits are read thru 
ptty. The major number of ptty and the hard disk are both 3. I am blocking 
read system call in my module and I want to deal with the requests 
pertaining to the disk only. So given a file descriptor I am able to get 
the inode value and also the major and minor number of the device to which 
the request has to go.

 So in order to service only the requests of the disk i have an if 
statement

  if(inode && major == 3)
   {
      do my sys_read
   }
else
  {
	do original sys_read
  }


  but every keystroke evaluates to true and does my sys_read section. I 
thought that character devices do not have inode and the ptty requests 
evaluate to false at if statement. But it is not happening so...

 am i missing something...

 please help me.

 thanks,
raghu

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux