patch-2.3.46 linux/drivers/scsi/sr.c

Next file: linux/drivers/scsi/st.c
Previous file: linux/drivers/scsi/sg.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.45/linux/drivers/scsi/sr.c linux/drivers/scsi/sr.c
@@ -23,6 +23,8 @@
  *       Modified by Jens Axboe <axboe@image.dk> - Uniform sr_packet()
  *       interface, capabilities probe additions, ioctl cleanups, etc.
  *
+ *       Modified by Richard Gooch <rgooch@atnf.csiro.au> to support devfs
+ *
  */
 
 #include <linux/module.h>
@@ -693,7 +695,7 @@
 		return 0;
 
 	if (!sr_registered) {
-		if (register_blkdev(MAJOR_NR, "sr", &cdrom_fops)) {
+		if (devfs_register_blkdev(MAJOR_NR, "sr", &cdrom_fops)) {
 			printk("Unable to get major %d for SCSI-CD\n", MAJOR_NR);
 			return 1;
 		}
@@ -767,6 +769,11 @@
 
 		sprintf(name, "sr%d", i);
 		strcpy(scsi_CDs[i].cdi.name, name);
+                scsi_CDs[i].cdi.de =
+                    devfs_register (scsi_CDs[i].device->de, "cd", 2,
+                                    DEVFS_FL_DEFAULT, MAJOR_NR, i,
+                                    S_IFBLK | S_IRUGO | S_IWUGO, 0, 0,
+                                    &cdrom_fops, NULL);
 		register_cdrom(&scsi_CDs[i].cdi);
 	}
 
@@ -828,7 +835,7 @@
 void cleanup_module(void)
 {
 	scsi_unregister_module(MODULE_SCSI_DEV, &sr_template);
-	unregister_blkdev(MAJOR_NR, "sr");
+	devfs_unregister_blkdev(MAJOR_NR, "sr");
 	sr_registered--;
 	if (scsi_CDs != NULL) {
 		kfree((char *) scsi_CDs);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)