[Pkg-loop-aes-commits] r1368 - in /upstream/loop-aes/current: ChangeLog Makefile dkms.conf glue.c kernel-2.4.31.diff kernel-2.4.32.diff kernel-2.6.13.diff kernel-2.6.15.diff loop.c-2.6.patched

xam at users.alioth.debian.org xam at users.alioth.debian.org
Sun Feb 25 12:15:25 CET 2007


Author: xam
Date: Sun Feb 25 12:15:24 2007
New Revision: 1368

URL: http://svn.debian.org/wsvn/pkg-loop-aes/?sc=1&rev=1368
Log:
Import loop-AES v3.1c

Added:
    upstream/loop-aes/current/kernel-2.4.32.diff
      - copied, changed from r1367, upstream/loop-aes/current/kernel-2.4.31.diff
    upstream/loop-aes/current/kernel-2.6.15.diff
      - copied, changed from r1367, upstream/loop-aes/current/kernel-2.6.13.diff
Removed:
    upstream/loop-aes/current/kernel-2.4.31.diff
    upstream/loop-aes/current/kernel-2.6.13.diff
Modified:
    upstream/loop-aes/current/ChangeLog
    upstream/loop-aes/current/Makefile
    upstream/loop-aes/current/dkms.conf
    upstream/loop-aes/current/glue.c
    upstream/loop-aes/current/loop.c-2.6.patched

Modified: upstream/loop-aes/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-loop-aes/upstream/loop-aes/current/ChangeLog?rev=1368&op=diff
==============================================================================
--- upstream/loop-aes/current/ChangeLog (original)
+++ upstream/loop-aes/current/ChangeLog Sun Feb 25 12:15:24 2007
@@ -458,3 +458,13 @@
     - Added losetup -R option which recomputes size of loop device. Useful
       with loop device on top of LVM volume. Patch from Jim MacBaine. (2.4
       and 2.6 kernels)
+
+loop-AES-v3.1c    January 18 2006
+    - WBINVD assembler instruction is no longer used on Xen builds.
+    - Makefile changed to probe .h header files instead of .c source files.
+      (2.4 and 2.6 kernels)
+    - compat_ioctl code updated to handle all 32bit/64bit loop ioctl
+      conversions on 2.6 kernels. No longer depends on fs/compat_ioctl.c
+      handling them.
+    - Semaphores are not used/needed anymore on 2.6 kernels.
+    - Makefile changed to work around 2.6.16-rc1 build breakage.

Modified: upstream/loop-aes/current/Makefile
URL: http://svn.debian.org/wsvn/pkg-loop-aes/upstream/loop-aes/current/Makefile?rev=1368&op=diff
==============================================================================
--- upstream/loop-aes/current/Makefile (original)
+++ upstream/loop-aes/current/Makefile Sun Feb 25 12:15:24 2007
@@ -1,9 +1,9 @@
 #
 #  Makefile
 #
-#  Written by Jari Ruusu, August 31 2005
-#
-#  Copyright 2001-2005 by Jari Ruusu.
+#  Written by Jari Ruusu, January 6 2006
+#
+#  Copyright 2001-2006 by Jari Ruusu.
 #  Redistribution of this file is permitted under the GNU Public License.
 #
 #  To compile and install, use commands:  make clean; make
@@ -62,6 +62,7 @@
 CP1:=
 PP1:=
 VM1:=
+SR1:=n
 ifeq ($(shell if [ "$(VERSION)$(PATCHLEVEL)0" -lt 260 ]; then echo y; fi),y)
 	OD1:=$(LS)
 endif
@@ -86,7 +87,7 @@
 	# Use optimized assembler implementation if target is AMD64 or compatible processor
 	AMD64_ASM:=$(shell if grep -q -s "define CONFIG_X86_64" $(LS)/include/linux/autoconf.h; then echo y; fi)
 	# some older 2.4 kernels don't have struct block_device_operations.owner
-	EF += $(shell if ! grep -q -s "owner.*THIS_MODULE" $(LS)/drivers/block/loop.c; then echo "-DNO_BLOCK_DEVICE_OPERATIONS_OWNER"; fi)
+	EF += $(shell if test -r $(LS)/include/linux/fs.h; then if ! sed -e '1,/^struct block_device_operations {$$/ d' $(LS)/include/linux/fs.h | sed -e '/^};$$/,$$ d' | grep -q -s 'struct module.*owner;'; then echo "-DNO_BLOCK_DEVICE_OPERATIONS_OWNER"; fi; fi)
 	# some older 2.4 kernels don't have reparent_to_init()
 	EF += $(shell if ! grep -q -s "extern void reparent_to_init" $(LS)/include/linux/sched.h; then echo "-DNO_REPARENT_TO_INIT"; fi)
 	# some 2.4 kernels don't have struct task_struct.sigmask_lock
@@ -110,9 +111,17 @@
 	# Use optimized assembler implementation if target is AMD64 or compatible processor
 	AMD64_ASM:=$(shell if grep -q -s "define CONFIG_X86_64" $(OD1)/include/linux/autoconf.h; then echo y; fi)
 	# some older 2.6 kernels have different request_module interface
-	EF += $(shell if ! grep -q -s "request_module.*block-major-.*MAJOR.*MINOR" $(LS)/drivers/block/genhd.c; then echo "-DOLD_REQUEST_MODULE_INTERFACE"; fi)
+	EF += $(shell if test -r $(LS)/drivers/block/genhd.c; then if ! grep -q -s "request_module.*block-major-.*MAJOR.*MINOR" $(LS)/drivers/block/genhd.c; then echo "-DOLD_REQUEST_MODULE_INTERFACE"; fi; fi)
 	# some older 2.6 kernels have per thread resource limits
-	EF += $(shell if grep -q -s "current->rlim" $(LS)/kernel/sys.c; then echo "-DOLD_PER_THREAD_RLIMITS"; fi)
+	EF += $(shell if test -r $(LS)/include/linux/sched.h; then if sed -e '1,/^struct task_struct {$$/ d' $(LS)/include/linux/sched.h | sed -e '/^};$$/,$$ d' | grep -q -s 'struct rlimit rlim.RLIM_NLIMITS.;'; then echo "-DOLD_PER_THREAD_RLIMITS"; fi; fi)
+	# some 2.6 kernels need # character in KBUILD_BASENAME and KBUILD_MODNAME
+	SR1:=$(shell if grep -q -s "^basename_flags.*KBUILD_BASENAME.*KBUILD_STR" $(LS)/scripts/Makefile.lib; then echo y; fi)
+endif
+
+ifeq ($(SR1),y)
+	EF += -D"KBUILD_STR(s)=\#s"
+else
+	EF += -D"KBUILD_STR(s)=s"
 endif
 
 ifeq ($(KEYSCRUB),y)
@@ -227,7 +236,7 @@
 	$(LD) $(LF) patched-loop.o glue.o $(AES_OBJ_CODE) $(MD5_OBJ_CODE) -o loop.o
 ifneq "$(VM1)" ""
 	$(CP1) $(MP1) vmlinux $(PP1)loop.o >/dev/null 2>&1
-	$(CP1) $(CC) $(CFLAGS) $(EF) -DKBUILD_BASENAME=loop_mod -DKBUILD_MODNAME=loop -c $(PP1)loop.mod.c -o $(PP1)loop.mod.o
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(loop_mod)" -D"KBUILD_MODNAME=KBUILD_STR(loop)" -c $(PP1)loop.mod.c -o $(PP1)loop.mod.o
 	$(LD) $(LF) loop.o loop.mod.o -o loop.$(VM1)o
 	rm -f loop.o loop.mod.[co]
 endif
@@ -242,17 +251,17 @@
 	@echo "*** END OF SECTION TO IGNORE PATCH ERRORS ***"
 	patch -p0 -l -f < $(PATCHNAME)
 endif
-	$(CP1) $(CC) $(CFLAGS) $(EF) -DKBUILD_BASENAME=patched_loop -DKBUILD_MODNAME=loop -DEXPORT_SYMTAB -c $(PP1)patched-loop.c -o $(PP1)patched-loop.o
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(patched_loop)" -D"KBUILD_MODNAME=KBUILD_STR(loop)" -DEXPORT_SYMTAB -c $(PP1)patched-loop.c -o $(PP1)patched-loop.o
 glue.o: glue.c aes.h md5.h
-	$(CP1) $(CC) $(CFLAGS) $(EF) -DKBUILD_BASENAME=glue -DKBUILD_MODNAME=loop -c $(PP1)glue.c -o $(PP1)glue.o
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(glue)" -D"KBUILD_MODNAME=KBUILD_STR(loop)" -c $(PP1)glue.c -o $(PP1)glue.o
 aes.o: aes.c aes.h
-	$(CP1) $(CC) $(CFLAGS) $(EF) -DKBUILD_BASENAME=aes -DKBUILD_MODNAME=loop -DDATA_ALWAYS_ALIGNED=1 -c $(PP1)aes.c -o $(PP1)aes.o
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(aes)" -D"KBUILD_MODNAME=KBUILD_STR(loop)" -DDATA_ALWAYS_ALIGNED=1 -c $(PP1)aes.c -o $(PP1)aes.o
 aes-x86.o: aes-x86.S
 	$(CP1) $(CC) $(AFLAGS) -c $(PP1)aes-x86.S -o $(PP1)aes-x86.o
 aes-amd64.o: aes-amd64.S
 	$(CP1) $(CC) $(AFLAGS) -c $(PP1)aes-amd64.S -o $(PP1)aes-amd64.o
 md5.o: md5.c md5.h
-	$(CP1) $(CC) $(CFLAGS) $(EF) -DKBUILD_BASENAME=md5 -DKBUILD_MODNAME=loop -c $(PP1)md5.c -o $(PP1)md5.o
+	$(CP1) $(CC) $(CFLAGS) $(EF) -D"KBUILD_BASENAME=KBUILD_STR(md5)" -D"KBUILD_MODNAME=KBUILD_STR(loop)" -c $(PP1)md5.c -o $(PP1)md5.o
 md5-x86.o: md5-x86.S
 	$(CP1) $(CC) $(AFLAGS) -c $(PP1)md5-x86.S -o $(PP1)md5-x86.o
 md5-amd64.o: md5-amd64.S

Modified: upstream/loop-aes/current/dkms.conf
URL: http://svn.debian.org/wsvn/pkg-loop-aes/upstream/loop-aes/current/dkms.conf?rev=1368&op=diff
==============================================================================
--- upstream/loop-aes/current/dkms.conf (original)
+++ upstream/loop-aes/current/dkms.conf Sun Feb 25 12:15:24 2007
@@ -1,7 +1,7 @@
 # dkms.conf for Dynamic Kernel Module Support
 # http://linux.dell.com/dkms/dkms.html for more info
 
-PACKAGE_VERSION=v3.1b
+PACKAGE_VERSION=v3.1c
 
 # Items below here should not have to change with each driver version
 PACKAGE_NAME="loop-AES"

Modified: upstream/loop-aes/current/glue.c
URL: http://svn.debian.org/wsvn/pkg-loop-aes/upstream/loop-aes/current/glue.c?rev=1368&op=diff
==============================================================================
--- upstream/loop-aes/current/glue.c (original)
+++ upstream/loop-aes/current/glue.c Sun Feb 25 12:15:24 2007
@@ -1,7 +1,7 @@
 /*
  *  glue.c
  *
- *  Written by Jari Ruusu, September 20 2005
+ *  Written by Jari Ruusu, October 20 2005
  *
  *  Copyright 2001-2005 by Jari Ruusu.
  *  Redistribution of this file is permitted under the GNU Public License.
@@ -147,7 +147,7 @@
     p[3] ^= 0xFFFFFFFF;
 
     /* try to flush dirty cache data to RAM */
-#if defined(CONFIG_X86_64) || (defined(CONFIG_X86) && !defined(CONFIG_M386) && !defined(CONFIG_CPU_386))
+#if !defined(CONFIG_XEN) && (defined(CONFIG_X86_64) || (defined(CONFIG_X86) && !defined(CONFIG_M386) && !defined(CONFIG_CPU_386)))
     __asm__ __volatile__ ("wbinvd": : :"memory");
 #else
     mb();

Copied: upstream/loop-aes/current/kernel-2.4.32.diff (from r1367, upstream/loop-aes/current/kernel-2.4.31.diff)
URL: http://svn.debian.org/wsvn/pkg-loop-aes/upstream/loop-aes/current/kernel-2.4.32.diff?rev=1368&op=diff
==============================================================================
--- upstream/loop-aes/current/kernel-2.4.31.diff (original)
+++ upstream/loop-aes/current/kernel-2.4.32.diff Sun Feb 25 12:15:24 2007
@@ -3,9 +3,9 @@
 
     rm -f drivers/block/loop.c include/linux/loop.h
 
-diff -urN linux-2.4.31-noloop/Documentation/Configure.help linux-2.4.31-AES/Documentation/Configure.help
---- linux-2.4.31-noloop/Documentation/Configure.help	2005-04-04 19:15:13.000000000 +0300
-+++ linux-2.4.31-AES/Documentation/Configure.help	2005-08-31 18:32:29.000000000 +0300
+diff -urN linux-2.4.32-noloop/Documentation/Configure.help linux-2.4.32-AES/Documentation/Configure.help
+--- linux-2.4.32-noloop/Documentation/Configure.help	2005-11-18 17:42:38.000000000 +0200
++++ linux-2.4.32-AES/Documentation/Configure.help	2005-11-18 18:12:25.000000000 +0200
 @@ -622,6 +622,27 @@
  
    If unsure, say N.
@@ -34,9 +34,9 @@
  ATA/IDE/MFM/RLL support
  CONFIG_IDE
    If you say Y here, your kernel will be able to manage low cost mass
-diff -urN linux-2.4.31-noloop/drivers/block/Config.in linux-2.4.31-AES/drivers/block/Config.in
---- linux-2.4.31-noloop/drivers/block/Config.in	2004-08-08 14:15:13.000000000 +0300
-+++ linux-2.4.31-AES/drivers/block/Config.in	2005-08-31 18:36:34.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/block/Config.in linux-2.4.32-AES/drivers/block/Config.in
+--- linux-2.4.32-noloop/drivers/block/Config.in	2004-08-08 14:15:13.000000000 +0300
++++ linux-2.4.32-AES/drivers/block/Config.in	2005-11-18 18:12:25.000000000 +0200
 @@ -42,6 +42,15 @@
  dep_tristate 'Promise SATA SX8 support' CONFIG_BLK_DEV_SX8 $CONFIG_PCI
  
@@ -53,9 +53,9 @@
  dep_tristate 'Network block device support' CONFIG_BLK_DEV_NBD $CONFIG_NET
  
  tristate 'RAM disk support' CONFIG_BLK_DEV_RAM
-diff -urN linux-2.4.31-noloop/drivers/block/loop.c linux-2.4.31-AES/drivers/block/loop.c
---- linux-2.4.31-noloop/drivers/block/loop.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/block/loop.c	2005-09-20 19:39:29.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/block/loop.c linux-2.4.32-AES/drivers/block/loop.c
+--- linux-2.4.32-noloop/drivers/block/loop.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/block/loop.c	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,2271 @@
 +/*
 + *  linux/drivers/block/loop.c
@@ -318,7 +318,7 @@
 +    p[3] ^= 0xFFFFFFFF;
 +
 +    /* try to flush dirty cache data to RAM */
-+#if defined(CONFIG_X86_64) || (defined(CONFIG_X86) && !defined(CONFIG_M386) && !defined(CONFIG_CPU_386))
++#if !defined(CONFIG_XEN) && (defined(CONFIG_X86_64) || (defined(CONFIG_X86) && !defined(CONFIG_M386) && !defined(CONFIG_CPU_386)))
 +    __asm__ __volatile__ ("wbinvd": : :"memory");
 +#else
 +    mb();
@@ -2328,9 +2328,9 @@
 +}
 +EXPORT_SYMBOL(loop_add_keyscrub_fn);
 +#endif
-diff -urN linux-2.4.31-noloop/drivers/misc/Makefile linux-2.4.31-AES/drivers/misc/Makefile
---- linux-2.4.31-noloop/drivers/misc/Makefile	2000-12-30 00:07:22.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/Makefile	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/Makefile linux-2.4.32-AES/drivers/misc/Makefile
+--- linux-2.4.32-noloop/drivers/misc/Makefile	2000-12-30 00:07:22.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/Makefile	2005-11-18 18:12:26.000000000 +0200
 @@ -9,8 +9,35 @@
  # parent makes..
  #
@@ -2367,9 +2367,9 @@
  include $(TOPDIR)/Rules.make
  
  fastdep:
-diff -urN linux-2.4.31-noloop/drivers/misc/aes-amd64.S linux-2.4.31-AES/drivers/misc/aes-amd64.S
---- linux-2.4.31-noloop/drivers/misc/aes-amd64.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/aes-amd64.S	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/aes-amd64.S linux-2.4.32-AES/drivers/misc/aes-amd64.S
+--- linux-2.4.32-noloop/drivers/misc/aes-amd64.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/aes-amd64.S	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,893 @@
 +//
 +// Copyright (c) 2001, Dr Brian Gladman <brg at gladman.uk.net>, Worcester, UK.
@@ -3264,9 +3264,9 @@
 +	im_data5(v3)
 +	im_data6(v3)
 +	im_data7(v3)
-diff -urN linux-2.4.31-noloop/drivers/misc/aes-x86.S linux-2.4.31-AES/drivers/misc/aes-x86.S
---- linux-2.4.31-noloop/drivers/misc/aes-x86.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/aes-x86.S	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/aes-x86.S linux-2.4.32-AES/drivers/misc/aes-x86.S
+--- linux-2.4.32-noloop/drivers/misc/aes-x86.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/aes-x86.S	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,922 @@
 +//
 +// Copyright (c) 2001, Dr Brian Gladman <brg at gladman.uk.net>, Worcester, UK.
@@ -4190,9 +4190,9 @@
 +	im_data5(v3)
 +	im_data6(v3)
 +	im_data7(v3)
-diff -urN linux-2.4.31-noloop/drivers/misc/aes.c linux-2.4.31-AES/drivers/misc/aes.c
---- linux-2.4.31-noloop/drivers/misc/aes.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/aes.c	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/aes.c linux-2.4.32-AES/drivers/misc/aes.c
+--- linux-2.4.32-noloop/drivers/misc/aes.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/aes.c	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,1479 @@
 +// I retain copyright in this code but I encourage its free use provided
 +// that I don't carry any responsibility for the results. I am especially 
@@ -5673,9 +5673,9 @@
 +
 +    state_out(out_blk, b0);
 +}
-diff -urN linux-2.4.31-noloop/drivers/misc/aes.h linux-2.4.31-AES/drivers/misc/aes.h
---- linux-2.4.31-noloop/drivers/misc/aes.h	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/aes.h	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/aes.h linux-2.4.32-AES/drivers/misc/aes.h
+--- linux-2.4.32-noloop/drivers/misc/aes.h	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/aes.h	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,113 @@
 +// I retain copyright in this code but I encourage its free use provided
 +// that I don't carry any responsibility for the results. I am especially 
@@ -5790,9 +5790,9 @@
 +// if their parameters have not changed.
 +
 +#endif  // _AES_H
-diff -urN linux-2.4.31-noloop/drivers/misc/crypto-ksym.c linux-2.4.31-AES/drivers/misc/crypto-ksym.c
---- linux-2.4.31-noloop/drivers/misc/crypto-ksym.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/crypto-ksym.c	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/crypto-ksym.c linux-2.4.32-AES/drivers/misc/crypto-ksym.c
+--- linux-2.4.32-noloop/drivers/misc/crypto-ksym.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/crypto-ksym.c	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,7 @@
 +#include <linux/module.h>
 +#include "aes.h"
@@ -5801,9 +5801,9 @@
 +EXPORT_SYMBOL_NOVERS(aes_encrypt);
 +EXPORT_SYMBOL_NOVERS(aes_decrypt);
 +EXPORT_SYMBOL_NOVERS(md5_transform_CPUbyteorder);
-diff -urN linux-2.4.31-noloop/drivers/misc/md5-amd64.S linux-2.4.31-AES/drivers/misc/md5-amd64.S
---- linux-2.4.31-noloop/drivers/misc/md5-amd64.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/md5-amd64.S	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/md5-amd64.S linux-2.4.32-AES/drivers/misc/md5-amd64.S
+--- linux-2.4.32-noloop/drivers/misc/md5-amd64.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/md5-amd64.S	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,200 @@
 +//
 +//  md5-amd64.S
@@ -6005,9 +6005,9 @@
 +	addl	%ecx,8(%rdi)
 +	addl	%edx,12(%rdi)
 +	ret
-diff -urN linux-2.4.31-noloop/drivers/misc/md5-x86.S linux-2.4.31-AES/drivers/misc/md5-x86.S
---- linux-2.4.31-noloop/drivers/misc/md5-x86.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/md5-x86.S	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/md5-x86.S linux-2.4.32-AES/drivers/misc/md5-x86.S
+--- linux-2.4.32-noloop/drivers/misc/md5-x86.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/md5-x86.S	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,207 @@
 +//
 +//  md5-x86.S
@@ -6216,9 +6216,9 @@
 +	pop	%ebx
 +	pop	%ebp
 +	ret
-diff -urN linux-2.4.31-noloop/drivers/misc/md5.c linux-2.4.31-AES/drivers/misc/md5.c
---- linux-2.4.31-noloop/drivers/misc/md5.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/md5.c	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/md5.c linux-2.4.32-AES/drivers/misc/md5.c
+--- linux-2.4.32-noloop/drivers/misc/md5.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/md5.c	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,106 @@
 +/*
 + * MD5 Message Digest Algorithm (RFC1321).
@@ -6326,9 +6326,9 @@
 +    hash[2] += c;
 +    hash[3] += d;
 +}
-diff -urN linux-2.4.31-noloop/drivers/misc/md5.h linux-2.4.31-AES/drivers/misc/md5.h
---- linux-2.4.31-noloop/drivers/misc/md5.h	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/drivers/misc/md5.h	2005-06-01 20:59:27.000000000 +0300
+diff -urN linux-2.4.32-noloop/drivers/misc/md5.h linux-2.4.32-AES/drivers/misc/md5.h
+--- linux-2.4.32-noloop/drivers/misc/md5.h	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/drivers/misc/md5.h	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,11 @@
 +/* md5.h */
 +
@@ -6341,9 +6341,9 @@
 + asmlinkage
 +#endif
 +extern void md5_transform_CPUbyteorder(u_int32_t *, u_int32_t const *);
-diff -urN linux-2.4.31-noloop/include/linux/loop.h linux-2.4.31-AES/include/linux/loop.h
---- linux-2.4.31-noloop/include/linux/loop.h	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.4.31-AES/include/linux/loop.h	2005-09-17 12:20:54.000000000 +0300
+diff -urN linux-2.4.32-noloop/include/linux/loop.h linux-2.4.32-AES/include/linux/loop.h
+--- linux-2.4.32-noloop/include/linux/loop.h	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.4.32-AES/include/linux/loop.h	2005-11-18 18:12:26.000000000 +0200
 @@ -0,0 +1,195 @@
 +#ifndef _LINUX_LOOP_H
 +#define _LINUX_LOOP_H

Copied: upstream/loop-aes/current/kernel-2.6.15.diff (from r1367, upstream/loop-aes/current/kernel-2.6.13.diff)
URL: http://svn.debian.org/wsvn/pkg-loop-aes/upstream/loop-aes/current/kernel-2.6.15.diff?rev=1368&op=diff
==============================================================================
--- upstream/loop-aes/current/kernel-2.6.13.diff (original)
+++ upstream/loop-aes/current/kernel-2.6.15.diff Sun Feb 25 12:15:24 2007
@@ -3,9 +3,9 @@
 
     rm -f drivers/block/loop.c include/linux/loop.h
 
-diff -urN linux-2.6.13-noloop/drivers/block/Kconfig linux-2.6.13-AES/drivers/block/Kconfig
---- linux-2.6.13-noloop/drivers/block/Kconfig	2005-06-18 11:22:28.000000000 +0300
-+++ linux-2.6.13-AES/drivers/block/Kconfig	2005-08-31 18:36:34.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/block/Kconfig linux-2.6.15-AES/drivers/block/Kconfig
+--- linux-2.6.15-noloop/drivers/block/Kconfig	2006-01-03 16:26:46.000000000 +0200
++++ linux-2.6.15-AES/drivers/block/Kconfig	2006-01-03 17:27:14.000000000 +0200
 @@ -285,14 +285,6 @@
  	  bits of, say, a sound file). This is also safe if the file resides
  	  on a remote file server.
@@ -65,9 +65,9 @@
  
  config BLK_DEV_NBD
  	tristate "Network block device support"
-diff -urN linux-2.6.13-noloop/drivers/block/Makefile linux-2.6.13-AES/drivers/block/Makefile
---- linux-2.6.13-noloop/drivers/block/Makefile	2004-12-25 19:24:35.000000000 +0200
-+++ linux-2.6.13-AES/drivers/block/Makefile	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/block/Makefile linux-2.6.15-AES/drivers/block/Makefile
+--- linux-2.6.15-noloop/drivers/block/Makefile	2006-01-03 16:26:47.000000000 +0200
++++ linux-2.6.15-AES/drivers/block/Makefile	2006-01-03 17:27:14.000000000 +0200
 @@ -1,6 +1,9 @@
  #
  # Makefile for the kernel block device drivers.
@@ -78,10 +78,10 @@
  # 12 June 2000, Christoph Hellwig <hch at infradead.org>
  # Rewritten to use lists instead of if-statements.
  # 
-diff -urN linux-2.6.13-noloop/drivers/block/loop.c linux-2.6.13-AES/drivers/block/loop.c
---- linux-2.6.13-noloop/drivers/block/loop.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/block/loop.c	2005-09-20 19:39:29.000000000 +0300
-@@ -0,0 +1,2703 @@
+diff -urN linux-2.6.15-noloop/drivers/block/loop.c linux-2.6.15-AES/drivers/block/loop.c
+--- linux-2.6.15-noloop/drivers/block/loop.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/block/loop.c	2006-01-12 20:22:48.000000000 +0200
+@@ -0,0 +1,2795 @@
 +/*
 + *  linux/drivers/block/loop.c
 + *
@@ -181,6 +181,9 @@
 +#include <linux/writeback.h>
 +#include <linux/buffer_head.h>		/* for invalidate_bdev() */
 +#include <linux/completion.h>
++#if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
++# include <linux/compat.h>
++#endif
 +#if LINUX_VERSION_CODE >= 0x20606
 +# include <linux/mqueue.h>
 +#endif
@@ -361,7 +364,7 @@
 +    p[3] ^= 0xFFFFFFFF;
 +
 +    /* try to flush dirty cache data to RAM */
-+#if defined(CONFIG_X86_64) || (defined(CONFIG_X86) && !defined(CONFIG_M386) && !defined(CONFIG_CPU_386))
++#if !defined(CONFIG_XEN) && (defined(CONFIG_X86_64) || (defined(CONFIG_X86) && !defined(CONFIG_M386) && !defined(CONFIG_CPU_386)))
 +    __asm__ __volatile__ ("wbinvd": : :"memory");
 +#else
 +    mb();
@@ -1122,6 +1125,7 @@
 +			bio_put(bio);
 +			goto fail1;
 +		}
++		memset(page_address(bio->bi_io_vec[0].bv_page), 0, PAGE_SIZE);
 +		bio->bi_vcnt = 1;
 +		bio->bi_private = kmalloc(sizeof(struct loop_bio_extension), GFP_KERNEL);
 +		if (!bio->bi_private)
@@ -1354,9 +1358,6 @@
 +	bio->bi_rw &= ~(1 << BIO_RW_SYNC);
 +	if (bio_sync(orig_bio) && (merge->bi_idx == (orig_bio->bi_vcnt - 1)))
 +		bio->bi_rw |= (1 << BIO_RW_SYNC);
-+#endif
-+#if defined(BIO_PRIO_SHIFT)
-+	bio_set_prio(bio, bio_prio(orig_bio));
 +#endif
 +	bio->bi_vcnt = 1;
 +	bio->bi_idx = 0;
@@ -1780,7 +1781,7 @@
 +	/*
 +	 * up sem, we are running
 +	 */
-+	up(&lo->lo_sem);
++	complete(&lo->lo_done);
 +
 +	for (;;) {
 +		add_wait_queue(&lo->lo_bio_wait, &waitq);
@@ -1941,7 +1942,7 @@
 +			break;
 +	}
 +
-+	up(&lo->lo_sem);
++	complete(&lo->lo_done);
 +	return 0;
 +}
 +
@@ -2041,6 +2042,12 @@
 +	return error;
 +}
 +
++#if defined(blk_fua_rq) || defined(REQ_FUA)
++# define loop_blk_queue_ordered(a,b) blk_queue_ordered(a,b,NULL)
++#else
++# define loop_blk_queue_ordered(a,b) blk_queue_ordered(a,b)
++#endif
++
 +static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
 +		       struct block_device *bdev, unsigned int arg)
 +{
@@ -2061,7 +2068,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(&lo->lo_bio_wait);
 +	atomic_set(&lo->lo_pending, 0);
@@ -2145,10 +2152,13 @@
 +	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);
++#if !defined(MAX_SECTORS)
++# define MAX_SECTORS SAFE_MAX_SECTORS
++#endif
 +	blk_queue_max_sectors(lo->lo_queue, 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);
++	loop_blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE);
 +#endif
 +#if LINUX_VERSION_CODE >= 0x20609
 +	blk_queue_issue_flush_fn(lo->lo_queue, NULL);
@@ -2163,14 +2173,14 @@
 +		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);
++			loop_blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_TAG);
 +			if(q->issue_flush_fn) {
 +				blk_queue_issue_flush_fn(lo->lo_queue, loop_issue_flush);
 +			}
 +		}
 +#elif (LINUX_VERSION_CODE >= 0x20609) || defined(QUEUE_FLAG_ORDERED)
 +		if(q->queue_flags & (1 << QUEUE_FLAG_ORDERED)) {
-+			blk_queue_ordered(lo->lo_queue, 1);
++			loop_blk_queue_ordered(lo->lo_queue, 1);
 +#if LINUX_VERSION_CODE >= 0x20609
 +			if(q->issue_flush_fn) {
 +				blk_queue_issue_flush_fn(lo->lo_queue, loop_issue_flush);
@@ -2192,7 +2202,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;
@@ -2261,10 +2271,10 @@
 +	lo->lo_queue->make_request_fn = loop_make_request_err;
 +	if (atomic_dec_and_test(&lo->lo_pending))
 +		wake_up_interruptible(&lo->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);
++	loop_blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE);
 +#endif
 +	loop_prealloc_cleanup(lo);
 +	lo->lo_backing_file = NULL;
@@ -2504,8 +2514,24 @@
 +	struct block_device *bdev = inode->i_bdev;
 +	struct loop_device *lo = bdev->bd_disk->private_data;
 +	int err;
-+
-+	down(&bdev->bd_sem);
++	wait_queue_t waitq;
++
++	/*
++	 * mutual exclusion - lock
++	 */
++	init_waitqueue_entry(&waitq, current);
++	add_wait_queue(&lo->lo_ioctl_wait, &waitq);
++	for (;;) {
++		set_current_state(TASK_UNINTERRUPTIBLE);
++		spin_lock(&lo->lo_ioctl_spin);
++		err = lo->lo_ioctl_busy;
++		if(!err) lo->lo_ioctl_busy = 1;
++		spin_unlock(&lo->lo_ioctl_spin);
++		if(!err) break;
++		schedule();
++	}
++	set_current_state(TASK_RUNNING);
++	remove_wait_queue(&lo->lo_ioctl_wait, &waitq);
 +
 +	/*
 +	 * LOOP_SET_FD can only be called when no device is attached.
@@ -2552,22 +2578,86 @@
 +		err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
 +	}
 +out_err:
-+	up(&bdev->bd_sem);
++	/*
++	 * mutual exclusion - unlock
++	 */
++	spin_lock(&lo->lo_ioctl_spin);
++	lo->lo_ioctl_busy = 0;
++	spin_unlock(&lo->lo_ioctl_spin);
++	wake_up_all(&lo->lo_ioctl_wait);
++
 +	return err;
 +}
 +
 +#if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
++struct loop_info32 {
++	compat_int_t	lo_number;      /* ioctl r/o */
++	compat_dev_t	lo_device;      /* ioctl r/o */
++	compat_ulong_t	lo_inode;       /* ioctl r/o */
++	compat_dev_t	lo_rdevice;     /* ioctl r/o */
++	compat_int_t	lo_offset;
++	compat_int_t	lo_encrypt_type;
++	compat_int_t	lo_encrypt_key_size;    /* ioctl w/o */
++	compat_int_t	lo_flags;       /* ioctl r/o */
++	char		lo_name[LO_NAME_SIZE];
++	unsigned char	lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
++	compat_ulong_t	lo_init[2];
++	char		reserved[4];
++};
++
 +static long lo_compat_ioctl(struct file * file, unsigned int cmd, unsigned long arg)
 +{
 +	struct inode *inode =  file->f_dentry->d_inode;
++	mm_segment_t old_fs = get_fs();
++	struct loop_info l;
++	struct loop_info32 *ul = (struct loop_info32 *)arg;
 +	int err = -ENOIOCTLCMD;
 +
 +	switch (cmd) {
++	case LOOP_SET_FD:
++	case LOOP_CLR_FD:
++	case LOOP_SET_STATUS64:
++	case LOOP_GET_STATUS64:
++	case LOOP_CHANGE_FD:
 +	case LOOP_MULTI_KEY_SETUP:
 +	case LOOP_MULTI_KEY_SETUP_V3:
 +	case LOOP_RECOMPUTE_DEV_SIZE:
 +		err = lo_ioctl(inode, file, cmd, arg);
 +		break;
++	case LOOP_SET_STATUS:
++		memset(&l, 0, sizeof(l));
++		err = get_user(l.lo_number, &ul->lo_number);
++		err |= get_user(l.lo_device, &ul->lo_device);
++		err |= get_user(l.lo_inode, &ul->lo_inode);
++		err |= get_user(l.lo_rdevice, &ul->lo_rdevice);
++		err |= copy_from_user(&l.lo_offset, &ul->lo_offset,
++		        8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
++		if (err) {
++			err = -EFAULT;
++		} else {
++			set_fs (KERNEL_DS);
++			err = lo_ioctl(inode, file, cmd, (unsigned long)&l);
++			set_fs (old_fs);
++		}
++		memset(&l, 0, sizeof(l));
++		break;
++	case LOOP_GET_STATUS:
++		set_fs (KERNEL_DS);
++		err = lo_ioctl(inode, file, cmd, (unsigned long)&l);
++		set_fs (old_fs);
++		if (!err) {
++			err = put_user(l.lo_number, &ul->lo_number);
++			err |= put_user(l.lo_device, &ul->lo_device);
++			err |= put_user(l.lo_inode, &ul->lo_inode);
++			err |= put_user(l.lo_rdevice, &ul->lo_rdevice);
++			err |= copy_to_user(&ul->lo_offset, &l.lo_offset,
++				(unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
++			if (err)
++				err = -EFAULT;
++		}
++		memset(&l, 0, sizeof(l));
++		break;
++
 +	}
 +	return err;
 +}
@@ -2709,6 +2799,8 @@
 +		memset(lo, 0, sizeof(struct loop_device));
 +		lo->lo_number = i;
 +		lo->lo_queue = disk->queue;
++		spin_lock_init(&lo->lo_ioctl_spin);
++		init_waitqueue_head(&lo->lo_ioctl_wait);
 +		disk->major = LOOP_MAJOR;
 +		disk->first_minor = i;
 +		disk->fops = &lo_fops;
@@ -2785,9 +2877,9 @@
 +}
 +EXPORT_SYMBOL(loop_add_keyscrub_fn);
 +#endif
-diff -urN linux-2.6.13-noloop/drivers/misc/Makefile linux-2.6.13-AES/drivers/misc/Makefile
---- linux-2.6.13-noloop/drivers/misc/Makefile	2005-06-18 11:22:48.000000000 +0300
-+++ linux-2.6.13-AES/drivers/misc/Makefile	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/Makefile linux-2.6.15-AES/drivers/misc/Makefile
+--- linux-2.6.15-noloop/drivers/misc/Makefile	2005-06-18 11:22:48.000000000 +0300
++++ linux-2.6.15-AES/drivers/misc/Makefile	2006-01-03 17:27:14.000000000 +0200
 @@ -1,6 +1,28 @@
  #
  # Makefile for misc devices that really don't fit anywhere else.
@@ -2817,9 +2909,9 @@
  obj- := misc.o	# Dummy rule to force built-in.o to be made
  
  obj-$(CONFIG_IBM_ASM)	+= ibmasm/
-diff -urN linux-2.6.13-noloop/drivers/misc/aes-amd64.S linux-2.6.13-AES/drivers/misc/aes-amd64.S
---- linux-2.6.13-noloop/drivers/misc/aes-amd64.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/aes-amd64.S	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/aes-amd64.S linux-2.6.15-AES/drivers/misc/aes-amd64.S
+--- linux-2.6.15-noloop/drivers/misc/aes-amd64.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/aes-amd64.S	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,893 @@
 +//
 +// Copyright (c) 2001, Dr Brian Gladman <brg at gladman.uk.net>, Worcester, UK.
@@ -3714,9 +3806,9 @@
 +	im_data5(v3)
 +	im_data6(v3)
 +	im_data7(v3)
-diff -urN linux-2.6.13-noloop/drivers/misc/aes-x86.S linux-2.6.13-AES/drivers/misc/aes-x86.S
---- linux-2.6.13-noloop/drivers/misc/aes-x86.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/aes-x86.S	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/aes-x86.S linux-2.6.15-AES/drivers/misc/aes-x86.S
+--- linux-2.6.15-noloop/drivers/misc/aes-x86.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/aes-x86.S	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,922 @@
 +//
 +// Copyright (c) 2001, Dr Brian Gladman <brg at gladman.uk.net>, Worcester, UK.
@@ -4640,9 +4732,9 @@
 +	im_data5(v3)
 +	im_data6(v3)
 +	im_data7(v3)
-diff -urN linux-2.6.13-noloop/drivers/misc/aes.c linux-2.6.13-AES/drivers/misc/aes.c
---- linux-2.6.13-noloop/drivers/misc/aes.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/aes.c	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/aes.c linux-2.6.15-AES/drivers/misc/aes.c
+--- linux-2.6.15-noloop/drivers/misc/aes.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/aes.c	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,1479 @@
 +// I retain copyright in this code but I encourage its free use provided
 +// that I don't carry any responsibility for the results. I am especially 
@@ -6123,9 +6215,9 @@
 +
 +    state_out(out_blk, b0);
 +}
-diff -urN linux-2.6.13-noloop/drivers/misc/aes.h linux-2.6.13-AES/drivers/misc/aes.h
---- linux-2.6.13-noloop/drivers/misc/aes.h	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/aes.h	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/aes.h linux-2.6.15-AES/drivers/misc/aes.h
+--- linux-2.6.15-noloop/drivers/misc/aes.h	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/aes.h	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,113 @@
 +// I retain copyright in this code but I encourage its free use provided
 +// that I don't carry any responsibility for the results. I am especially 
@@ -6240,9 +6332,9 @@
 +// if their parameters have not changed.
 +
 +#endif  // _AES_H
-diff -urN linux-2.6.13-noloop/drivers/misc/crypto-ksym.c linux-2.6.13-AES/drivers/misc/crypto-ksym.c
---- linux-2.6.13-noloop/drivers/misc/crypto-ksym.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/crypto-ksym.c	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/crypto-ksym.c linux-2.6.15-AES/drivers/misc/crypto-ksym.c
+--- linux-2.6.15-noloop/drivers/misc/crypto-ksym.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/crypto-ksym.c	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,7 @@
 +#include <linux/module.h>
 +#include "aes.h"
@@ -6251,9 +6343,9 @@
 +EXPORT_SYMBOL(aes_encrypt);
 +EXPORT_SYMBOL(aes_decrypt);
 +EXPORT_SYMBOL(md5_transform_CPUbyteorder);
-diff -urN linux-2.6.13-noloop/drivers/misc/md5-amd64.S linux-2.6.13-AES/drivers/misc/md5-amd64.S
---- linux-2.6.13-noloop/drivers/misc/md5-amd64.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/md5-amd64.S	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/md5-amd64.S linux-2.6.15-AES/drivers/misc/md5-amd64.S
+--- linux-2.6.15-noloop/drivers/misc/md5-amd64.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/md5-amd64.S	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,200 @@
 +//
 +//  md5-amd64.S
@@ -6455,9 +6547,9 @@
 +	addl	%ecx,8(%rdi)
 +	addl	%edx,12(%rdi)
 +	ret
-diff -urN linux-2.6.13-noloop/drivers/misc/md5-x86.S linux-2.6.13-AES/drivers/misc/md5-x86.S
---- linux-2.6.13-noloop/drivers/misc/md5-x86.S	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/md5-x86.S	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/md5-x86.S linux-2.6.15-AES/drivers/misc/md5-x86.S
+--- linux-2.6.15-noloop/drivers/misc/md5-x86.S	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/md5-x86.S	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,207 @@
 +//
 +//  md5-x86.S
@@ -6666,9 +6758,9 @@
 +	pop	%ebx
 +	pop	%ebp
 +	ret
-diff -urN linux-2.6.13-noloop/drivers/misc/md5.c linux-2.6.13-AES/drivers/misc/md5.c
---- linux-2.6.13-noloop/drivers/misc/md5.c	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/md5.c	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/md5.c linux-2.6.15-AES/drivers/misc/md5.c
+--- linux-2.6.15-noloop/drivers/misc/md5.c	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/md5.c	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,106 @@
 +/*
 + * MD5 Message Digest Algorithm (RFC1321).
@@ -6776,9 +6868,9 @@
 +    hash[2] += c;
 +    hash[3] += d;
 +}
-diff -urN linux-2.6.13-noloop/drivers/misc/md5.h linux-2.6.13-AES/drivers/misc/md5.h
---- linux-2.6.13-noloop/drivers/misc/md5.h	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/drivers/misc/md5.h	2005-08-29 18:05:28.000000000 +0300
+diff -urN linux-2.6.15-noloop/drivers/misc/md5.h linux-2.6.15-AES/drivers/misc/md5.h
+--- linux-2.6.15-noloop/drivers/misc/md5.h	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/drivers/misc/md5.h	2006-01-03 17:27:14.000000000 +0200
 @@ -0,0 +1,11 @@
 +/* md5.h */
 +
@@ -6791,10 +6883,10 @@
 + asmlinkage
 +#endif
 +extern void md5_transform_CPUbyteorder(u_int32_t *, u_int32_t const *);
-diff -urN linux-2.6.13-noloop/include/linux/loop.h linux-2.6.13-AES/include/linux/loop.h
---- linux-2.6.13-noloop/include/linux/loop.h	1970-01-01 02:00:00.000000000 +0200
-+++ linux-2.6.13-AES/include/linux/loop.h	2005-09-17 12:20:54.000000000 +0300
-@@ -0,0 +1,164 @@
+diff -urN linux-2.6.15-noloop/include/linux/loop.h linux-2.6.15-AES/include/linux/loop.h
+--- linux-2.6.15-noloop/include/linux/loop.h	1970-01-01 02:00:00.000000000 +0200
++++ linux-2.6.15-AES/include/linux/loop.h	2006-01-12 20:22:48.000000000 +0200
+@@ -0,0 +1,167 @@
 +#ifndef _LINUX_LOOP_H
 +#define _LINUX_LOOP_H
 +
@@ -6843,7 +6935,7 @@
 +	int		old_gfp_mask;
 +
 +	spinlock_t		lo_lock;
-+	struct semaphore	lo_sem;
++	struct completion	lo_done;
 +	atomic_t		lo_pending;
 +
 +	request_queue_t		*lo_queue;
@@ -6860,6 +6952,9 @@
 +	sector_t		lo_offs_sec;
 +	sector_t		lo_iv_remove;
 +	unsigned long		lo_bio_flag;
++	spinlock_t		lo_ioctl_spin;
++	int			lo_ioctl_busy;
++	wait_queue_head_t	lo_ioctl_wait;
 +#ifdef CONFIG_BLK_DEV_LOOP_KEYSCRUB
 +	void			(*lo_keyscrub_fn)(void *);
 +	void			*lo_keyscrub_ptr;

Modified: upstream/loop-aes/current/loop.c-2.6.patched
URL: http://svn.debian.org/wsvn/pkg-loop-aes/upstream/loop-aes/current/loop.c-2.6.patched?rev=1368&op=diff
==============================================================================
--- upstream/loop-aes/current/loop.c-2.6.patched (original)
+++ upstream/loop-aes/current/loop.c-2.6.patched Sun Feb 25 12:15:24 2007
@@ -94,6 +94,9 @@
 #include <linux/writeback.h>
 #include <linux/buffer_head.h>		/* for invalidate_bdev() */
 #include <linux/completion.h>
+#if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
+# include <linux/compat.h>
+#endif
 #if LINUX_VERSION_CODE >= 0x20606
 # include <linux/mqueue.h>
 #endif
@@ -246,6 +249,10 @@
 	sector_t		lo_offs_sec;
 	sector_t		lo_iv_remove;
 	unsigned long           lo_bio_flag;
+	struct completion	lo_done;
+	spinlock_t		lo_ioctl_spin;
+	int			lo_ioctl_busy;
+	wait_queue_head_t	lo_ioctl_wait;
 #ifdef CONFIG_BLK_DEV_LOOP_KEYSCRUB
 	void			(*lo_keyscrub_fn)(void *);
 	void			*lo_keyscrub_ptr;
@@ -253,19 +260,23 @@
 } LoDevExt;
 static struct loop_device **loop_dev_ptr_arr;
 
-#define LDE_lo_pending   (((LoDevExt *)lo)->lo_pending)
-#define LDE_lo_bio_que0  (((LoDevExt *)lo)->lo_bio_que0)
-#define LDE_lo_bio_que1  (((LoDevExt *)lo)->lo_bio_que1)
-#define LDE_lo_bio_que2  (((LoDevExt *)lo)->lo_bio_que2)
-#define LDE_lo_bio_free0 (((LoDevExt *)lo)->lo_bio_free0)
-#define LDE_lo_bio_free1 (((LoDevExt *)lo)->lo_bio_free1)
-#define LDE_lo_bio_barr  (((LoDevExt *)lo)->lo_bio_barr)
-#define LDE_lo_bio_flsh  (((LoDevExt *)lo)->lo_bio_flsh)
-#define LDE_lo_bio_need  (((LoDevExt *)lo)->lo_bio_need)
-#define LDE_lo_bio_wait  (((LoDevExt *)lo)->lo_bio_wait)
-#define LDE_lo_offs_sec  (((LoDevExt *)lo)->lo_offs_sec)
-#define LDE_lo_iv_remove (((LoDevExt *)lo)->lo_iv_remove)
-#define LDE_lo_bio_flag  (((LoDevExt *)lo)->lo_bio_flag)
+#define LDE_lo_pending      (((LoDevExt *)lo)->lo_pending)
+#define LDE_lo_bio_que0     (((LoDevExt *)lo)->lo_bio_que0)
+#define LDE_lo_bio_que1     (((LoDevExt *)lo)->lo_bio_que1)
+#define LDE_lo_bio_que2     (((LoDevExt *)lo)->lo_bio_que2)
+#define LDE_lo_bio_free0    (((LoDevExt *)lo)->lo_bio_free0)
+#define LDE_lo_bio_free1    (((LoDevExt *)lo)->lo_bio_free1)
+#define LDE_lo_bio_barr     (((LoDevExt *)lo)->lo_bio_barr)
+#define LDE_lo_bio_flsh     (((LoDevExt *)lo)->lo_bio_flsh)
+#define LDE_lo_bio_need     (((LoDevExt *)lo)->lo_bio_need)
+#define LDE_lo_bio_wait     (((LoDevExt *)lo)->lo_bio_wait)
+#define LDE_lo_offs_sec     (((LoDevExt *)lo)->lo_offs_sec)
+#define LDE_lo_iv_remove    (((LoDevExt *)lo)->lo_iv_remove)
+#define LDE_lo_bio_flag     (((LoDevExt *)lo)->lo_bio_flag)
+#define LDE_lo_done         (((LoDevExt *)lo)->lo_done)
+#define LDE_lo_ioctl_spin   (((LoDevExt *)lo)->lo_ioctl_spin)
+#define LDE_lo_ioctl_busy   (((LoDevExt *)lo)->lo_ioctl_busy)
+#define LDE_lo_ioctl_wait   (((LoDevExt *)lo)->lo_ioctl_wait)
 #ifdef CONFIG_BLK_DEV_LOOP_KEYSCRUB
 #define LDE_lo_keyscrub_fn  (((LoDevExt *)lo)->lo_keyscrub_fn)
 #define LDE_lo_keyscrub_ptr (((LoDevExt *)lo)->lo_keyscrub_ptr)
@@ -325,6 +336,7 @@
 			bio_put(bio);
 			goto fail1;
 		}
+		memset(page_address(bio->bi_io_vec[0].bv_page), 0, PAGE_SIZE);
 		bio->bi_vcnt = 1;
 		bio->bi_private = kmalloc(sizeof(struct loop_bio_extension), GFP_KERNEL);
 		if (!bio->bi_private)
@@ -557,9 +569,6 @@
 	bio->bi_rw &= ~(1 << BIO_RW_SYNC);
 	if (bio_sync(orig_bio) && (merge->bi_idx == (orig_bio->bi_vcnt - 1)))
 		bio->bi_rw |= (1 << BIO_RW_SYNC);
-#endif
-#if defined(BIO_PRIO_SHIFT)
-	bio_set_prio(bio, bio_prio(orig_bio));
 #endif
 	bio->bi_vcnt = 1;
 	bio->bi_idx = 0;
@@ -985,7 +994,7 @@
 	/*
 	 * up sem, we are running
 	 */
-	up(&lo->lo_sem);
+	complete(&LDE_lo_done);
 
 	for (;;) {
 		add_wait_queue(&LDE_lo_bio_wait, &waitq);
@@ -1146,7 +1155,7 @@
 			break;
 	}
 
-	up(&lo->lo_sem);
+	complete(&LDE_lo_done);
 	return 0;
 }
 
@@ -1246,6 +1255,12 @@
 	return error;
 }
 
+#if defined(blk_fua_rq) || defined(REQ_FUA)
+# define loop_blk_queue_ordered(a,b) blk_queue_ordered(a,b,NULL)
+#else
+# define loop_blk_queue_ordered(a,b) blk_queue_ordered(a,b)
+#endif
+
 static int loop_set_fd(struct loop_device *lo, struct file *lo_file,
 		       struct block_device *bdev, unsigned int arg)
 {
@@ -1266,7 +1281,7 @@
 	if (!(file->f_mode & FMODE_WRITE))
 		lo_flags |= LO_FLAGS_READ_ONLY;
 
-	init_MUTEX_LOCKED(&lo->lo_sem);
+	init_completion(&LDE_lo_done);
 	spin_lock_init(&lo->lo_lock);
 	init_waitqueue_head(&LDE_lo_bio_wait);
 	atomic_set(&LDE_lo_pending, 0);
@@ -1350,10 +1365,13 @@
 	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);
+#if !defined(MAX_SECTORS)
+# define MAX_SECTORS SAFE_MAX_SECTORS
+#endif
 	blk_queue_max_sectors(lo->lo_queue, 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);
+	loop_blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE);
 #endif
 #if LINUX_VERSION_CODE >= 0x20609
 	blk_queue_issue_flush_fn(lo->lo_queue, NULL);
