diff -urN truecrypt-4.2a/Linux/build.sh truecrypt-4.2a-new/Linux/build.sh --- truecrypt-4.2a/Linux/build.sh 2006-06-24 21:13:18 +0700 +++ truecrypt-4.2a-new/Linux/build.sh 2007-03-14 11:18:54 +0700 @@ -38,7 +38,7 @@ esac [ "$V" ] && error "TrueCrypt requires Linux kernel 2.6.5 or later" && exit 1 -KERNEL_SRC=/usr/src/linux-source-$(uname -r) +KERNEL_SRC=/lib/modules/$(uname -r)/source check_kernel_version "$KERNEL_SRC" || KERNEL_SRC=/usr/src/linux-source-$(uname -r | cut -d'-' -f1) check_kernel_version "$KERNEL_SRC" || KERNEL_SRC=/usr/src/linux-$(uname -r) check_kernel_version "$KERNEL_SRC" || KERNEL_SRC=/usr/src/linux-$(uname -r | cut -d'-' -f1) diff -urN truecrypt-4.2a/Linux/Kernel/Dm-target.c truecrypt-4.2a-new/Linux/Kernel/Dm-target.c --- truecrypt-4.2a/Linux/Kernel/Dm-target.c 2006-06-28 17:36:28 +0700 +++ truecrypt-4.2a-new/Linux/Kernel/Dm-target.c 2007-03-14 11:08:22 +0700 @@ -26,9 +26,14 @@ #error Linux kernel 2.6.5 or later required #endif +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) +#define DM_MSG_PREFIX "truecrypt" +#endif + int trace_level = 0; #define MSG_PREFIX "truecrypt: " +#define DM_MSG_PREFIX MSG_PREFIX #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) @@ -124,8 +129,13 @@ if (p) return p; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + trace (3, "congestion_wait\n"); + congestion_wait (direction, HZ / 50); +#else trace (3, "blk_congestion_wait\n"); blk_congestion_wait (direction, HZ / 50); +#endif } } @@ -373,9 +383,16 @@ } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) +static void work_process (struct work_struct *work) +{ + struct bio_ctx *bc = container_of(work, struct bio_ctx, work); + void *qdata = (void *)bc; +#else static void work_process (void *qdata) { struct bio_ctx *bc = (struct bio_ctx *) qdata; +#endif struct target_ctx *tc = (struct target_ctx *) bc->target->private; struct bio_vec *bv; u64 sec_no = bc->crypto_sector; @@ -431,7 +448,11 @@ bio_put (bio); // Queue decryption to leave completion interrupt ASAP +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) + INIT_WORK (&bc->work, work_process); +#else INIT_WORK (&bc->work, work_process, bc); +#endif trace (3, "queue_work (%p)\n", work_queue); queue_work (work_queue, &bc->work); return error; @@ -496,8 +517,13 @@ trace (3, "bio_alloc (%hd)\n", bio_segments (bio)); while (!(bion = bio_alloc (GFP_NOIO | __GFP_NOMEMALLOC, bio_segments (bio)))) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) + trace (3, "congestion_wait\n"); + congestion_wait (bio_data_dir (bio), HZ / 50); +#else trace (3, "blk_congestion_wait\n"); blk_congestion_wait (bio_data_dir (bio), HZ / 50); +#endif } bion->bi_bdev = tc->dev->bdev;