On Fri, Feb 01, 2019 at 09:50:17PM +0100, David Kozub wrote:
> From: Jonas Rabenstein <jonas.rabenst...@studium.uni-erlangen.de>
> 
> Enable users to mark the shadow mbr as done without completely
> deactivating the shadow mbr feature. This may be useful on reboots,
> when the power to the disk is not disconnected in between and the shadow
> mbr stores the required boot files. Of course, this saves also the
> (few) commands required to enable the feature if it is already enabled
> and one only wants to mark the shadow mbr as done.
> 
> Signed-off-by: Jonas Rabenstein <jonas.rabenst...@studium.uni-erlangen.de>
> Reviewed-by: Scott Bauer <sba...@plzdonthack.me>
> ---
>  block/sed-opal.c              | 33 +++++++++++++++++++++++++++++++--
>  include/linux/sed-opal.h      |  1 +
>  include/uapi/linux/sed-opal.h |  1 +
>  3 files changed, 33 insertions(+), 2 deletions(-)
> 
> diff --git a/block/sed-opal.c b/block/sed-opal.c
> index 4b0a63b9d7c9..e03838cfd31b 100644
> --- a/block/sed-opal.c
> +++ b/block/sed-opal.c
> @@ -1996,13 +1996,39 @@ static int opal_erase_locking_range(struct opal_dev 
> *dev,
>  static int opal_enable_disable_shadow_mbr(struct opal_dev *dev,
>                                         struct opal_mbr_data *opal_mbr)
>  {
> +     u8 token = opal_mbr->enable_disable == OPAL_MBR_ENABLE
> +             ? OPAL_TRUE : OPAL_FALSE;
>       const struct opal_step mbr_steps[] = {
>               { opal_discovery0, },
>               { start_admin1LSP_opal_session, &opal_mbr->key },
> -             { set_mbr_done, &opal_mbr->enable_disable },
> +             { set_mbr_done, &token },
>               { end_opal_session, },
>               { start_admin1LSP_opal_session, &opal_mbr->key },
> -             { set_mbr_enable_disable, &opal_mbr->enable_disable },
> +             { set_mbr_enable_disable, &token },
> +             { end_opal_session, },
> +             { NULL, }

This seems to be a change of what we pass to set_mbr_done /
set_mbr_enable_disable and not really related to the new functionality
here, so it should be split into a separate patch.

That being said if we really care about this translation between
the two sets of constants, why not do it inside
set_mbr_done and set_mbr_enable_disable?

Reply via email to