[PATCH pre 3.16-rc1] bio: Fix build failure.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 75b9f78ddc8ab30555a520f5a2477a9340341dd1 Mon Sep 17 00:00:00 2001
From: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Jun 2014 12:35:35 +0900
Subject: [PATCH pre 3.16-rc1] bio: Fix build failure.

Commit 62a8067a7f "bio_vec-backed iov_iter" introduced an unnamed union
inside a struct which gcc-4.4.7 cannot handle. Name the unnamed union as
u in order to fix build failure.

Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
---
 fs/fuse/file.c      |    6 ++--
 fs/splice.c         |    2 +-
 include/linux/uio.h |    6 ++--
 mm/iov_iter.c       |   64 +++++++++++++++++++++++++-------------------------
 mm/page_io.c        |    2 +-
 5 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 6e16dad..6ea6124 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1271,7 +1271,7 @@ static inline void fuse_page_descs_length_init(struct fuse_req *req,
 
 static inline unsigned long fuse_get_user_addr(const struct iov_iter *ii)
 {
-	return (unsigned long)ii->iov->iov_base + ii->iov_offset;
+	return (unsigned long)ii->u.iov->iov_base + ii->iov_offset;
 }
 
 static inline size_t fuse_get_frag_size(const struct iov_iter *ii,
@@ -2349,8 +2349,8 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov,
 		kaddr = kmap(page);
 
 		while (todo) {
-			char __user *uaddr = ii.iov->iov_base + ii.iov_offset;
-			size_t iov_len = ii.iov->iov_len - ii.iov_offset;
+			char __user *uaddr = ii.u.iov->iov_base + ii.iov_offset;
+			size_t iov_len = ii.u.iov->iov_len - ii.iov_offset;
 			size_t copy = min(todo, iov_len);
 			size_t left;
 
diff --git a/fs/splice.c b/fs/splice.c
index f5cb9ba..a50a379 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1007,7 +1007,7 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
 
 		/* ... iov_iter */
 		from.type = ITER_BVEC | WRITE;
-		from.bvec = array;
+		from.u.bvec = array;
 		from.nr_segs = n;
 		from.count = sd.total_len - left;
 		from.iov_offset = 0;
diff --git a/include/linux/uio.h b/include/linux/uio.h
index e2231e4..9fb76ad 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -32,7 +32,7 @@ struct iov_iter {
 	union {
 		const struct iovec *iov;
 		const struct bio_vec *bvec;
-	};
+	} u;
 	unsigned long nr_segs;
 };
 
@@ -56,9 +56,9 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
 static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
 {
 	return (struct iovec) {
-		.iov_base = iter->iov->iov_base + iter->iov_offset,
+		.iov_base = iter->u.iov->iov_base + iter->iov_offset,
 		.iov_len = min(iter->count,
-			       iter->iov->iov_len - iter->iov_offset),
+			       iter->u.iov->iov_len - iter->iov_offset),
 	};
 }
 
diff --git a/mm/iov_iter.c b/mm/iov_iter.c
index 7b5dbd1..5165b82 100644
--- a/mm/iov_iter.c
+++ b/mm/iov_iter.c
@@ -19,7 +19,7 @@ static size_t copy_page_to_iter_iovec(struct page *page, size_t offset, size_t b
 		return 0;
 
 	wanted = bytes;
-	iov = i->iov;
+	iov = i->u.iov;
 	skip = i->iov_offset;
 	buf = iov->iov_base + skip;
 	copy = min(bytes, iov->iov_len - skip);
@@ -79,8 +79,8 @@ done:
 		skip = 0;
 	}
 	i->count -= wanted - bytes;
-	i->nr_segs -= iov - i->iov;
-	i->iov = iov;
+	i->nr_segs -= iov - i->u.iov;
+	i->u.iov = iov;
 	i->iov_offset = skip;
 	return wanted - bytes;
 }
@@ -100,7 +100,7 @@ static size_t copy_page_from_iter_iovec(struct page *page, size_t offset, size_t
 		return 0;
 
 	wanted = bytes;
-	iov = i->iov;
+	iov = i->u.iov;
 	skip = i->iov_offset;
 	buf = iov->iov_base + skip;
 	copy = min(bytes, iov->iov_len - skip);
@@ -160,8 +160,8 @@ done:
 		skip = 0;
 	}
 	i->count -= wanted - bytes;
-	i->nr_segs -= iov - i->iov;
-	i->iov = iov;
+	i->nr_segs -= iov - i->u.iov;
+	i->u.iov = iov;
 	i->iov_offset = skip;
 	return wanted - bytes;
 }
@@ -202,12 +202,12 @@ static size_t copy_from_user_atomic_iovec(struct page *page,
 	kaddr = kmap_atomic(page);
 	if (likely(i->nr_segs == 1)) {
 		int left;
-		char __user *buf = i->iov->iov_base + i->iov_offset;
+		char __user *buf = i->u.iov->iov_base + i->iov_offset;
 		left = __copy_from_user_inatomic(kaddr + offset, buf, bytes);
 		copied = bytes - left;
 	} else {
 		copied = __iovec_copy_from_user_inatomic(kaddr + offset,
-						i->iov, i->iov_offset, bytes);
+						i->u.iov, i->iov_offset, bytes);
 	}
 	kunmap_atomic(kaddr);
 
@@ -222,7 +222,7 @@ static void advance_iovec(struct iov_iter *i, size_t bytes)
 		i->iov_offset += bytes;
 		i->count -= bytes;
 	} else {
-		const struct iovec *iov = i->iov;
+		const struct iovec *iov = i->u.iov;
 		size_t base = i->iov_offset;
 		unsigned long nr_segs = i->nr_segs;
 
@@ -244,7 +244,7 @@ static void advance_iovec(struct iov_iter *i, size_t bytes)
 				base = 0;
 			}
 		}
-		i->iov = iov;
+		i->u.iov = iov;
 		i->iov_offset = base;
 		i->nr_segs = nr_segs;
 	}
@@ -262,8 +262,8 @@ static void advance_iovec(struct iov_iter *i, size_t bytes)
 int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes)
 {
 	if (!(i->type & ITER_BVEC)) {
-		char __user *buf = i->iov->iov_base + i->iov_offset;
-		bytes = min(bytes, i->iov->iov_len - i->iov_offset);
+		char __user *buf = i->u.iov->iov_base + i->iov_offset;
+		bytes = min(bytes, i->u.iov->iov_len - i->iov_offset);
 		return fault_in_pages_readable(buf, bytes);
 	}
 	return 0;
@@ -272,7 +272,7 @@ EXPORT_SYMBOL(iov_iter_fault_in_readable);
 
 static unsigned long alignment_iovec(const struct iov_iter *i)
 {
-	const struct iovec *iov = i->iov;
+	const struct iovec *iov = i->u.iov;
 	unsigned long res;
 	size_t size = i->count;
 	size_t n;
@@ -302,7 +302,7 @@ void iov_iter_init(struct iov_iter *i, int direction,
 	if (segment_eq(get_fs(), KERNEL_DS))
 		direction |= ITER_KVEC;
 	i->type = direction;
-	i->iov = iov;
+	i->u.iov = iov;
 	i->nr_segs = nr_segs;
 	i->iov_offset = 0;
 	i->count = count;
@@ -314,7 +314,7 @@ static ssize_t get_pages_iovec(struct iov_iter *i,
 		   size_t *start)
 {
 	size_t offset = i->iov_offset;
-	const struct iovec *iov = i->iov;
+	const struct iovec *iov = i->u.iov;
 	size_t len;
 	unsigned long addr;
 	int n;
@@ -340,7 +340,7 @@ static ssize_t get_pages_alloc_iovec(struct iov_iter *i,
 		   size_t *start)
 {
 	size_t offset = i->iov_offset;
-	const struct iovec *iov = i->iov;
+	const struct iovec *iov = i->u.iov;
 	size_t len;
 	unsigned long addr;
 	void *p;
@@ -376,7 +376,7 @@ static int iov_iter_npages_iovec(const struct iov_iter *i, int maxpages)
 {
 	size_t offset = i->iov_offset;
 	size_t size = i->count;
-	const struct iovec *iov = i->iov;
+	const struct iovec *iov = i->u.iov;
 	int npages = 0;
 	int n;
 
@@ -426,7 +426,7 @@ static size_t copy_page_to_iter_bvec(struct page *page, size_t offset, size_t by
 		return 0;
 
 	wanted = bytes;
-	bvec = i->bvec;
+	bvec = i->u.bvec;
 	skip = i->iov_offset;
 	copy = min_t(size_t, bytes, bvec->bv_len - skip);
 
@@ -450,8 +450,8 @@ static size_t copy_page_to_iter_bvec(struct page *page, size_t offset, size_t by
 		skip = 0;
 	}
 	i->count -= wanted - bytes;
-	i->nr_segs -= bvec - i->bvec;
-	i->bvec = bvec;
+	i->nr_segs -= bvec - i->u.bvec;
+	i->u.bvec = bvec;
 	i->iov_offset = skip;
 	return wanted - bytes;
 }
@@ -470,7 +470,7 @@ static size_t copy_page_from_iter_bvec(struct page *page, size_t offset, size_t
 		return 0;
 
 	wanted = bytes;
-	bvec = i->bvec;
+	bvec = i->u.bvec;
 	skip = i->iov_offset;
 
 	kaddr = kmap_atomic(page);
@@ -499,8 +499,8 @@ static size_t copy_page_from_iter_bvec(struct page *page, size_t offset, size_t
 		skip = 0;
 	}
 	i->count -= wanted;
-	i->nr_segs -= bvec - i->bvec;
-	i->bvec = bvec;
+	i->nr_segs -= bvec - i->u.bvec;
+	i->u.bvec = bvec;
 	i->iov_offset = skip;
 	return wanted;
 }
@@ -514,7 +514,7 @@ static size_t copy_from_user_bvec(struct page *page,
 	size_t base = i->iov_offset;
 
 	kaddr = kmap_atomic(page);
-	for (left = bytes, bvec = i->bvec; left; bvec++, base = 0) {
+	for (left = bytes, bvec = i->u.bvec; left; bvec++, base = 0) {
 		size_t copy = min(left, bvec->bv_len - base);
 		if (!bvec->bv_len)
 			continue;
@@ -535,7 +535,7 @@ static void advance_bvec(struct iov_iter *i, size_t bytes)
 		i->iov_offset += bytes;
 		i->count -= bytes;
 	} else {
-		const struct bio_vec *bvec = i->bvec;
+		const struct bio_vec *bvec = i->u.bvec;
 		size_t base = i->iov_offset;
 		unsigned long nr_segs = i->nr_segs;
 
@@ -557,7 +557,7 @@ static void advance_bvec(struct iov_iter *i, size_t bytes)
 				base = 0;
 			}
 		}
-		i->bvec = bvec;
+		i->u.bvec = bvec;
 		i->iov_offset = base;
 		i->nr_segs = nr_segs;
 	}
@@ -565,7 +565,7 @@ static void advance_bvec(struct iov_iter *i, size_t bytes)
 
 static unsigned long alignment_bvec(const struct iov_iter *i)
 {
-	const struct bio_vec *bvec = i->bvec;
+	const struct bio_vec *bvec = i->u.bvec;
 	unsigned long res;
 	size_t size = i->count;
 	size_t n;
@@ -591,7 +591,7 @@ static ssize_t get_pages_bvec(struct iov_iter *i,
 		   struct page **pages, size_t maxsize,
 		   size_t *start)
 {
-	const struct bio_vec *bvec = i->bvec;
+	const struct bio_vec *bvec = i->u.bvec;
 	size_t len = bvec->bv_len - i->iov_offset;
 	if (len > i->count)
 		len = i->count;
@@ -608,7 +608,7 @@ static ssize_t get_pages_alloc_bvec(struct iov_iter *i,
 		   struct page ***pages, size_t maxsize,
 		   size_t *start)
 {
-	const struct bio_vec *bvec = i->bvec;
+	const struct bio_vec *bvec = i->u.bvec;
 	size_t len = bvec->bv_len - i->iov_offset;
 	if (len > i->count)
 		len = i->count;
@@ -629,7 +629,7 @@ static int iov_iter_npages_bvec(const struct iov_iter *i, int maxpages)
 {
 	size_t offset = i->iov_offset;
 	size_t size = i->count;
-	const struct bio_vec *bvec = i->bvec;
+	const struct bio_vec *bvec = i->u.bvec;
 	int npages = 0;
 	int n;
 
@@ -696,9 +696,9 @@ size_t iov_iter_single_seg_count(const struct iov_iter *i)
 	if (i->nr_segs == 1)
 		return i->count;
 	else if (i->type & ITER_BVEC)
-		return min(i->count, i->iov->iov_len - i->iov_offset);
+		return min(i->count, i->u.iov->iov_len - i->iov_offset);
 	else
-		return min(i->count, i->bvec->bv_len - i->iov_offset);
+		return min(i->count, i->u.bvec->bv_len - i->iov_offset);
 }
 EXPORT_SYMBOL(iov_iter_single_seg_count);
 
diff --git a/mm/page_io.c b/mm/page_io.c
index 243a9b7..875a460 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -274,7 +274,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
 			.count = PAGE_SIZE,
 			.iov_offset = 0,
 			.nr_segs = 1,
-			.bvec = &bv
+			.u.bvec = &bv
 		};
 
 		init_sync_kiocb(&kiocb, swap_file);
-- 
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux