mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
New API: luks_uuid
Return the UUID of a LUKS device.
(cherry picked from commit 206ce8bbf1)
This commit is contained in:
committed by
Richard W.M. Jones
parent
77606e831f
commit
c31eaba4d6
@@ -292,3 +292,28 @@ do_luks_kill_slot (const char *device, const char *key, int keyslot)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
do_luks_uuid (const char *device)
|
||||
{
|
||||
const char *argv[MAX_ARGS];
|
||||
size_t i = 0;
|
||||
|
||||
ADD_ARG (argv, i, "cryptsetup");
|
||||
ADD_ARG (argv, i, "luksUUID");
|
||||
ADD_ARG (argv, i, device);
|
||||
ADD_ARG (argv, i, NULL);
|
||||
|
||||
char *out = NULL;
|
||||
CLEANUP_FREE char *err = NULL;
|
||||
int r = commandv (&out, &err, (const char * const *) argv);
|
||||
|
||||
if (r == -1) {
|
||||
reply_with_error ("%s", err);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
trim (out);
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -9728,4 +9728,12 @@ it is useful when you have added a new device or deleted an
|
||||
existing device (such as when the C<guestfs_luks_open> API
|
||||
is used)." };
|
||||
|
||||
{ defaults with
|
||||
name = "luks_uuid"; added = (1, 41, 9);
|
||||
style = RString (RPlainString, "uuid"), [String (Device, "device")], [];
|
||||
optional = Some "luks";
|
||||
shortdesc = "get the UUID of a LUKS device";
|
||||
longdesc = "\
|
||||
This returns the UUID of the LUKS device C<device>." };
|
||||
|
||||
]
|
||||
|
||||
@@ -514,6 +514,7 @@ let proc_nr = [
|
||||
504, "part_get_gpt_attributes";
|
||||
505, "f2fs_expand";
|
||||
506, "lvm_scan";
|
||||
507, "luks_uuid";
|
||||
]
|
||||
|
||||
(* End of list. If adding a new entry, add it at the end of the list
|
||||
|
||||
@@ -1 +1 @@
|
||||
506
|
||||
507
|
||||
|
||||
Reference in New Issue
Block a user