title: Inode to device information
body: <p>I have 3 questions:</p>
  <ol>
  <li><p>I want to figure out if a file belongs to a USB device given the file inode. By looking in the latest kernel sources (2.6.33) on LXR, I think one can find that information by following pointers as follows:
  inode-&gt;super_block-&gt;block_device-&gt;backing_dev_info-&gt;device-&gt;device_driver(or device_type).
  However, the kernel that I am working with - 2.6.22.14 - does not have struct device pointer in the backing_dev_info object. So how can I figure out to which device does a file belong to from just the inode?
  I see that each of the inode, super_block and block_device contain an object of type 'dev_t'. But even after searching a lot, I could not find out how to convert 'dev_t' into struct device *. Is there any way to get that infomation?</p>
  </li>
  <li><p>I tried to print device major and minor numbers using imajor(inode) and iminor(inode). However, for every file - belonging to hdd or usb - it always prints major and minor number as zero. Why would that be happening?</p>
  </li>
  <li><p>I searched online for USB major numbers and I found out that major number for a USB is 180. However, on multiple machines, it showed me the major number associated with the USB dev as 253.</p>
  </li>
  </ol>
  <blockquote>
  <p>$ ls -ltr /dev/usb*</p>
  <p>crw-rw---- 1 root root 253, 4 2010-04-13 17:20 /dev/usbmon4</p>
  <p>crw-rw---- 1 root root 253, 3 2010-04-13 17:20 /dev/usbmon3</p>
  <p>crw-rw---- 1 root root 253, 8 2010-04-13 17:20 /dev/usbmon8</p>
  <p>crw-rw---- 1 root root 253, 5 2010-04-13 17:20 /dev/usbmon5</p>
  <p>crw-rw---- 1 root root 253, 1 2010-04-13 17:20 /dev/usbmon1</p>
  <p>crw-rw---- 1 root root 253, 7 2010-04-13 17:20 /dev/usbmon7</p>
  </blockquote>
  <p>Why is that so?</p>