1 |
dragonheart 09/02/02 12:24:10 |
2 |
|
3 |
Added: cowloop-3.0-2.6.28.patch |
4 |
Log: |
5 |
patch for 2.6.28 thanks to Jérôme Poulin in bug #257335 |
6 |
(Portage version: 2.2_rc23/cvs/Linux x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 sys-fs/cowloop/files/cowloop-3.0-2.6.28.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cowloop/files/cowloop-3.0-2.6.28.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-fs/cowloop/files/cowloop-3.0-2.6.28.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: cowloop-3.0-2.6.28.patch |
15 |
=================================================================== |
16 |
diff -pur /tmp/cowloop-3.0/src/cowdev.c cowloop-3.0/src/cowdev.c |
17 |
--- /tmp/cowloop-3.0/src/cowdev.c 2006-12-12 10:28:17.000000000 +1100 |
18 |
+++ cowloop-3.0/src/cowdev.c 2009-02-02 23:04:45.000000000 +1100 |
19 |
@@ -198,8 +198,8 @@ pairadd (char *rdopath, char *cowpath, c |
20 |
/* |
21 |
** fill structure info for ioctl COWMKPAIR |
22 |
*/ |
23 |
- cowpair.rdofile = rdopath; |
24 |
- cowpair.cowfile = cowpath; |
25 |
+ cowpair.rdofile = (u_char*) rdopath; |
26 |
+ cowpair.cowfile = (u_char*) cowpath; |
27 |
|
28 |
cowpair.rdoflen = strlen(rdopath); |
29 |
cowpair.cowflen = strlen(cowpath); |
30 |
Only in cowloop-3.0/src: cowdev.c.orig |
31 |
Only in cowloop-3.0/src: cowdev.c.rej |
32 |
diff -pur /tmp/cowloop-3.0/src/cowloop.c cowloop-3.0/src/cowloop.c |
33 |
--- /tmp/cowloop-3.0/src/cowloop.c 2006-12-12 10:28:17.000000000 +1100 |
34 |
+++ cowloop-3.0/src/cowloop.c 2009-02-02 23:15:25.000000000 +1100 |
35 |
@@ -408,8 +408,13 @@ static long int cowlo_readcowraw (struct |
36 |
static long int cowlo_writecow (struct cowloop_device *, void *, int, loff_t); |
37 |
static long int cowlo_writecowraw(struct cowloop_device *, void *, int, loff_t); |
38 |
|
39 |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) |
40 |
static int cowlo_ioctl (struct inode *, struct file *, |
41 |
unsigned int, unsigned long); |
42 |
+#else |
43 |
+static int cowlo_ioctl (struct block_device *, fmode_t, |
44 |
+ unsigned int, unsigned long); |
45 |
+#endif |
46 |
|
47 |
static int cowlo_makepair (struct cowpair __user *); |
48 |
static int cowlo_removepair (unsigned long __user *); |
49 |
@@ -434,8 +439,15 @@ static void cowlo_undo_opencow(struct co |
50 |
** < 0 - error value |
51 |
*/ |
52 |
static int |
53 |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) |
54 |
cowlo_open(struct inode *inode, struct file *file) |
55 |
-{ |
56 |
+#else |
57 |
+cowlo_open(struct block_device *bdev, fmode_t mode) |
58 |
+#endif |
59 |
+{ |
60 |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) |
61 |
+ struct inode *inode = bdev->bd_inode; |
62 |
+#endif |
63 |
if (!inode) |
64 |
return -EINVAL; |
65 |
|
66 |
@@ -474,9 +486,20 @@ cowlo_open(struct inode *inode, struct f |
67 |
** < 0 - error value |
68 |
*/ |
69 |
static int |
70 |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) |
71 |
cowlo_release(struct inode *inode, struct file *file) |
72 |
+#else |
73 |
+cowlo_release(struct gendisk *gd, fmode_t mode) |
74 |
+#endif |
75 |
{ |
76 |
int err = 0; |
77 |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) |
78 |
+ struct block_device *bdev; |
79 |
+ struct inode *inode; |
80 |
+ |
81 |
+ bdev = bdget_disk(gd, 0); |
82 |
+ inode = bdev->bd_inode; |
83 |
+#endif |
84 |
|
85 |
if (!inode) |
86 |
return 0; |
87 |
@@ -497,10 +520,18 @@ cowlo_release(struct inode *inode, struc |
88 |
** < 0 - error value |
89 |
*/ |
90 |
static int |
91 |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) |
92 |
cowlo_ioctl(struct inode *inode, struct file *filp, |
93 |
unsigned int cmd, unsigned long arg) |
94 |
+#else |
95 |
+cowlo_ioctl(struct block_device *bdev, fmode_t mode, |
96 |
+ unsigned int cmd, unsigned long arg) |
97 |
+#endif |
98 |
{ |
99 |
struct hd_geometry geo; |
100 |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) |
101 |
+ struct inode *inode = bdev->bd_inode; |
102 |
+#endif |
103 |
|
104 |
DEBUGP(DCOW "cowloop - ioctl cmd %x\n", cmd); |
105 |
|
106 |
@@ -2067,7 +2098,11 @@ cowlo_openrdo(struct cowloop_device *cow |
107 |
cowdev->belowq = cowdev->belowgd->queue; |
108 |
|
109 |
if (cowdev->numblocks == 0) |
110 |
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)) |
111 |
cowdev->numblocks = cowdev->belowgd->capacity |
112 |
+#else |
113 |
+ cowdev->numblocks = get_capacity(cowdev->belowgd) |
114 |
+#endif |
115 |
/ (MAPUNIT/512); |
116 |
} |
117 |
|
118 |
@@ -2637,6 +2672,9 @@ cowlo_sync(void) |
119 |
static int __init |
120 |
cowlo_init_module(void) |
121 |
{ |
122 |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) |
123 |
+ spinlock_t ilock; /* Initial lock for the default queue assigned on load */ |
124 |
+#endif |
125 |
int rv; |
126 |
int minor, uptocows; |
127 |
|
128 |
@@ -2748,7 +2786,7 @@ cowlo_init_module(void) |
129 |
** allocate fake disk as control channel to handle the requests |
130 |
** to activate and deactivate cowdevices dynamically |
131 |
*/ |
132 |
- if ((cowctlgd = alloc_disk(1)) == NULL) { |
133 |
+ if (!(cowctlgd = alloc_disk(1))) { |
134 |
printk(KERN_WARNING |
135 |
"cowloop - unable to alloc_disk for cowctl\n"); |
136 |
|
137 |
@@ -2759,11 +2797,19 @@ cowlo_init_module(void) |
138 |
goto error_out; |
139 |
} |
140 |
|
141 |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) |
142 |
+ spin_lock_init(&ilock); |
143 |
+#endif |
144 |
+ |
145 |
cowctlgd->major = COWMAJOR; |
146 |
cowctlgd->first_minor = COWCTL; |
147 |
cowctlgd->minors = 1; |
148 |
cowctlgd->fops = &cowlo_fops; |
149 |
cowctlgd->private_data = NULL; |
150 |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) |
151 |
+ /* The device is of capacity 0, so there won't be any queue request */ |
152 |
+ cowctlgd->queue = blk_init_queue(NULL, &ilock); |
153 |
+#endif |
154 |
sprintf(cowctlgd->disk_name, "cowctl"); |
155 |
set_capacity(cowctlgd, 0); |
156 |
|
157 |
@@ -2816,7 +2862,9 @@ cowlo_cleanup_module(void) |
158 |
kfree(cowdevall[minor]); |
159 |
} |
160 |
kfree(cowdevall); |
161 |
- |
162 |
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,28)) |
163 |
+ blk_cleanup_queue(cowctlgd->queue); /* cleanup the empty queue */ |
164 |
+#endif |
165 |
del_gendisk(cowctlgd); /* revert the alloc_disk() */ |
166 |
put_disk (cowctlgd); /* revert the add_disk() */ |