lib: Drop GFile variant mapping API for fd-relative

In addition to generic fd relative porting,
this is a necessary preparatory step for libglnx porting, because
when I tried to use `g_mapped_file_new` I hit an issue with
it using a different error domain from GIO.

Thankfully libglnx consistently uses the GIO error domain, and here
we're now using it for the `open()` call.

Closes: #317
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-06-01 15:02:41 +00:00
1 parent f725d39f11
commit c148631a98
5 files changed
+7 -54

No files matched your search

-40
View File
@@ -117,46 +117,6 @@ ot_util_variant_take_ref (GVariant *variant)
return g_variant_take_ref (variant);
}
/**
* ot_util_variant_map:
* @src: a #GFile
* @type: Use this for variant
* @trusted: See documentation of g_variant_new_from_data()
* @out_variant: (out): Return location for new variant
* @error:
*
* Memory-map @src, and store a new #GVariant referring to this memory
* in @out_variant. Note the returned @out_variant is not floating.
*/
gboolean
ot_util_variant_map (GFile *src,
const GVariantType *type,
gboolean trusted,
GVariant **out_variant,
GError **error)
{
gboolean ret = FALSE;
g_autoptr(GVariant) ret_variant = NULL;
GMappedFile *mfile = NULL;
mfile = gs_file_map_noatime (src, NULL, error);
if (!mfile)
goto out;
ret_variant = g_variant_new_from_data (type,
g_mapped_file_get_contents (mfile),
g_mapped_file_get_length (mfile),
trusted,
(GDestroyNotify) g_mapped_file_unref,
mfile);
g_variant_ref_sink (ret_variant);
ret = TRUE;
ot_transfer_out_value(out_variant, &ret_variant);
out:
return ret;
}
gboolean
ot_util_variant_map_at (int dfd,
const char *path,
-6
View File
@@ -42,12 +42,6 @@ gboolean ot_util_variant_save (GFile *dest,
GCancellable *cancellable,
GError **error);
gboolean ot_util_variant_map (GFile *src,
const GVariantType *type,
gboolean trusted,
GVariant **out_variant,
GError **error);
gboolean ot_util_variant_map_at (int dfd,
const char *path,
const GVariantType *type,