Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sed-opal: add IOC_OPAL_ENABLE_DISABLE_LR.

This ioctl is used to set up RLE (read lock enabled) and WLE (write
lock enabled) parameters of the Locking object.

In Single User Mode (SUM), if the RangeStartRangeLengthPolicy parameter
is set in the 'Reactivate' method, only Admin authority maintains the
locking range length and start (offset) attributes of Locking objects
set up for SUM. All other attributes from struct opal_user_lr_setup
(RLE - read locking enabled, WLE - write locking enabled) shall
remain in possession of the User authority associated with the Locking
object set for SUM.

With the IOC_OPAL_ENABLE_DISABLE_LR ioctl, the opal_user_lr_setup
members 'range_start' and 'range_length' of the ioctl argument are
ignored.

Signed-off-by: Ondrej Kozina <okozina@redhat.com>
Reviewed-and-tested-by: Milan Broz <gmazyland@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Ondrej Kozina and committed by
Jens Axboe
a441a9d2 8e3d34a7

+26
+24
block/sed-opal.c
··· 3116 3116 return ret; 3117 3117 } 3118 3118 3119 + static int opal_enable_disable_range(struct opal_dev *dev, 3120 + struct opal_user_lr_setup *opal_lrs) 3121 + { 3122 + const struct opal_step lr_steps[] = { 3123 + { start_auth_opal_session, &opal_lrs->session }, 3124 + { setup_enable_range, opal_lrs }, 3125 + { end_opal_session, } 3126 + }; 3127 + int ret; 3128 + 3129 + ret = opal_get_key(dev, &opal_lrs->session.opal_key); 3130 + if (ret) 3131 + return ret; 3132 + mutex_lock(&dev->dev_lock); 3133 + setup_opal_dev(dev); 3134 + ret = execute_steps(dev, lr_steps, ARRAY_SIZE(lr_steps)); 3135 + mutex_unlock(&dev->dev_lock); 3136 + 3137 + return ret; 3138 + } 3139 + 3119 3140 static int opal_locking_range_status(struct opal_dev *dev, 3120 3141 struct opal_lr_status *opal_lrst, 3121 3142 void __user *data) ··· 3479 3458 break; 3480 3459 case IOC_OPAL_LR_SET_START_LEN: 3481 3460 ret = opal_setup_locking_range_start_length(dev, p); 3461 + break; 3462 + case IOC_OPAL_ENABLE_DISABLE_LR: 3463 + ret = opal_enable_disable_range(dev, p); 3482 3464 break; 3483 3465 3484 3466 default:
+1
include/linux/sed-opal.h
··· 55 55 case IOC_OPAL_SET_SID_PW: 56 56 case IOC_OPAL_REACTIVATE_LSP: 57 57 case IOC_OPAL_LR_SET_START_LEN: 58 + case IOC_OPAL_ENABLE_DISABLE_LR: 58 59 return true; 59 60 } 60 61 return false;
+1
include/uapi/linux/sed-opal.h
··· 231 231 #define IOC_OPAL_SET_SID_PW _IOW('p', 241, struct opal_new_pw) 232 232 #define IOC_OPAL_REACTIVATE_LSP _IOW('p', 242, struct opal_lr_react) 233 233 #define IOC_OPAL_LR_SET_START_LEN _IOW('p', 243, struct opal_user_lr_setup) 234 + #define IOC_OPAL_ENABLE_DISABLE_LR _IOW('p', 244, struct opal_user_lr_setup) 234 235 235 236 #endif /* _UAPI_SED_OPAL_H */