mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
lszcrypt/chzcrypt: Warn if default domain is unavailable
Improvements for lszcrypt and chzcrypt: * lszcrypt -b and lszcrypt -d now check for default domain available and gives a warning if the current default domain is not in the usage_domain_mask of the AP bus. * lszcrypt without any further device also checks for the default domain and emits a warning string if the default domain is not available. * chzcrypt --default-domain emits a warning if the newly set default domain is not enabled in the usage_domain_mask of the AP bus. Suggested-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
daad3bf0e7
commit
d0046257b6
@@ -71,3 +71,31 @@ bool ap_bus_has_SB_support(void)
|
||||
|
||||
return sb_support > 0 ? true : false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper function: for a given hex string return the bit value.
|
||||
* Bit count starts on the left with 0.
|
||||
* Returns 0 or 1 or -1 on failure.
|
||||
*/
|
||||
int check_mask_bit(const char *mask, int bit)
|
||||
{
|
||||
int b;
|
||||
|
||||
if (mask && mask[0] == '0' && mask[1] == 'x')
|
||||
mask += 2;
|
||||
|
||||
while (*mask && bit >= 4) {
|
||||
mask++;
|
||||
bit -= 4;
|
||||
}
|
||||
if (*mask >= '0' && *mask <= '9')
|
||||
b = *mask - '0';
|
||||
else if (*mask >= 'a' && *mask <= 'f')
|
||||
b = *mask + 10 - 'a';
|
||||
else if (*mask >= 'A' && *mask <= 'F')
|
||||
b = *mask + 10 - 'A';
|
||||
else
|
||||
return -1;
|
||||
|
||||
return b & (0x08 >> bit) ? 1 : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user