[Stgt-devel] [Patch 1/1] Add SCSI MEDIUM CHANGER support

FUJITA Tomonori fujita.tomonori
Sat Jul 7 14:37:28 CEST 2007


From: Mark Harvey <markh794 at gmail.com>
Subject: [Stgt-devel] [Patch 1/1] Add SCSI MEDIUM CHANGER support
Date: Fri, 06 Jul 2007 18:22:06 +1000

> Re-work of initial SMC commit based on latest git head MODE PAGE commit.
> 
> This version includes the ability to load/unload media from the
> DATA TRANSFER DEVICE at the configured TID/LUN address.
> 
> Update spc_test_unit() TEST UNIT READY op processing to 'understand'
> online, Poweron/Reset and removable flags. i.e. Response from TUR
> depends on the status of each of these flags.
>  - If poweron_reset, return POWER-ON or RESET occurred, then clear flag.
>  - If online - Return READY
>  - If off-line and non-removable media - UNIT BECOMING READY
>  - If off-line and removable media - MEDIUM NOT PRESENT
> 
> Online is when the backing file is open and ready for reading/writing.
> 
> To be done at at a later time:
> Other SCSI op codes need to be aware of these flags.

Applied, thanks a lot!

Please separate logical changes into a single patch file next
time. You could split this into load/unload media stuff and smc.


After applying this patch, I fixed and cleaned up many things so check
whether it works.


> Signed-off-by: Mark Harvey <markh794 at gmail.com>
> ---
>  doc/README.lu_configuration |   47 +++
>  scripts/tgt-core-test       |  104 +++++-
>  usr/Makefile                |    5 +-
>  usr/media.h                 |   28 ++
>  usr/mmc.c                   |    1 +
>  usr/osd.c                   |    2 +
>  usr/sbc.c                   |    1 +
>  usr/smc.c                   |  846 +++++++++++++++++++++++++++++++++++++++++++
>  usr/smc.h                   |  121 ++++++
>  usr/spc.c                   |   65 ++--
>  usr/spc.h                   |    5 +-
>  usr/target.c                |   62 ++++
>  usr/tgtadm.c                |    2 +
>  usr/tgtd.h                  |    7 +-
>  14 files changed, 1255 insertions(+), 41 deletions(-)
> 

(snip)


> +static int test_slot_full(struct slot *s)
> +{
> +	return s->status && 1;
> +}

?

s->status & 1;


> @@ -1200,12 +1256,18 @@ int tgt_target_show_all(char *buf, int rest)
>  				 _TAB3 "SCSI ID: %s\n"
>  				 _TAB3 "SCSI SN: %s\n"
>  				 _TAB3 "Size: %s\n"
> +				 _TAB3 "Online: %s\n"
> +				 _TAB3 "Poweron/Reset: %s\n"
> +				 _TAB3 "Removable media: %s\n"
>  				 _TAB3 "Backing store: %s\n",
>  				 lu->lun,
>    				 print_type(lu->attrs.device_type),
>  				 lu->attrs.scsi_id,
>  				 lu->attrs.scsi_sn,
>  				 print_disksize(lu->size),
> +				 lu->attrs.online ? "Yes" : "No",
> +				 lu->attrs.reset ? "Yes" : "No",
> +				 lu->attrs.removable ? "Yes" : "No",
>  				 lu->path ? : "No backing store");
>  

Probably, I'll change this later. I'd like to have more simple output.



More information about the stgt mailing list