mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 05:10:03 +01:00
Add crypt_get_default_type() API call.
This commit is contained in:
@@ -424,6 +424,13 @@ int crypt_get_metadata_size(struct crypt_device *cd,
|
||||
*/
|
||||
const char *crypt_get_type(struct crypt_device *cd);
|
||||
|
||||
/**
|
||||
* Get device default LUKS type
|
||||
*
|
||||
* @return string according to device type (CRYPT_LUKS1 or CRYPT_LUKS2).
|
||||
*/
|
||||
const char *crypt_get_default_type(void);
|
||||
|
||||
/**
|
||||
*
|
||||
* Structure used as parameter for PLAIN device type.
|
||||
|
||||
@@ -81,6 +81,7 @@ CRYPTSETUP_2.0 {
|
||||
crypt_get_sector_size;
|
||||
|
||||
crypt_get_type;
|
||||
crypt_get_default_type;
|
||||
crypt_get_active_device;
|
||||
crypt_get_active_integrity_failures;
|
||||
crypt_persistent_flags_set;
|
||||
|
||||
@@ -4810,6 +4810,11 @@ const char *crypt_get_type(struct crypt_device *cd)
|
||||
return cd ? cd->type : NULL;
|
||||
}
|
||||
|
||||
const char *crypt_get_default_type(void)
|
||||
{
|
||||
return DEFAULT_LUKS_FORMAT;
|
||||
}
|
||||
|
||||
int crypt_get_verity_info(struct crypt_device *cd,
|
||||
struct crypt_params_verity *vp)
|
||||
{
|
||||
|
||||
@@ -1038,7 +1038,7 @@ static int action_luksFormat(void)
|
||||
|
||||
type = luksType(opt_type);
|
||||
if (!type)
|
||||
type = DEFAULT_LUKS_FORMAT;
|
||||
type = crypt_get_default_type();
|
||||
|
||||
if (!strcmp(type, CRYPT_LUKS2)) {
|
||||
params = ¶ms2;
|
||||
@@ -2418,7 +2418,7 @@ static void help(poptContext popt_context,
|
||||
crypt_get_dir());
|
||||
|
||||
log_std(_("\nDefault compiled-in metadata format is %s (for luksFormat action).\n"),
|
||||
DEFAULT_LUKS_FORMAT);
|
||||
crypt_get_default_type());
|
||||
|
||||
pbkdf_luks1 = crypt_get_pbkdf_default(CRYPT_LUKS1);
|
||||
pbkdf_luks2 = crypt_get_pbkdf_default(CRYPT_LUKS2);
|
||||
|
||||
@@ -148,7 +148,7 @@ static const char *luksType(const char *type)
|
||||
return CRYPT_LUKS1;
|
||||
|
||||
if (!type || !strcmp(type, "luks"))
|
||||
return DEFAULT_LUKS_FORMAT;
|
||||
return crypt_get_default_type();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user