--- ur-0.4/ur.c	2002-08-03 16:37:16.000000000 +0100
+++ ur-0.4.1test/ur.c	2003-11-05 15:03:15.000000000 +0000
@@ -24,6 +24,7 @@
  *  9 Nov 2001  
  * 15 Jul 2002  Proper macro inits for mutexes; change malloc.h to slab.h
  *  3 Aug 2002  v0.4 release
+ *  5 Nov 2003  Implement non-default CCW command codes (experimental)
  */
 #include <linux/module.h>
 #include <linux/poll.h>
@@ -40,7 +41,7 @@
 #include <asm/atomic.h>
 #include <asm/semaphore.h>
 
-#define UR_VERSION "0.4"
+#define UR_VERSION "0.4.1test"
 static char ur_banner[] = "S/390 unit record device driver v" UR_VERSION;
 
 MODULE_AUTHOR("Malcolm Beattie <beattiem@uk.ibm.com>");
@@ -102,6 +103,15 @@
 /* Flags for the flags field of struct urdev */
 #define UR_READABLE	1
 #define UR_WRITABLE	2
+/*
+ * The next six bits are the CCW command modifier bits. Although they
+ * are (coincidentally) in the same bit positions as in the CCW
+ * command itself, we use a macro which extracts the 6 bits into the
+ * range 0-63 and let the code which uses the modifier shift it back
+ * up again itself. This keeps our choice of flag bit positions totally
+ * independent of the CCW bit positions.
+ */
+#define UR_CCWMOD(flags) (((flags) >> 2) & 0x3F)
 
 static struct file_operations ur_fops = {
 	open:		ur_open,
@@ -210,6 +220,7 @@
 	int err;
 	struct urdev *urd = file2urdev(file);
 	__u32 rescnt;
+	int cmd;
 	
 	if (!urd)
 		return -ENXIO;
@@ -219,7 +230,7 @@
 		return -EIO;
 
 	if (count > urd->blocksize)
-	    count = urd->blocksize;
+		count = urd->blocksize;
 
 	/* reclen != 0 means we only accept writes of multiples of reclen */
 	if (urd->reclen && count % urd->reclen)
@@ -228,7 +239,8 @@
 	if (copy_from_user(urd->data, buf, count))
 		return -EFAULT;
 
-	err = do_ur_io(urd, CCW_CMD_WRITE, urd->data, count);
+	cmd = CCW_CMD_WRITE | (UR_CCWMOD(urd->flags) << 2);
+	err = do_ur_io(urd, cmd, urd->data, count);
 	if (err)
 		return err;
 

