Skip to content

Commit

Permalink
sed-opal: add support flag for SUM in status ioctl
Browse files Browse the repository at this point in the history
Not every OPAL drive supports SUM (Single User Mode), so report this
information to userspace via the get-status ioctl so that we can adjust
the formatting options accordingly.
Tested on a kingston drive (which supports it) and a samsung one
(which does not).

Signed-off-by: Luca Boccassi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
bluca authored and axboe committed Feb 17, 2023
1 parent 0aa2988 commit 9ec041e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions block/sed-opal.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ static int opal_discovery0_end(struct opal_dev *dev)
break;
case FC_SINGLEUSER:
single_user = check_sum(body->features);
if (single_user)
dev->flags |= OPAL_FL_SUM_SUPPORTED;
break;
case FC_GEOMETRY:
check_geometry(dev, body);
Expand Down
1 change: 1 addition & 0 deletions include/uapi/linux/sed-opal.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ struct opal_read_write_table {
#define OPAL_FL_LOCKED 0x00000008
#define OPAL_FL_MBR_ENABLED 0x00000010
#define OPAL_FL_MBR_DONE 0x00000020
#define OPAL_FL_SUM_SUPPORTED 0x00000040

struct opal_status {
__u32 flags;
Expand Down

0 comments on commit 9ec041e

Please sign in to comment.