35 lines
751 B
C
35 lines
751 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <czmq.h>
|
|
#include <guestfs.h>
|
|
|
|
int main(int argc, char **argv) {
|
|
if (argc < 2) {
|
|
printf("Usage: %s <disk-path>\n", argv[0]);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
guestfs_h *g = guestfs_create();
|
|
|
|
for (int i = 1; i < argc; i++) {
|
|
printf("Loading drive %s...\n", argv[i]);
|
|
guestfs_add_drive(g, argv[i]);
|
|
}
|
|
|
|
guestfs_launch(g);
|
|
|
|
char **filesystems = guestfs_list_filesystems(g);
|
|
if (filesystems == NULL)
|
|
return EXIT_FAILURE;
|
|
|
|
for (int i = 0; filesystems[i] != NULL; i += 2) {
|
|
printf("%s:%s is a %s filesystem\n",
|
|
argv[2], filesystems[i], filesystems[i+1]);
|
|
free(filesystems[i]);
|
|
free(filesystems[i+1]);
|
|
}
|
|
free(filesystems);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|