* LUKS - Linux Unified Key Setup
*
* Copyright (C) 2004-2006, Clemens Fruhwirth <clemens@endorphin.org>
+ * Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
{
int device_sector_size = sector_size_for_device(device);
struct crypt_dm_active_device dmd = {
- .device = device,
- .cipher = cipher,
+ .target = DM_CRYPT,
.uuid = NULL,
- .vk = vk,
- .offset = sector,
- .iv_offset = 0,
.size = 0,
- .flags = (mode == O_RDONLY) ? CRYPT_ACTIVATE_READONLY : 0
+ .flags = 0,
+ .data_device = device,
+ .u.crypt = {
+ .cipher = cipher,
+ .vk = vk,
+ .offset = sector,
+ .iv_offset = 0,
+ }
};
+ dmd.flags = CRYPT_ACTIVATE_PRIVATE;
+ if (mode == O_RDONLY)
+ dmd.flags |= CRYPT_ACTIVATE_READONLY;
/*
* we need to round this to nearest multiple of the underlying
* device's sector size, otherwise the mapping will be refused.