lkml.org 
[lkml]   [2004]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] 2.6.2, Partition support for SCSI CDROM...
Here is the second try at the patch.

-Steve
diff -urN linux-2.6.2/drivers/scsi/sr.c linux-2.6.2-patched/drivers/scsi/sr.c
--- linux-2.6.2/drivers/scsi/sr.c 2004-02-22 20:15:08.000000000 -0500
+++ linux-2.6.2-patched/drivers/scsi/sr.c 2004-02-24 11:48:16.000000000 -0500
@@ -55,6 +55,23 @@
#include "scsi_logging.h"
#include "sr.h"

+/*
+ * Device node mappings are as follows:
+ *
+ * sr0 - first CDROM, whole disk
+ * sr1 - first CDROM, first partition
+ *
+ * [...]
+ *
+ * sr16 - first CDROM, sixteenth partition
+ * sr17 - second CDROM, whole disk
+ * sr18 - second CDROM, first partition
+ *
+ * [...]
+ */
+static int partitions = 16;
+MODULE_PARM(partitions, "i");
+MODULE_PARM_DESC(partitions, "number of SCSI CDROM partitions to support");

MODULE_PARM(xa_test, "i"); /* see sr_ioctl.c */

@@ -518,7 +535,7 @@
goto fail;
memset(cd, 0, sizeof(*cd));

- disk = alloc_disk(1);
+ disk = alloc_disk(partitions + 1);
if (!disk)
goto fail_free;

@@ -533,7 +550,7 @@
spin_unlock(&sr_index_lock);

disk->major = SCSI_CDROM_MAJOR;
- disk->first_minor = minor;
+ disk->first_minor = minor * (partitions + 1);
sprintf(disk->disk_name, "sr%d", minor);
disk->fops = &sr_bdops;
disk->flags = GENHD_FL_CD;
@@ -868,6 +885,10 @@
{
int rc;

+ /* Check number of partitions specified. */
+ if (partitions < 0)
+ partitions = 0;
+
rc = register_blkdev(SCSI_CDROM_MAJOR, "sr");
if (rc)
return rc;
\
 
 \ /
  Last update: 2005-03-22 14:01    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site