X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=devices%2Fudev-helper.c;h=6a9a42bac12e9c626e1c768dd7664edf759ac74c;hp=c113e55432177217c7fc144ded1b9e4ddc11ce69;hb=6ce15c4265d3813ee311756ec03c6e4da74c1dbd;hpb=2ee42ce22b643f865e52088b0f0451ec1f3a8f09 diff --git a/devices/udev-helper.c b/devices/udev-helper.c index c113e55..6a9a42b 100644 --- a/devices/udev-helper.c +++ b/devices/udev-helper.c @@ -26,6 +26,7 @@ extern struct parser native_parser; extern struct parser yaboot_parser; +extern struct parser kboot_parser; static FILE *logf; static int sock; @@ -33,6 +34,7 @@ static int sock; static struct parser *parsers[] = { &native_parser, &yaboot_parser, + &kboot_parser, NULL }; @@ -48,7 +50,7 @@ static void iterate_parsers(const char *devpath, const char *mountpoint) log("\ttrying parser '%s'\n", parsers[i]->name); /* just use a dummy device path for now */ if (parsers[i]->parse(devpath, mountpoint)) - return; + /*return*/; } log("\tno boot_options found\n"); } @@ -370,6 +372,8 @@ enum generic_icon_type guess_device_type(void) const char *bus = getenv("ID_BUS"); if (type && streq(type, "cd")) return ICON_TYPE_OPTICAL; + if (!bus) + return ICON_TYPE_UNKNOWN; if (streq(bus, "usb")) return ICON_TYPE_USB; if (streq(bus, "ata") || streq(bus, "scsi")) @@ -568,3 +572,19 @@ int main(int argc, char **argv) } return rc; } + +/* convenience function for parsers */ +char *join_paths(const char *a, const char *b) +{ + char *full_path; + + full_path = malloc(strlen(a) + strlen(b) + 2); + + strcpy(full_path, a); + if (b[0] != '/') + strcat(full_path, "/"); + strcat(full_path, b); + + return full_path; +} +