Re: Cloop and kernel 3.14.0
Hello Max,
On Tue, Apr 08, 2014 at 03:08:21AM -0700, Max wrote:
> Hi Klaus,
>
> I've a problem with compiling, here's the log:
> ....
> /usr/src/cloop-2.639/cloop.c: In function ‘cloop_handle_request’:
> include/linux/bio.h:239:9: error: incompatible types when assigning to type
> ‘struct bio_vec *’ from type ‘struct bio_vec’
> ((bvl = bio_iter_iovec((bio), (iter))), 1); \
> ^
> include/linux/bio.h:243:2: note: in expansion of macro
> ‘__bio_for_each_segment’
> __bio_for_each_segment(bvl, bio, iter, (bio)->bi_iter)
[...]
Yes, they changed the bio_vec parameter in rq_for_each_segment() to be a
struct instead of a pointer, and also changed the "release" function to
a void return value.
Please consider the attached patch patch. Works for me with kernel 3.14.0.
Regards
-Klaus
--- Cloop-3.12/cloop.c 2014-01-24 15:34:18.000000000 +0100
+++ Cloop/cloop.c 2014-04-09 01:46:46.000000000 +0200
@@ -20,7 +20,7 @@
*/
#define CLOOP_NAME "cloop"
-#define CLOOP_VERSION "3.12"
+#define CLOOP_VERSION "3.14"
#define CLOOP_MAX 8
#ifndef KBUILD_MODNAME
@@ -296,12 +296,12 @@
int buffered_blocknum = -1;
int preloaded = 0;
loff_t offset = (loff_t) blk_rq_pos(req)<<9; /* req->sector<<9 */
- struct bio_vec *bvec;
+ struct bio_vec bvec;
struct req_iterator iter;
rq_for_each_segment(bvec, req, iter)
{
- unsigned long len = bvec->bv_len;
- char *to_ptr = kmap(bvec->bv_page) + bvec->bv_offset;
+ unsigned long len = bvec.bv_len;
+ char *to_ptr = kmap(bvec.bv_page) + bvec.bv_offset;
while(len > 0)
{
u_int32_t length_in_buffer;
@@ -341,7 +341,7 @@
len -= length_in_buffer;
offset += length_in_buffer;
} /* while inner loop */
- kunmap(bvec->bv_page);
+ kunmap(bvec.bv_page);
} /* end rq_for_each_segment*/
return ((buffered_blocknum!=-1) || preloaded);
}
@@ -925,14 +925,13 @@
return 0;
}
-static int cloop_close(struct gendisk *disk, fmode_t mode)
+static void cloop_close(struct gendisk *disk, fmode_t mode)
{
- int cloop_num, err=0;
- if(!disk) return 0;
+ int cloop_num;
+ if(!disk) return;
cloop_num=((struct cloop_device *)disk->private_data)->clo_number;
- if(cloop_num < 0 || cloop_num > (cloop_count-1)) return 0;
+ if(cloop_num < 0 || cloop_num > (cloop_count-1)) return;
cloop_dev[cloop_num]->refcnt-=1;
- return err;
}
static struct block_device_operations clo_fops =
Reply to: