X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fparser.c;h=7833981ae3785d11aa072066f4aa834ae3a4acbc;hp=21b48debcb31d52e4f788040c1ce391e4ded7fc6;hb=49d7e0f299f96125620003e4b2388e1327b15d3e;hpb=b8e53cb4b96eb17dc7fa0ffc505dfebae37e6cbf diff --git a/discover/parser.c b/discover/parser.c index 21b48de..7833981 100644 --- a/discover/parser.c +++ b/discover/parser.c @@ -5,6 +5,7 @@ #include #include "types/types.h" +#include #include #include @@ -12,7 +13,6 @@ #include "parser.h" #include "parser-utils.h" #include "paths.h" -#include "file.h" struct p_item { struct list_item list; @@ -49,6 +49,25 @@ int parser_request_file(struct discover_context *ctx, return rc; } +int parser_check_dir(struct discover_context *ctx, + struct discover_device *dev, const char *dirname) +{ + struct stat statbuf; + char *path; + int rc; + + if (!dev->mount_path) + return -1; + + path = local_path(ctx, dev, dirname); + + rc = stat(path, &statbuf); + if (!rc) + return -1; + + return S_ISDIR(statbuf.st_mode) ? 0 : -1; +} + int parser_replace_file(struct discover_context *ctx, struct discover_device *dev, const char *filename, char *buf, int len)