[Pkg-privacy-commits] [libgsecuredelete] 18/168: Make use of the new SecureDeleteOperation base class.
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Jul 7 20:06:33 UTC 2016
This is an automated email from the git hooks/post-receive script.
u-guest pushed a commit to branch master
in repository libgsecuredelete.
commit 1382b6db890d0843e7d5bf0f207891a84f0d733f
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Wed Sep 30 17:14:35 2009 +0200
Make use of the new SecureDeleteOperation base class.
Use the new SecureDeleteOperation in DeleteOperation and FillOperation.
---
gsecuredelete/delete-operation.vala | 53 ++++---------------------------------
gsecuredelete/fill-operation.vala | 30 +++------------------
2 files changed, 8 insertions(+), 75 deletions(-)
diff --git a/gsecuredelete/delete-operation.vala b/gsecuredelete/delete-operation.vala
index b674d0d..057b2ca 100644
--- a/gsecuredelete/delete-operation.vala
+++ b/gsecuredelete/delete-operation.vala
@@ -21,7 +21,7 @@ using GLib;
namespace SecureDelete
{
- public class DeleteOperation : AsyncOperation
+ public class DeleteOperation : SecureDeleteOperation
{
private List<string> paths;
private uint n_files = 0;
@@ -57,7 +57,7 @@ namespace SecureDelete
}
/* builds the command's arguments (argv) */
- private override string?[] build_args ()
+ protected override string?[] build_args ()
throws AsyncOperationError
{
string?[] args = {
@@ -82,58 +82,15 @@ namespace SecureDelete
return args;
}
- private override void cleanup ()
+ protected override void cleanup ()
{
/* empty the paths' list not to try to remove them again at next call */
this.paths = null;
}
- private override uint get_max_progress ()
+ protected override uint get_max_progress ()
{
- /* FIXME: 38 is the standard SRM pass number, but may change with options
- * like -l. If we support it one day, we need to fix this value (by
- * getting the one SRM reports) in order to get a meaningful progress
- * information */
- return 38 * this.n_files;
- }
-
- /* gets the progress status of the child process */
- private override uint get_progress ()
- {
- uint progress = 0;
-
- try {
- progress = FD.count_ready_bytes (this.fd_out, '*');
- } catch (FDError e) {
- warning ("Progression check failed: %s", e.message);
- }
-
- return progress;
- }
-
- /** run_sync:
- * Launches a secure deletion asynchronously.
- *
- * Returns: whether subprocess started successfully.
- */
- public new bool run (uint watch_interval = 100)
- throws SpawnError, AsyncOperationError
- requires (! this.busy)
- {
- return base.run (null, SpawnFlags.SEARCH_PATH, watch_interval);
- }
-
- /** run_sync:
- * Launches a secure deletion synchronously.
- *
- * Returns: whether deletion was successful.
- */
- public new bool run_sync ()
- throws SpawnError, AsyncOperationError
- requires (! this.busy)
- {
- return base.run_sync (null, SpawnFlags.SEARCH_PATH |
- SpawnFlags.STDOUT_TO_DEV_NULL, null);
+ return base.get_max_progress () * this.n_files;
}
}
}
diff --git a/gsecuredelete/fill-operation.vala b/gsecuredelete/fill-operation.vala
index 6f7d068..585aaf4 100644
--- a/gsecuredelete/fill-operation.vala
+++ b/gsecuredelete/fill-operation.vala
@@ -25,7 +25,7 @@ namespace SecureDelete
* perhaps support -l and -z.
*/
- public class FillOperation : AsyncOperation
+ public class FillOperation : SecureDeleteOperation
{
/** Whether to do fast and insecure filling */
public bool fast {
@@ -74,29 +74,6 @@ namespace SecureDelete
this.directory = null;
}
- private override uint get_max_progress ()
- {
- /* FIXME: 38 is the standard SFILL pass number, but may change with
- * options like -l. If we support it one day, we need to fix this value
- * (by getting the one SFILL reports) in order to get a meaningful
- * progress information */
- return 38;
- }
-
- /* gets the progress status of the child process */
- private override uint get_progress ()
- {
- uint progress = 0;
-
- try {
- progress = FD.count_ready_bytes (this.fd_out, '*');
- } catch (FDError e) {
- warning ("Progression check failed: %s", e.message);
- }
-
- return progress;
- }
-
/** run_sync:
* @directory: the directory to fill. It is exactly the same as setting
* the FillOperation:directory property, just a convenience
@@ -115,7 +92,7 @@ namespace SecureDelete
if (directory != null) {
this.directory = directory;
}
- return base.run (null, SpawnFlags.SEARCH_PATH, watch_interval);
+ return base.run (watch_interval);
}
/** run_sync:
@@ -134,8 +111,7 @@ namespace SecureDelete
if (directory != null) {
this.directory = directory;
}
- return base.run_sync (null, SpawnFlags.SEARCH_PATH |
- SpawnFlags.STDOUT_TO_DEV_NULL, null);
+ return base.run_sync ();
}
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libgsecuredelete.git
More information about the Pkg-privacy-commits
mailing list