summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-bootconfig-parser.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2015-03-04 21:33:25 -0500
committerColin Walters <walters@verbum.org>2015-03-09 14:29:14 -0400
commit68ce55420211698d14065c20891a517102db3016 (patch)
tree0e2745b7bd2dc3d156b6e49b6726341deb64dabf /src/libostree/ostree-bootconfig-parser.c
parenta5ffaca9d7d3fdb815e2f8e19032d0868c64c708 (diff)
downloadostree-68ce55420211698d14065c20891a517102db3016.tar.gz
sysroot: Read the bootloader configuration with fd-relative API
Another piece of the conversion.
Diffstat (limited to 'src/libostree/ostree-bootconfig-parser.c')
-rw-r--r--src/libostree/ostree-bootconfig-parser.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/libostree/ostree-bootconfig-parser.c b/src/libostree/ostree-bootconfig-parser.c
index ae817989..5cad20fa 100644
--- a/src/libostree/ostree-bootconfig-parser.c
+++ b/src/libostree/ostree-bootconfig-parser.c
@@ -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,