CDC_RAM for lk 2.4, PATCH proposed
Subsystems (2)
Jens A:
Would you consider for 2.4.27, a patch written to give us CDC_RAM alone?
I ask because I notice, we don't need the problematic op x46 GPCMD_GET_CONFIGURATION feature x0028 MRW for 2.4.27 to support CDC_RAM. We only need that for MRW.
Pat LaVarre
P.S.
I speak from a context of you & John M having already done most of the work:
--- http://sourceforge.net/projects/iomrrdtools/
--- Release Name: writable-patch-0.2
--- http://sourceforge.net/project/shownotes.php?release_id=229527
...
http://w1.894.telia.com/~u89404340/patches/packet/2.4/cd-mrw-2.4.23-rc1.patch.bz2
...
not ... complete MRW [like] lk 2.6.2+
one drive ... respond incorrectly
when doing the GET_CONFIGURATION with 0x28 ...
main reason ... not introduced into lk 2.4.
---
I ask because people connecting the recently announced Iomega RRD drives have asked me how to mkfs ext in 2.4, to which my answer as yet is sorry, can't help you, except for people willing to mkfs in /dev/loop and sg_dd the disc image across.
Also I'm guessing feature fetch per se could be broadly compatible, because today I grabbed one sample of one of the massively distributed Microsoft XP SP1 instances beginning USB life:
https://lists.one-eyed-alien.net/pipermail/usb-storage/2004-April/000214.html
The first three commands I see are:
-i x24 -y "12 00:00:00 24 00" // standard "INQUIRY" GPCMD_INQUIRY
-i 8 -y "46 00 00:00:00:00 00 00:08 00" // header alone of GPCMD_GET_CONFIGURATION -i x80 -y "46 00 00:00:00:00 00 00:80 00" // total available length
...
Soon thereafter my sample proceeds with such familiar & sufficient-to-discover-rewritable talk as:
-i x20 -y "5A 08 2A:00:00:00 00 00:20 00" // "Capabilities" GPMODE_CAPABILITIES_PAGE
...
-i x0C -y "46 00 00:20:00:00 00 00:0C 00" // "Random Writable" CDF_RWRT
...
-i x0C -y "46 00 00:24:00:00 00 00:0C 00" // "Hardware Defect Management" CDF_HWDM
...
Quoted 7 lines · Pat LaVarre
Jens A:
Would you consider for 2.4.27, a patch written to give us
CDC_RAMalone?I ask because I notice, we don't need the problematic op x46
GPCMD_GET_CONFIGURATIONfeature x0028 MRW for 2.4.27 to supportCDC_RAM. We only need that for MRW.
If you send me a patch, I'll be sure to review it. I won't be adding MRW in 2.4. I made a substantial amount of changes and bug fixes while migrating the code to 2.6, and I don't want to spend time on porting that back to 2.4.
Signature · 1 line
Jens Axboe
Quoted 5 lines · Jens Axboe
Quoted 4 lines · Pat LaVarre
Jens A:
Would you consider for 2.4.27, a patch written to give us
CDC_RAMalone?
Quoted 8 lines
Quoted 3 lines
I ask because I notice, we don't need the problematic op x46
GPCMD_GET_CONFIGURATIONfeature x0028 MRW for 2.4.27 to supportCDC_RAM. We only need that for MRW.If you send me a patch, I'll be sure to review it. I won't be adding MRW in 2.4. I made a substantial amount of changes and bug fixes while migrating the code to 2.6, and I don't want to spend time on porting that back to 2.4.
Jens,
I have created a patch for 2.4.26 based on elements of your MRW patch for 2.6 as well as the patch we submitted to you for our device. Note that I have taken out the MRW support and other changes that did not relate to what we needed. Let us know what you think.
---John McKell
include/linux/cdrom.h +49 -10
@@ -5,7 +5,8 @@* 1994, 1995 Eberhard Moenkeberg, [email protected] * 1996 David van Leeuwen, [email protected] * 1997, 1998 Erik Andersen, [email protected] -* 1998-2000 Jens Axboe, [email protected] +* 1998-2004 Jens Axboe, [email protected] +* 2004 Iomega Corp */ #ifndef _LINUX_CDROM_H
@@ -387,6 +388,7 @@ struct cdrom_generic_command#define CDC_DVD 0x8000/* drive is a DVD */ #define CDC_DVD_R 0x10000/* drive can write DVD-R */ #define CDC_DVD_RAM 0x20000/* drive can write DVD-RAM */ +#define CDC_RAM 0x100000/* ok to open WRITE */ /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ #define CDS_NO_INFO 0/* if not implemented */
@@ -714,16 +716,43 @@ struct request_sense {__u8 asb[46 ]; }; -#ifdef __KERNEL__ -#include <linux/devfs_fs_kernel.h> +/* +* feature profile +*/ +#define CDF_RWRT 0x0020 +#define CDF_HWDM 0x0024 -struct cdrom_write_settings { - unsigned char fpacket; /* fixed/variable packets */ - unsigned long packet_size; /* write out this number of packets */ - unsigned long nwa; /* next writeable address */ - unsigned char writeable; /* cdrom is writeable */ +/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ +struct rwrt_feature_desc { +__u16 feature_code; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved1 :2 ; +__u8 feature_version :4 ; +__u8 persistent :1 ; +__u8 curr :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 curr :1 ; +__u8 persistent :1 ; +__u8 feature_version :4 ; +__u8 reserved1 :2 ; +#endif +__u8 add_len; +__u32 last_lba; +__u32 block_size; +__u16 blocking; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved2 :7 ; +__u8 page_present :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 page_present :1 ; +__u8 reserved2 :7 ; +#endif +__u8 reserved3; }; +#ifdef __KERNEL__ +#include <linux/devfs_fs_kernel.h> + /* Uniform cdrom data structures for cdrom.c */ struct cdrom_device_info { struct cdrom_device_ops *ops; /* link to device_ops */
@@ -744,7 +773,6 @@ struct cdrom_device_info {/* per-device flags */ __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */ __u8 reserved : 6; /* not used yet */ -struct cdrom_write_settings write; };struct cdrom_device_ops {
@@ -1053,6 +1081,17 @@ typedef struct {__u8 reserved3; } rpc_state_t; -#endif /* End of kernel only stuff */ +struct feature_header { +__u32 data_len; +__u8 reserved1; +__u8 reserved2; +__u16 curr_profile; +}; + +extern int cdrom_get_disc_info (kdev_t dev,disc_information *di); +extern int cdrom_get_track_info (kdev_t dev,__u16 track,__u8 type, +track_information *ti); +extern int cdrom_is_random_writable (struct cdrom_device_info *cdi,int *write); +#endif /* __KERNEL__ */ #endif /* _LINUX_CDROM_H */
drivers/ide/ide-cd.h +3 -1
@@ -2,7 +2,8 @@* linux/drivers/ide/ide_cd.h * * Copyright (C) 1996-98 Erik Andersen -* Copyright (C) 1998-2000 Jens Axboe +* Copyright (C) 1998-2004 Jens Axboe +* Copyright (C) 2004 Iomega Corp */ #ifndef _IDE_CD_H#define _IDE_CD_H
@@ -75,6 +76,7 @@ struct ide_cd_config_flags { __u8 dvd : 1; /* Drive is a DVD-ROM */ __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ + __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ __u8 test_write : 1; /* Drive can fake writes */ __u8 supp_disc_present : 1; /* Changer can report exact contentsof slots. */
drivers/ide/ide-cd.c +14 -6
@@ -3,7 +3,8 @@* * Copyright (C) 1994, 1995, 1996 scott snyder <[email protected]> * Copyright (C) 1996-1998 Erik Andersen <[email protected]> -* Copyright (C) 1998-2000 Jens Axboe <[email protected]> +* Copyright (C) 1998-2004 Jens Axboe <[email protected]> +* Copyright (C) 2004 Iomega Corp * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information.
@@ -2683,7 +2684,7 @@ static struct cdrom_device_ops ide_cdromCDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R |CDC_DVD_RAM | -CDC_GENERIC_PACKET , +CDC_GENERIC_PACKET |CDC_RAM , generic_packet: ide_cdrom_packet, };
@@ -2718,6 +2719,8 @@ static int ide_cdrom_register (ide_drive devinfo->mask |=CDC_PLAY_AUDIO ;if (!CDROM_CONFIG_FLAGS (drive)->close_tray) devinfo->mask |=CDC_CLOSE_TRAY ; +if (!CDROM_CONFIG_FLAGS (drive)->ram) + devinfo->mask |=CDC_RAM ; devinfo->de = devfs_register(drive->de, "cd", DEVFS_FL_DEFAULT, HWIF(drive)->major, minor,
@@ -2766,7 +2769,7 @@ int ide_cdrom_probe_capabilities (ide_drstruct cdrom_info *info = drive->driver_data;struct cdrom_device_info *cdi = &info->devinfo;struct atapi_capabilities_page cap; -int nslots =1 ; +int nslots =1 , ram_write =0 ;if (CDROM_CONFIG_FLAGS (drive)->nec260) {CDROM_CONFIG_FLAGS (drive)->no_eject =0 ;
@@ -2776,7 +2779,9 @@ int ide_cdrom_probe_capabilities (ide_drif (ide_cdrom_get_capabilities (drive, &cap))return 0 ; - +cdrom_is_random_writable (cdi, &ram_write); +if (ram_write) +CDROM_CONFIG_FLAGS (drive)->ram =1 ;if (cap.lock ==0 )CDROM_CONFIG_FLAGS (drive)->no_doorlock =1 ;if (cap.eject)
@@ -2789,8 +2794,10 @@ int ide_cdrom_probe_capabilities (ide_drCDROM_CONFIG_FLAGS (drive)->test_write =1 ;if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom)CDROM_CONFIG_FLAGS (drive)->dvd =1 ; -if (cap.dvd_ram_write) +if (cap.dvd_ram_write) {CDROM_CONFIG_FLAGS (drive)->dvd_ram =1 ; +CDROM_CONFIG_FLAGS (drive)->ram =1 ; + }if (cap.dvd_r_write)CDROM_CONFIG_FLAGS (drive)->dvd_r =1 ;if (cap.audio_play)
@@ -3000,7 +3007,8 @@ int ide_cdrom_setup (ide_drive_t *drive) nslots =ide_cdrom_probe_capabilities (drive); -if (CDROM_CONFIG_FLAGS (drive)->dvd_ram) +if ((CDROM_CONFIG_FLAGS (drive)->dvd_ram) || + (CDROM_CONFIG_FLAGS (drive)->ram))set_device_ro (MKDEV (HWIF (drive)->major, minor),0 );#if 0
drivers/scsi/sr.c +15 -4
@@ -1,6 +1,7 @@/* * sr.c Copyright (C) 1992 David Giller * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale +* Copyright (C) 2004 Iomega Corp * * adapted from: * sd.c Copyright (C) 1992 Drew Eckhardt
@@ -128,7 +129,7 @@ static struct cdrom_device_ops sr_dops =CDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R | -CDC_DVD_RAM |CDC_GENERIC_PACKET , +CDC_DVD_RAM |CDC_GENERIC_PACKET |CDC_RAM , generic_packet: sr_packet, };
@@ -693,7 +694,7 @@ void get_capabilities(int i) {unsigned char cmd[6 ];unsigned char *buffer; -int rc, n; +int rc, n, ram_write=0 ;static char *loadmech[] = {
@@ -731,6 +732,11 @@ void get_capabilities(int i)printk ("sr%i: scsi-1 drive\n" , i);return ; } +if (cdrom_is_random_writable (&scsi_CDs[i].cdi, &ram_write)) + scsi_CDs[i].cdi.mask |=CDC_RAM ; +if (!ram_write) + scsi_CDs[i].cdi.mask |=CDC_RAM ; + n = buffer[3 ] +4 ; scsi_CDs[i].cdi.speed = ((buffer[n +8 ] <<8 ) + buffer[n +9 ]) /176 ; scsi_CDs[i].readcd_known =1 ;
@@ -754,8 +760,6 @@ void get_capabilities(int i)if ((buffer[n +3 ] &0x20 ) ==0 ) {/* can't write DVD-RAM media */ scsi_CDs[i].cdi.mask |=CDC_DVD_RAM ; - }else { - scsi_CDs[i].device->writeable =1 ; }if ((buffer[n +3 ] &0x10 ) ==0 )/* can't write DVD-R media */
@@ -780,6 +784,13 @@ void get_capabilities(int i)/*else I don't think it can close its tray scsi_CDs[i].cdi.mask |= CDC_CLOSE_TRAY; */ +/* +* if DVD-RAM of MRW-W, we are randomly writeable +*/ +if ((scsi_CDs[i].cdi.mask & (CDC_DVD_RAM |CDC_RAM )) != + (CDC_DVD_RAM |CDC_RAM )) + scsi_CDs[i].device->writeable =1 ; +scsi_free (buffer,512 ); }
drivers/cdrom/cdrom.c +146 -13
216 lines not on this page · raw message
Jens A:
In answer to your short silence, I now take the liberty of retransmitting this patch. Specifically I have reason to fear that the copy you received previously may have violated our taboo against Html in e-mail.
We apply this patch to make "feature" x0020 "Random Writable" plus feature x0024 "Hardware Defect Management" mean CDC_RAM "ok to open for WRITE". However, by contrast with 2.6.2, we omit the aggressive CD-MRW probing, for the sake of 2.4 stability.
In this retransmission, I grew the #define CDF comments to match 2.6.5.
Between first and re- transmission, I confirmed 2.4.27-pre1 swallows this patch without complaint, as did 2.4.26, and I saw this patch made USB write CDC_RAM discs.
I look forward to your review.
Pat LaVarre
http://sourceforge.net/projects/iomrrdtools/
P.S. I now emphasise, though pending your instruction I have not deleted, the per-open dmesg that this 2.4 patch introduces that 2.6.5 lacks:
int cdrom_open(struct inode *ip, struct
...
ret = -EROFS;
if (fp->f_mode & FMODE_WRITE) {
printk("cdrom: %s opening for WRITE\n", current->comm);include/linux/cdrom.h +49 -10
@@ -5,7 +5,8 @@* 1994, 1995 Eberhard Moenkeberg, [email protected] * 1996 David van Leeuwen, [email protected] * 1997, 1998 Erik Andersen, [email protected] -* 1998-2000 Jens Axboe, [email protected] +* 1998-2004 Jens Axboe, [email protected] +* 2004 Iomega Corp */ #ifndef _LINUX_CDROM_H
@@ -387,6 +388,7 @@ struct cdrom_generic_command#define CDC_DVD 0x8000/* drive is a DVD */ #define CDC_DVD_R 0x10000/* drive can write DVD-R */ #define CDC_DVD_RAM 0x20000/* drive can write DVD-RAM */ +#define CDC_RAM 0x100000/* ok to open WRITE */ /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ #define CDS_NO_INFO 0/* if not implemented */
@@ -714,16 +716,43 @@ struct request_sense {__u8 asb[46 ]; }; -#ifdef __KERNEL__ -#include <linux/devfs_fs_kernel.h> +/* +* feature profile +*/ +#define CDF_RWRT 0x0020/* "Random Writable" */ +#define CDF_HWDM 0x0024/* "Hardware Defect Management" */ -struct cdrom_write_settings { - unsigned char fpacket; /* fixed/variable packets */ - unsigned long packet_size; /* write out this number of packets */ - unsigned long nwa; /* next writeable address */ - unsigned char writeable; /* cdrom is writeable */ +/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ +struct rwrt_feature_desc { +__u16 feature_code; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved1 :2 ; +__u8 feature_version :4 ; +__u8 persistent :1 ; +__u8 curr :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 curr :1 ; +__u8 persistent :1 ; +__u8 feature_version :4 ; +__u8 reserved1 :2 ; +#endif +__u8 add_len; +__u32 last_lba; +__u32 block_size; +__u16 blocking; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved2 :7 ; +__u8 page_present :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 page_present :1 ; +__u8 reserved2 :7 ; +#endif +__u8 reserved3; }; +#ifdef __KERNEL__ +#include <linux/devfs_fs_kernel.h> + /* Uniform cdrom data structures for cdrom.c */ struct cdrom_device_info { struct cdrom_device_ops *ops; /* link to device_ops */
@@ -744,7 +773,6 @@ struct cdrom_device_info {/* per-device flags */ __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */ __u8 reserved : 6; /* not used yet */ -struct cdrom_write_settings write; };struct cdrom_device_ops {
@@ -1053,6 +1081,17 @@ typedef struct {__u8 reserved3; } rpc_state_t; -#endif /* End of kernel only stuff */ +struct feature_header { +__u32 data_len; +__u8 reserved1; +__u8 reserved2; +__u16 curr_profile; +}; + +extern int cdrom_get_disc_info (kdev_t dev,disc_information *di); +extern int cdrom_get_track_info (kdev_t dev,__u16 track,__u8 type, +track_information *ti); +extern int cdrom_is_random_writable (struct cdrom_device_info *cdi,int *write); +#endif /* __KERNEL__ */ #endif /* _LINUX_CDROM_H */
drivers/ide/ide-cd.h +3 -1
@@ -2,7 +2,8 @@* linux/drivers/ide/ide_cd.h * * Copyright (C) 1996-98 Erik Andersen -* Copyright (C) 1998-2000 Jens Axboe +* Copyright (C) 1998-2004 Jens Axboe +* Copyright (C) 2004 Iomega Corp */ #ifndef _IDE_CD_H#define _IDE_CD_H
@@ -75,6 +76,7 @@ struct ide_cd_config_flags { __u8 dvd : 1; /* Drive is a DVD-ROM */ __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ + __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ __u8 test_write : 1; /* Drive can fake writes */ __u8 supp_disc_present : 1; /* Changer can report exact contentsof slots. */
drivers/ide/ide-cd.c +14 -6
@@ -3,7 +3,8 @@* * Copyright (C) 1994, 1995, 1996 scott snyder <[email protected]> * Copyright (C) 1996-1998 Erik Andersen <[email protected]> -* Copyright (C) 1998-2000 Jens Axboe <[email protected]> +* Copyright (C) 1998-2004 Jens Axboe <[email protected]> +* Copyright (C) 2004 Iomega Corp * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information.
@@ -2683,7 +2684,7 @@ static struct cdrom_device_ops ide_cdromCDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R |CDC_DVD_RAM | -CDC_GENERIC_PACKET , +CDC_GENERIC_PACKET |CDC_RAM , generic_packet: ide_cdrom_packet, };
@@ -2718,6 +2719,8 @@ static int ide_cdrom_register (ide_drive devinfo->mask |=CDC_PLAY_AUDIO ;if (!CDROM_CONFIG_FLAGS (drive)->close_tray) devinfo->mask |=CDC_CLOSE_TRAY ; +if (!CDROM_CONFIG_FLAGS (drive)->ram) + devinfo->mask |=CDC_RAM ; devinfo->de = devfs_register(drive->de, "cd", DEVFS_FL_DEFAULT, HWIF(drive)->major, minor,
@@ -2766,7 +2769,7 @@ int ide_cdrom_probe_capabilities (ide_drstruct cdrom_info *info = drive->driver_data;struct cdrom_device_info *cdi = &info->devinfo;struct atapi_capabilities_page cap; -int nslots =1 ; +int nslots =1 , ram_write =0 ;if (CDROM_CONFIG_FLAGS (drive)->nec260) {CDROM_CONFIG_FLAGS (drive)->no_eject =0 ;
@@ -2776,7 +2779,9 @@ int ide_cdrom_probe_capabilities (ide_drif (ide_cdrom_get_capabilities (drive, &cap))return 0 ; - +cdrom_is_random_writable (cdi, &ram_write); +if (ram_write) +CDROM_CONFIG_FLAGS (drive)->ram =1 ;if (cap.lock ==0 )CDROM_CONFIG_FLAGS (drive)->no_doorlock =1 ;if (cap.eject)
@@ -2789,8 +2794,10 @@ int ide_cdrom_probe_capabilities (ide_drCDROM_CONFIG_FLAGS (drive)->test_write =1 ;if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom)CDROM_CONFIG_FLAGS (drive)->dvd =1 ; -if (cap.dvd_ram_write) +if (cap.dvd_ram_write) {CDROM_CONFIG_FLAGS (drive)->dvd_ram =1 ; +CDROM_CONFIG_FLAGS (drive)->ram =1 ; + }if (cap.dvd_r_write)CDROM_CONFIG_FLAGS (drive)->dvd_r =1 ;if (cap.audio_play)
@@ -3000,7 +3007,8 @@ int ide_cdrom_setup (ide_drive_t *drive) nslots =ide_cdrom_probe_capabilities (drive); -if (CDROM_CONFIG_FLAGS (drive)->dvd_ram) +if ((CDROM_CONFIG_FLAGS (drive)->dvd_ram) || + (CDROM_CONFIG_FLAGS (drive)->ram))set_device_ro (MKDEV (HWIF (drive)->major, minor),0 );#if 0
drivers/scsi/sr.c +15 -4
@@ -1,6 +1,7 @@/* * sr.c Copyright (C) 1992 David Giller * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale +* Copyright (C) 2004 Iomega Corp * * adapted from: * sd.c Copyright (C) 1992 Drew Eckhardt
@@ -128,7 +129,7 @@ static struct cdrom_device_ops sr_dops =CDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R | -CDC_DVD_RAM |CDC_GENERIC_PACKET , +CDC_DVD_RAM |CDC_GENERIC_PACKET |CDC_RAM , generic_packet: sr_packet, };
@@ -693,7 +694,7 @@ void get_capabilities(int i) {unsigned char cmd[6 ];unsigned char *buffer; -int rc, n; +int rc, n, ram_write=0 ;static char *loadmech[] = {
@@ -731,6 +732,11 @@ void get_capabilities(int i)printk ("sr%i: scsi-1 drive\n" , i);return ; } +if (cdrom_is_random_writable (&scsi_CDs[i].cdi, &ram_write)) + scsi_CDs[i].cdi.mask |=CDC_RAM ; +if (!ram_write) + scsi_CDs[i].cdi.mask |=CDC_RAM ; + n = buffer[3 ] +4 ; scsi_CDs[i].cdi.speed = ((buffer[n +8 ] <<8 ) + buffer[n +9 ]) /176 ; scsi_CDs[i].readcd_known =1 ;
@@ -754,8 +760,6 @@ void get_capabilities(int i)if ((buffer[n +3 ] &0x20 ) ==0 ) {/* can't write DVD-RAM media */ scsi_CDs[i].cdi.mask |=CDC_DVD_RAM ; - }else { - scsi_CDs[i].device->writeable =1 ; }if ((buffer[n +3 ] &0x10 ) ==0 )/* can't write DVD-R media */
@@ -780,6 +784,13 @@ void get_capabilities(int i)/*else I don't think it can close its tray scsi_CDs[i].cdi.mask |= CDC_CLOSE_TRAY; */ +/* +* if DVD-RAM of MRW-W, we are randomly writeable +*/ +if ((scsi_CDs[i].cdi.mask & (CDC_DVD_RAM |CDC_RAM )) != + (CDC_DVD_RAM |CDC_RAM )) + scsi_CDs[i].device->writeable =1 ; +scsi_free (buffer,512 ); }
drivers/cdrom/cdrom.c +146 -13
216 lines not on this page · raw message
-
Quoted 3 lines
Specifically I have reason to fear that the
copy you received previously may have violated
our taboo against Html in e-mail.
Sorry to say I now have evidence of Html in both posts of this thread that arrived after Jens last spoke. Unless someone else acts, I won't soon have a way to know whether Jens has received an html-free copy or not, though I do see an html-free copy archived at:
http://marc.theaimsgroup.com/?l=linux-scsi&m=108311702301193&q=raw
Pat LaVarre
A message that is not in the archive (sent off-list or not yet received): 1084897080.3746.38.camel@patibmrh9
Quoted 57 lines · Pat LaVarre
In the absence of a consensus over a more elegant resolution, I'm getting by for now with the following, dramatically concise, alternative.
Pat LaVarre
----- Forwarded Message -----
...grep in the
rewritable-patch-0.3b/rewrite-2.4.26.patchof
http://sourceforge.net/projects/iomrrdtools/ reminds me the source files at issue are:
include/linux/cdrom.hdrivers/ide/ide-cd.hdrivers/ide/ide-cd.cdrivers/scsi/sr.cdrivers/cdrom/cdrom.cThe following two file patch gives me the result:
$ sudo rrd scan /dev/scd0 is Iomega RRD 74.B rw /dev/hdc is Iomega RRD 74.B rw $ $ sudo dd of=/dev/scd0 bs=64K count=1 if=/dev/zero 1+0 records in 1+0 records out $ $ sudo dd of=/dev/hdc bs=64K count=1 if=/dev/zero 1+0 records in 1+0 records out $rather than the kernel.org 2.4.18 default:
$ sudo rrd scan /dev/scd0 is Iomega RRD 74.B rw /dev/hdc is Iomega RRD 74.B rw $ $ sudo dd of=/dev/scd0 bs=64K skip=0 count=1 if=/dev/zero dd: opening `/dev/scd0': Read-only file system $ $ sudo dd of=/dev/hdc bs=64K skip=0 count=1 if=/dev/zero dd: opening `/dev/hdc': Read-only file system $Pat LaVarre
diff -Nurp
linux-2.4.18/include/linux/cdrom.hlinux-2.4.18-pel/include/linux/cdrom.hdiff -Nurplinux-2.4.18/drivers/ide/ide-cd.hlinux-2.4.18-pel/drivers/ide/ide-cd.hdiff -Nurplinux-2.4.18/drivers/ide/ide-cd.clinux-2.4.18-pel/drivers/ide/ide-cd.cdrivers/ide/ide-cd.c +0
-0@@ -2599,6 +2599,13 @@ int ide_cdrom_get_capabilities(ide_driveif (!stat)break ;
drivers/ide/ide-cd.c int ide_cdrom_get_capabilities(ide_drive · line 2610
Quoted 10 lines
drivers/ide/ide-cd.c +7
-0}while (--attempts); +#if 1 /* see all DVD/CD drives as DVD-RAM/ DVD-ROM compatible */ +if (!stat) { + cap->dvd_rom =1 ; + cap->dvd_ram_read =1 ; + cap->dvd_ram_write =1 ; + } +#endif return stat; }
This looks incredibly odd - if we succeed in getting the mode sense capabilities page, you force setting og dvd-rom/ram?!
Quoted 14 lines
diff -Nurp
linux-2.4.18/drivers/scsi/sr.clinux-2.4.18-pel/drivers/scsi/sr.cdrivers/scsi/sr.c +4
-0@@ -709,6 +709,10 @@ void get_capabilities(int i)return ; } n = buffer[3 ] +4 ; +#if 1 /* see all DVD/CD drives as DVD-RAM/ DVD-ROM compatible */ + buffer[n +2 ] |=0x28 ;/* readable: x20 = DVD-RAM, x08 = DVD-ROM */ + buffer[n +3 ] |=0x20 ;/* writable: x20 = DVD-RAM */ +#endif scsi_CDs[i].cdi.speed = ((buffer[n +8 ] <<8 ) + buffer[n +9 ]) /176 ; scsi_CDs[i].readcd_known =1 ; scsi_CDs[i].readcd_cdda = buffer[n +5 ] &0x01 ;
Quoted 1 line
diff -Nurp
linux-2.4.18/drivers/cdrom/cdrom.clinux-2.4.18-pel/drivers/cdrom/cdrom.c
Ditto here. Please explain your reasoning for this patch. And do base patches on recent kernels please, 2.4.18 is over 2 years old.
Signature · 1 line
Jens Axboe
Jens A:
Quoted 1 line
Please explain your reasoning for this patch.
I fear to answer fully, because I see I have a history of answering in ways that make you lose interest.
I see you have not yet volunteered to review the 2.4.26 patch proposed in this thread 2004-04-23 by John McKell, written to give us CDC_RAM alone without MRW in 2.4.
Can I help best by updating that patch to become a 2.4.27-pre3 patch?
Pat LaVarre
----- ----- -----
P.S. An alternative, less short reply that I also drafted was:
Quoted 6 lines
Quoted 1 line
linux-2.4.18/drivers/ide/ide-cd.cif we succeed in getting the mode sense capabilities page, you force setting og dvd-rom/ram?!
...Quoted 1 line
linux-2.4.18/drivers/scsi/sr.cDitto here.
Yes.
I believe 2.4.18 patch actually makes mount -w work there by way of "see all DVD/CD drives as DVD-RAM/ DVD-ROM compatible".
Quoted 1 line
Please explain your reasoning for this patch.
Sorry I don't understand what you don't understand.
You're clearly far more expert in this area of Linux than I.
I say my 2.4.18 patch works because otherwise cdrom/ ide-cd/ sr older than 2.6.2 together decide to fail open via EROFS any time a DVD/ CD drive reports it is mechanically incompatible with DVD-RAM, no matter what kind of disc is actually inserted at the time.
You knew that already, yes?
How can I have been unclear?
Quoted 2 lines
And do base patches on recent kernels please,
2.4.18 is over 2 years old.
Yes I fetch from kernel.org when I write for merge to kernel.org.
For example, my last linux-ide patch posted is against 2.6.6-bk5.
But this 2.4.18 linux-scsi patch I wrote to help when yet another person offline was hurt by discovering that mount -w did not work for DVD/ CD discs other than DVD-RAM without an upgrade to Linux-2.6.2 or newer.
I now have this patch archived as patches-be.dvd.ram of:
http://sourceforge.net/projects/iomrrdtools/
I expect in time I will rewrite this patch for 2.4.26, 2.4.25, ... and back thru all the 2.4 now massively redistributed. The mount -w of 2.6.1 thru 2.6.5 also need this patch, but I hope to avoid writing it there by insisting 2.6 people should begin life with 2.6.5 or better.
Pat LaVarre
Quoted 6 lines · Pat LaVarre
Jens A:
Quoted 1 line
Please explain your reasoning for this patch.
I fear to answer fully, because I see I have a history of answering in ways that make you lose interest.
Sorry you feel that way. It's not loss of interesting, mainly juggling other tasks.
Quoted 5 lines
I see you have not yet volunteered to review the 2.4.26 patch proposed in this thread 2004-04-23 by John McKell, written to give us
CDC_RAMalone without MRW in 2.4.Can I help best by updating that patch to become a 2.4.27-pre3 patch?
2.4.26 patch should apply to 2.4.27-pre3 as well, I think. But it doesn't hurt to check.
Quoted 8 lines
----- ----- -----
P.S. An alternative, less short reply that I also drafted was:Quoted 4 lines
Quoted 1 line
linux-2.4.18/drivers/ide/ide-cd.cif we succeed in getting the mode sense capabilities page, you force setting og dvd-rom/ram?!
...
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
linux-2.4.18/drivers/scsi/sr.cDitto here.
Yes.
I believe 2.4.18 patch actually makes
mount -wwork there by way of "see all DVD/CD drives as DVD-RAM/ DVD-ROM compatible".
But that's not what the patch does at all. The patch simply says "If we succeeded in retriving the mode capability page, ignore what it says and flag the drive as dvd-rom/ram capable" which is clearly bogus.
Signature · 1 line
Jens Axboe
Jens A:
Quoted 2 lines
2.4.26 patch should apply to 2.4.27-pre3 as well, I think. But it doesn't hurt to check.
In short:
Yes, it applies.
Quoted 2 lines
2.4.26 patch should apply to 2.4.27-pre3 as well, I think. But it doesn't hurt to check.
At length ...
John McKell's 2.4.26 patch still applies clean. I see:
$ cd linux-2.4.27-pre3/ $ patch --dry-run -p1 <http://marc.theaimsgroup.com/?l=linux-scsi&m=... patching file include/linux/cdrom.h patching file drivers/ide/ide-cd.h patching file drivers/ide/ide-cd.c patching file drivers/scsi/sr.c patching file drivers/cdrom/cdrom.c $
Also I include a copy inline below for your convenience.
Also I will install & reboot & look for trouble.
diff confirms for me the patch inline of this post matches what John McKell posted, except for the trivial difference of folder names & dates and the substantive difference that I did comment out the per-open printk:
- + printk("cdrom: %s opening for WRITE\n", current->comm);
+ + /* printk("cdrom: %s opening for WRITE\n", current->comm); */
Quoted 5 lines
Quoted 2 lines
I fear to answer fully, because I see I have a history of answering in ways that make you lose interest.
Sorry you feel that way. It's not loss of interesting, mainly juggling other tasks.
Thanks for finding the time to correct my interpretation.
Sorry I did not understand.
I see you volunteering, I'm trying to discover how I the newbie can help more than I hurt.
Quoted 6 lines
Quoted 2 lines
I believe 2.4.18 patch actually makes
mount -wwork there by way of "see all DVD/CD drives as DVD-RAM/ DVD-ROM compatible".But that's not what the patch does at all. The patch simply says "If we succeeded in retriving the mode capability page, ignore what it says and flag the drive as dvd-rom/ram capable" which is clearly bogus.
To newbie me, this is not clearly bogus, sorry.
1)
I see my 2.4.18 patch makes mount -w work, by way of breaking cat /proc/sys/dev/cdrom/info.
mount matters more to me than proc.
Besides, the breakage is small. I'm not falsely claiming that a DVD-RAM disc is present. I'm only falsely claiming that a DVD-RAM disc could be present. Software that branches visibly on which kind of disc might someday be present looks very nearly bogus to me.
2)
I see my 2.4.18 patch is extremely short and simple.
Simplicity in the patch matters more to me the further I step back from the latest available at kernel.org.
Pat LaVarre
include/linux/cdrom.h +49 -10
@@ -5,7 +5,8 @@* 1994, 1995 Eberhard Moenkeberg, [email protected] * 1996 David van Leeuwen, [email protected] * 1997, 1998 Erik Andersen, [email protected] -* 1998-2000 Jens Axboe, [email protected] +* 1998-2004 Jens Axboe, [email protected] +* 2004 Iomega Corp */ #ifndef _LINUX_CDROM_H
@@ -387,6 +388,7 @@ struct cdrom_generic_command#define CDC_DVD 0x8000/* drive is a DVD */ #define CDC_DVD_R 0x10000/* drive can write DVD-R */ #define CDC_DVD_RAM 0x20000/* drive can write DVD-RAM */ +#define CDC_RAM 0x100000/* ok to open WRITE */ /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ #define CDS_NO_INFO 0/* if not implemented */
@@ -714,16 +716,43 @@ struct request_sense {__u8 asb[46 ]; }; -#ifdef __KERNEL__ -#include <linux/devfs_fs_kernel.h> +/* +* feature profile +*/ +#define CDF_RWRT 0x0020 +#define CDF_HWDM 0x0024 -struct cdrom_write_settings { - unsigned char fpacket; /* fixed/variable packets */ - unsigned long packet_size; /* write out this number of packets */ - unsigned long nwa; /* next writeable address */ - unsigned char writeable; /* cdrom is writeable */ +/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ +struct rwrt_feature_desc { +__u16 feature_code; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved1 :2 ; +__u8 feature_version :4 ; +__u8 persistent :1 ; +__u8 curr :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 curr :1 ; +__u8 persistent :1 ; +__u8 feature_version :4 ; +__u8 reserved1 :2 ; +#endif +__u8 add_len; +__u32 last_lba; +__u32 block_size; +__u16 blocking; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved2 :7 ; +__u8 page_present :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 page_present :1 ; +__u8 reserved2 :7 ; +#endif +__u8 reserved3; }; +#ifdef __KERNEL__ +#include <linux/devfs_fs_kernel.h> + /* Uniform cdrom data structures for cdrom.c */ struct cdrom_device_info { struct cdrom_device_ops *ops; /* link to device_ops */
@@ -744,7 +773,6 @@ struct cdrom_device_info {/* per-device flags */ __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */ __u8 reserved : 6; /* not used yet */ -struct cdrom_write_settings write; };struct cdrom_device_ops {
@@ -1053,6 +1081,17 @@ typedef struct {__u8 reserved3; } rpc_state_t; -#endif /* End of kernel only stuff */ +struct feature_header { +__u32 data_len; +__u8 reserved1; +__u8 reserved2; +__u16 curr_profile; +}; + +extern int cdrom_get_disc_info (kdev_t dev,disc_information *di); +extern int cdrom_get_track_info (kdev_t dev,__u16 track,__u8 type, +track_information *ti); +extern int cdrom_is_random_writable (struct cdrom_device_info *cdi,int *write); +#endif /* __KERNEL__ */ #endif /* _LINUX_CDROM_H */
drivers/ide/ide-cd.h +3 -1
@@ -2,7 +2,8 @@* linux/drivers/ide/ide_cd.h * * Copyright (C) 1996-98 Erik Andersen -* Copyright (C) 1998-2000 Jens Axboe +* Copyright (C) 1998-2004 Jens Axboe +* Copyright (C) 2004 Iomega Corp */ #ifndef _IDE_CD_H#define _IDE_CD_H
@@ -75,6 +76,7 @@ struct ide_cd_config_flags { __u8 dvd : 1; /* Drive is a DVD-ROM */ __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ + __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ __u8 test_write : 1; /* Drive can fake writes */ __u8 supp_disc_present : 1; /* Changer can report exact contentsof slots. */
drivers/ide/ide-cd.c +14 -6
@@ -3,7 +3,8 @@* * Copyright (C) 1994, 1995, 1996 scott snyder <[email protected]> * Copyright (C) 1996-1998 Erik Andersen <[email protected]> -* Copyright (C) 1998-2000 Jens Axboe <[email protected]> +* Copyright (C) 1998-2004 Jens Axboe <[email protected]> +* Copyright (C) 2004 Iomega Corp * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information.
@@ -2683,7 +2684,7 @@ static struct cdrom_device_ops ide_cdromCDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R |CDC_DVD_RAM | -CDC_GENERIC_PACKET , +CDC_GENERIC_PACKET |CDC_RAM , generic_packet: ide_cdrom_packet, };
@@ -2718,6 +2719,8 @@ static int ide_cdrom_register (ide_drive devinfo->mask |=CDC_PLAY_AUDIO ;if (!CDROM_CONFIG_FLAGS (drive)->close_tray) devinfo->mask |=CDC_CLOSE_TRAY ; +if (!CDROM_CONFIG_FLAGS (drive)->ram) + devinfo->mask |=CDC_RAM ; devinfo->de = devfs_register(drive->de, "cd", DEVFS_FL_DEFAULT, HWIF(drive)->major, minor,
@@ -2766,7 +2769,7 @@ int ide_cdrom_probe_capabilities (ide_drstruct cdrom_info *info = drive->driver_data;struct cdrom_device_info *cdi = &info->devinfo;struct atapi_capabilities_page cap; -int nslots =1 ; +int nslots =1 , ram_write =0 ;if (CDROM_CONFIG_FLAGS (drive)->nec260) {CDROM_CONFIG_FLAGS (drive)->no_eject =0 ;
@@ -2776,7 +2779,9 @@ int ide_cdrom_probe_capabilities (ide_drif (ide_cdrom_get_capabilities (drive, &cap))return 0 ; - +cdrom_is_random_writable (cdi, &ram_write); +if (ram_write) +CDROM_CONFIG_FLAGS (drive)->ram =1 ;if (cap.lock ==0 )CDROM_CONFIG_FLAGS (drive)->no_doorlock =1 ;if (cap.eject)
@@ -2789,8 +2794,10 @@ int ide_cdrom_probe_capabilities (ide_drCDROM_CONFIG_FLAGS (drive)->test_write =1 ;if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom)CDROM_CONFIG_FLAGS (drive)->dvd =1 ; -if (cap.dvd_ram_write) +if (cap.dvd_ram_write) {CDROM_CONFIG_FLAGS (drive)->dvd_ram =1 ; +CDROM_CONFIG_FLAGS (drive)->ram =1 ; + }if (cap.dvd_r_write)CDROM_CONFIG_FLAGS (drive)->dvd_r =1 ;if (cap.audio_play)
@@ -3000,7 +3007,8 @@ int ide_cdrom_setup (ide_drive_t *drive) nslots =ide_cdrom_probe_capabilities (drive); -if (CDROM_CONFIG_FLAGS (drive)->dvd_ram) +if ((CDROM_CONFIG_FLAGS (drive)->dvd_ram) || + (CDROM_CONFIG_FLAGS (drive)->ram))set_device_ro (MKDEV (HWIF (drive)->major, minor),0 );#if 0
drivers/scsi/sr.c +15 -4
@@ -1,6 +1,7 @@/* * sr.c Copyright (C) 1992 David Giller * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale +* Copyright (C) 2004 Iomega Corp * * adapted from: * sd.c Copyright (C) 1992 Drew Eckhardt
@@ -128,7 +129,7 @@ static struct cdrom_device_ops sr_dops =CDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R | -CDC_DVD_RAM |CDC_GENERIC_PACKET , +CDC_DVD_RAM |CDC_GENERIC_PACKET |CDC_RAM , generic_packet: sr_packet, };
@@ -693,7 +694,7 @@ void get_capabilities(int i) {unsigned char cmd[6 ];unsigned char *buffer; -int rc, n; +int rc, n, ram_write=0 ;static char *loadmech[] = {
@@ -731,6 +732,11 @@ void get_capabilities(int i)printk ("sr%i: scsi-1 drive\n" , i);return ; } +if (cdrom_is_random_writable (&scsi_CDs[i].cdi, &ram_write)) + scsi_CDs[i].cdi.mask |=CDC_RAM ; +if (!ram_write) + scsi_CDs[i].cdi.mask |=CDC_RAM ; + n = buffer[3 ] +4 ; scsi_CDs[i].cdi.speed = ((buffer[n +8 ] <<8 ) + buffer[n +9 ]) /176 ; scsi_CDs[i].readcd_known =1 ;
@@ -754,8 +760,6 @@ void get_capabilities(int i)if ((buffer[n +3 ] &0x20 ) ==0 ) {/* can't write DVD-RAM media */ scsi_CDs[i].cdi.mask |=CDC_DVD_RAM ; - }else { - scsi_CDs[i].device->writeable =1 ; }if ((buffer[n +3 ] &0x10 ) ==0 )/* can't write DVD-R media */
@@ -780,6 +784,13 @@ void get_capabilities(int i)/*else I don't think it can close its tray scsi_CDs[i].cdi.mask |= CDC_CLOSE_TRAY; */ +/* +* if DVD-RAM of MRW-W, we are randomly writeable +*/ +if ((scsi_CDs[i].cdi.mask & (CDC_DVD_RAM |CDC_RAM )) != + (CDC_DVD_RAM |CDC_RAM )) + scsi_CDs[i].device->writeable =1 ; +scsi_free (buffer,512 ); }
drivers/cdrom/cdrom.c +146 -13
216 lines not on this page · raw message
Quoted 3 lines
... inline below for your convenience.
Also I will install & reboot & look for trouble.
No trouble found, in the search quoted below.
Pat LaVarre
$ uname -r 2.4.27-pre3 $ $ sudo mkudffs /dev/hdc ... $ sudo mkudffs /dev/scd0 ... $ $ sudo mount /dev/hdc /mnt/hdc $ sudo mount /dev/scd0 /mnt/scd0 $ mount | grep mnt /dev/hdc on /mnt/hdc type udf (rw) /dev/scd0 on /mnt/scd0 type udf (rw) $ $ sudo umount /dev/hdc /dev/scd0 $
Quoted 7 lines · Pat LaVarre
diff confirms for me the patch inline of this post matches what John McKell posted, except for the trivial difference of folder names & dates and the substantive difference that I did comment out the per-open printk:
- +
printk("cdrom: %s opening for WRITE\n", current->comm);
+ + /*printk("cdrom: %s opening for WRITE\n", current->comm); */
That's fine, I killed that in 2.6 as well.
Quoted 14 lines
Quoted 6 lines
Quoted 2 lines
I believe 2.4.18 patch actually makes
mount -wwork there by way of "see all DVD/CD drives as DVD-RAM/ DVD-ROM compatible".But that's not what the patch does at all. The patch simply says "If we succeeded in retriving the mode capability page, ignore what it says and flag the drive as dvd-rom/ram capable" which is clearly bogus.
To newbie me, this is not clearly bogus, sorry.
1)
I see my 2.4.18 patch makes
mount -wwork, by way of breakingcat /proc/sys/dev/cdrom/info.
Quoted 6 lines
mount matters more to me than proc.
Besides, the breakage is small. I'm not falsely claiming that a DVD-RAM disc is present. I'm only falsely claiming that a DVD-RAM disc could be present. Software that branches visibly on which kind of disc might someday be present looks very nearly bogus to me.
Sorry, I still think this is completely bogus. No point in debating it, there's no way that hack will go into the 2.4 kernels.
Quoted 6 lines
2)
I see my 2.4.18 patch is extremely short and simple.
Simplicity in the patch matters more to me the further I step back from the latest available at kernel.org.
Your 2.4.18 patch is a hack.
Quoted 1 line
diff -Nurp
linux-2.4.27-pre3/include/linux/cdrom.hlinux-2.4.27-pre3-pel/include/linux/cdrom.h
[snip]
Patch looks fine to me, I'll send it to Marcelo for inclusion. Thanks!
Signature · 1 line
Jens Axboe
Quoted 6 lines
Quoted 1 line
diff -Nurp linux-2.4.27-pre3/... linux-2.4.27-pre3-pel/...
[snip]
Patch looks fine to me,
I'll send it to Marcelo for inclusion. Thanks!
Wonderful news, thank you both, consequently now with more hope I look forward to writing kernel patches exclusively for 2.6.
Quoted 1 line
Your 2.4.18 patch is a hack.
Yes.
Quoted 1 line
No point in debating ...
I agree I will not now confirm my new understanding of what the word "bogus" means to you.
Pat LaVarre
Jens A:
Quoted 10 lines
Quoted 7 lines
http://marc.theaimsgroup.com/?l=linux-scsi&m=108509426227562
Quoted 1 line
diff -Nurp linux-2.4.27-pre3/... linux-2.4.27-pre3-pel/...
[snip]
Patch looks fine to me,
I'll send it to Marcelo for inclusion. Thanks!Wonderful news, thank you both, consequently now with more hope I look forward to writing kernel patches exclusively for 2.6.
Today 2004-6-3 I see no mention of the 5-21 CDC_RAM for lk 2.4 patch near such strings as "Marcelo" and "Axboe" in:
http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.27.log
I will think go on naively believing that is the right place to poll until someone tells me different (or we all start working 2.4.28).
Pat LaVarre
Quoted 13 lines · Pat LaVarre
Jens A:
Quoted 10 lines
Quoted 7 lines
http://marc.theaimsgroup.com/?l=linux-scsi&m=108509426227562
Quoted 1 line
diff -Nurp linux-2.4.27-pre3/... linux-2.4.27-pre3-pel/...
[snip]
Patch looks fine to me,
I'll send it to Marcelo for inclusion. Thanks!Wonderful news, thank you both, consequently now with more hope I look forward to writing kernel patches exclusively for 2.6.
Quoted 7 lines
Today 2004-6-3 I see no mention of the 5-21
CDC_RAMfor lk 2.4 patch near such strings as "Marcelo" and "Axboe" in:http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.27.log
I will think go on naively believing that is the right place to poll until someone tells me different (or we all start working 2.4.28).
It was sent to Marcelo, and he even asked for a resend since he lost it. Marcelo, do you still have it or should I send it again?
Signature · 1 line
Jens Axboe
Quoted 17 lines · Jens Axboe
Quoted 16 lines · Pat LaVarre
Jens A:
Quoted 10 lines
Quoted 7 lines
http://marc.theaimsgroup.com/?l=linux-scsi&m=108509426227562
Quoted 1 line
diff -Nurp linux-2.4.27-pre3/... linux-2.4.27-pre3-pel/...
[snip]
Patch looks fine to me,
I'll send it to Marcelo for inclusion. Thanks!Wonderful news, thank you both, consequently now with more hope I look forward to writing kernel patches exclusively for 2.6.
Today 2004-6-3 I see no mention of the 5-21
CDC_RAMfor lk 2.4 patch near such strings as "Marcelo" and "Axboe" in:
Quoted 7 lines
Quoted 4 lines
http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.27.log
I will think go on naively believing that is the right place to poll until someone tells me different (or we all start working 2.4.28).
It was sent to Marcelo, and he even asked for a resend since he lost it. Marcelo, do you still have it or should I send it again?
Terribly sorry for losing this contribution, yet another time.
Please resend me.
Marcelo T:
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
http://marc.theaimsgroup.com/?l=linux-scsi&m=108509426227562
Quoted 1 line
diff -Nurp linux-2.4.27-pre3/... linux-2.4.27-pre3-pel/...
[snip]
Patch looks fine to me,
I'll send it to Marcelo for inclusion. Thanks!...
Please resend me.
Thank you for helping.
Inline below is a copy of the Axboe-approved version, taken from:
http://marc.theaimsgroup.com/?l=linux-scsi&m=108509426227562&q=raw
Be aware, meanwhile, offline an issue has arisen in 2.6 whose fix is also now being backported to 2.4. I don't myself yet fully understand that discussion, but I will try to post a 2.4 fix today here (UTC-7+1).
Please tell me if you want one combined substitute patch, or an incremental like 2.6 gets.
Pat LaVarre
include/linux/cdrom.h +49 -10
@@ -5,7 +5,8 @@* 1994, 1995 Eberhard Moenkeberg, [email protected] * 1996 David van Leeuwen, [email protected] * 1997, 1998 Erik Andersen, [email protected] -* 1998-2000 Jens Axboe, [email protected] +* 1998-2004 Jens Axboe, [email protected] +* 2004 Iomega Corp */ #ifndef _LINUX_CDROM_H
@@ -387,6 +388,7 @@ struct cdrom_generic_command#define CDC_DVD 0x8000/* drive is a DVD */ #define CDC_DVD_R 0x10000/* drive can write DVD-R */ #define CDC_DVD_RAM 0x20000/* drive can write DVD-RAM */ +#define CDC_RAM 0x100000/* ok to open WRITE */ /* drive status possibilities returned by CDROM_DRIVE_STATUS ioctl */ #define CDS_NO_INFO 0/* if not implemented */
@@ -714,16 +716,43 @@ struct request_sense {__u8 asb[46 ]; }; -#ifdef __KERNEL__ -#include <linux/devfs_fs_kernel.h> +/* +* feature profile +*/ +#define CDF_RWRT 0x0020 +#define CDF_HWDM 0x0024 -struct cdrom_write_settings { - unsigned char fpacket; /* fixed/variable packets */ - unsigned long packet_size; /* write out this number of packets */ - unsigned long nwa; /* next writeable address */ - unsigned char writeable; /* cdrom is writeable */ +/* cf. mmc4r02g.pdf 5.3.10 Random Writable Feature (0020h) pg 197 of 635 */ +struct rwrt_feature_desc { +__u16 feature_code; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved1 :2 ; +__u8 feature_version :4 ; +__u8 persistent :1 ; +__u8 curr :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 curr :1 ; +__u8 persistent :1 ; +__u8 feature_version :4 ; +__u8 reserved1 :2 ; +#endif +__u8 add_len; +__u32 last_lba; +__u32 block_size; +__u16 blocking; +#if defined(__BIG_ENDIAN_BITFIELD) +__u8 reserved2 :7 ; +__u8 page_present :1 ; +#elif defined(__LITTLE_ENDIAN_BITFIELD) +__u8 page_present :1 ; +__u8 reserved2 :7 ; +#endif +__u8 reserved3; }; +#ifdef __KERNEL__ +#include <linux/devfs_fs_kernel.h> + /* Uniform cdrom data structures for cdrom.c */ struct cdrom_device_info { struct cdrom_device_ops *ops; /* link to device_ops */
@@ -744,7 +773,6 @@ struct cdrom_device_info {/* per-device flags */ __u8 sanyo_slot : 2; /* Sanyo 3 CD changer support */ __u8 reserved : 6; /* not used yet */ -struct cdrom_write_settings write; };struct cdrom_device_ops {
@@ -1053,6 +1081,17 @@ typedef struct {__u8 reserved3; } rpc_state_t; -#endif /* End of kernel only stuff */ +struct feature_header { +__u32 data_len; +__u8 reserved1; +__u8 reserved2; +__u16 curr_profile; +}; + +extern int cdrom_get_disc_info (kdev_t dev,disc_information *di); +extern int cdrom_get_track_info (kdev_t dev,__u16 track,__u8 type, +track_information *ti); +extern int cdrom_is_random_writable (struct cdrom_device_info *cdi,int *write); +#endif /* __KERNEL__ */ #endif /* _LINUX_CDROM_H */
drivers/ide/ide-cd.h +3 -1
@@ -2,7 +2,8 @@* linux/drivers/ide/ide_cd.h * * Copyright (C) 1996-98 Erik Andersen -* Copyright (C) 1998-2000 Jens Axboe +* Copyright (C) 1998-2004 Jens Axboe +* Copyright (C) 2004 Iomega Corp */ #ifndef _IDE_CD_H#define _IDE_CD_H
@@ -75,6 +76,7 @@ struct ide_cd_config_flags { __u8 dvd : 1; /* Drive is a DVD-ROM */ __u8 dvd_r : 1; /* Drive can write DVD-R */ __u8 dvd_ram : 1; /* Drive can write DVD-RAM */ + __u8 ram : 1; /* generic WRITE (dvd-ram/mrw) */ __u8 test_write : 1; /* Drive can fake writes */ __u8 supp_disc_present : 1; /* Changer can report exact contentsof slots. */
drivers/ide/ide-cd.c +14 -6
@@ -3,7 +3,8 @@* * Copyright (C) 1994, 1995, 1996 scott snyder <[email protected]> * Copyright (C) 1996-1998 Erik Andersen <[email protected]> -* Copyright (C) 1998-2000 Jens Axboe <[email protected]> +* Copyright (C) 1998-2004 Jens Axboe <[email protected]> +* Copyright (C) 2004 Iomega Corp * * May be copied or modified under the terms of the GNU General Public * License. See linux/COPYING for more information.
@@ -2683,7 +2684,7 @@ static struct cdrom_device_ops ide_cdromCDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R |CDC_DVD_RAM | -CDC_GENERIC_PACKET , +CDC_GENERIC_PACKET |CDC_RAM , generic_packet: ide_cdrom_packet, };
@@ -2718,6 +2719,8 @@ static int ide_cdrom_register (ide_drive devinfo->mask |=CDC_PLAY_AUDIO ;if (!CDROM_CONFIG_FLAGS (drive)->close_tray) devinfo->mask |=CDC_CLOSE_TRAY ; +if (!CDROM_CONFIG_FLAGS (drive)->ram) + devinfo->mask |=CDC_RAM ; devinfo->de = devfs_register(drive->de, "cd", DEVFS_FL_DEFAULT, HWIF(drive)->major, minor,
@@ -2766,7 +2769,7 @@ int ide_cdrom_probe_capabilities (ide_drstruct cdrom_info *info = drive->driver_data;struct cdrom_device_info *cdi = &info->devinfo;struct atapi_capabilities_page cap; -int nslots =1 ; +int nslots =1 , ram_write =0 ;if (CDROM_CONFIG_FLAGS (drive)->nec260) {CDROM_CONFIG_FLAGS (drive)->no_eject =0 ;
@@ -2776,7 +2779,9 @@ int ide_cdrom_probe_capabilities (ide_drif (ide_cdrom_get_capabilities (drive, &cap))return 0 ; - +cdrom_is_random_writable (cdi, &ram_write); +if (ram_write) +CDROM_CONFIG_FLAGS (drive)->ram =1 ;if (cap.lock ==0 )CDROM_CONFIG_FLAGS (drive)->no_doorlock =1 ;if (cap.eject)
@@ -2789,8 +2794,10 @@ int ide_cdrom_probe_capabilities (ide_drCDROM_CONFIG_FLAGS (drive)->test_write =1 ;if (cap.dvd_ram_read || cap.dvd_r_read || cap.dvd_rom)CDROM_CONFIG_FLAGS (drive)->dvd =1 ; -if (cap.dvd_ram_write) +if (cap.dvd_ram_write) {CDROM_CONFIG_FLAGS (drive)->dvd_ram =1 ; +CDROM_CONFIG_FLAGS (drive)->ram =1 ; + }if (cap.dvd_r_write)CDROM_CONFIG_FLAGS (drive)->dvd_r =1 ;if (cap.audio_play)
@@ -3000,7 +3007,8 @@ int ide_cdrom_setup (ide_drive_t *drive) nslots =ide_cdrom_probe_capabilities (drive); -if (CDROM_CONFIG_FLAGS (drive)->dvd_ram) +if ((CDROM_CONFIG_FLAGS (drive)->dvd_ram) || + (CDROM_CONFIG_FLAGS (drive)->ram))set_device_ro (MKDEV (HWIF (drive)->major, minor),0 );#if 0
drivers/scsi/sr.c +15 -4
@@ -1,6 +1,7 @@/* * sr.c Copyright (C) 1992 David Giller * Copyright (C) 1993, 1994, 1995, 1999 Eric Youngdale +* Copyright (C) 2004 Iomega Corp * * adapted from: * sd.c Copyright (C) 1992 Drew Eckhardt
@@ -128,7 +129,7 @@ static struct cdrom_device_ops sr_dops =CDC_MEDIA_CHANGED |CDC_PLAY_AUDIO |CDC_RESET |CDC_IOCTLS |CDC_DRIVE_STATUS |CDC_CD_R |CDC_CD_RW |CDC_DVD |CDC_DVD_R | -CDC_DVD_RAM |CDC_GENERIC_PACKET , +CDC_DVD_RAM |CDC_GENERIC_PACKET |CDC_RAM , generic_packet: sr_packet, };
@@ -693,7 +694,7 @@ void get_capabilities(int i) {unsigned char cmd[6 ];unsigned char *buffer; -int rc, n; +int rc, n, ram_write=0 ;static char *loadmech[] = {
@@ -731,6 +732,11 @@ void get_capabilities(int i)printk ("sr%i: scsi-1 drive\n" , i);return ; } +if (cdrom_is_random_writable (&scsi_CDs[i].cdi, &ram_write)) + scsi_CDs[i].cdi.mask |=CDC_RAM ; +if (!ram_write) + scsi_CDs[i].cdi.mask |=CDC_RAM ; + n = buffer[3 ] +4 ; scsi_CDs[i].cdi.speed = ((buffer[n +8 ] <<8 ) + buffer[n +9 ]) /176 ; scsi_CDs[i].readcd_known =1 ;
@@ -754,8 +760,6 @@ void get_capabilities(int i)if ((buffer[n +3 ] &0x20 ) ==0 ) {/* can't write DVD-RAM media */ scsi_CDs[i].cdi.mask |=CDC_DVD_RAM ; - }else { - scsi_CDs[i].device->writeable =1 ; }if ((buffer[n +3 ] &0x10 ) ==0 )/* can't write DVD-R media */
@@ -780,6 +784,13 @@ void get_capabilities(int i)/*else I don't think it can close its tray scsi_CDs[i].cdi.mask |= CDC_CLOSE_TRAY; */ +/* +* if DVD-RAM of MRW-W, we are randomly writeable +*/ +if ((scsi_CDs[i].cdi.mask & (CDC_DVD_RAM |CDC_RAM )) != + (CDC_DVD_RAM |CDC_RAM )) + scsi_CDs[i].device->writeable =1 ; +scsi_free (buffer,512 ); }
drivers/cdrom/cdrom.c +146 -13
216 lines not on this page · raw message
-
Quoted 16 lines · Pat LaVarre
Marcelo T:
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
http://marc.theaimsgroup.com/?l=linux-scsi&m=108509426227562
Quoted 1 line
diff -Nurp linux-2.4.27-pre3/... linux-2.4.27-pre3-pel/...
[snip]
Patch looks fine to me,
I'll send it to Marcelo for inclusion. Thanks!...
Please resend me.Thank you for helping.
Inline below is a copy of the Axboe-approved version, taken from:
Quoted 8 lines
http://marc.theaimsgroup.com/?l=linux-scsi&m=108509426227562&q=raw
Be aware, meanwhile, offline an issue has arisen in 2.6 whose fix is also now being backported to 2.4. I don't myself yet fully understand that discussion, but I will try to post a 2.4 fix today here (UTC-7+1).
Please tell me if you want one combined substitute patch, or an incremental like 2.6 gets.
I already sent an updated to Marcelo 5 minutes ago which has that fixed incorporated. JFYI Marcelo, apply that version and the above is void.
Signature · 1 line
Jens Axboe
Quoted 2 lines
I already sent an updated to Marcelo 5 minutes ago which has that fixed incorporated. JFYI Marcelo, apply that version and the above is void.
Thank you.
Therefore, absolutely no work remains for me? I cannot help further?
Pat LaVarre
Quoted 6 lines · Pat LaVarre
Quoted 2 lines
I already sent an updated to Marcelo 5 minutes ago which has that fixed incorporated. JFYI Marcelo, apply that version and the above is void.
Thank you.
Therefore, absolutely no work remains for me? I cannot help further?
No work remains :)
Signature · 1 line
Jens Axboe
Thanks again to everyone.
2.4.27-pre6 here now of rewritable RMB MMC UDF looks better than 2.6.6, indeed as good as 2.6.7.
Pat LaVarre
-----
http://www.kernel.org/pub/linux/kernel/v2.4/testing/patch-2.4.27.log
Summary of changes ... to v2.4.27-pre6
...
Jens Axboe:
o DVD-RW write support
o cdrom hardware defect mgt header length
...
Summary of changes from v2.4.26 ...
...
-----
$ uname -r 2.4.27-pre6 $ $ sudo mkudffs /dev/scd0 ... $ sudo mount /dev/scd0 /mnt/scd0 $ mount | grep scd0 /dev/scd0 on /mnt/scd0 type udf (rw) $ sudo umount /dev/scd0 $ $ sudo rrd scan /dev/scd0 is Iomega RRD 74.B rw $ $ sudo eject /dev/scd0 $ $ sudo mount -r /dev/scd0 /mnt/scd0 $ ls -l /mnt/scd0 total 20 -rw-rw-rw- 1 4294967295 4294967295 25 Jun 17 14:01 Autorun.inf -rw-rw-rw- 1 4294967295 4294967295 18902 Feb 5 08:35 REV.ico $ sudo umount /dev/scd0 $