[ostree] libglnx porting: Use glnx_opendirat()
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] libglnx porting: Use glnx_opendirat()
- Date: Wed, 23 Mar 2016 14:31:56 +0000 (UTC)
commit 0b1d301d81a36c010b4b56f3e6320420b8344305
Author: Colin Walters <walters verbum org>
Date: Fri Mar 18 17:17:54 2016 -0400
libglnx porting: Use glnx_opendirat()
This unfortunately adds *more* `gs_file_get_path_cached()`, but we'll
fix that all in one go.
src/libostree/ostree-repo-checkout.c | 5 ++---
src/libostree/ostree-repo.c | 15 ++++++++-------
src/libostree/ostree-sysroot-deploy.c | 9 ++++++---
src/libotutil/ot-gio-utils.c | 7 ++++---
4 files changed, 20 insertions(+), 16 deletions(-)
---
diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c
index d6ad494..0a77da0 100644
--- a/src/libostree/ostree-repo-checkout.c
+++ b/src/libostree/ostree-repo-checkout.c
@@ -655,9 +655,8 @@ checkout_tree_at (OstreeRepo *self,
}
}
- if (!gs_file_open_dir_fd_at (destination_parent_fd, destination_name,
- &destination_dfd,
- cancellable, error))
+ if (!glnx_opendirat (destination_parent_fd, destination_name, TRUE,
+ &destination_dfd, error))
goto out;
/* Set the xattrs now, so any derived labeling works */
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index 41377e7..09791c6 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -2271,14 +2271,15 @@ ostree_repo_open (OstreeRepo *self,
goto out;
g_strdelimit (self->boot_id, "\n", '\0');
- if (!gs_file_open_dir_fd (self->repodir, &self->repo_dir_fd, cancellable, error))
+ if (!glnx_opendirat (AT_FDCWD, gs_file_get_path_cached (self->repodir), TRUE,
+ &self->repo_dir_fd, error))
{
g_prefix_error (error, "%s: ", gs_file_get_path_cached (self->repodir));
goto out;
}
- if (!gs_file_open_dir_fd_at (self->repo_dir_fd, "objects",
- &self->objects_dir_fd, cancellable, error))
+ if (!glnx_opendirat (self->repo_dir_fd, "objects", TRUE,
+ &self->objects_dir_fd, error))
{
g_prefix_error (error, "Opening objects/ directory: ");
goto out;
@@ -2387,16 +2388,16 @@ ostree_repo_open (OstreeRepo *self,
goto out;
}
- if (!gs_file_open_dir_fd (self->tmp_dir, &self->tmp_dir_fd, cancellable, error))
+ if (!glnx_opendirat (self->repo_dir_fd, "tmp", TRUE, &self->tmp_dir_fd, error))
goto out;
if (self->mode == OSTREE_REPO_MODE_ARCHIVE_Z2 && self->enable_uncompressed_cache)
{
if (!gs_file_ensure_directory (self->uncompressed_objects_dir, TRUE, cancellable, error))
goto out;
- if (!gs_file_open_dir_fd (self->uncompressed_objects_dir,
- &self->uncompressed_objects_dir_fd,
- cancellable, error))
+ if (!glnx_opendirat (self->repo_dir_fd, "uncompressed-objects-cache", TRUE,
+ &self->uncompressed_objects_dir_fd,
+ error))
goto out;
}
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index a3a7b30..77ecb9a 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -456,11 +456,14 @@ merge_etc_changes (GFile *orig_etc,
removed->len,
added->len);
- if (!gs_file_open_dir_fd (orig_etc, &orig_etc_fd, cancellable, error))
+ if (!glnx_opendirat (AT_FDCWD, gs_file_get_path_cached (orig_etc), TRUE,
+ &orig_etc_fd, error))
goto out;
- if (!gs_file_open_dir_fd (modified_etc, &modified_etc_fd, cancellable, error))
+ if (!glnx_opendirat (AT_FDCWD, gs_file_get_path_cached (modified_etc), TRUE,
+ &modified_etc_fd, error))
goto out;
- if (!gs_file_open_dir_fd (new_etc, &new_etc_fd, cancellable, error))
+ if (!glnx_opendirat (AT_FDCWD, gs_file_get_path_cached (new_etc), TRUE,
+ &new_etc_fd, error))
goto out;
for (i = 0; i < removed->len; i++)
diff --git a/src/libotutil/ot-gio-utils.c b/src/libotutil/ot-gio-utils.c
index f750e75..9b8b0dc 100644
--- a/src/libotutil/ot-gio-utils.c
+++ b/src/libotutil/ot-gio-utils.c
@@ -362,8 +362,8 @@ ot_gfile_replace_contents_fsync (GFile *path,
parent = g_file_get_parent (path);
- if (!gs_file_open_dir_fd (parent, &parent_dfd,
- cancellable, error))
+ if (!glnx_opendirat (AT_FDCWD, gs_file_get_path_cached (parent), TRUE,
+ &parent_dfd, error))
goto out;
if (!ot_file_replace_contents_at (parent_dfd, target_basename,
@@ -426,7 +426,8 @@ ot_util_fsync_directory (GFile *dir,
gboolean ret = FALSE;
int dfd = -1;
- if (!gs_file_open_dir_fd (dir, &dfd, cancellable, error))
+ if (!glnx_opendirat (AT_FDCWD, gs_file_get_path_cached (dir), TRUE,
+ &dfd, error))
goto out;
if (fsync (dfd) != 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]