]>
Commit | Line | Data |
---|---|---|
fda6bd2d JR |
1 | diff -ur lin_tape-3.0.23/upper.c lin_tape-3.0.23.iov/upper.c |
2 | --- lin_tape-3.0.23/upper.c 2018-04-07 22:18:09.417415364 +0200 | |
3 | +++ lin_tape-3.0.23.iov/upper.c 2018-04-07 22:19:26.582769230 +0200 | |
4 | @@ -388,6 +388,22 @@ | |
5 | if (hdr->iovec_count) { | |
6 | const int size = sizeof(struct sg_iovec) * hdr->iovec_count; | |
7 | size_t iov_data_len; | |
8 | +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) | |
9 | + struct iov_iter i; | |
10 | + | |
11 | + sg_iov = kmalloc(size, GFP_KERNEL); | |
12 | + if (!sg_iov) { | |
13 | + ret = -ENOMEM; | |
14 | + goto out; | |
15 | + } | |
16 | + | |
17 | + ret = import_iovec(hdr->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ, hdr->dxferp, hdr->iovec_count, 0, (struct iovec **)&sg_iov, &i); | |
18 | + if (ret < 0) | |
19 | + goto out; | |
20 | + | |
21 | + iov_iter_truncate(&i, hdr->dxfer_len); | |
22 | + iov_data_len = hdr->dxfer_len; | |
23 | +#else | |
24 | struct iovec *iov; | |
25 | int i; | |
26 | ||
27 | @@ -426,6 +442,7 @@ | |
28 | hdr->dxfer_len); | |
29 | iov_data_len = hdr->dxfer_len; | |
30 | } | |
31 | +#endif | |
32 | ||
33 | pfo_cmd.buffer = sg_iov; | |
34 | pfo_cmd.bufflen = iov_data_len; |