Whamcloud - gitweb
Add munlink tool which unlinks files without stat first (unlike GNU rm).
authoradilger <adilger>
Thu, 1 Aug 2002 00:01:18 +0000 (00:01 +0000)
committeradilger <adilger>
Thu, 1 Aug 2002 00:01:18 +0000 (00:01 +0000)
lustre/tests/Makefile.am
lustre/tests/munlink.c [new file with mode: 0755]
lustre/tests/runtests

index 39a89c1..0d9a9a5 100644 (file)
@@ -23,13 +23,15 @@ noinst_SCRIPTS = fs.sh intent-test.sh intent-test2.sh leak_finder.pl \
        runtests runvmstat snaprun.sh
 pkglib_SCRIPTS = common.sh
 pkgcfg_DATA = lustre.cfg
-noinst_PROGRAMS = openunlink testreq truncate directio openme writeme mcreate tchmod toexcl fsx #ldaptest 
+noinst_PROGRAMS = openunlink testreq truncate directio openme writeme mcreate
+noinst_PROGRAMS += munlink tchmod toexcl fsx #ldaptest 
 
 # ldaptest_SOURCES = ldaptest.c
 tchmod_SOURCES = tchmod.c
 toexcl_SOURCES = toexcl.c
 testreq_SOURCES = testreq.c
 mcreate_SOURCES = mcreate.c
+munlink_SOURCES = munlink.c
 truncate_SOURCES = truncate.c
 directio_SOURCES = directio.c
 openunlink_SOURCES = openunlink.c
diff --git a/lustre/tests/munlink.c b/lustre/tests/munlink.c
new file mode 100755 (executable)
index 0000000..a3c18c5
--- /dev/null
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <string.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+int main(int argc, char ** argv)
+{
+        int rc;
+
+        if (argc < 2) { 
+                printf("Usage %s filename\n", argv[0]);
+                return 1;
+        }
+
+        rc = unlink(argv[1]);
+        if (rc) { 
+                printf("unlink(%s) error: %s\n", argv[1], strerror(errno));
+        }
+        return rc;
+} 
index c999a4d..5f4dde4 100755 (executable)
@@ -12,7 +12,7 @@ export PATH=/sbin:/usr/sbin:$SRCDIR:$PATH
 
 ERROR=
 SRC=/etc
-COUNT=1000
+[ "$COUNT" ] || COUNT=1000
 
 setup_opts $@