11 void pb_log(const char *fmt, ...)
16 vfprintf(stderr, fmt, ap);
20 int mount_device(const char *dev_path)
22 printf("[mount] %s\n", dev_path);
26 static int device_idx;
27 static int option_idx;
29 int add_device(const struct device *dev)
31 printf("[dev %2d] id: %s\n", device_idx, dev->id);
32 printf("[dev %2d] name: %s\n", device_idx, dev->name);
33 printf("[dev %2d] description: %s\n", device_idx, dev->description);
34 printf("[dev %2d] boot_image: %s\n", device_idx, dev->icon_file);
42 int add_boot_option(const struct boot_option *opt)
45 fprintf(stderr, "Option (%s) added before device\n",
50 printf("[opt %2d] name: %s\n", option_idx, opt->name);
51 printf("[opt %2d] description: %s\n", option_idx, opt->description);
52 printf("[opt %2d] boot_image: %s\n", option_idx, opt->boot_image_file);
53 printf("[opt %2d] initrd: %s\n", option_idx, opt->initrd_file);
54 printf("[opt %2d] boot_args: %s\n", option_idx, opt->boot_args);
61 enum generic_icon_type guess_device_type(void)
63 return ICON_TYPE_UNKNOWN;
66 static char *mountpoint;
68 /* pretend that all devices are mounted at our original mountpoint */
69 const char *mountpoint_for_device(const char *dev_path)
74 char *resolve_path(const char *path, const char *default_mountpoint)
79 sep = strchr(path, ':');
81 devpath = default_mountpoint;
82 asprintf(&ret, "%s/%s", devpath, path);
84 char *tmp = strndup(path, sep - path);
85 devpath = mountpoint_for_device(path);
86 asprintf(&ret, "%s/%s", devpath, sep + 1);
93 int main(int argc, char **argv)
95 const char *dev = "sda1";
98 fprintf(stderr, "usage: %s <fake-mountpoint>\n", argv[0]);
102 mountpoint = argv[1];
104 iterate_parsers(dev, mountpoint);