lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1225817083-6040-1-git-send-email-bharrosh@panasas.com>
Date:	Tue,  4 Nov 2008 18:44:43 +0200
From:	Boaz Harrosh <bharrosh@...asas.com>
To:	James Bottomley <James.Bottomley@...senPartnership.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Mike Christie <michaelc@...wisc.edu>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	Jeff Garzik <jeff@...zik.org>,
	open-osd ml <osd-dev@...n-osd.org>,
	linux-scsi <linux-scsi@...r.kernel.org>
Cc:	linux-kernel <linux-kernel@...r.kernel.org>, Sami.Iren@...gate.com,
	Pete Wyckoff <pw@...d.com>
Subject: [PATCH 07/18] osd_test: User-mode application to run the OSD tests

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@...asas.com>
---
 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@...asas.com>
+ *   Benny Halevy <bhalevy@...asas.com>
+ *
+ * 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