summaryrefslogtreecommitdiff
path: root/src/cryptsetup/cryptsetup.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-04-01 14:26:47 +0200
committerTom Gundersen <teg@jklm.no>2015-04-02 00:18:27 +0200
commit9a97aaae3b35a6e7711acd2118249209bead6c54 (patch)
treea2b42c7678a2022443fde9aa63e9132e831f8396 /src/cryptsetup/cryptsetup.c
parent914d6c09f1a449c60c8495c179a8bbe012315ba2 (diff)
cryptsetup: port from libudev to sd-device
Diffstat (limited to 'src/cryptsetup/cryptsetup.c')
-rw-r--r--src/cryptsetup/cryptsetup.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 9e0fef7c6a..ba0ef72d06 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -32,8 +32,8 @@
#include "path-util.h"
#include "strv.h"
#include "ask-password-api.h"
-#include "libudev.h"
-#include "udev-util.h"
+#include "sd-device.h"
+#include "device-util.h"
static const char *arg_type = NULL; /* CRYPT_LUKS1, CRYPT_TCRYPT or CRYPT_PLAIN */
static char *arg_cipher = NULL;
@@ -224,10 +224,10 @@ static char* disk_description(const char *path) {
"ID_MODEL_FROM_DATABASE\0"
"ID_MODEL\0";
- _cleanup_udev_unref_ struct udev *udev = NULL;
- _cleanup_udev_device_unref_ struct udev_device *device = NULL;
+ _cleanup_device_unref_ sd_device *device = NULL;
struct stat st;
const char *i;
+ int r;
assert(path);
@@ -237,19 +237,15 @@ static char* disk_description(const char *path) {
if (!S_ISBLK(st.st_mode))
return NULL;
- udev = udev_new();
- if (!udev)
- return NULL;
-
- device = udev_device_new_from_devnum(udev, 'b', st.st_rdev);
- if (!device)
+ r = sd_device_new_from_devnum(&device, 'b', st.st_rdev);
+ if (r < 0)
return NULL;
NULSTR_FOREACH(i, name_fields) {
const char *name;
- name = udev_device_get_property_value(device, i);
- if (!isempty(name))
+ r = sd_device_get_property_value(device, i, &name);
+ if (r >= 0 && !isempty(name))
return strdup(name);
}