Re: [PATCH 2/4] block: sed-opal: Implement IOC_OPAL_REVERT_LSP

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

 



On Mon, Jul 18, 2022 at 04:01:54PM -0500, gjoyce@xxxxxxxxxxxxxxxxxx wrote:
> From: Greg Joyce <gjoyce@xxxxxxxxxxxxxxxxxx>
> 
> This is used in conjunction with IOC_OPAL_REVERT_TPR to return a drive to
> Original Factory State without erasing the data. If IOC_OPAL_REVERT_LSP
> is called with opal_revert_lsp.options bit OPAL_PRESERVE set prior
> to calling IOC_OPAL_REVERT_TPR, the drive global locking range will not
> be erased.
> 
> Signed-off-by: Greg Joyce <gjoyce@xxxxxxxxxxxxxxxxxx>
> ---
>  block/opal_proto.h            |  4 ++++
>  block/sed-opal.c              | 42 ++++++++++++++++++++++++++++++++++-
>  include/linux/sed-opal.h      |  1 +
>  include/uapi/linux/sed-opal.h |  9 ++++++++
>  4 files changed, 55 insertions(+), 1 deletion(-)
> 
> diff --git a/block/opal_proto.h b/block/opal_proto.h
> index b486b3ec7dc4..6127c08267f8 100644
> --- a/block/opal_proto.h
> +++ b/block/opal_proto.h
> @@ -210,6 +210,10 @@ enum opal_parameter {
>  	OPAL_SUM_SET_LIST = 0x060000,
>  };
>  
> +enum opal_revertlsp {
> +	OPAL_KEEP_GLOBAL_RANGE_KEY = 0x060000,
> +};
> +
>  /* Packets derived from:
>   * TCG_Storage_Architecture_Core_Spec_v2.01_r1.00
>   * Secion: 3.2.3 ComPackets, Packets & Subpackets
> diff --git a/block/sed-opal.c b/block/sed-opal.c
> index 4b9a7ffbf00f..feba36e54ae0 100644
> --- a/block/sed-opal.c
> +++ b/block/sed-opal.c
> @@ -448,7 +448,7 @@ static int opal_discovery0_end(struct opal_dev *dev, void *data)
>  
>  	if (discv_out) {
>  		buf_out = (u8 __user *)(uintptr_t)discv_out->data;
> -		len_out = min(discv_out->size, (u64)hlen);
> +		len_out = min_t(u64, discv_out->size, hlen);

This seems like it should go into the previous patch (or just dropped).

> +
>  struct opal_lr_act {
>  	struct opal_key key;
>  	__u32 sum;
> @@ -137,6 +141,10 @@ struct opal_discovery {
>  	__u64 size;
>  };
>  
> +struct opal_revert_lsp {
> +	struct opal_key key;
> +	__u32 options;

this wants a __u32 __pad at the end to avoid struct padding problems.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux