问题
I need to get a label for specific device using c/c++ (and no d-bus) in linux. The problem is that i can't just open device and read it's information (for extN it is very easy to get label from device) because reading from /dev/xxx requires root privileges.
回答1:
I think in most distributions now you have
/dev/disk/by-label/
which is filled with symlinks that point to the real device.
来源:https://stackoverflow.com/questions/4112964/how-to-get-drive-label-in-linux-using-c-from-userspace