sysroot: Read the bootloader configuration with fd-relative API

Another piece of the conversion.
This commit is contained in:
Colin Walters committed 2015-03-09 14:29:14 -04:00
1 parent a5ffaca9d7
commit 68ce554202
3 files changed
+61 -31

No files matched your search

+26 -5
View File
@@ -62,11 +62,22 @@ ostree_bootconfig_parser_clone (OstreeBootconfigParser *self)
return parser;
}
/**
* ostree_bootconfig_parser_parse_at:
* @self: Parser
* @dfd: Directory fd
* @path: File path
* @cancellable: Cancellable
* @error: Error
*
* Initialize a bootconfig from the given file.
*/
gboolean
ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
GFile *path,
GCancellable *cancellable,
GError **error)
ostree_bootconfig_parser_parse_at (OstreeBootconfigParser *self,
int dfd,
const char *path,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gs_free char *contents = NULL;
@@ -75,7 +86,7 @@ ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
g_return_val_if_fail (!self->parsed, FALSE);
contents = gs_file_load_contents_utf8 (path, cancellable, error);
contents = glnx_file_get_contents_utf8_at (dfd, path, NULL, cancellable, error);
if (!contents)
goto out;
@@ -111,6 +122,16 @@ ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
return ret;
}
gboolean
ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
GFile *path,
GCancellable *cancellable,
GError **error)
{
return ostree_bootconfig_parser_parse_at (self, AT_FDCWD, gs_file_get_path_cached (path),
cancellable, error);
}
void
ostree_bootconfig_parser_set (OstreeBootconfigParser *self,
const char *key,