about summary refs log tree commit diff
path: root/src/nix-store
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2008-06-18T14·20+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2008-06-18T14·20+0000
commitd3aa183beb774c20cb77052248cf45e684d134fb (patch)
treedff630ec4a8a0af08added558a1f6b753edfd5dd /src/nix-store
parenta8f3b02092fcc08fb25fb327d0188ffc888120bb (diff)
* Garbage collector: option `--max-freed' to stop after at least N
  bytes have been freed, `--max-links' to stop when the Nix store
  directory has fewer than N hard links (the latter being important
  for very large Nix stores on filesystems with a 32000 subdirectories
  limit).

Diffstat (limited to 'src/nix-store')
-rw-r--r--src/nix-store/nix-store.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 9618823ea681..b59ff27bb30c 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -528,6 +528,8 @@ static void opGC(Strings opFlags, Strings opArgs)
         else if (*i == "--print-live") options.action = GCOptions::gcReturnLive;
         else if (*i == "--print-dead") options.action = GCOptions::gcReturnDead;
         else if (*i == "--delete") options.action = GCOptions::gcDeleteDead;
+        else if (*i == "--max-freed") options.maxFreed = getIntArg(*i, i, opFlags.end());
+        else if (*i == "--max-links") options.maxLinks = getIntArg(*i, i, opFlags.end());
         else throw UsageError(format("bad sub-operation `%1%' in GC") % *i);
 
     PrintFreed freed(
@@ -744,8 +746,12 @@ void run(Strings args)
         }
         else if (arg == "--indirect")
             indirectRoot = true;
-        else if (arg[0] == '-')
+        else if (arg[0] == '-') {            
             opFlags.push_back(arg);
+            if (arg == "--max-freed" || arg == "--max-links") { /* !!! hack */
+                if (i != args.end()) opFlags.push_back(*i++);
+            }
+        }
         else
             opArgs.push_back(arg);