All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
       [not found] <200704271707.l3RH7H5Z032671@hera.kernel.org>
@ 2007-05-01 15:41 ` Geert Uytterhoeven
  2007-05-01 16:14   ` David Howells
  2007-05-01 16:23   ` Linus Torvalds
  0 siblings, 2 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2007-05-01 15:41 UTC (permalink / raw)
  To: David Howells; +Cc: Linus Torvalds, Andrew Morton, Linux Kernel Development

On Fri, 27 Apr 2007, Linux Kernel Mailing List wrote:
>     [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
>     
>     Make the in-kernel AFS filesystem use AF_RXRPC instead of the old RxRPC code.

> --- a/fs/afs/fsclient.c
> +++ b/fs/afs/fsclient.c

> +		if (call->count < PAGE_SIZE) {
> +			buffer = kmap_atomic(call->reply3, KM_USER0);
                                             ^^^^^^^^^^^^

This causes a compile failure on m68k:

| linux/fs/afs/fsclient.c: In function 'afs_deliver_fs_fetch_data':
| linux/fs/afs/fsclient.c:269: warning: dereferencing 'void *' pointer
| linux/fs/afs/fsclient.c:269: error: request for member 'virtual' in something not a structure or union

Probably you wanted to assign call->reply3 to a struct page pointer first, like you do for the call->unmarshall == 2 case.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

--- linux-m68k-2.6.21/fs/afs/fsclient.c
+++ linux-m68k-2.6.21/fs/afs/fsclient.c
@@ -266,7 +266,8 @@ static int afs_deliver_fs_fetch_data(str
 		call->unmarshall++;
 
 		if (call->count < PAGE_SIZE) {
-			buffer = kmap_atomic(call->reply3, KM_USER0);
+			page = call->reply3;
+			buffer = kmap_atomic(page, KM_USER0);
 			memset(buffer + PAGE_SIZE - call->count, 0,
 			       call->count);
 			kunmap_atomic(buffer, KM_USER0);

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
  2007-05-01 15:41 ` [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC Geert Uytterhoeven
@ 2007-05-01 16:14   ` David Howells
  2007-05-01 16:31     ` Geert Uytterhoeven
  2007-05-01 16:23   ` Linus Torvalds
  1 sibling, 1 reply; 7+ messages in thread
From: David Howells @ 2007-05-01 16:14 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Torvalds, Andrew Morton, Linux Kernel Development

Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> This causes a compile failure on m68k:

Hmmm... I couldn't actually test m68k as I couldn't get it to compile.  Can
you give me a good config I can use as a base?

> | linux/fs/afs/fsclient.c: In function 'afs_deliver_fs_fetch_data':
> | linux/fs/afs/fsclient.c:269: warning: dereferencing 'void *' pointer
> | linux/fs/afs/fsclient.c:269: error: request for member 'virtual' in something not a structure or union

Ummm...  Maybe m68k kmap_atomic() should cast it...  I think everywhere else
it must be an inline function or something.

However, I'll subsume your patch into mine if you don't mind.

David

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

* Re: [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
  2007-05-01 15:41 ` [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC Geert Uytterhoeven
  2007-05-01 16:14   ` David Howells
@ 2007-05-01 16:23   ` Linus Torvalds
  2007-05-01 17:51     ` Geert Uytterhoeven
  1 sibling, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2007-05-01 16:23 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: David Howells, Andrew Morton, Linux Kernel Development



On Tue, 1 May 2007, Geert Uytterhoeven wrote:
> 
> This causes a compile failure on m68k:
> 
> | linux/fs/afs/fsclient.c: In function 'afs_deliver_fs_fetch_data':
> | linux/fs/afs/fsclient.c:269: warning: dereferencing 'void *' pointer
> | linux/fs/afs/fsclient.c:269: error: request for member 'virtual' in something not a structure or union
> 
> Probably you wanted to assign call->reply3 to a struct page pointer first, like you do for the call->unmarshall == 2 case.

Hmm. Wouldn't it be nicer to make "kmap_atomic()" be an inline function 
instead? That way, if you pass it a "void *", it still just works, and you 
get a much nicer/more readable error message too when the types actually 
don't match?

Of course, there may be some reason why <linux/highmem.h> does those with 
#define's rather than inline functions. Maybe "page_address()" or 
"pagefault_disabled()" is not declared at that point, and asking it to be 
declared might cause header file inclusion recursion?

		Linus

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

* Re: [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
  2007-05-01 16:14   ` David Howells
@ 2007-05-01 16:31     ` Geert Uytterhoeven
  2007-05-01 16:58       ` David Howells
  0 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2007-05-01 16:31 UTC (permalink / raw)
  To: David Howells; +Cc: Linus Torvalds, Andrew Morton, Linux Kernel Development

On Tue, 1 May 2007, David Howells wrote:
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > This causes a compile failure on m68k:
> 
> Hmmm... I couldn't actually test m68k as I couldn't get it to compile.  Can
> you give me a good config I can use as a base?
> 
> > | linux/fs/afs/fsclient.c: In function 'afs_deliver_fs_fetch_data':
> > | linux/fs/afs/fsclient.c:269: warning: dereferencing 'void *' pointer
> > | linux/fs/afs/fsclient.c:269: error: request for member 'virtual' in something not a structure or union
> 
> Ummm...  Maybe m68k kmap_atomic() should cast it...  I think everywhere else
> it must be an inline function or something.

On architectures that #define WANT_PAGE_VIRTUAL (frv/m68k/mips/extensa),
page_address(page) expands to (page)->virtual, which fails if page is a
void *.

> However, I'll subsume your patch into mine if you don't mind.

Please apply ;-)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
  2007-05-01 16:31     ` Geert Uytterhoeven
@ 2007-05-01 16:58       ` David Howells
  2007-05-01 17:52         ` Geert Uytterhoeven
  0 siblings, 1 reply; 7+ messages in thread
From: David Howells @ 2007-05-01 16:58 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linus Torvalds, Andrew Morton, Linux Kernel Development

Geert Uytterhoeven <geert@linux-m68k.org> wrote:

> On architectures that #define WANT_PAGE_VIRTUAL (frv/m68k/mips/extensa),
> page_address(page) expands to (page)->virtual, which fails if page is a
> void *.

On FRV, kmap_atomic() should always be an inline function (I wrote it:-):

	static inline void *kmap_atomic(struct page *page, enum km_type type)
	{
	...
	}

David

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

* Re: [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
  2007-05-01 16:23   ` Linus Torvalds
@ 2007-05-01 17:51     ` Geert Uytterhoeven
  0 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2007-05-01 17:51 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: David Howells, Andrew Morton, Linux Kernel Development

On Tue, 1 May 2007, Linus Torvalds wrote:
> On Tue, 1 May 2007, Geert Uytterhoeven wrote:
> > This causes a compile failure on m68k:
> > 
> > | linux/fs/afs/fsclient.c: In function 'afs_deliver_fs_fetch_data':
> > | linux/fs/afs/fsclient.c:269: warning: dereferencing 'void *' pointer
> > | linux/fs/afs/fsclient.c:269: error: request for member 'virtual' in something not a structure or union
> > 
> > Probably you wanted to assign call->reply3 to a struct page pointer first, like you do for the call->unmarshall == 2 case.
> 
> Hmm. Wouldn't it be nicer to make "kmap_atomic()" be an inline function 
> instead? That way, if you pass it a "void *", it still just works, and you 
> get a much nicer/more readable error message too when the types actually 
> don't match?

Of course.

> Of course, there may be some reason why <linux/highmem.h> does those with 
> #define's rather than inline functions. Maybe "page_address()" or 
> "pagefault_disabled()" is not declared at that point, and asking it to be 
> declared might cause header file inclusion recursion?

That's what I was afraid of, too...

However, this change seems to build fine (for one of my test configs):

Convert kmap_atomic() in the non-highmem case from a macro to a static
inline function, for better type-checking and the ability to pass void
pointers instead of struct page pointers.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

--- linux-m68k-2.6.21/include/linux/highmem.h
+++ linux-m68k-2.6.21/include/linux/highmem.h
@@ -42,8 +42,14 @@ static inline void *kmap(struct page *pa
 
 #define kunmap(page) do { (void) (page); } while (0)
 
-#define kmap_atomic(page, idx) \
-	({ pagefault_disable(); page_address(page); })
+#include <asm/kmap_types.h>
+
+static inline void *kmap_atomic(struct page *page, enum km_type idx)
+{
+	pagefault_disable();
+	return page_address(page);
+}
+
 #define kunmap_atomic(addr, idx)	do { pagefault_enable(); } while (0)
 #define kmap_atomic_pfn(pfn, idx)	kmap_atomic(pfn_to_page(pfn), (idx))
 #define kmap_atomic_to_page(ptr)	virt_to_page(ptr)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

* Re: [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC.
  2007-05-01 16:58       ` David Howells
@ 2007-05-01 17:52         ` Geert Uytterhoeven
  0 siblings, 0 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2007-05-01 17:52 UTC (permalink / raw)
  To: David Howells; +Cc: Linus Torvalds, Andrew Morton, Linux Kernel Development

On Tue, 1 May 2007, David Howells wrote:
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On architectures that #define WANT_PAGE_VIRTUAL (frv/m68k/mips/extensa),
> > page_address(page) expands to (page)->virtual, which fails if page is a
> > void *.
> 
> On FRV, kmap_atomic() should always be an inline function (I wrote it:-):
> 
> 	static inline void *kmap_atomic(struct page *page, enum km_type type)
> 	{
> 	...
> 	}
> 
> David

That's why I was actually surprised to find out frv has WANT_PAGE_VIRTUAL...

However, upon a closer look, have you tried without CONFIG_HIGHMEM? ;-)

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

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

end of thread, other threads:[~2007-05-01 17:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200704271707.l3RH7H5Z032671@hera.kernel.org>
2007-05-01 15:41 ` [AF_RXRPC]: Make the in-kernel AFS filesystem use AF_RXRPC Geert Uytterhoeven
2007-05-01 16:14   ` David Howells
2007-05-01 16:31     ` Geert Uytterhoeven
2007-05-01 16:58       ` David Howells
2007-05-01 17:52         ` Geert Uytterhoeven
2007-05-01 16:23   ` Linus Torvalds
2007-05-01 17:51     ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.