Question about "An example of using LUKS device through libcryptsetup API"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

The program code is published at

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


_______________________________________________
dm-crypt mailing list
dm-crypt@xxxxxxxx
http://www.saout.de/mailman/listinfo/dm-crypt

[Index of Archives]     [Device Mapper Devel]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux