summaryrefslogtreecommitdiff
path: root/src/shared/dm-util.c
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2020-07-14 15:07:21 +0100
committerLuca Boccassi <luca.boccassi@microsoft.com>2020-07-21 23:26:41 +0100
commit536879480a5ec4d4be10941aa837791ddd68edc2 (patch)
tree1dcd13a24a4f8c287b63213a2637ac84b2c7f685 /src/shared/dm-util.c
parent002674387c595322ced45797652707f253d92f13 (diff)
downloadsystemd-536879480a5ec4d4be10941aa837791ddd68edc2.tar.gz
dm-util: use CRYPT_DEACTIVATE_DEFERRED instead of ioctl
Diffstat (limited to 'src/shared/dm-util.c')
-rw-r--r--src/shared/dm-util.c34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/shared/dm-util.c b/src/shared/dm-util.c
index d817e5b0e5..9ffa427027 100644
--- a/src/shared/dm-util.c
+++ b/src/shared/dm-util.c
@@ -5,37 +5,3 @@
#include "dm-util.h"
#include "fd-util.h"
#include "string-util.h"
-
-int dm_deferred_remove(const char *name) {
-
- struct dm_ioctl dm = {
- .version = {
- DM_VERSION_MAJOR,
- DM_VERSION_MINOR,
- DM_VERSION_PATCHLEVEL
- },
- .data_size = sizeof(dm),
- .flags = DM_DEFERRED_REMOVE,
- };
-
- _cleanup_close_ int fd = -1;
-
- assert(name);
-
- /* Unfortunately, libcryptsetup doesn't provide a proper API for this, hence call the ioctl()
- * directly. */
-
- if (strlen(name) >= sizeof(dm.name))
- return -ENODEV; /* A device with a name longer than this cannot possibly exist */
-
- fd = open("/dev/mapper/control", O_RDWR|O_CLOEXEC);
- if (fd < 0)
- return -errno;
-
- strncpy_exact(dm.name, name, sizeof(dm.name));
-
- if (ioctl(fd, DM_DEV_REMOVE, &dm))
- return -errno;
-
- return 0;
-}