repo: Port hardlink-scanning code to fd-relative calls
Continuing the migration.
This commit is contained in:
1 parent
6e0d92db00
commit
488efac728
4 files changed
+81
-136
No files matched your search
@@ -1511,89 +1511,6 @@ ostree_repo_get_parent (OstreeRepo *self)
|
||||
return self->parent_repo;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
append_object_dirs_from (OstreeRepo *self,
|
||||
GFile *dir,
|
||||
GPtrArray *object_dirs,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
GError *temp_error = NULL;
|
||||
gs_unref_object GFileEnumerator *enumerator = NULL;
|
||||
|
||||
enumerator = g_file_enumerate_children (dir, OSTREE_GIO_FAST_QUERYINFO,
|
||||
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
||||
cancellable,
|
||||
&temp_error);
|
||||
if (!enumerator)
|
||||
{
|
||||
if (g_error_matches (temp_error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
|
||||
{
|
||||
g_clear_error (&temp_error);
|
||||
ret = TRUE;
|
||||
}
|
||||
else
|
||||
g_propagate_error (error, temp_error);
|
||||
|
||||
goto out;
|
||||
}
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
GFileInfo *file_info;
|
||||
const char *name;
|
||||
guint32 type;
|
||||
|
||||
if (!gs_file_enumerator_iterate (enumerator, &file_info, NULL,
|
||||
NULL, error))
|
||||
goto out;
|
||||
if (file_info == NULL)
|
||||
break;
|
||||
|
||||
name = g_file_info_get_attribute_byte_string (file_info, "standard::name");
|
||||
type = g_file_info_get_attribute_uint32 (file_info, "standard::type");
|
||||
|
||||
if (strlen (name) == 2 && type == G_FILE_TYPE_DIRECTORY)
|
||||
{
|
||||
GFile *objdir = g_file_get_child (g_file_enumerator_get_container (enumerator), name);
|
||||
g_ptr_array_add (object_dirs, objdir); /* transfer ownership */
|
||||
}
|
||||
}
|
||||
|
||||
ret = TRUE;
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_ostree_repo_get_loose_object_dirs (OstreeRepo *self,
|
||||
GPtrArray **out_object_dirs,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
gs_unref_ptrarray GPtrArray *ret_object_dirs = NULL;
|
||||
|
||||
ret_object_dirs = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
|
||||
|
||||
if (ostree_repo_get_mode (self) == OSTREE_REPO_MODE_ARCHIVE_Z2)
|
||||
{
|
||||
if (!append_object_dirs_from (self, self->uncompressed_objects_dir, ret_object_dirs,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!append_object_dirs_from (self, self->objects_dir, ret_object_dirs,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
ret = TRUE;
|
||||
ot_transfer_out_value (out_object_dirs, &ret_object_dirs);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
list_loose_objects_at (OstreeRepo *self,
|
||||
GHashTable *inout_objects,
|
||||
|
||||
Reference in new issue
Block a user