[PATCH 07/18] osd_test: User-mode application to run the OSD tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Most simple user-app to invoke the in-kernel test ioctl of the
specified osd device.

Usage: osd_test "/dev/osdX"

Where /dev/osdX is the osd device (lun) to run tests on. The output
of the tests is in dmesg log file

Signed-off-by: Boaz Harrosh <bharrosh@xxxxxxxxxxx>
---
 drivers/scsi/osd/Makefile   |   10 +++++-
 drivers/scsi/osd/osd_test.c |   74 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+), 2 deletions(-)
 create mode 100644 drivers/scsi/osd/osd_test.c

diff --git a/drivers/scsi/osd/Makefile b/drivers/scsi/osd/Makefile
index d905344..92d8b19 100755
--- a/drivers/scsi/osd/Makefile
+++ b/drivers/scsi/osd/Makefile
@@ -28,10 +28,16 @@ V ?= 0
 # this is the basic Kbuild out-of-tree invocation, with the M= option
 KBUILD_BASE = +$(MAKE) -C $(KSRC) M=`pwd` KBUILD_OUTPUT=$(KBUILD_OUTPUT) ARCH=$(ARCH) V=$(V)
 
-all: libosd
+all: libosd osd_test
 
 libosd: ;
 	$(KBUILD_BASE) OSD_INC=$(OSD_INC) modules
 
-clean:
+clean: osd_test_clean
 	$(KBUILD_BASE) clean
+
+osd_test: osd_test.o
+	$(CC) -o $@ $<
+
+osd_test_clean:
+	rm -vf osd_test
diff --git a/drivers/scsi/osd/osd_test.c b/drivers/scsi/osd/osd_test.c
new file mode 100644
index 0000000..dc74865
--- /dev/null
+++ b/drivers/scsi/osd/osd_test.c
@@ -0,0 +1,74 @@
+/*
+ * osd_test.c - A user-mode program that calls into the osd ULD
+ *
+ * Copyright (C) 2008 Panasas Inc.  All rights reserved.
+ *
+ * Authors:
+ *   Boaz Harrosh <bharrosh@xxxxxxxxxxx>
+ *   Benny Halevy <bhalevy@xxxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *  3. Neither the name of the Panasas company nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+
+#include "osd_ktests.h"
+
+void usage(void)
+{
+	printf("usage: osd_test /dev/osdX testNo\n");
+}
+
+int main(int argc, char *argv[])
+{
+	int osd_file, ret;
+
+	if (argc <= 1) {
+		usage();
+		return -2;
+	}
+
+	osd_file = open(argv[1], O_RDWR);
+	if (osd_file < 0) {
+		printf("Error opening <%s>\n", argv[1]);
+		return -3;
+	}
+
+	ret = ioctl(osd_file, OSD_TEST_ALL, 0);
+	if (ret) {
+		printf("ioctl 17 returned %d\n", ret);
+		return ret;
+	}
+
+	close(osd_file);
+	return 0;
+}
-- 
1.6.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux