--- truecrypt-4.2a/Linux/Kernel/Dm-target.c 2006-12-11 17:50:46.000000000 +0200 +++ truecrypt-4.2a.new/Linux/Kernel/Dm-target.c 2006-12-10 19:32:43.000000000 +0200 @@ -22,6 +22,35 @@ #include "Tests.h" #include "Dm-target.h" +/* http://kernel.org/pub/linux/kernel/v2.6/testing/ChangeLog-2.6.17-rc1 + * + * commit 4ee218cd67b385759993a6c840ea45f0ee0a8b30 + * Author: Andrew Morton + * Date: Mon Mar 27 01:17:48 2006 -0800 + * + * [PATCH] dm: remove SECTOR_FORMAT + * + * We don't know what type sector_t has. Sometimes it's unsigned long, sometimes + * it's unsigned long long. For example on ppc64 it's unsigned long with + * CONFIG_LBD=n and on x86_64 it's unsigned long long with CONFIG_LBD=n. + * + * The way to handle all of this is to always use unsigned long long and to + * always typecast the sector_t when printing it. + * + * Acked-by: Alasdair G Kergon + * Signed-off-by: Andrew Morton + * Signed-off-by: Linus Torvalds + * + */ + +#ifndef SECTOR_FORMAT +# ifndef CONFIG_LBD /* Large Block Device defined*/ +# define SECTOR_FORMAT "%lu" /* No 32Bit uint */ +# else +# define SECTOR_FORMAT "%llu" /* Yes 64Bit uint */ +# endif +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5) #error Linux kernel 2.6.5 or later required #endif @@ -29,6 +58,11 @@ int trace_level = 0; #define MSG_PREFIX "truecrypt: " + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +# define DM_MSG_PREFIX MSG_PREFIX +#endif + #define error(fmt, args...) printk(KERN_ERR MSG_PREFIX fmt, ## args) #define trace(level, fmt, args...) level <= trace_level && printk(KERN_DEBUG MSG_PREFIX fmt, ## args) #define dbg(fmt, args...) printk(KERN_DEBUG MSG_PREFIX fmt, ## args) @@ -125,7 +159,11 @@ return p; trace (3, "blk_congestion_wait\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + congestion_wait (direction, HZ / 50); +#else blk_congestion_wait (direction, HZ / 50); +#endif } } @@ -497,7 +535,11 @@ while (!(bion = bio_alloc (GFP_NOIO | __GFP_NOMEMALLOC, bio_segments (bio)))) { trace (3, "blk_congestion_wait\n"); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + congestion_wait (bio_data_dir (bio), HZ / 50); +#else blk_congestion_wait (bio_data_dir (bio), HZ / 50); +#endif } bion->bi_bdev = tc->dev->bdev; @@ -699,6 +741,12 @@ module_param_named(trace, trace_level, int, 0); MODULE_AUTHOR("TrueCrypt Foundation"); + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +MODULE_DESCRIPTION(DM_MSG_PREFIX " target for encryption and decryption of TrueCrypt volumes"); +#else MODULE_DESCRIPTION(DM_NAME " target for encryption and decryption of TrueCrypt volumes"); +#endif + MODULE_PARM_DESC(trace, "Trace level"); MODULE_LICENSE("GPL and additional rights"); // Kernel thinks only GPL/BSD/MPL != closed-source code