X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fparser.h;h=2aaa07744d62281334df79fdaa3411321a4cc5d5;hp=03ba8d4d704134b3a9a239c9da9f6657ff449505;hb=1b646fb733ef99b1dc1862276ae3595bdeaf355b;hpb=5be946cda7b8e2271ade6188ca3f5dc068826619 diff --git a/discover/parser.h b/discover/parser.h index 03ba8d4..2aaa077 100644 --- a/discover/parser.h +++ b/discover/parser.h @@ -3,6 +3,8 @@ #include +#include "device-handler.h" + struct discover_context; struct device_handler; struct resource; @@ -25,6 +27,7 @@ struct resource; */ struct parser { char *name; + enum conf_method method; const char * const *filenames; int (*parse)(struct discover_context *ctx, char *buf, int len); @@ -45,7 +48,20 @@ enum generic_icon_type { void parser_init(void); -void iterate_parsers(struct discover_context *ctx); +void iterate_parsers(struct discover_context *ctx, enum conf_method method); int parse_user_event(struct discover_context *ctx, struct event *event); +/* File IO functions for parsers; these should be the only interface that + * parsers use to access a device's filesystem. + * + * These are intended for small amounts of data, typically text configuration + * and state files. + */ +int parser_request_file(struct discover_context *ctx, + struct discover_device *dev, const char *filename, + char **buf, int *len); +int parser_replace_file(struct discover_context *ctx, + struct discover_device *dev, const char *filename, + char *buf, int len); + #endif /* _PARSER_H */