linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] UIO: unbreak uio.h userspace compilation
@ 2009-07-28 13:14 Jiri Slaby
  2009-07-28 19:31 ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2009-07-28 13:14 UTC (permalink / raw)
  To: Alexander Viro; +Cc: linux-fsdevel, Andrew Morton, linux-kernel, Jiri Slaby

To avoid userspace build failures such as:
.../linux/uio.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘iov_length’
.../linux/uio.h:47: error: expected declaration specifiers or ‘...’ before ‘size_t’
move one uio declaration inside a __KERNEL__ block and use __kernel_size_t
instead of size_t for iov_length (it's inlined and used in userspace already).

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 include/linux/uio.h |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/uio.h b/include/linux/uio.h
index b7fe138..9b2623c 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -42,16 +42,18 @@ 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 __kernel_size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
 {
 	unsigned long seg;
-	size_t ret = 0;
+	__kernel_size_t ret = 0;
 
 	for (seg = 0; seg < nr_segs; seg++)
 		ret += iov[seg].iov_len;
 	return ret;
 }
 
+#ifdef __KERNEL__
 unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
+#endif
 
 #endif
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] UIO: unbreak uio.h userspace compilation
  2009-07-28 13:14 [PATCH 1/1] UIO: unbreak uio.h userspace compilation Jiri Slaby
@ 2009-07-28 19:31 ` Christoph Hellwig
  2009-07-28 19:41   ` [PATCH 1/1] UIO: mark uio.h functions __KERNEL__ only Jiri Slaby
  0 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2009-07-28 19:31 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: Alexander Viro, linux-fsdevel, Andrew Morton, linux-kernel

On Tue, Jul 28, 2009 at 03:14:37PM +0200, Jiri Slaby wrote:
> diff --git a/include/linux/uio.h b/include/linux/uio.h
> index b7fe138..9b2623c 100644
> --- a/include/linux/uio.h
> +++ b/include/linux/uio.h
> @@ -42,16 +42,18 @@ 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 __kernel_size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
>  {
>  	unsigned long seg;
> -	size_t ret = 0;
> +	__kernel_size_t ret = 0;
>  
>  	for (seg = 0; seg < nr_segs; seg++)
>  		ret += iov[seg].iov_len;
>  	return ret;
>  }
>  
> +#ifdef __KERNEL__
>  unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to);
> +#endif

iov_length is kernel internal and should not be exported to userspace.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/1] UIO: mark uio.h functions __KERNEL__ only
  2009-07-28 19:31 ` Christoph Hellwig
@ 2009-07-28 19:41   ` Jiri Slaby
  2009-07-28 19:54     ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2009-07-28 19:41 UTC (permalink / raw)
  To: Alexander Viro
  Cc: linux-fsdevel, Andrew Morton, Christoph Hellwig, linux-kernel,
	Jiri Slaby

To avoid userspace build failures such as:
.../linux/uio.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘iov_length’
.../linux/uio.h:47: error: expected declaration specifiers or ‘...’ before ‘size_t’
move uio functions inside a __KERNEL__ block.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 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..693c149 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -35,6 +35,7 @@ struct kvec {
 #define UIO_FASTIOV	8
 #define UIO_MAXIOV	1024
 
+#ifdef __KERNEL__
 /*
  * Total number of bytes covered by an iovec.
  *
@@ -53,5 +54,6 @@ 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.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/1] UIO: mark uio.h functions __KERNEL__ only
  2009-07-28 19:41   ` [PATCH 1/1] UIO: mark uio.h functions __KERNEL__ only Jiri Slaby
@ 2009-07-28 19:54     ` Sam Ravnborg
  2009-07-28 20:05       ` [PATCH v3 " Jiri Slaby
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2009-07-28 19:54 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Alexander Viro, linux-fsdevel, Andrew Morton, Christoph Hellwig,
	linux-kernel

On Tue, Jul 28, 2009 at 09:41:34PM +0200, Jiri Slaby wrote:
> To avoid userspace build failures such as:
> .../linux/uio.h:37: error: expected ???=???, ???,???, ???;???, ???asm??? or ???__attribute__??? before ???iov_length???
> .../linux/uio.h:47: error: expected declaration specifiers or ???...??? before ???size_t???
> move uio functions inside a __KERNEL__ block.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> ---
>  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..693c149 100644
> --- a/include/linux/uio.h
> +++ b/include/linux/uio.h
> @@ -35,6 +35,7 @@ struct kvec {
>  #define UIO_FASTIOV	8
>  #define UIO_MAXIOV	1024
>  
> +#ifdef __KERNEL__
>  /*
>   * Total number of bytes covered by an iovec.
>   *
> @@ -53,5 +54,6 @@ 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

Can we get this fixed up so we have a single #ifdef __KERNEL__ block?
It would be prettier, and nothing the in non-kernel part would rely
on the kernel part so you can put the kernel part in the bottom of
the file.

	Sam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/1] UIO: mark uio.h functions __KERNEL__ only
  2009-07-28 19:54     ` Sam Ravnborg
@ 2009-07-28 20:05       ` Jiri Slaby
  2009-07-28 20:21         ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Slaby @ 2009-07-28 20:05 UTC (permalink / raw)
  To: Alexander Viro
  Cc: linux-fsdevel, Andrew Morton, Christoph Hellwig, linux-kernel,
	Sam Ravnborg, Jiri Slaby

To avoid userspace build failures such as:
.../linux/uio.h:37: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘iov_length’
.../linux/uio.h:47: error: expected declaration specifiers or ‘...’ before ‘size_t’
move uio functions inside a __KERNEL__ block.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
---
 include/linux/uio.h |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/include/linux/uio.h b/include/linux/uio.h
index b7fe138..98c1143 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -19,15 +19,6 @@ struct iovec
 	__kernel_size_t iov_len; /* Must be size_t (1003.1g) */
 };
 
-#ifdef __KERNEL__
-
-struct kvec {
-	void *iov_base; /* and that should *never* hold a userland pointer */
-	size_t iov_len;
-};
-
-#endif
-
 /*
  *	UIO_MAXIOV shall be at least 16 1003.1g (5.4.1.1)
  */
@@ -35,6 +26,13 @@ struct kvec {
 #define UIO_FASTIOV	8
 #define UIO_MAXIOV	1024
 
+#ifdef __KERNEL__
+
+struct kvec {
+	void *iov_base; /* and that should *never* hold a userland pointer */
+	size_t iov_len;
+};
+
 /*
  * Total number of bytes covered by an iovec.
  *
@@ -53,5 +51,6 @@ 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.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/1] UIO: mark uio.h functions __KERNEL__ only
  2009-07-28 20:05       ` [PATCH v3 " Jiri Slaby
@ 2009-07-28 20:21         ` Sam Ravnborg
  0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2009-07-28 20:21 UTC (permalink / raw)
  To: Jiri Slaby
  Cc: Alexander Viro, linux-fsdevel, Andrew Morton, Christoph Hellwig,
	linux-kernel

On Tue, Jul 28, 2009 at 10:05:55PM +0200, Jiri Slaby wrote:
> To avoid userspace build failures such as:
> .../linux/uio.h:37: error: expected ???=???, ???,???, ???;???, ???asm??? or ???__attribute__??? before ???iov_length???
> .../linux/uio.h:47: error: expected declaration specifiers or ???...??? before ???size_t???
> move uio functions inside a __KERNEL__ block.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>

Diff is larger but result is better - thanks.

Acked-by: Sam Ravnborg <sam@ravnborg.org>

	Sam

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-28 20:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-28 13:14 [PATCH 1/1] UIO: unbreak uio.h userspace compilation Jiri Slaby
2009-07-28 19:31 ` Christoph Hellwig
2009-07-28 19:41   ` [PATCH 1/1] UIO: mark uio.h functions __KERNEL__ only Jiri Slaby
2009-07-28 19:54     ` Sam Ravnborg
2009-07-28 20:05       ` [PATCH v3 " Jiri Slaby
2009-07-28 20:21         ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).