[Pkg-privacy-commits] [libgsecuredelete] 17/168: Added another base class for all SecureDelete operators.

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 16168944313120e8b4a9537ddf4cdcd4cde9b3dc
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Wed Sep 30 17:12:15 2009 +0200

    Added another base class for all SecureDelete operators.
    
    Added a ScureDeleteOperation abstract class that implements things that
    are the same for all SecureDelete operators (such as progress getting).
---
 gsecuredelete/Makefile.am                 |  1 +
 gsecuredelete/securedelete-operation.vala | 79 +++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)

diff --git a/gsecuredelete/Makefile.am b/gsecuredelete/Makefile.am
index d053a69..e228abd 100644
--- a/gsecuredelete/Makefile.am
+++ b/gsecuredelete/Makefile.am
@@ -9,6 +9,7 @@ libgsecuredelete_la_includedir=$(includedir)/gsecuredelete
 
 libgsecuredelete_la_VALAFLAGS = $(AM_VALAFLAGS) --library=libgsecuredelete -H libgsecuredelete.h
 libgsecuredelete_la_SOURCES = async-operation.vala \
+                              securedelete-operation.vala \
                               delete-operation.vala \
                               fill-operation.vala \
                               utils.vala
diff --git a/gsecuredelete/securedelete-operation.vala b/gsecuredelete/securedelete-operation.vala
new file mode 100644
index 0000000..6db33b4
--- /dev/null
+++ b/gsecuredelete/securedelete-operation.vala
@@ -0,0 +1,79 @@
+/* 
+ * 
+ * Copyright (C) 2009 Colomban Wendling <ban at herbesfolles.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ * 
+ */
+
+using GLib;
+
+namespace SecureDelete
+{
+  /**
+   * SecureDeleteOperation:
+   * 
+   * A subclass of AsyncOperation designed to be the base class for all
+   * SecureDelete operations. It implements things that are the same for all
+   * SecureDelete operators.
+   */
+  public abstract class SecureDeleteOperation : AsyncOperation
+  {
+    protected override uint get_max_progress ()
+    {
+      /* FIXME: 38 is the standard S* 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 S* reports) in order to get a meaningful progress
+       * information */
+      return 38;
+    }
+    
+    /* gets the progress status of the child process */
+    protected 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:
+     * Runs a SecureDelete operator asynchronously.
+     * 
+     * Returns: whether subprocess started successfully.
+     */
+    public new bool run (uint watch_interval = 100)
+      throws SpawnError, AsyncOperationError
+    {
+      return base.run (null, SpawnFlags.SEARCH_PATH, watch_interval);
+    }
+    
+    /** run_sync:
+     * Runs a SecureDelete operator synchronously.
+     * 
+     * Returns: whether operation was successful.
+     */
+    public new bool run_sync ()
+      throws SpawnError, AsyncOperationError
+    {
+      return base.run_sync (null, SpawnFlags.SEARCH_PATH |
+                                  SpawnFlags.STDOUT_TO_DEV_NULL, null);
+    }
+  }
+}

-- 
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