Adding upstream version 2.10.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
1e65f355a3
commit
24ce361c7c
530 changed files with 12276 additions and 4877 deletions
|
@ -251,8 +251,21 @@ int sedopal_cmd_lock(int fd)
|
|||
*/
|
||||
int sedopal_cmd_unlock(int fd)
|
||||
{
|
||||
int rc;
|
||||
|
||||
return sedopal_lock_unlock(fd, OPAL_RW);
|
||||
rc = sedopal_lock_unlock(fd, OPAL_RW);
|
||||
|
||||
/*
|
||||
* If the unlock was successful, force a re-read of the
|
||||
* partition table. Return rc of unlock operation.
|
||||
*/
|
||||
if (rc == 0) {
|
||||
if (ioctl(fd, BLKRRPART, 0) != 0)
|
||||
fprintf(stderr,
|
||||
"Warning: failed re-reading partition\n");
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -275,18 +288,6 @@ int sedopal_lock_unlock(int fd, int lock_state)
|
|||
if (rc != 0)
|
||||
fprintf(stderr,
|
||||
"Error: failed locking or unlocking - %d\n", rc);
|
||||
|
||||
/*
|
||||
* If the unlock was successful, force a re-read of the
|
||||
* partition table.
|
||||
*/
|
||||
if (rc == 0) {
|
||||
rc = ioctl(fd, BLKRRPART, 0);
|
||||
if (rc != 0)
|
||||
fprintf(stderr,
|
||||
"Error: failed re-reading partition\n");
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -397,6 +398,14 @@ int sedopal_cmd_revert(int fd)
|
|||
revert_lsp.__pad = 0;
|
||||
|
||||
rc = ioctl(fd, IOC_OPAL_REVERT_LSP, &revert_lsp);
|
||||
if (rc == 0) {
|
||||
/*
|
||||
* TPER must also be reverted.
|
||||
*/
|
||||
rc = ioctl(fd, IOC_OPAL_REVERT_TPR, &revert_lsp.key);
|
||||
if (rc != 0)
|
||||
fprintf(stderr, "Error: revert TPR - %d\n", rc);
|
||||
}
|
||||
#else
|
||||
rc = -EOPNOTSUPP;
|
||||
#endif
|
||||
|
@ -465,7 +474,7 @@ void sedopal_print_locking_features(uint8_t features)
|
|||
int sedopal_cmd_discover(int fd)
|
||||
{
|
||||
#ifdef IOC_OPAL_DISCOVERY
|
||||
int rc;
|
||||
int rc, feat_length;
|
||||
bool sedopal_locking_supported = false;
|
||||
struct opal_discovery discover;
|
||||
struct level_0_discovery_header *dh;
|
||||
|
@ -500,6 +509,7 @@ int sedopal_cmd_discover(int fd)
|
|||
*/
|
||||
while (feat < feat_end) {
|
||||
code = be16toh(feat->code);
|
||||
feat_length = feat->length + 4 /* hdr */;
|
||||
switch (code) {
|
||||
case OPAL_FEATURE_CODE_LOCKING:
|
||||
locking_flags = feat->feature;
|
||||
|
@ -511,7 +521,7 @@ int sedopal_cmd_discover(int fd)
|
|||
break;
|
||||
}
|
||||
|
||||
feat++;
|
||||
feat = (struct level_0_discovery_features *)((char *)feat + feat_length);
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue