Re: [PATCH v6] block: sed-opal: Add ioctl to return device status

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

 



On Tue, 2022-08-16 at 12:37 +0200, Christian Brauner wrote:
> On Wed, Aug 10, 2022 at 01:35:51PM +0100, luca.boccassi@xxxxxxxxx wrote:
> > From: "dougmill@xxxxxxxxxxxxxxxxxx" <dougmill@xxxxxxxxxxxxxxxxxx>
> > 
> > Provide a mechanism to retrieve basic status information about
> > the device, including the "supported" flag indicating whether
> > SED-OPAL is supported. The information returned is from the various
> > feature descriptors received during the discovery0 step, and so
> > this ioctl does nothing more than perform the discovery0 step
> > and then save the information received. See "struct opal_status"
> > and OPAL_FL_* bits for the status information currently returned.
> > 
> > This is necessary to be able to check whether a device is OPAL
> > enabled, set up, locked or unlocked from userspace programs
> > like systemd-cryptsetup and libcryptsetup. Right now we just
> > have to assume the user 'knows' or blindly attempt setup/lock/unlock
> > operations.
> > 
> > Signed-off-by: Douglas Miller <dougmill@xxxxxxxxxxxxxxxxxx>
> > Tested-by: Luca Boccassi <bluca@xxxxxxxxxx>
> > ---
> 
> Seems good to me (One nit below.),
> Acked-by: Christian Brauner (Microsoft) <brauner@xxxxxxxxxx>
> 
> > v2: https://patchwork.kernel.org/project/linux-block/patch/612795b5.tj7FMS9wzchsMzrK%25dougmill@xxxxxxxxxxxxxxxxxx/
> > v3: resend on request, after rebasing and testing on my machine
> >     https://patchwork.kernel.org/project/linux-block/patch/20220125215248.6489-1-luca.boccassi@xxxxxxxxx/
> > v4: it's been more than 7 months and no alternative approach has appeared.
> >     we really need to be able to identify and query the status of a sed-opal
> >     device, so rebased and resending.
> > v5: as requested by reviewer, add __32 reserved to the UAPI ioctl struct to align to 64
> >     bits and to reserve space for future expansion
> > v6: as requested by reviewer, update commit message with use case
> > 
> >  block/opal_proto.h            |  5 ++
> >  block/sed-opal.c              | 90 ++++++++++++++++++++++++++++++-----
> >  include/linux/sed-opal.h      |  1 +
> >  include/uapi/linux/sed-opal.h | 13 +++++
> >  4 files changed, 97 insertions(+), 12 deletions(-)
> > 
> > 
> > +static int opal_get_status(struct opal_dev *dev, void __user *data)
> > +{
> > +	struct opal_status sts = {0};
> > +
> > +	/*
> > +	 * check_opal_support() error is not fatal,
> > +	 * !dev->supported is a valid condition
> > +	 */
> > +	if (!check_opal_support(dev)) {
> > +		sts.flags = dev->flags;
> > +	}
> 
> nit: We generally don't do {} around single-line if.

Thank you, fixed in v7.

-- 
Kind regards,
Luca Boccassi



[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