Add support for larger block size in loop.

This commit is contained in:
Ondrej Kozina
2021-02-02 16:26:02 +01:00
parent 25cd2b2fb7
commit ce80f7c5b1
3 changed files with 19 additions and 8 deletions

View File

@@ -773,10 +773,10 @@ static int device_internal_prepare(struct crypt_device *cd, struct device *devic
return -ENOTSUP;
}
log_dbg(cd, "Allocating a free loop device.");
log_dbg(cd, "Allocating a free loop device (block size: %zu).", SECTOR_SIZE);
/* Keep the loop open, detached on last close. */
loop_fd = crypt_loop_attach(&loop_device, device->path, 0, 1, &readonly);
loop_fd = crypt_loop_attach(&loop_device, device->path, 0, 1, &readonly, SECTOR_SIZE);
if (loop_fd == -1) {
log_err(cd, _("Attaching loopback device failed "
"(loop device with autoclear flag is required)."));
@@ -795,6 +795,8 @@ static int device_internal_prepare(struct crypt_device *cd, struct device *devic
return r;
}
log_dbg(cd, "Attached loop device block size is %zu bytes.", device_block_size_fd(loop_fd, NULL));
device->loop_fd = loop_fd;
device->file_path = file_path;
device->init_done = 1;