* [PATCH] linux/uio.h: cleanup for userspace
@ 2008-12-27 6:49 Mike Frysinger
2008-12-29 12:20 ` [PATCH v2] " Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2008-12-27 6:49 UTC (permalink / raw)
To: linux-kernel
Hide iov_shorten() behind __KERNEL__ since it's a prototype only. Use the
__inline__ form for iov_length() since it's usable by userspace.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
include/linux/uio.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index b7fe138..2faeea6 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -42,7 +42,7 @@ struct kvec {
* segment lengths have been validated. Because the individual lengths can
* overflow a size_t when added together.
*/
-static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
+static __inline__ size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
{
unsigned long seg;
size_t ret = 0;
@@ -52,6 +52,8 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
return ret;
}
+#ifdef __KERNEL__
unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
+#endif
#endif
--
1.6.0.6
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v2] linux/uio.h: cleanup for userspace
2008-12-27 6:49 [PATCH] linux/uio.h: cleanup for userspace Mike Frysinger
@ 2008-12-29 12:20 ` Mike Frysinger
2008-12-29 12:56 ` Sam Ravnborg
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2008-12-29 12:20 UTC (permalink / raw)
To: linux-kernel
Hide iov_shorten() behind __KERNEL__ since it's a prototype only. Use the
__inline__ form for iov_length() since it's usable by userspace.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v2
- drop inline conversion stuff
include/linux/uio.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index b7fe138..bd1661b 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -52,6 +52,8 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
return ret;
}
+#ifdef __KERNEL__
unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
+#endif
#endif
--
1.6.0.6
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] linux/uio.h: cleanup for userspace
2008-12-29 12:20 ` [PATCH v2] " Mike Frysinger
@ 2008-12-29 12:56 ` Sam Ravnborg
2008-12-29 12:59 ` [PATCH v3] " Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2008-12-29 12:56 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-kernel
On Mon, Dec 29, 2008 at 07:20:17AM -0500, Mike Frysinger wrote:
> Hide iov_shorten() behind __KERNEL__ since it's a prototype only. Use the
> __inline__ form for iov_length() since it's usable by userspace.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> v2
> - drop inline conversion stuff
>
> include/linux/uio.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/uio.h b/include/linux/uio.h
> index b7fe138..bd1661b 100644
> --- a/include/linux/uio.h
> +++ b/include/linux/uio.h
> @@ -52,6 +52,8 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
> return ret;
> }
>
> +#ifdef __KERNEL__
> unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
> +#endif
>
> #endif
Could we rearrange stuff in this file so we only get one #ifdef __KERNEL__ / endif
pair?
Sam
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3] linux/uio.h: cleanup for userspace
2008-12-29 12:56 ` Sam Ravnborg
@ 2008-12-29 12:59 ` Mike Frysinger
2008-12-29 13:03 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2008-12-29 12:59 UTC (permalink / raw)
To: linux-kernel
Hide iov_shorten() behind __KERNEL__ since it's a prototype only. Use the
__inline__ form for iov_length() since it's usable by userspace.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v3
- keep all __KERNEL__ stuff in one place
v2
- drop inline conversion stuff
include/linux/uio.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index b7fe138..3debd89 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -26,6 +26,8 @@ struct kvec {
size_t iov_len;
};
+unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
+
#endif
/*
@@ -52,6 +54,4 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
return ret;
}
-unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
-
#endif
--
1.6.0.6
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v3] linux/uio.h: cleanup for userspace
2008-12-29 12:59 ` [PATCH v3] " Mike Frysinger
@ 2008-12-29 13:03 ` Christoph Hellwig
2008-12-29 20:32 ` [PATCH v4] " Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2008-12-29 13:03 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-kernel
On Mon, Dec 29, 2008 at 07:59:59AM -0500, Mike Frysinger wrote:
> Hide iov_shorten() behind __KERNEL__ since it's a prototype only. Use the
> __inline__ form for iov_length() since it's usable by userspace.
>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> v3
> - keep all __KERNEL__ stuff in one place
> v2
> - drop inline conversion stuff
>
> include/linux/uio.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/uio.h b/include/linux/uio.h
> index b7fe138..3debd89 100644
> --- a/include/linux/uio.h
> +++ b/include/linux/uio.h
> @@ -26,6 +26,8 @@ struct kvec {
> size_t iov_len;
> };
>
> +unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
> +
> #endif
>
> /*
> @@ -52,6 +54,4 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
> return ret;
> }
>
> -unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
> -
> #endif
Umm, iov_length is another kernel-only thing and should not be left
user-visible. And struct kvec is in another __KERNEL__ block.
Just move UIO_FASTIOV and UIO_MAXIOV up and have a single __KERNEL__
block for the rest.
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH v4] linux/uio.h: cleanup for userspace
2008-12-29 13:03 ` Christoph Hellwig
@ 2008-12-29 20:32 ` Mike Frysinger
0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2008-12-29 20:32 UTC (permalink / raw)
To: linux-kernel
Hide iov_shorten() behind __KERNEL__ since it's a prototype only. Use the
__inline__ form for iov_length() since it's usable by userspace.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
v4
- hide all funcs behind __KERNEL__
v3
- keep all __KERNEL__ stuff in one place
v2
- drop inline conversion stuff
include/linux/uio.h | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/uio.h b/include/linux/uio.h
index b7fe138..31d75cd 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -19,6 +19,13 @@ struct iovec
__kernel_size_t iov_len; /* Must be size_t (1003.1g) */
};
+/*
+ * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
+ */
+
+#define UIO_FASTIOV 8
+#define UIO_MAXIOV 1024
+
#ifdef __KERNEL__
struct kvec {
@@ -26,15 +33,6 @@ struct kvec {
size_t iov_len;
};
-#endif
-
-/*
- * UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
- */
-
-#define UIO_FASTIOV 8
-#define UIO_MAXIOV 1024
-
/*
* Total number of bytes covered by an iovec.
*
@@ -55,3 +53,5 @@ static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
#endif
+
+#endif
--
1.6.0.6
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2008-12-29 20:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-27 6:49 [PATCH] linux/uio.h: cleanup for userspace Mike Frysinger
2008-12-29 12:20 ` [PATCH v2] " Mike Frysinger
2008-12-29 12:56 ` Sam Ravnborg
2008-12-29 12:59 ` [PATCH v3] " Mike Frysinger
2008-12-29 13:03 ` Christoph Hellwig
2008-12-29 20:32 ` [PATCH v4] " Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®