[Pkg-privacy-commits] [libgsecuredelete] 21/168: Added a generic property for the security mode.
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 ff74d51a5bb16f4813092db9c08b8f8da7dc2c28
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Thu Oct 1 19:13:10 2009 +0200
Added a generic property for the security mode.
Added SecureDeleteOperationMode, SecureDeleteOperation:mode
SecureDeleteOperation.get_argument_for_mode() and
SecureDeleteOperation.add_mode_argument().
Only the last one is meant to be used by implementations, even if
they can call SecureDeleteOperation.get_argument_for_mode().
---
gsecuredelete/securedelete-operation.vala | 48 +++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
diff --git a/gsecuredelete/securedelete-operation.vala b/gsecuredelete/securedelete-operation.vala
index 6db33b4..af253a0 100644
--- a/gsecuredelete/securedelete-operation.vala
+++ b/gsecuredelete/securedelete-operation.vala
@@ -22,6 +22,22 @@ using GLib;
namespace SecureDelete
{
/**
+ * SecureDeleteOperationMode:
+ *
+ * Secure mode:
+ * @NORMAL: normal mode
+ * @FAST: faster but less secure (correspond to the -f option)
+ * @VERY_FAST: really faster but with a very poor security
+ * @VERY_VERY_FAST: even more faster, even less secure
+ */
+ public enum SecureDeleteOperationMode {
+ NORMAL,
+ FAST,
+ VERY_FAST,
+ VERY_VERY_FAST
+ }
+
+ /**
* SecureDeleteOperation:
*
* A subclass of AsyncOperation designed to be the base class for all
@@ -30,6 +46,38 @@ namespace SecureDelete
*/
public abstract class SecureDeleteOperation : AsyncOperation
{
+ /** Whether to do fast and insecure filling */
+ public SecureDeleteOperationMode mode {
+ get;
+ set;
+ default = SecureDeleteOperationMode.NORMAL;
+ }
+
+ /* returns the argument to pass to SecureDelete tools depending on the
+ * security mode. %null wan be returned, meaning no argument should be
+ * added */
+ protected unowned string? get_argument_for_mode (SecureDeleteOperationMode mode)
+ {
+ switch (this.mode) {
+ case SecureDeleteOperationMode.FAST:
+ return "-f";
+ case SecureDeleteOperationMode.VERY_FAST:
+ return "-l";
+ case SecureDeleteOperationMode.VERY_VERY_FAST:
+ return "-ll";
+ }
+ return null;
+ }
+
+ /* adds the argument needed by the current set mode to an argument list */
+ protected void add_mode_argument (ref List<string> args)
+ {
+ unowned string? arg_mode = this.get_argument_for_mode (this.mode);
+ if (arg_mode != null) {
+ args.append (arg_mode);
+ }
+ }
+
protected override uint get_max_progress ()
{
/* FIXME: 38 is the standard S* pass number, but may change with options
--
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