Re: [PATCH 5/7] target: Refactor MODE SENSE emulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2012-10-31 at 09:16 -0700, Roland Dreier wrote:
> From: Roland Dreier <roland@xxxxxxxxxxxxxxx>
> 
> Convert spc_emulate_modesense() to use a table of mode pages, rather
> than a switch statement.  This makes it possible to add more pages
> sanely -- in particular we no longer need to make sure we keep the
> 0x3f (return all mode pages) case in sync.
> 
> While we're touching this code, make our MODE SENSE emulation a bit
> better in a couple of ways:
>  - When the initiator passes PC == 1 asking for changeable values,
>    return all 0s to show we don't support setting anything.
>  - Return a block descriptor for disk devices.
> 
> Signed-off-by: Roland Dreier <roland@xxxxxxxxxxxxxxx>
> ---
>  drivers/target/target_core_spc.c |  235 ++++++++++++++++++++++++++++----------
>  1 file changed, 176 insertions(+), 59 deletions(-)
> 

<SNIP>

> -static int spc_modesense_caching(struct se_device *dev, unsigned char *p)
> +static int spc_modesense_caching(struct se_device *dev, u8 pc, u8 *p)
>  {
>  	p[0] = 0x08;
>  	p[1] = 0x12;
> +
> +	/* No changeable values for now */
> +	if (pc == 1)
> +		goto out;
> +
>  	if (dev->se_sub_dev->se_dev_attrib.emulate_write_cache > 0)
>  		p[2] = 0x04; /* Write Cache Enable */

Just FYI, changing a handful of dev->se_sub_dev->se_dev_attrib
references here to instead use dev->dev_attrib to follow for-next
change:

commit a5ee06b14d3bb4f09c4b2d79400e96aa3480f6d0
Author: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date:   Mon Oct 8 00:03:19 2012 -0400

    target: kill struct se_subsystem_dev

Thanks again Roland !

--nab

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux