Reputation: 1964
Given: The path of a file on a UNIX file system
How can I get the UUID of the device it is stored on, possibly with a library call from C, in a way that is the most portable amongst UNIX like system (including OS X)?
Upvotes: 1
Views: 411
Reputation: 555
You can call int stat(const char *path, struct stat *buf) and the buf->st_dev will give to you the device's ID. stat() is POSIX.1.
Upvotes: 1