[ostree] libglnx porting: Use glnx_shutil_rm_rf_at()



commit 18530894c74a9b7be73ca334e2e87d7dbe01f9c6
Author: Colin Walters <walters verbum org>
Date:   Fri Mar 18 16:59:59 2016 -0400

    libglnx porting: Use glnx_shutil_rm_rf_at()
    
    In some cases (such as `ostree-sysroot-cleanup.c`), the surrounding
    code would be substantially cleaner if it was also ported to
    fd-relative, but I'm going to do that in a separate patch.
    
    That way these patches are easier to review for mechanical
    correctness.  I used an Emacs keyboard macro as the poor man's
    [Coccinelle](http://coccinelle.lip6.fr/).

 src/libostree/ostree-repo-commit.c     |    6 +++---
 src/libostree/ostree-repo-prune.c      |    2 +-
 src/libostree/ostree-sysroot-cleanup.c |   12 ++++++------
 src/libostree/ostree-sysroot-deploy.c  |    4 ++--
 src/ostree/ot-admin-builtin-deploy.c   |    4 ++--
 5 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c
index c0810a6..0fb3b0f 100644
--- a/src/libostree/ostree-repo-commit.c
+++ b/src/libostree/ostree-repo-commit.c
@@ -1272,8 +1272,8 @@ rename_pending_loose_objects (OstreeRepo        *self,
         }
     }
 
-  if (!gs_shutil_rm_rf_at (self->tmp_dir_fd, self->commit_stagedir_name,
-                           cancellable, error))
+  if (!glnx_shutil_rm_rf_at (self->tmp_dir_fd, self->commit_stagedir_name,
+                             cancellable, error))
     goto out;
 
   ret = TRUE;
@@ -1323,7 +1323,7 @@ cleanup_tmpdir (OstreeRepo        *self,
       delta = curtime_secs - mtime;
       if (delta > 60*60*24)
         {
-          if (!gs_shutil_rm_rf (path, cancellable, error))
+          if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (path), cancellable, error))
             goto out;
         }
     }
diff --git a/src/libostree/ostree-repo-prune.c b/src/libostree/ostree-repo-prune.c
index 3384883..2d93a9c 100644
--- a/src/libostree/ostree-repo-prune.c
+++ b/src/libostree/ostree-repo-prune.c
@@ -236,7 +236,7 @@ ostree_repo_prune_static_deltas (OstreeRepo *self, const char *commit,
 
       deltadir = _ostree_get_relative_static_delta_path (from, to, NULL);
 
-      if (!gs_shutil_rm_rf_at (self->repo_dir_fd, deltadir,
+      if (!glnx_shutil_rm_rf_at (self->repo_dir_fd, deltadir,
                                cancellable, error))
         goto out;
     }
diff --git a/src/libostree/ostree-sysroot-cleanup.c b/src/libostree/ostree-sysroot-cleanup.c
index f053ac0..5c37050 100644
--- a/src/libostree/ostree-sysroot-cleanup.c
+++ b/src/libostree/ostree-sysroot-cleanup.c
@@ -255,28 +255,28 @@ cleanup_other_bootversions (OstreeSysroot       *self,
   cleanup_subbootversion = self->subbootversion == 0 ? 1 : 0;
 
   cleanup_boot_dir = ot_gfile_resolve_path_printf (self->path, "boot/loader.%d", cleanup_bootversion);
-  if (!gs_shutil_rm_rf (cleanup_boot_dir, cancellable, error))
+  if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (cleanup_boot_dir), cancellable, error))
     goto out;
   g_clear_object (&cleanup_boot_dir);
 
   cleanup_boot_dir = ot_gfile_resolve_path_printf (self->path, "ostree/boot.%d", cleanup_bootversion);
-  if (!gs_shutil_rm_rf (cleanup_boot_dir, cancellable, error))
+  if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (cleanup_boot_dir), cancellable, error))
     goto out;
   g_clear_object (&cleanup_boot_dir);
 
   cleanup_boot_dir = ot_gfile_resolve_path_printf (self->path, "ostree/boot.%d.0", cleanup_bootversion);
-  if (!gs_shutil_rm_rf (cleanup_boot_dir, cancellable, error))
+  if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (cleanup_boot_dir), cancellable, error))
     goto out;
   g_clear_object (&cleanup_boot_dir);
 
   cleanup_boot_dir = ot_gfile_resolve_path_printf (self->path, "ostree/boot.%d.1", cleanup_bootversion);
-  if (!gs_shutil_rm_rf (cleanup_boot_dir, cancellable, error))
+  if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (cleanup_boot_dir), cancellable, error))
     goto out;
   g_clear_object (&cleanup_boot_dir);
 
   cleanup_boot_dir = ot_gfile_resolve_path_printf (self->path, "ostree/boot.%d.%d", self->bootversion,
                                                    cleanup_subbootversion);
-  if (!gs_shutil_rm_rf (cleanup_boot_dir, cancellable, error))
+  if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (cleanup_boot_dir), cancellable, error))
     goto out;
   g_clear_object (&cleanup_boot_dir);
 
@@ -377,7 +377,7 @@ cleanup_old_deployments (OstreeSysroot       *self,
       if (g_hash_table_lookup (active_boot_checksums, bootcsum))
         continue;
 
-      if (!gs_shutil_rm_rf (bootdir, cancellable, error))
+      if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (bootdir), cancellable, error))
         goto out;
     }
 
diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c
index 659a7be..a3a7b30 100644
--- a/src/libostree/ostree-sysroot-deploy.c
+++ b/src/libostree/ostree-sysroot-deploy.c
@@ -473,7 +473,7 @@ merge_etc_changes (GFile          *orig_etc,
       g_assert (path);
       target_file = g_file_resolve_relative_path (new_etc, path);
 
-      if (!gs_shutil_rm_rf (target_file, cancellable, error))
+      if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (target_file), cancellable, error))
         goto out;
     }
 
@@ -1821,7 +1821,7 @@ ostree_sysroot_write_deployments (OstreeSysroot     *self,
 
       new_loader_entries_dir = ot_gfile_resolve_path_printf (self->path, "boot/loader.%d/entries",
                                                              new_bootversion);
-      if (!gs_shutil_rm_rf (new_loader_entries_dir, cancellable, error))
+      if (!glnx_shutil_rm_rf_at (AT_FDCWD, gs_file_get_path_cached (new_loader_entries_dir), cancellable, 
error))
         goto out;
       if (!ot_util_ensure_directory_and_fsync (new_loader_entries_dir, cancellable, error))
         goto out;
diff --git a/src/ostree/ot-admin-builtin-deploy.c b/src/ostree/ot-admin-builtin-deploy.c
index 51de4ee..c66c9b3 100644
--- a/src/ostree/ot-admin-builtin-deploy.c
+++ b/src/ostree/ot-admin-builtin-deploy.c
@@ -113,8 +113,8 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro
   merge_deployment = ostree_sysroot_get_merge_deployment (sysroot, opt_osname);
 
   /* Here we perform cleanup of any leftover data from previous
-   * partial failures.  This avoids having to call gs_shutil_rm_rf()
-   * at random points throughout the process.
+   * partial failures.  This avoids having to call
+   * glnx_shutil_rm_rf_at() at random points throughout the process.
    *
    * TODO: Add /ostree/transaction file, and only do this cleanup if
    * we find it.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]