Skip to contentSkip to conversation

fs/read_write.c: unexport iov_shorten

RFC PATCH In review Adrian Bunk 4 participants 4 messages Apr 27, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 fs/read_write.c: unexport iov_shorten

This patch removes the unused EXPORT_SYMBOL(iov_shorten).

---

This patch was already sent on:
- 23 Apr 2006

fs/read_write.c renamed from fs/read_write.c.old +0 -2
@@ -436,8 +436,6 @@
 	return seg;
 }
 
-EXPORT_SYMBOL(iov_shorten);
-
 /* A write operation does a read from user space and vice versa */
 #define vrfy_dir(type) ((type) == READ ? VERIFY_WRITE : VERIFY_READ)
 
#1 lore raw
Quoted 12 lines · Adrian Bunk

This patch removes the unused EXPORT_SYMBOL(iov_shorten).

---

This patch was already sent on:
- 23 Apr 2006

fs/read_write.c line 440

Quoted 7 lines
fs/read_write.c renamed from fs/read_write.c.old +0 -2
@@ -436,8 +436,6 @@
 	return seg;
 }
 
-EXPORT_SYMBOL(iov_shorten);
-
 /* A write operation does a read from user space and vice versa */
 #define vrfy_dir(type) ((type) == READ ? VERIFY_WRITE : VERIFY_READ)

While you are at it, why not move iov_shorten() to only file its currently used from filemap.c, make it static and take it out from uio.h ? (filemap.c may not be the right place for it, but ..)

Thanks,
Badari

#2 lore raw
In reply to Adrian Bunk
Quoted 12 lines · Adrian Bunk

This patch removes the unused EXPORT_SYMBOL(iov_shorten).

---

This patch was already sent on:
- 23 Apr 2006

fs/read_write.c line 441

Quoted 8 lines
fs/read_write.c renamed from fs/read_write.c.old +0 -2
@@ -436,8 +436,6 @@
 	return seg;
 }
 
-EXPORT_SYMBOL(iov_shorten);
-
 /* A write operation does a read from user space and vice versa */
 #define vrfy_dir(type) ((type) == READ ? VERIFY_WRITE : VERIFY_READ)
 

How about this ? Wondering if we need to make this "inline" also (since its used only in one place).

Thanks,
Badari

 fs/read_write.c     |   22 ----------------------
 include/linux/uio.h |   22 +++++++++++++++++++++-
 2 files changed, 21 insertions(+), 23 deletions(-)
fs/read_write.c +0 -22
Index: linux-2.6.17-rc2/fs/read_write.c
===================================================================
@@ -416,28 +416,6 @@ asmlinkage ssize_t sys_pwrite64(unsigned
 	return ret;
 }
 
-/*
- * Reduce an iovec's length in-place.  Return the resulting number of segments
- */
-unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to)
-{
-	unsigned long seg = 0;
-	size_t len = 0;
-
-	while (seg < nr_segs) {
-		seg++;
-		if (len + iov->iov_len >= to) {
-			iov->iov_len = to - len;
-			break;
-		}
-		len += iov->iov_len;
-		iov++;
-	}
-	return seg;
-}
-
-EXPORT_SYMBOL(iov_shorten);
-
 /* A write operation does a read from user space and vice versa */
 #define vrfy_dir(type) ((type) == READ ? VERIFY_WRITE : VERIFY_READ)
 
include/linux/uio.h +21 -1
Index: linux-2.6.17-rc2/include/linux/uio.h
===================================================================
@@ -61,6 +61,26 @@ static inline size_t iov_length(const st
 	return ret;
 }
 
-unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
+
+/*
+ * Reduce an iovec's length in-place.  Return the resulting number of segments
+ */
+static
+unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to)
+{
+	unsigned long seg = 0;
+	size_t len = 0;
+
+	while (seg < nr_segs) {
+		seg++;
+		if (len + iov->iov_len >= to) {
+			iov->iov_len = to - len;
+			break;
+		}
+		len += iov->iov_len;
+		iov++;
+	}
+	return seg;
+}
 
 #endif
#3 lore raw
Quoted 16 lines · Badari Pulavarty
Quoted 15 lines · Adrian Bunk

This patch removes the unused EXPORT_SYMBOL(iov_shorten).

---

This patch was already sent on:
- 23 Apr 2006

fs/read_write.c renamed from fs/read_write.c.old +0 -0
@@ -436,8 +436,6 @@
 	return seg;
 }
 
Quoted 8 lines

fs/read_write.c asmlinkage ssize_t sys_pwrite64(unsigned · line 421

Quoted 5 lines
fs/read_write.c renamed from fs/read_write.c.old +0 -2
-EXPORT_SYMBOL(iov_shorten);
-
 /* A write operation does a read from user space and vice versa */
 #define vrfy_dir(type) ((type) == READ ? VERIFY_WRITE : VERIFY_READ)
 

How about this ? Wondering if we need to make this "inline" also (since its used only in one place).

no real need; if it's static modern gcc will inline it anyway