[Stgt-devel] Prototype MMC DVD-ROM and burnable DVD+R implementation

ronnie sahlberg ronniesahlberg
Sun Apr 27 21:36:34 CEST 2008


Hi,

Please find attached a series of patches to enhance the MMC emulation
to allow writing to emulated DVD+R disks.
The emulation checks the backing store file when coming online and
decides which type of emulation profile should be used :
If there is no backingstore file   or the device is offline  this is
emulated as NO_PROFILE and behaves as if there is no media in the "dvd
drive".
If the backing store file is >0 bytes in size, this is emulated as
DVD_ROM and the emulation behaves as if there is a DVD-ROM disk in the
"dvd drive" that can be read from.
If the backing store file is ==0 bytes in size, this is emulated as if
there is a blank writeable DVD+R disk in the "dvd drive", allowing a
user to burn to the device.
Once finished burning and the application issues a CLOSE_TRACK
command, the device morphs from DVD+R into the DVD_ROM profile.

Please apply,


mmc.00 Rename TYPE_ROM to TYPE_MMC
mmc.01 Add a helper scsi_rw_count() similar to scsi_rw_offset()
mmc.02 Add ->lu_online/lu_offline methods to abstract out the handling
of changing the online attribute. Default on all devices is just
setting/clearing
             this attribute bit.
mmc.03 Update mmc to provide three profiles : NO_PROFILE, DVD_ROM and DVD+R
             Provide mmc specific online/offline methods. When a MMC
device is brought online, check which profile we should try to
emulate.
             We force the "rdwr" backingstore for MMC.
mmc.04 Add two more sense codes we will need later.
mmc.05 Add SET_STREAMING command
mmc.06 Add GET_PERFORMANCE command
mmc.07 Add SYNCHRONIZE_CACHE command
mmc.08 Add READ_BUFFER_CAPACITY command
mmc.09 Add READ_TRACK_INFORMATION command
mmc.10 Add GET_CONFIGURATION command
mmc.11 Add READ_DISC_INFORMATION command
mmc.12 Add CLOSE_TRACK command. When invoked, the device will morph
from DVD+R into DVD_ROM
mmc.13 Replace/enhance READ_TOC command
mmc.14 Replace/enhance READ_CAPACITY command
mmc.15 Fix bug in mmc.14
mmc.16 Replace/enhance mmc_rw with a profile aware version
mmc.17 Add READ_DVD_STRUCTURE command


I have tested it with the windows application DVD-decrypter and it
works for that aplication.
It may/will need further additions to the command emulation for other
dvd burning applications that use different parts of the commandset
that might not
be implemented yet in this emulation.


ronnie sahlberg



On Sat, Apr 26, 2008 at 6:09 PM, FUJITA Tomonori <tomof at acm.org> wrote:
> From: "ronnie sahlberg" <ronniesahlberg at gmail.com>
>  Subject: Re: [Stgt-devel] Prototype MMC DVD-ROM and burnable DVD+R      implementation
>  Date: Mon, 21 Apr 2008 16:15:23 +1000
>
>
>  > Thanks for looking at this.
>  >
>  > Your plan sounds great to me. Once implemented, Ill modify the mmc
>  > emulation to hook into the new methods in
>  > the template.
>
>  You can create a new logical unit without a backing store file:
>
>  tgtadm --op new --mode target --tid 1 -T iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
>  tgtadm --op new --mode logicalunit --tid 1 --lun 1 -Y cd
>  tgtadm --op bind --mode target --tid 1 -I ALL
>
>  root at iris:~/git# ./tgt/usr/tgtadm --op show --mode target
>  Target 1: iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
>     System information:
>         Driver: iscsi
>         Status: running
>     I_T nexus information:
>     LUN information:
>         LUN: 0
>             Type: controller
>             SCSI ID: deadbeaf1:0
>             SCSI SN: beaf10
>             Size: 0 MB
>             Online: No
>             Removable media: No
>             Backing store: No backing store
>         LUN: 1
>             Type: cd/dvd
>             SCSI ID: deadbeaf1:1
>             SCSI SN: beaf11
>             Size: 0 MB
>             Online: No
>             Removable media: Yes
>             Backing store: No backing store
>     Account information:
>     ACL information:
>         ALL
>
>  You can update the backing store file:
>
>  tgtadm --tid 1 --lun 1 --op update --mode logicalunit --name path --value /var/tmp/debian-40r1-amd64-netinst.iso
>
>  root at iris:~/git# ./tgt/usr/tgtadm --op show --mode target
>  Target 1: iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
>     System information:
>         Driver: iscsi
>         Status: running
>     I_T nexus information:
>     LUN information:
>         LUN: 0
>             Type: controller
>             SCSI ID: deadbeaf1:0
>             SCSI SN: beaf10
>             Size: 0 MB
>             Online: No
>             Removable media: No
>             Backing store: No backing store
>         LUN: 1
>             Type: cd/dvd
>             SCSI ID: deadbeaf1:1
>             SCSI SN: beaf11
>             Size: 156 MB
>             Online: Yes
>             Removable media: Yes
>             Backing store: /var/tmp/debian-40r1-amd64-netinst.iso
>     Account information:
>     ACL information:
>         ALL
>
>  You can replace the backing store file with new one:
>
>  tgtadm --tid 1 --lun 1 --op update --mode logicalunit --name online --value No
>  tgtadm --tid 1 --lun 1 --op update --mode logicalunit --name path --value /var/tmp/debian-40r1-sparc-netinst.iso
>
>  root at iris:~/git# ./tgt/usr/tgtadm --op show --mode target
>  Target 1: iqn.2001-04.com.example:storage.disk2.iris.sys1.xyz
>     System information:
>         Driver: iscsi
>         Status: running
>     I_T nexus information:
>     LUN information:
>         LUN: 0
>             Type: controller
>             SCSI ID: deadbeaf1:0
>             SCSI SN: beaf10
>             Size: 0 MB
>             Online: No
>             Removable media: No
>             Backing store: No backing store
>         LUN: 1
>             Type: cd/dvd
>             SCSI ID: deadbeaf1:1
>             SCSI SN: beaf11
>             Size: 148 MB
>             Online: Yes
>             Removable media: Yes
>             Backing store: /var/tmp/debian-40r1-sparc-netinst.iso
>     Account information:
>     ACL information:
>         ALL
>
>
>  I've not implemented this feature fully yet. If you replace a backing
>  store while the logical unit has outstanding commands, tgtd
>  crashes. But it would be good enough for you to see how new code works
>  well with your mmc emulation code, I think.
>
>
>  Yeah, again, I know that tgt's user interface is pretty inconsistent
>  so I'll clean up it.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mmc.diff.tgz
Type: application/x-gzip
Size: 13941 bytes
Desc: not available
Url : https://lists.berlios.de/pipermail/stgt-devel/attachments/20080428/0578ce00/attachment-0001.gz 



More information about the stgt mailing list