X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fluks1%2Fkeyencryption.c;h=c634b68f87375158bdcf33f46c21b273ca5f5ebe;hb=ce2218ed6505de0dc84698fbf1e30a7a4ad35eee;hp=680d2e91f3a9cd98fcd269133e40f8ffe2cd1791;hpb=7835b365a730ebc721460166cce9a03cabde4677;p=platform%2Fupstream%2Fcryptsetup.git diff --git a/lib/luks1/keyencryption.c b/lib/luks1/keyencryption.c index 680d2e9..c634b68 100644 --- a/lib/luks1/keyencryption.c +++ b/lib/luks1/keyencryption.c @@ -2,6 +2,7 @@ * LUKS - Linux Unified Key Setup * * Copyright (C) 2004-2006, Clemens Fruhwirth + * 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 @@ -57,16 +58,22 @@ static int setup_mapping(const char *cipher, const char *name, { 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.