mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-08 01:10:03 +01:00
Cleanup translated messages id.
- minimize count of almost identical message ids - unify style for some messages - remove some useless messages
This commit is contained in:
committed by
Milan Broz
parent
2f4a50064f
commit
d4682b3b38
@@ -1565,7 +1565,7 @@ int dm_reload_device(struct crypt_device *cd, const char *name,
|
||||
if (r == -EINVAL && (dmd->segment.type == DM_CRYPT || dmd->segment.type == DM_LINEAR)) {
|
||||
if ((dmd->flags & (CRYPT_ACTIVATE_SAME_CPU_CRYPT|CRYPT_ACTIVATE_SUBMIT_FROM_CRYPT_CPUS)) &&
|
||||
!dm_flags(cd, DM_CRYPT, &dmt_flags) && !(dmt_flags & (DM_SAME_CPU_CRYPT_SUPPORTED|DM_SUBMIT_FROM_CRYPT_CPUS_SUPPORTED)))
|
||||
log_err(cd, _("Requested dmcrypt performance options are not supported."));
|
||||
log_err(cd, _("Requested dm-crypt performance options are not supported."));
|
||||
if ((dmd->flags & CRYPT_ACTIVATE_ALLOW_DISCARDS) &&
|
||||
!dm_flags(cd, DM_CRYPT, &dmt_flags) && !(dmt_flags & DM_DISCARDS_SUPPORTED))
|
||||
log_err(cd, _("Discard/TRIM is not supported."));
|
||||
|
||||
@@ -1154,7 +1154,7 @@ static int _init_storage_wrappers(struct crypt_device *cd,
|
||||
LUKS2_reencrypt_segment_cipher_old(hdr),
|
||||
vk, wrapper_flags | OPEN_READONLY);
|
||||
if (r) {
|
||||
log_dbg(cd, "Failed to initialize storage wrapper for old cipher.");
|
||||
log_err(cd, _("Failed to initialize old segment storage wrapper."));
|
||||
return r;
|
||||
}
|
||||
rh->wflags1 = wrapper_flags | OPEN_READONLY;
|
||||
@@ -1168,7 +1168,7 @@ static int _init_storage_wrappers(struct crypt_device *cd,
|
||||
LUKS2_reencrypt_segment_cipher_new(hdr),
|
||||
vk, wrapper_flags);
|
||||
if (r) {
|
||||
log_dbg(cd, "Failed to initialize storage wrapper for new cipher.");
|
||||
log_err(cd, _("Failed to initialize new segment storage wrapper."));
|
||||
return r;
|
||||
}
|
||||
rh->wflags2 = wrapper_flags;
|
||||
@@ -1283,7 +1283,7 @@ static int _reenc_recover(struct crypt_device *cd,
|
||||
data_offset + rh->offset, crash_iv_offset, new_sector_size,
|
||||
LUKS2_reencrypt_segment_cipher_new(hdr), vk_new, 0);
|
||||
if (r) {
|
||||
log_err(cd, _("Failed to initialize new key storage wrapper."));
|
||||
log_err(cd, _("Failed to initialize new segment storage wrapper."));
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -1325,10 +1325,8 @@ static int _reenc_recover(struct crypt_device *cd,
|
||||
|
||||
/* TODO: lock for read */
|
||||
devfd = device_open(cd, crypt_metadata_device(cd), O_RDONLY);
|
||||
if (devfd < 0) {
|
||||
log_err(cd, _("Failed to open mdata device."));
|
||||
if (devfd < 0)
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* read old data checksums */
|
||||
read = read_lseek_blockwise(devfd, device_block_size(cd, crypt_metadata_device(cd)),
|
||||
@@ -1341,7 +1339,7 @@ static int _reenc_recover(struct crypt_device *cd,
|
||||
|
||||
read = crypt_storage_wrapper_read(cw2, 0, data_buffer, rh->length);
|
||||
if (read < 0 || (size_t)read != rh->length) {
|
||||
log_err(cd, _("Failed to read hotzone area."));
|
||||
log_err(cd, _("Failed to read hotzone area starting at %" PRIu64 "."), rh->offset + data_offset);
|
||||
r = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -1390,7 +1388,7 @@ static int _reenc_recover(struct crypt_device *cd,
|
||||
area_offset, crash_iv_offset, old_sector_size,
|
||||
LUKS2_reencrypt_segment_cipher_old(hdr), vk_old, 0);
|
||||
if (r) {
|
||||
log_err(cd, _("Failed to initialize old key storage wrapper."));
|
||||
log_err(cd, _("Failed to initialize old segment storage wrapper."));
|
||||
goto out;
|
||||
}
|
||||
read = crypt_storage_wrapper_read_decrypt(cw1, 0, data_buffer, rh->length);
|
||||
@@ -1424,7 +1422,7 @@ static int _reenc_recover(struct crypt_device *cd,
|
||||
data_offset + rh->offset - rh->data_shift, 0, 0,
|
||||
LUKS2_reencrypt_segment_cipher_old(hdr), NULL, 0);
|
||||
if (r) {
|
||||
log_err(cd, _("Failed to initialize old key storage wrapper."));
|
||||
log_err(cd, _("Failed to initialize old segment storage wrapper."));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1735,7 +1733,7 @@ static int reenc_setup_segments(struct crypt_device *cd,
|
||||
if (!strcmp(json_segment_type(jobj), "crypt")) {
|
||||
vk = crypt_volume_key_by_id(vks, reenc_seg ? LUKS2_reencrypt_digest_new(hdr) : LUKS2_digest_by_segment(hdr, s));
|
||||
if (!vk) {
|
||||
log_err(cd, _("Missing key for dm-crypt segment %d"), s);
|
||||
log_err(cd, _("Missing key for dm-crypt segment %u"), s);
|
||||
r = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -2031,7 +2029,7 @@ static int reenc_refresh_helper_devices(struct crypt_device *cd, const char *ove
|
||||
*/
|
||||
r = dm_suspend_device(cd, overlay, DM_SUSPEND_SKIP_LOCKFS | DM_SUSPEND_NOFLUSH);
|
||||
if (r) {
|
||||
log_err(cd, _("Failed to suspend %s."), overlay);
|
||||
log_err(cd, _("Failed to suspend device %s."), overlay);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -2040,7 +2038,7 @@ static int reenc_refresh_helper_devices(struct crypt_device *cd, const char *ove
|
||||
/* suspend HZ device */
|
||||
r = dm_suspend_device(cd, hotzone, DM_SUSPEND_SKIP_LOCKFS | DM_SUSPEND_NOFLUSH);
|
||||
if (r) {
|
||||
log_err(cd, _("Failed to suspend %s."), hotzone);
|
||||
log_err(cd, _("Failed to suspend device %s."), hotzone);
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -2224,7 +2222,7 @@ static int _create_backup_segments(struct crypt_device *cd,
|
||||
/* FIXME: also check occupied space by keyslot in shrunk area */
|
||||
if (data_shift && (crypt_metadata_device(cd) == crypt_data_device(cd))
|
||||
&& LUKS2_set_keyslots_size(cd, hdr, json_segment_get_offset(jobj_segment_new, 0))) {
|
||||
log_err(cd, _("Failed to set new keyslots size."));
|
||||
log_err(cd, _("Failed to set new keyslots area size."));
|
||||
r = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
@@ -2330,8 +2328,6 @@ static int _reencrypt_init(struct crypt_device *cd,
|
||||
if (devfd < 0) {
|
||||
if (devfd == -EBUSY)
|
||||
log_err(cd,_("Failed to open %s in exclusive mode (already mapped or mounted)."), device_path(crypt_data_device(cd)));
|
||||
else
|
||||
log_err(cd,_("Failed to open %s in exclusive mode."), device_path(crypt_data_device(cd)));
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
@@ -2951,6 +2947,7 @@ static reenc_status_t _reencrypt_step(struct crypt_device *cd,
|
||||
/* FIXME: moved segment only case */
|
||||
if (!rh->offset && rh->type == ENCRYPT && rh->data_shift && rh->jobj_segment_moved) {
|
||||
crypt_storage_wrapper_destroy(rh->cw1);
|
||||
log_dbg(cd, "Reinitializing old segment storage wrapper for moved segment.");
|
||||
r = crypt_storage_wrapper_init(cd, &rh->cw1, crypt_data_device(cd),
|
||||
LUKS2_reencrypt_get_data_offset_moved(hdr),
|
||||
crypt_get_iv_offset(cd),
|
||||
@@ -2959,16 +2956,15 @@ static reenc_status_t _reencrypt_step(struct crypt_device *cd,
|
||||
crypt_volume_key_by_id(rh->vks, rh->digest_old),
|
||||
rh->wflags1);
|
||||
if (r) {
|
||||
log_err(cd, _("Failed to reinitialize storage wrapper."));
|
||||
log_err(cd, _("Failed to initialize old segment storage wrapper."));
|
||||
return REENC_ROLLBACK;
|
||||
}
|
||||
log_dbg(cd, "This will be encryption last step.");
|
||||
}
|
||||
|
||||
rh->read = crypt_storage_wrapper_read(rh->cw1, rh->offset, rh->reenc_buffer, rh->length);
|
||||
if (rh->read < 0) {
|
||||
/* severity normal */
|
||||
log_err(cd, _("Failed to read chunk starting at %" PRIu64 "."), rh->offset);
|
||||
log_err(cd, _("Failed to read hotzone area starting at %" PRIu64 "."), rh->offset);
|
||||
return REENC_ROLLBACK;
|
||||
}
|
||||
|
||||
@@ -3078,7 +3074,7 @@ static int _reencrypt_teardown_ok(struct crypt_device *cd, struct luks2_hdr *hdr
|
||||
if (!r) {
|
||||
r = dm_resume_device(cd, rh->device_name, 0);
|
||||
if (r)
|
||||
log_err(cd, _("Failed to resume %s device."), rh->device_name);
|
||||
log_err(cd, _("Failed to resume device %s."), rh->device_name);
|
||||
}
|
||||
dm_remove_device(cd, rh->overlay_name, 0);
|
||||
dm_remove_device(cd, rh->hotzone_name, 0);
|
||||
@@ -3088,7 +3084,7 @@ static int _reencrypt_teardown_ok(struct crypt_device *cd, struct luks2_hdr *hdr
|
||||
if (_wipe_moved_segment(cd, hdr, rh))
|
||||
log_err(cd, _("Failed to wipe backup segment data."));
|
||||
if (LUKS2_reencrypt_get_data_offset_new(hdr) && LUKS2_set_keyslots_size(cd, hdr, LUKS2_reencrypt_get_data_offset_new(hdr)))
|
||||
log_err(cd, _("Failed to set new keyslots_size after reencryption"));
|
||||
log_err(cd, _("Failed to set new keyslots area size."));
|
||||
if (rh->digest_old >= 0 && rh->digest_new != rh->digest_old)
|
||||
for (i = 0; i < LUKS2_KEYSLOTS_MAX; i++)
|
||||
if (LUKS2_digest_by_keyslot(hdr, i) == rh->digest_old)
|
||||
|
||||
13
lib/setup.c
13
lib/setup.c
@@ -1820,7 +1820,7 @@ static int _crypt_format_luks2(struct crypt_device *cd,
|
||||
8 * SECTOR_SIZE, 8 * SECTOR_SIZE, NULL, NULL);
|
||||
if (r < 0) {
|
||||
if (r == -EBUSY)
|
||||
log_err(cd, _("Cannot format device %s which is still in use."),
|
||||
log_err(cd, _("Cannot format device %s in use."),
|
||||
data_device_path(cd));
|
||||
else if (r == -EACCES) {
|
||||
log_err(cd, _("Cannot format device %s, permission denied."),
|
||||
@@ -2620,17 +2620,17 @@ static int _reload_device_with_integrity(struct crypt_device *cd,
|
||||
tdmd.size = sdmd->size;
|
||||
|
||||
if ((r = dm_reload_device(cd, iname, sdmdi, 0, 0))) {
|
||||
log_dbg(cd, "Failed to reload device %s.", iname);
|
||||
log_err(cd, _("Failed to reload device %s."), iname);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((r = dm_reload_device(cd, name, &tdmd, 0, 0))) {
|
||||
log_dbg(cd, "Failed to reload device %s.", name);
|
||||
log_err(cd, _("Failed to reload device %s."), name);
|
||||
goto err_clear;
|
||||
}
|
||||
|
||||
if ((r = dm_suspend_device(cd, name, 0))) {
|
||||
log_dbg(cd, "Failed to suspend device %s.", name);
|
||||
log_err(cd, _("Failed to suspend device %s."), name);
|
||||
goto err_clear;
|
||||
}
|
||||
|
||||
@@ -2740,8 +2740,7 @@ int crypt_resize(struct crypt_device *cd, const char *name, uint64_t new_size)
|
||||
goto out;
|
||||
|
||||
if (MISALIGNED(new_size, tgt->u.crypt.sector_size >> SECTOR_SHIFT)) {
|
||||
log_err(cd, _("Device %s size is not aligned to requested sector size (%u bytes)."),
|
||||
crypt_get_device_name(cd), (unsigned)tgt->u.crypt.sector_size);
|
||||
log_err(cd, _("Device size is not aligned to requested sector size."));
|
||||
r = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@@ -3532,7 +3531,7 @@ int crypt_keyslot_destroy(struct crypt_device *cd, int keyslot)
|
||||
|
||||
if (isLUKS1(cd->type)) {
|
||||
if (ki == CRYPT_SLOT_INACTIVE) {
|
||||
log_err(cd, _("Key slot %d is not used."), keyslot);
|
||||
log_err(cd, _("Keyslot %d is not active."), keyslot);
|
||||
return -EINVAL;
|
||||
}
|
||||
return LUKS_del_key(keyslot, &cd->u.luks1.hdr, cd);
|
||||
|
||||
@@ -1567,7 +1567,7 @@ static int action_luksRemoveKey(void)
|
||||
tools_keyslot_msg(r, UNLOCKED);
|
||||
|
||||
opt_key_slot = r;
|
||||
log_verbose(_("Key slot %d selected for deletion."), opt_key_slot);
|
||||
log_verbose(_("Keyslot %d is selected for deletion."), opt_key_slot);
|
||||
|
||||
if (crypt_keyslot_status(cd, opt_key_slot) == CRYPT_SLOT_ACTIVE_LAST &&
|
||||
!yesDialog(_("This is the last keyslot. "
|
||||
@@ -3173,7 +3173,7 @@ static struct action_type {
|
||||
const char *arg_desc;
|
||||
const char *desc;
|
||||
} action_types[] = {
|
||||
{ "open", action_open, 1, 1, N_("<device> [--type <type>] [<name>]"),N_("open device as mapping <name>") },
|
||||
{ "open", action_open, 1, 1, N_("<device> [--type <type>] [<name>]"),N_("open device as <name>") },
|
||||
{ "close", action_close, 1, 1, N_("<name>"), N_("close device (remove mapping)") },
|
||||
{ "resize", action_resize, 1, 1, N_("<name>"), N_("resize active device") },
|
||||
{ "status", action_status, 1, 0, N_("<name>"), N_("show device status") },
|
||||
|
||||
@@ -544,7 +544,7 @@ static int create_new_header(struct reenc_ctx *rc, struct crypt_device *cd_old,
|
||||
|
||||
r = set_pbkdf_params(cd_new, type);
|
||||
if (r) {
|
||||
log_err(_("Failed to set PBKDF parameters."));
|
||||
log_err(_("Failed to set pbkdf parameters."));
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -1053,7 +1053,7 @@ static void zero_rest_of_device(int fd, size_t block_size, void *buf,
|
||||
log_dbg("Zeroing rest of device.");
|
||||
|
||||
if (lseek64(fd, offset, SEEK_SET) < 0) {
|
||||
log_dbg(_("Cannot seek to device offset.\n"));
|
||||
log_dbg("Cannot seek to device offset.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1322,7 +1322,7 @@ static int initialize_passphrase(struct reenc_ctx *rc, const char *device)
|
||||
|
||||
if (opt_key_slot != CRYPT_ANY_SLOT)
|
||||
snprintf(msg, sizeof(msg),
|
||||
_("Enter passphrase for key slot %u: "), opt_key_slot);
|
||||
_("Enter passphrase for key slot %d: "), opt_key_slot);
|
||||
else
|
||||
snprintf(msg, sizeof(msg), _("Enter any existing passphrase: "));
|
||||
|
||||
@@ -1333,7 +1333,7 @@ static int initialize_passphrase(struct reenc_ctx *rc, const char *device)
|
||||
rc->reencrypt_mode == DECRYPT) {
|
||||
r = init_passphrase1(rc, cd, msg, opt_key_slot, 1, 0);
|
||||
} else for (i = 0; i < crypt_keyslot_max(crypt_get_type(cd)); i++) {
|
||||
snprintf(msg, sizeof(msg), _("Enter passphrase for key slot %u: "), i);
|
||||
snprintf(msg, sizeof(msg), _("Enter passphrase for key slot %d: "), i);
|
||||
r = init_passphrase1(rc, cd, msg, i, 1, 0);
|
||||
if (r == -ENOENT) {
|
||||
r = 0;
|
||||
|
||||
@@ -472,7 +472,7 @@ static struct action_type {
|
||||
} action_types[] = {
|
||||
{ "format", action_format, 1, N_("<integrity_device>"),N_("format device") },
|
||||
{ "open", action_open, 2, N_("<integrity_device> <name>"),N_("open device as <name>") },
|
||||
{ "close", action_close, 1, N_("<name>"),N_("close device (deactivate and remove mapping)") },
|
||||
{ "close", action_close, 1, N_("<name>"),N_("close device (remove mapping)") },
|
||||
{ "status", action_status, 1, N_("<name>"),N_("show active device status") },
|
||||
{ "dump", action_dump, 1, N_("<integrity_device>"),N_("show on-disk information") },
|
||||
{ NULL, NULL, 0, NULL, NULL }
|
||||
|
||||
@@ -361,7 +361,7 @@ static struct action_type {
|
||||
{ "format", action_format, 2, N_("<data_device> <hash_device>"),N_("format device") },
|
||||
{ "verify", action_verify, 3, N_("<data_device> <hash_device> <root_hash>"),N_("verify device") },
|
||||
{ "open", action_open, 4, N_("<data_device> <name> <hash_device> <root_hash>"),N_("open device as <name>") },
|
||||
{ "close", action_close, 1, N_("<name>"),N_("close device (deactivate and remove mapping)") },
|
||||
{ "close", action_close, 1, N_("<name>"),N_("close device (remove mapping)") },
|
||||
{ "status", action_status, 1, N_("<name>"),N_("show active device status") },
|
||||
{ "dump", action_dump, 1, N_("<hash_device>"),N_("show on-disk information") },
|
||||
{ NULL, NULL, 0, NULL, NULL }
|
||||
|
||||
Reference in New Issue
Block a user