From: H McCurdy <hmccurdy@yahoo.com>
To: "dm-crypt@saout.de" <dm-crypt@saout.de>
Subject: [dm-crypt] Question about "An example of using LUKS device through libcryptsetup API"
Date: Sat, 26 Sep 2015 01:03:44 +0000 (UTC) [thread overview]
Message-ID: <1087656308.1214643.1443229424819.JavaMail.yahoo@mail.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1463 bytes --]
Hi,
The program code is published athttps://gitlab.com/cryptsetup/cryptsetup/wikis/API/index.html
Looking in
static int handle_active_device(const char *device_name)
at
if (crypt_status(cd, device_name) == CRYPT_ACTIVE)
printf("Device %s is still active.\n", device_name);
else {
printf("Something failed perhaps, device %s is not active.\n", device_name);
crypt_free(cd);
return -1;
}
/*
* crypt_deactivate() is used to deactivate device
*/
r = crypt_deactivate(cd, device_name);
if (r < 0) {
printf("crypt_deactivate() failed.\n");
crypt_free(cd);
return r;
}
But if I look in /usr/include/libcryptsetup.h, I see
typedef enum {
CRYPT_INVALID, /**< device mapping is invalid in this context */
CRYPT_INACTIVE, /**< no such mapped device */
CRYPT_ACTIVE, /**< device is active */
CRYPT_BUSY /**< device is active and has open count > 0 */
} crypt_status_info;
and
crypt_status_info crypt_status(struct crypt_device *cd, const char *name);
It appears to me that the code flow is good since we probably can't deactivate a busy container
but it appears to me that the error is misleading in the event of CRYPT_BUSY because the message
indicates the device isn't active.
Am I interpreting correctly?
Hugh
[-- Attachment #2: Type: text/html, Size: 3548 bytes --]
next reply other threads:[~2015-09-26 1:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-26 1:03 H McCurdy [this message]
2015-09-26 6:11 ` [dm-crypt] Question about "An example of using LUKS device through libcryptsetup API" Milan Broz
2015-09-26 19:13 ` H McCurdy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1087656308.1214643.1443229424819.JavaMail.yahoo@mail.yahoo.com \
--to=hmccurdy@yahoo.com \
--cc=dm-crypt@saout.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.