summaryrefslogtreecommitdiff
path: root/src/import
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-04-04 11:52:57 +0200
committerLennart Poettering <lennart@poettering.net>2015-04-06 10:57:53 +0200
commitc6878637502b1717a110a9a7e8bba32a8583fcdf (patch)
tree44bd9f305f8f3b97a0c736c3ac549e568b6495cd /src/import
parent2f653bded321fc2271edcda43d54fcc3e6c20dc9 (diff)
util: rework rm_rf() logic
- Move to its own file rm-rf.c - Change parameters into a single flags parameter - Remove "honour sticky" logic, it's unused these days
Diffstat (limited to 'src/import')
-rw-r--r--src/import/aufs-util.c5
-rw-r--r--src/import/import-raw.c3
-rw-r--r--src/import/import-tar.c5
-rw-r--r--src/import/pull-common.c5
-rw-r--r--src/import/pull-dkr.c3
-rw-r--r--src/import/pull-raw.c3
-rw-r--r--src/import/pull-tar.c3
7 files changed, 17 insertions, 10 deletions
diff --git a/src/import/aufs-util.c b/src/import/aufs-util.c
index c1301cdb4a..18c42b8b6d 100644
--- a/src/import/aufs-util.c
+++ b/src/import/aufs-util.c
@@ -22,6 +22,7 @@
#include <ftw.h>
#include "util.h"
+#include "rm-rf.h"
#include "aufs-util.h"
static int nftw_cb(
@@ -43,7 +44,7 @@ static int nftw_cb(
return FTW_CONTINUE;
log_debug("Removing whiteout indicator %s.", fpath);
- r = rm_rf_dangerous(fpath, false, true, false);
+ r = rm_rf(fpath, REMOVE_ROOT|REMOVE_PHYSICAL);
if (r < 0)
return FTW_STOP;
@@ -53,7 +54,7 @@ static int nftw_cb(
strcpy(mempcpy(p, fpath, ftwbuf->base), original);
log_debug("Removing deleted file %s.", p);
- r = rm_rf_dangerous(p, false, true, false);
+ r = rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
if (r < 0)
return FTW_STOP;
}
diff --git a/src/import/import-raw.c b/src/import/import-raw.c
index 7d1ac2afd7..3a315139e5 100644
--- a/src/import/import-raw.c
+++ b/src/import/import-raw.c
@@ -28,6 +28,7 @@
#include "btrfs-util.h"
#include "copy.h"
#include "mkdir.h"
+#include "rm-rf.h"
#include "ratelimit.h"
#include "machine-pool.h"
#include "qcow2-util.h"
@@ -242,7 +243,7 @@ static int raw_import_finish(RawImport *i) {
if (i->force_local) {
(void) btrfs_subvol_remove(i->final_path);
- (void) rm_rf_dangerous(i->final_path, false, true, false);
+ (void) rm_rf(i->final_path, REMOVE_ROOT|REMOVE_PHYSICAL);
}
r = rename_noreplace(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path);
diff --git a/src/import/import-tar.c b/src/import/import-tar.c
index ef2345c7b9..c5346ca2b0 100644
--- a/src/import/import-tar.c
+++ b/src/import/import-tar.c
@@ -28,6 +28,7 @@
#include "btrfs-util.h"
#include "copy.h"
#include "mkdir.h"
+#include "rm-rf.h"
#include "ratelimit.h"
#include "machine-pool.h"
#include "qcow2-util.h"
@@ -87,7 +88,7 @@ TarImport* tar_import_unref(TarImport *i) {
if (i->temp_path) {
(void) btrfs_subvol_remove(i->temp_path);
- (void) rm_rf_dangerous(i->temp_path, false, true, false);
+ (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL);
free(i->temp_path);
}
@@ -198,7 +199,7 @@ static int tar_import_finish(TarImport *i) {
if (i->force_local) {
(void) btrfs_subvol_remove(i->final_path);
- (void) rm_rf_dangerous(i->final_path, false, true, false);
+ (void) rm_rf(i->final_path, REMOVE_ROOT|REMOVE_PHYSICAL);
}
r = rename_noreplace(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path);
diff --git a/src/import/pull-common.c b/src/import/pull-common.c
index 94dd54bd57..d4cebe205e 100644
--- a/src/import/pull-common.c
+++ b/src/import/pull-common.c
@@ -24,6 +24,7 @@
#include "util.h"
#include "strv.h"
#include "copy.h"
+#include "rm-rf.h"
#include "btrfs-util.h"
#include "capability.h"
#include "pull-job.h"
@@ -125,7 +126,7 @@ int pull_make_local_copy(const char *final, const char *image_root, const char *
if (force_local) {
(void) btrfs_subvol_remove(p);
- (void) rm_rf_dangerous(p, false, true, false);
+ (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
}
r = btrfs_subvol_snapshot(final, p, false, false);
@@ -418,7 +419,7 @@ finish:
unlink(sig_file_path);
if (gpg_home_created)
- rm_rf_dangerous(gpg_home, false, true, false);
+ (void) rm_rf(gpg_home, REMOVE_ROOT|REMOVE_PHYSICAL);
return r;
}
diff --git a/src/import/pull-dkr.c b/src/import/pull-dkr.c
index 1a7dc310cb..a1e6fe8ff7 100644
--- a/src/import/pull-dkr.c
+++ b/src/import/pull-dkr.c
@@ -28,6 +28,7 @@
#include "btrfs-util.h"
#include "utf8.h"
#include "mkdir.h"
+#include "rm-rf.h"
#include "path-util.h"
#include "import-util.h"
#include "curl-util.h"
@@ -111,7 +112,7 @@ DkrPull* dkr_pull_unref(DkrPull *i) {
if (i->temp_path) {
(void) btrfs_subvol_remove(i->temp_path);
- (void) rm_rf_dangerous(i->temp_path, false, true, false);
+ (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL);
free(i->temp_path);
}
diff --git a/src/import/pull-raw.c b/src/import/pull-raw.c
index c0c6d57ead..e10b280b66 100644
--- a/src/import/pull-raw.c
+++ b/src/import/pull-raw.c
@@ -31,6 +31,7 @@
#include "util.h"
#include "macro.h"
#include "mkdir.h"
+#include "rm-rf.h"
#include "path-util.h"
#include "import-util.h"
#include "import-common.h"
@@ -278,7 +279,7 @@ static int raw_pull_make_local_copy(RawPull *i) {
if (i->force_local) {
(void) btrfs_subvol_remove(p);
- (void) rm_rf_dangerous(p, false, true, false);
+ (void) rm_rf(p, REMOVE_ROOT|REMOVE_PHYSICAL);
}
r = tempfn_random(p, &tp);
diff --git a/src/import/pull-tar.c b/src/import/pull-tar.c
index 58cafdd789..60dc22fdfa 100644
--- a/src/import/pull-tar.c
+++ b/src/import/pull-tar.c
@@ -30,6 +30,7 @@
#include "util.h"
#include "macro.h"
#include "mkdir.h"
+#include "rm-rf.h"
#include "path-util.h"
#include "import-util.h"
#include "import-common.h"
@@ -88,7 +89,7 @@ TarPull* tar_pull_unref(TarPull *i) {
if (i->temp_path) {
(void) btrfs_subvol_remove(i->temp_path);
- (void) rm_rf_dangerous(i->temp_path, false, true, false);
+ (void) rm_rf(i->temp_path, REMOVE_ROOT|REMOVE_PHYSICAL);
free(i->temp_path);
}