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-next>] [day] [month] [year] [list]
Message-ID: <AB5E58B87EB73C46A38073D8F459F113D9FBA4@dataspheresrv01>
Date:	Mon, 6 May 2013 15:58:31 +0200
From:	"Patrick Monnerat" <Patrick.Monnerat@...asphere.ch>
To:	"Neela Syam Kolli" <megaraidlinux@....com>
Cc:	"James E.J. Bottomley" <JBottomley@...allels.com>,
	<linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 1/1] Create megaraid ioctl device node

From: Patrick Monnerat <pm@...asphere.ch>

  Create ioctl device node for megaraid_sas driver. Let this node be
managed by udev. Fix a typo.

Reported-by: pm@...asphere.ch
To: Neela Syam Kolli <megaraidlinux@....com>
Cc: "James E.J. Bottomley" <JBottomley@...allels.com>
Cc: linux-scsi@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Signed-off-by: Patrick Monnerat <pm@...asphere.ch>
---
diff -uprN
linux-3.8.11-200.1pm.fc18.x86_64.orig/drivers/scsi/megaraid/megaraid_sas
_base.c
linux-3.8.11-200.1pm.fc18.x86_64.new/drivers/scsi/megaraid/megaraid_sas_
base.c
---
linux-3.8.11-200.1pm.fc18.x86_64.orig/drivers/scsi/megaraid/megaraid_sas
_base.c	2013-02-19 00:58:34.000000000 +0100
+++
linux-3.8.11-200.1pm.fc18.x86_64.new/drivers/scsi/megaraid/megaraid_sas_
base.c	2013-05-06 13:39:27.903234426 +0200
@@ -49,6 +49,7 @@
 #include <linux/blkdev.h>
 #include <linux/mutex.h>
 #include <linux/poll.h>
+#include <linux/device.h>
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -127,6 +128,8 @@ static struct pci_device_id megasas_pci_
 
 MODULE_DEVICE_TABLE(pci, megasas_pci_table);
 
+static struct class *megasas_mgmt_class;
+static struct device *megasas_mgmt_device;
 static int megasas_mgmt_majorno;
 static struct megasas_mgmt_info megasas_mgmt_info;
 static struct fasync_struct *megasas_async_queue;
@@ -5450,7 +5453,7 @@ static int __init megasas_init(void)
 	rval = pci_register_driver(&megasas_pci_driver);
 
 	if (rval) {
-		printk(KERN_DEBUG "megasas: PCI hotplug regisration
failed \n");
+		printk(KERN_DEBUG "megasas: PCI hotplug registration
failed\n");
 		goto err_pcidrv;
 	}
 
@@ -5477,8 +5480,28 @@ static int __init megasas_init(void)
 	if (rval)
 		goto err_dcf_support_device_change;
 
-	return rval;
+	/*
+	 * Register as an udev-controlled device.
+	 */
+	megasas_mgmt_class = class_create(THIS_MODULE, "megaraid");
+	rval = PTR_ERR(megasas_mgmt_class);
+	if (IS_ERR(megasas_mgmt_class))
+		goto err_class;
+
+	megasas_mgmt_device = device_create(megasas_mgmt_class, NULL,
+					    MKDEV(megasas_mgmt_majorno,
0),
+					    NULL, "megaraid_sas_ioctl");
+	rval = PTR_ERR(megasas_mgmt_device);
+	if (IS_ERR(megasas_mgmt_device))
+		goto err_create_device;
 
+	return 0;
+
+err_create_device:
+	class_destroy(megasas_mgmt_class);
+err_class:
+	driver_remove_file(&megasas_pci_driver.driver,
+			   &driver_attr_support_device_change);
 err_dcf_support_device_change:
 	driver_remove_file(&megasas_pci_driver.driver,
 			   &driver_attr_dbg_lvl);
@@ -5504,6 +5527,9 @@ err_pcidrv:
  */
 static void __exit megasas_exit(void)
 {
+	device_destroy(megasas_mgmt_class, MKDEV(megasas_mgmt_majorno,
0));
+	class_destroy(megasas_mgmt_class);
+
 	driver_remove_file(&megasas_pci_driver.driver,
 			   &driver_attr_dbg_lvl);
 	driver_remove_file(&megasas_pci_driver.driver,
--
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