X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=devices%2Fudev-helper.c;h=da12129316142814462162674d4e7aabdd69513f;hb=f6de8493cf6645f8da027671f935cf22f8008a1b;hp=f54ca238fd03178d165a169c520c36efa2f6b5e0;hpb=cabba48dcb96452352d0e6506384c4b2843bdac2;p=petitboot diff --git a/devices/udev-helper.c b/devices/udev-helper.c index f54ca23..da12129 100644 --- a/devices/udev-helper.c +++ b/devices/udev-helper.c @@ -16,10 +16,14 @@ #include #include "udev-helper.h" -#define REMOVABLE_SLEEP_DELAY 2 - #include "petitboot-paths.h" +/* Define below to operate without the frontend */ +#undef USE_FAKE_SOCKET + +/* Delay in seconds between polling of removable devices */ +#define REMOVABLE_SLEEP_DELAY 2 + extern struct parser native_parser; extern struct parser yaboot_parser; static FILE *logf; @@ -195,7 +199,7 @@ int remove_device(const char *dev_path) int connect_to_socket() { -#if 1 +#ifndef USE_FAKE_SOCKET int fd; struct sockaddr_un addr; @@ -564,3 +568,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; +} +