@@ -1368,14 +1386,14 @@
 		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);
+			loop_blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_TAG);
 			if(q->issue_flush_fn) {
 				blk_queue_issue_flush_fn(lo->lo_queue, loop_issue_flush);
 			}
 		}
 #elif (LINUX_VERSION_CODE >= 0x20609) || defined(QUEUE_FLAG_ORDERED)
 		if(q->queue_flags & (1 << QUEUE_FLAG_ORDERED)) {
-			blk_queue_ordered(lo->lo_queue, 1);
+			loop_blk_queue_ordered(lo->lo_queue, 1);
 #if LINUX_VERSION_CODE >= 0x20609
 			if(q->issue_flush_fn) {
 				blk_queue_issue_flush_fn(lo->lo_queue, loop_issue_flush);
@@ -1397,7 +1415,7 @@
 	error = kernel_thread(loop_thread, lo, CLONE_KERNEL);
 	if(error < 0)
 		goto out_mapping;
-	down(&lo->lo_sem);
+	wait_for_completion(&LDE_lo_done);
 	fput(file);
 #if defined(QUEUE_FLAG_PLUGGED)
 	lo->lo_queue->unplug_fn = loop_unplug_loopdev;
@@ -1469,10 +1487,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(&LDE_lo_done);
 
 #if (LINUX_VERSION_CODE >= 0x20609) || defined(QUEUE_FLAG_ORDERED)
-	blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE);
+	loop_blk_queue_ordered(lo->lo_queue, QUEUE_ORDERED_NONE);
 #endif
 	loop_prealloc_cleanup(lo);
 	lo->lo_backing_file = NULL;
@@ -1712,8 +1730,24 @@
 	struct block_device *bdev = inode->i_bdev;
 	struct loop_device *lo = bdev->bd_disk->private_data;
 	int err;
-
-	down(&bdev->bd_sem);
+	wait_queue_t waitq;
+
+	/*
+	 * mutual exclusion - lock
+	 */
+	init_waitqueue_entry(&waitq, current);
+	add_wait_queue(&LDE_lo_ioctl_wait, &waitq);
+	for (;;) {
+		set_current_state(TASK_UNINTERRUPTIBLE);
+		spin_lock(&LDE_lo_ioctl_spin);
+		err = LDE_lo_ioctl_busy;
+		if(!err) LDE_lo_ioctl_busy = 1;
+		spin_unlock(&LDE_lo_ioctl_spin);
+		if(!err) break;
+		schedule();
+	}
+	set_current_state(TASK_RUNNING);
+	remove_wait_queue(&LDE_lo_ioctl_wait, &waitq);
 
 	/*
 	 * LOOP_SET_FD can only be called when no device is attached.
@@ -1760,22 +1794,86 @@
 		err = lo->ioctl ? lo->ioctl(lo, cmd, arg) : -EINVAL;
 	}
 out_err:
-	up(&bdev->bd_sem);
+	/*
+	 * mutual exclusion - unlock
+	 */
+	spin_lock(&LDE_lo_ioctl_spin);
+	LDE_lo_ioctl_busy = 0;
+	spin_unlock(&LDE_lo_ioctl_spin);
+	wake_up_all(&LDE_lo_ioctl_wait);
+
 	return err;
 }
 
 #if defined(CONFIG_COMPAT) && defined(HAVE_COMPAT_IOCTL)
+struct loop_info32 {
+	compat_int_t	lo_number;      /* ioctl r/o */
+	compat_dev_t	lo_device;      /* ioctl r/o */
+	compat_ulong_t	lo_inode;       /* ioctl r/o */
+	compat_dev_t	lo_rdevice;     /* ioctl r/o */
+	compat_int_t	lo_offset;
+	compat_int_t	lo_encrypt_type;
+	compat_int_t	lo_encrypt_key_size;    /* ioctl w/o */
+	compat_int_t	lo_flags;       /* ioctl r/o */
+	char		lo_name[LO_NAME_SIZE];
+	unsigned char	lo_encrypt_key[LO_KEY_SIZE]; /* ioctl w/o */
+	compat_ulong_t	lo_init[2];
+	char		reserved[4];
+};
+
 static long lo_compat_ioctl(struct file * file, unsigned int cmd, unsigned long arg)
 {
 	struct inode *inode =  file->f_dentry->d_inode;
+	mm_segment_t old_fs = get_fs();
+	struct loop_info l;
+	struct loop_info32 *ul = (struct loop_info32 *)arg;
 	int err = -ENOIOCTLCMD;
 
 	switch (cmd) {
+	case LOOP_SET_FD:
+	case LOOP_CLR_FD:
+	case LOOP_SET_STATUS64:
+	case LOOP_GET_STATUS64:
+	case LOOP_CHANGE_FD:
 	case LOOP_MULTI_KEY_SETUP:
 	case LOOP_MULTI_KEY_SETUP_V3:
 	case LOOP_RECOMPUTE_DEV_SIZE:
 		err = lo_ioctl(inode, file, cmd, arg);
 		break;
+	case LOOP_SET_STATUS:
+		memset(&l, 0, sizeof(l));
+		err = get_user(l.lo_number, &ul->lo_number);
+		err |= get_user(l.lo_device, &ul->lo_device);
+		err |= get_user(l.lo_inode, &ul->lo_inode);
+		err |= get_user(l.lo_rdevice, &ul->lo_rdevice);
+		err |= copy_from_user(&l.lo_offset, &ul->lo_offset,
+		        8 + (unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
+		if (err) {
+			err = -EFAULT;
+		} else {
+			set_fs (KERNEL_DS);
+			err = lo_ioctl(inode, file, cmd, (unsigned long)&l);
+			set_fs (old_fs);
+		}
+		memset(&l, 0, sizeof(l));
+		break;
+	case LOOP_GET_STATUS:
+		set_fs (KERNEL_DS);
+		err = lo_ioctl(inode, file, cmd, (unsigned long)&l);
+		set_fs (old_fs);
+		if (!err) {
+			err = put_user(l.lo_number, &ul->lo_number);
+			err |= put_user(l.lo_device, &ul->lo_device);
+			err |= put_user(l.lo_inode, &ul->lo_inode);
+			err |= put_user(l.lo_rdevice, &ul->lo_rdevice);
+			err |= copy_to_user(&ul->lo_offset, &l.lo_offset,
+				(unsigned long)l.lo_init - (unsigned long)&l.lo_offset);
+			if (err)
+				err = -EFAULT;
+		}
+		memset(&l, 0, sizeof(l));
+		break;
+
 	}
 	return err;
 }
@@ -1807,7 +1905,7 @@
  */
 MODULE_LICENSE("GPL");
 
-#if !defined(OLD_REQUEST_MODULE_INTERFACE)
+#if (LINUX_VERSION_CODE >= 0x20601) || !defined(OLD_REQUEST_MODULE_INTERFACE)
 MODULE_ALIAS_BLOCKDEV_MAJOR(LOOP_MAJOR);
 #else
 MODULE_ALIAS("block-major-7");
@@ -1913,6 +2011,8 @@
 		memset(lo, 0, sizeof(LoDevExt));
 		lo->lo_number = i;
 		lo->lo_queue = disk->queue;
+		spin_lock_init(&LDE_lo_ioctl_spin);
+		init_waitqueue_head(&LDE_lo_ioctl_wait);
 		disk->major = LOOP_MAJOR;
 		disk->first_minor = i;
 		disk->fops = &lo_fops;




More information about the Pkg-loop-aes-commits mailing list