diff options
author | Javier Martinez Canillas <javierm@redhat.com> | 2018-03-22 09:41:23 +0100 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2018-03-23 11:39:35 +1100 |
commit | 91ce1a8f8863d8f740188236f138421d17292d6c (patch) | |
tree | f39fa6f339e8c8f3e3ec20052acc33b806aa040b /discover/parser.h | |
parent | 3dfa4123bdf987aaa0e4bfd73d436c6bab0184ce (diff) | |
download | talos-petitboot-91ce1a8f8863d8f740188236f138421d17292d6c.tar.gz talos-petitboot-91ce1a8f8863d8f740188236f138421d17292d6c.zip |
discover/grub: Add blscfg command support to parse BootLoaderSpec files
The BootLoaderSpec (BLS) defines a file format for boot configurations,
so bootloaders can parse these files and create their boot menu entries
by using the information provided by them [0].
This allow to configure the boot items as drop-in files in a directory
instead of having to parse and modify a bootloader configuration file.
The GRUB 2 bootloader provides a blscfg command that parses these files
and creates menu entries using this information. Add support for it.
[0]: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'discover/parser.h')
-rw-r--r-- | discover/parser.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/discover/parser.h b/discover/parser.h index fc165c5..bff52e3 100644 --- a/discover/parser.h +++ b/discover/parser.h @@ -5,6 +5,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <dirent.h> #include "device-handler.h" @@ -76,5 +77,12 @@ int parser_request_url(struct discover_context *ctx, struct pb_url *url, int parser_stat_path(struct discover_context *ctx, struct discover_device *dev, const char *path, struct stat *statbuf); +/* Function used to list the files on a directory. The dirname should + * be relative to the discover context device mount path. It returns + * the number of files returned in files or a negative value on error. + */ +int parser_scandir(struct discover_context *ctx, const char *dirname, + struct dirent ***files, int (*filter)(const struct dirent *), + int (*comp)(const struct dirent **, const struct dirent **)); #endif /* _PARSER_H */ |