Using libblkid to find UUID of a partition
问题 I was looking at libblkid and was confused about the documentation. Could someone provide me with an example of how I could find the UUID of a root linux partition using this library? 回答1: It's pretty much as simple as the manual makes it look: you create a probe structure, initialize it, ask it for some information, and then free it. And you can combine the first two steps into one. This is a working program: #include <stdio.h> #include <stdlib.h> #include <err.h> #include <blkid/blkid.h>