Finding the block device for a file?
I have a funny c programming question, I can't seem to find an answer for it. If I have the name of a file in linux, in C/C++ how would I go about find the block device it is hosted on? (We can assume it IS hosted on one.) :)
I've found the stat command, which would give me the device ID of the file, but I need the actual device path, like /dev/sda3.. (I have to feed it into the quotactl command, which needs a block device path.)
Any hints or suggestions in the right direction would be much appreciated. :)
I've found the stat command, which would give me the device ID of the file, but I need the actual device path, like /dev/sda3.. (I have to feed it into the quotactl command, which needs a block device path.)
Any hints or suggestions in the right direction would be much appreciated. :)
