How to get drive label in Linux using C from userspace

拜拜、爱过 提交于 2019-12-04 05:21:49

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!