HALF ECHO LEARN / REFERENCE COLLECTION
v262.2src/home/homework-luks.c
Git blob: d4ce674c3601e23183894548a8204dc282786674
Lines 4001–4048 of 4,048
int r;
assert(h);
assert(user_record_storage(h) == USER_LUKS);
assert(setup);
assert(setup->root_fd >= 0);
if (user_record_auto_resize_mode(h) != AUTO_RESIZE_SHRINK_AND_GROW)
return 0;
if (fstatfs(setup->root_fd, &sfs) < 0)
return log_error_errno(errno, "Failed to statfs home directory: %m");
if (!fs_can_online_shrink_and_grow(sfs.f_type)) {
log_debug("Not auto-shrinking file system, since selected file system cannot do both online shrink and grow.");
return 0;
}
r = home_resize_luks(
h,
HOME_SETUP_ALREADY_ACTIVATED|
HOME_SETUP_RESIZE_DONT_SYNC_IDENTITIES|
HOME_SETUP_RESIZE_MINIMIZE|
HOME_SETUP_RESIZE_DONT_GROW|
HOME_SETUP_RESIZE_DONT_UNDO,
setup,
cache,
NULL);
if (r < 0)
return r;
return 1;
}
uint64_t luks_volume_key_size_convert(struct crypt_device *cd) {
int k;
assert(cd);
/* Convert the "int" to uint64_t, which we usually use for byte sizes stored on disk. */
k = sym_crypt_get_volume_key_size(cd);
if (k <= 0)
return UINT64_MAX;
return (uint64_t) k;
}