Skip to content

Instantly share code, notes, and snippets.

@fourdollars
Created June 26, 2014 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fourdollars/c429ea26ead2d38aeeb1 to your computer and use it in GitHub Desktop.
Save fourdollars/c429ea26ead2d38aeeb1 to your computer and use it in GitHub Desktop.
/* gcc gio_mount_disk.c `pkg-config --cflags glib-2.0 gio-unix-2.0 --libs` -o gio_mount_disk */
#include <stdio.h>
#include <glib.h>
#include <gio/gunixmounts.h>
int main(int argc, char* argv[])
{
GList *p, *points = g_unix_mount_points_get (NULL);
for (p = points; p != NULL; p = p->next) {
GUnixMountEntry *mount = p->data;
const char *mount_path = g_unix_mount_get_mount_path (mount);
const char *fs = g_unix_mount_get_fs_type (mount);
const char *device = g_unix_mount_get_device_path (mount);
printf("mount: %s, fs: %s, device: %s\n", mount_path, fs, device);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment