Add LUKS open and format test using new api.

Fix some error messages.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@102 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Milan Broz
2009-08-31 17:03:22 +00:00
parent 771db939ad
commit bcd94f6ad4
4 changed files with 135 additions and 12 deletions

View File

@@ -1265,13 +1265,17 @@ int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot)
}
ki = crypt_keyslot_status(cd, keyslot);
if (ki == SLOT_INVALID)
if (ki == SLOT_INVALID) {
log_err(cd, _("Key slot %d is invalid.\n"), keyslot);
return -EINVAL;
}
if (ki == SLOT_INACTIVE)
return 0;
if (ki == SLOT_INACTIVE) {
log_err(cd, _("Key slot %d is not used.\n"), keyslot);
return -EINVAL;
}
return LUKS_del_key(cd->device, keyslot, cd);
return LUKS_del_key(cd->device, keyslot, &cd->hdr, cd);
}
// activation/deactivation of device mapping
@@ -1464,7 +1468,8 @@ int crypt_deactivate(struct crypt_device *cd, const char *name)
case ACTIVE: return dm_remove_device(name, 0, 0);
case BUSY: log_err(cd, _("Device %s is busy."), name);
return -EBUSY;
case INACTIVE: return -ENODEV;
case INACTIVE: log_err(cd, _("Device %s is not active."), name);
return -ENODEV;
default: log_err(cd, _("Invalid device %s."), name);
return -EINVAL;
}