loop-aes 3.1b 2.6.15-git7 compile fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,

loop-AES 3.1b fails to compile against recent 2.6.15 kernels (namely
-git6 and -git7). Attached Patch fixes this. I dont know if the fix is
okey, im not very deeply into kernel hacking. 

bye,
    - michael
--- /usr/src/modules/loop-aes/loop-AES-v3.1b/loop.c-2.6.patched	2005-09-17 11:20:54.000000000 +0200
+++ loop.c-2.6.15-git7	2006-01-11 11:40:12.000000000 +0100
@@ -985,7 +985,7 @@
 	/*
 	 * up sem, we are running
 	 */
-	up(&lo->lo_sem);
+	complete(&lo->lo_done);
 
 	for (;;) {
 		add_wait_queue(&LDE_lo_bio_wait, &waitq);
@@ -1146,7 +1146,7 @@
 			break;
 	}
 
-	up(&lo->lo_sem);
+	complete(&lo->lo_done);
 	return 0;
 }
 
@@ -1252,6 +1252,7 @@
 	struct file	*file;
 	struct inode	*inode;
 	struct block_device *lo_device = NULL;
+        prepare_flush_fn *prep_fn = NULL;
 	int		lo_flags = 0;
 	int		error;
 
@@ -1266,7 +1267,7 @@
 	if (!(file->f_mode & FMODE_WRITE))
 		lo_flags |= LO_FLAGS_READ_ONLY;
 
-	init_MUTEX_LOCKED(&lo->lo_sem);
+	init_completion(&lo->lo_done);
 	spin_lock_init(&lo->lo_lock);
 	init_waitqueue_head(&LDE_lo_bio_wait);
 	atomic_set(&LDE_lo_pending, 0);
@@ -1350,10 +1351,10 @@
 	blk_queue_segment_boundary(lo->lo_queue, PAGE_CACHE_SIZE - 1);
 	blk_queue_max_phys_segments(lo->lo_queue, MAX_PHYS_SEGMENTS);
 	blk_queue_max_hw_segments(lo->lo_queue, MAX_HW_SEGMENTS);
-	blk_queue_max_sectors(lo->lo_queue, MAX_SECTORS);
+	blk_queue_max_sectors(lo->lo_queue, SAFE_MAX_SECTORS);
 	lo->lo_queue->queue_flags &= ~(1 << QUEUE_FLAG_CLUSTER);
 #if (LINUX_VERSION_CODE >= 0x20609) || defined(QUEUE_FLAG_ORDERED)
-	blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE);
+	blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE, prep_fn);
 #endif
 #if LINUX_VERSION_CODE >= 0x20609
 	blk_queue_issue_flush_fn(lo->lo_queue, NULL);
@@ -1368,7 +1369,7 @@
 		blk_queue_hardsect_size(lo->lo_queue, q->hardsect_size);
 #if (LINUX_VERSION_CODE >= 0x20609) && !defined(QUEUE_FLAG_ORDERED)
 		if(q->ordered == QUEUE_ORDERED_TAG) {
-			blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_TAG);
+			blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_TAG, prep_fn);
 			if(q->issue_flush_fn) {
 				blk_queue_issue_flush_fn(lo->lo_queue, loop_issue_flush);
 			}
@@ -1397,7 +1398,7 @@
 	error = kernel_thread(loop_thread, lo, CLONE_KERNEL);
 	if(error < 0)
 		goto out_mapping;
-	down(&lo->lo_sem);
+	wait_for_completion(&lo->lo_done);
 	fput(file);
 #if defined(QUEUE_FLAG_PLUGGED)
 	lo->lo_queue->unplug_fn = loop_unplug_loopdev;
@@ -1459,7 +1460,8 @@
 {
 	struct file *filp = lo->lo_backing_file;
 	int gfp = lo->old_gfp_mask;
-
+        prepare_flush_fn *prep_fn = NULL;
+        
 	if (bdev->bd_openers != 1)	/* one for this fd being open */
 		return -EBUSY;
 	if (filp==NULL)
@@ -1469,10 +1471,10 @@
 	lo->lo_queue->make_request_fn = loop_make_request_err;
 	if (atomic_dec_and_test(&LDE_lo_pending))
 		wake_up_interruptible(&LDE_lo_bio_wait);
-	down(&lo->lo_sem);
+	wait_for_completion(&lo->lo_done);
 
 #if (LINUX_VERSION_CODE >= 0x20609) || defined(QUEUE_FLAG_ORDERED)
-	blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE);
+	blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE, prep_fn);
 #endif
 	loop_prealloc_cleanup(lo);
 	lo->lo_backing_file = NULL;

[Index of Archives]     [Kernel]     [Linux Crypto]     [Gnu Crypto]     [Gnu Classpath]     [Netfilter]     [Bugtraq]
  Powered by Linux