diff --git a/lib/libdevmapper.c b/lib/libdevmapper.c index a3dbc5a0..aced1a18 100644 --- a/lib/libdevmapper.c +++ b/lib/libdevmapper.c @@ -2044,6 +2044,23 @@ out: return r; } +int dm_suspend_device(struct crypt_device *cd, const char *name) +{ + int r; + + if (dm_init_context(cd, DM_UNKNOWN)) + return -ENOTSUP; + + if (!_dm_simple(DM_DEVICE_SUSPEND, name, 0)) + r = -EINVAL; + else + r = 0; + + dm_exit_context(); + + return r; +} + int dm_suspend_and_wipe_key(struct crypt_device *cd, const char *name) { uint32_t dmt_flags; diff --git a/lib/utils_dm.h b/lib/utils_dm.h index 841e3656..c49c4f23 100644 --- a/lib/utils_dm.h +++ b/lib/utils_dm.h @@ -138,6 +138,7 @@ int dm_query_device(struct crypt_device *cd, const char *name, int dm_create_device(struct crypt_device *cd, const char *name, const char *type, struct crypt_dm_active_device *dmd, int reload); +int dm_suspend_device(struct crypt_device *cd, const char *name); int dm_suspend_and_wipe_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);