Skip to contentSkip to conversation

multiple cpqarray controlers with devfs

PATCH New Sergey S. Kostyliov 1 participant 1 message Jan 16, 2003 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multiple cpqarray controlers with devfs

Hello Marcelo,

Without this patch I can't use more than one cpqarray controllers at once on devfs enabled system.

Tested with two controllers:
"Smart Array 221" + "SMART-2/P"

All credits goes to Richard Gooch <[email protected]>. This patch was already in his devfs patchset, but from what i've seen was never merged in mainline.

Please apply.

===== drivers/block/cpqarray.c 1.27 vs edited =====

drivers/block/cpqarray.c +13 -3
@@ -32,6 +32,7 @@
 #include <linux/blkpg.h>
 #include <linux/timer.h>
 #include <linux/proc_fs.h>
+#include <linux/devfs_fs_kernel.h>
 #include <linux/init.h>
 #include <linux/hdreg.h>
 #include <linux/spinlock.h>
@@ -69,7 +70,7 @@
 
 static ctlr_info_t *hba[MAX_CTLR] = 
 	{ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
-
+static devfs_handle_t de_arr[MAX_CTLR][NWD];
 static int eisa[8];
 
 #define NR_PRODUCTS (sizeof(products)/sizeof(struct board_type))
@@ -578,9 +579,10 @@
 	hba[i]->gendisk.max_p = IDA_MAX_PART;
 	hba[i]->gendisk.part = hba[i]->hd;
 	hba[i]->gendisk.sizes = hba[i]->sizes;
-	hba[i]->gendisk.nr_real = hba[i]->highest_lun+1; 
+	hba[i]->gendisk.nr_real = hba[i]->highest_lun+1;
+	hba[i]->gendisk.de_arr = de_arr[i];
 	hba[i]->gendisk.fops = &ida_fops;
-	
+
 		/* Get on the disk list */
 	add_gendisk(&(hba[i]->gendisk));
 
@@ -2439,6 +2441,13 @@
 				}
 				if(log_unit > info_p->highest_lun)
 					info_p->highest_lun = log_unit;
+				if(!de_arr[ctlr][log_unit]) {
+					char txt[16];
+					sprintf(txt, "ida/c%dd%d", ctlr,
+						log_unit);
+					de_arr[ctlr][log_unit] =
+					devfs_mk_dir(NULL,txt, NULL);
+				}
 				info_p->phys_drives =
 				    sense_config_buf->ctlr_phys_drv;
 				info_p->drv_assign_map
@@ -2472,6 +2481,7 @@
                         cpqarray_remove_one_eisa(i);
                 }
         }
+	devfs_unregister(devfs_find_handle(NULL, "ida", 0, 0, 0, 0));
         remove_proc_entry("cpqarray", proc_root_driver);
 }
 
Signature · 3 lines
                   Best regards,
                   Sergey S. Kostyliov <[email protected]>
                   Public PGP key: http://sysadminday.org.ru/rathamahata.asc