Add dm_error_device routine.

This commit is contained in:
Ondrej Kozina
2018-12-10 21:24:32 +01:00
committed by Milan Broz
parent 2cd85ddf11
commit d74e7fc084
2 changed files with 20 additions and 0 deletions

View File

@@ -925,6 +925,25 @@ error:
return r; return r;
} }
int dm_error_device(struct crypt_device *cd, const char *name)
{
int r = -EINVAL;
struct crypt_dm_active_device dmd = {};
if (!name)
return -EINVAL;
if (dm_init_context(cd, DM_UNKNOWN))
return -ENOTSUP;
if (dm_query_device(cd, name, 0, &dmd) && _error_device(name, dmd.size))
r = 0;
dm_exit_context();
return r;
}
int dm_remove_device(struct crypt_device *cd, const char *name, uint32_t flags) int dm_remove_device(struct crypt_device *cd, const char *name, uint32_t flags)
{ {
struct crypt_dm_active_device dmd = {}; struct crypt_dm_active_device dmd = {};

View File

@@ -147,6 +147,7 @@ int dm_suspend_and_wipe_key(struct crypt_device *cd, const char *name);
int dm_resume_device(struct crypt_device *cd, const char *name, uint32_t flags); int dm_resume_device(struct crypt_device *cd, const char *name, uint32_t flags);
int dm_resume_and_reinstate_key(struct crypt_device *cd, const char *name, int dm_resume_and_reinstate_key(struct crypt_device *cd, const char *name,
const struct volume_key *vk); const struct volume_key *vk);
int dm_error_device(struct crypt_device *cd, const char *name);
const char *dm_get_dir(void); const char *dm_get_dir(void);