summaryrefslogtreecommitdiffstats
path: root/discover/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'discover/parser.c')
-rw-r--r--discover/parser.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/discover/parser.c b/discover/parser.c
index 21b48de..74b2559 100644
--- a/discover/parser.c
+++ b/discover/parser.c
@@ -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)
OpenPOWER on IntegriCloud