vhost: Drop linux/socket.h
Subsystems (8)
PATCH 1/1 vhost: Drop linux/socket.h
memcpy_fromiovec is moved to lib/iovec.c. No need to include linux/socket.h for it.
--- drivers/vhost/vhost.c | 1 - 1 file changed, 1 deletion(-)
drivers/vhost/vhost.c +0 -1
@@ -13,7 +13,6 @@#include <linux/eventfd.h> #include <linux/vhost.h> -#include <linux/socket.h> /* memcpy_fromiovec */ #include <linux/mm.h> #include <linux/mmu_context.h> #include <linux/miscdevice.h>
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Asias He <[email protected]>
Date: Thu, 15 Aug 2013 11:20:16 +0800
Quoted 4 lines
memcpy_fromiovecis moved tolib/iovec.c. No need to includelinux/socket.hfor it.Signed-off-by Asias He <[email protected]>
You can't do this.
Because this file doesn't include the header file that provides the declaration, which is linux/uio.h
linux/socket.h includes linux/uio.h, so honestly leaving things the way they are is a 1000 times better than your patch.
Quoted 6 lines · David Miller
From: Asias He <[email protected]>
Date: Thu, 15 Aug 2013 11:20:16 +0800Quoted 3 lines
memcpy_fromiovecis moved tolib/iovec.c. No need to includelinux/socket.hfor it.
Quoted 6 lines
Quoted 1 line
Signed-off-by Asias He <[email protected]>You can't do this.
Because this file doesn't include the header file that provides the declaration, which is
linux/uio.h
vhost.c includes drivers/vhost/vhost.h. In drivers/vhost/vhost.h, we have linux/uio.h included.
Quoted 3 lines
linux/socket.hincludeslinux/uio.h, so honestly leaving things the way they are is a 1000 times better than your patch.
Vhost is a separate module and a generic infrastructure which is not bound to network anymore. I guess it's better to include the real one instead of the socket one.
Signature · 1 line
Asias
David Miller
maintainerFrom: Asias He <[email protected]>
Date: Fri, 16 Aug 2013 09:27:43 +0800
Quoted 9 lines · David Miller
Quoted 8 lines
From: Asias He <[email protected]>
Date: Thu, 15 Aug 2013 11:20:16 +0800Quoted 4 lines
memcpy_fromiovecis moved tolib/iovec.c. No need to includelinux/socket.hfor it.Signed-off-by Asias He <[email protected]>
Quoted 7 lines
Quoted 4 lines
You can't do this.
Because this file doesn't include the header file that provides the declaration, which is
linux/uio.h
vhost.cincludesdrivers/vhost/vhost.h. Indrivers/vhost/vhost.h, we havelinux/uio.hincluded.
Nothing in vhost.h needs linux/uio.h right? That's very poor style, include the header where the dependency exists which is vhost.c
Quoted 14 lines · David Miller
From: Asias He <[email protected]>
Date: Fri, 16 Aug 2013 09:27:43 +0800Quoted 11 lines · David Miller
Quoted 10 lines
From: Asias He <[email protected]>
Date: Thu, 15 Aug 2013 11:20:16 +0800Quoted 4 lines
memcpy_fromiovecis moved tolib/iovec.c. No need to includelinux/socket.hfor it.Signed-off-by Asias He <[email protected]>You can't do this.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Because this file doesn't include the header file that provides the declaration, which is
linux/uio.h
vhost.cincludesdrivers/vhost/vhost.h. Indrivers/vhost/vhost.h, we havelinux/uio.hincluded.Nothing in
vhost.hneedslinux/uio.hright? That's very poor style, include the header where the dependency exists which isvhost.c
We use 'struct iovec' in vhost.h which needs linux/uio.h, no?
So, how about including linux/uio.h in both vhost.c and vhost.h.
Signature · 1 line
Asias
David Miller
maintainerFrom: Asias He <[email protected]>
Date: Fri, 16 Aug 2013 17:27:43 +0800
Quoted 21 lines · David Miller
Quoted 20 lines
From: Asias He <[email protected]>
Date: Fri, 16 Aug 2013 09:27:43 +0800Quoted 16 lines · David Miller
Quoted 6 lines
From: Asias He <[email protected]>
Date: Thu, 15 Aug 2013 11:20:16 +0800Quoted 3 lines
memcpy_fromiovecis moved tolib/iovec.c. No need to includelinux/socket.hfor it.Quoted 6 lines
Quoted 1 line
Signed-off-by Asias He <[email protected]>You can't do this.
Because this file doesn't include the header file that provides the declaration, which is
linux/uio.h
vhost.cincludesdrivers/vhost/vhost.h. Indrivers/vhost/vhost.h, we havelinux/uio.hincluded.
Quoted 6 lines
Quoted 2 lines
Nothing in
vhost.hneedslinux/uio.hright? That's very poor style, include the header where the dependency exists which isvhost.cWe use 'struct iovec' in
vhost.hwhich needslinux/uio.h, no?So, how about including
linux/uio.hin bothvhost.candvhost.h.
That sounds good.
PATCH v2 1/1 vhost: Include linux/uio.h instead of linux/socket.h
memcpy_fromiovec is moved from net/core/iovec.c to lib/iovec.c. linux/uio.h provides the declaration for memcpy_fromiovec.
Include linux/uio.h instead of inux/socket.h for it.
--- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vhost.c +1 -1
@@ -13,7 +13,7 @@#include <linux/eventfd.h> #include <linux/vhost.h> -#include <linux/socket.h> /* memcpy_fromiovec */ +#include <linux/uio.h> #include <linux/mm.h> #include <linux/mmu_context.h> #include <linux/miscdevice.h>
Signature · 1 line
1.8.3.1
Re: [PATCH v2] vhost: Include linux/uio.h instead of linux/socket.h
Quoted 6 lines · Asias He
memcpy_fromiovecis moved fromnet/core/iovec.ctolib/iovec.c.linux/uio.hprovides the declaration formemcpy_fromiovec.Include
linux/uio.hinstead ofinux/socket.hfor it.Signed-off-by Asias He <[email protected]>
Quoted 19 lines
--- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vhost/vhost.c +1
-1@@ -13,7 +13,7 @@#include <linux/eventfd.h> #include <linux/vhost.h> -#include <linux/socket.h> /* memcpy_fromiovec */ +#include <linux/uio.h> #include <linux/mm.h> #include <linux/mmu_context.h> #include <linux/miscdevice.h> Signature · 1 line
1.8.3.1
Re: [PATCH v2] vhost: Include linux/uio.h instead of linux/socket.h
In reply to Asias HeFrom: Asias He <[email protected]>
Date: Mon, 19 Aug 2013 09:23:19 +0800
Quoted 6 lines
memcpy_fromiovecis moved fromnet/core/iovec.ctolib/iovec.c.linux/uio.hprovides the declaration formemcpy_fromiovec.Include
linux/uio.hinstead ofinux/socket.hfor it.Signed-off-by Asias He <[email protected]>
Applied.
Michael S. Tsirkin
maintainerQuoted 14 lines · David Miller
From: Asias He <[email protected]>
Date: Fri, 16 Aug 2013 09:27:43 +0800Quoted 11 lines · David Miller
Quoted 10 lines
From: Asias He <[email protected]>
Date: Thu, 15 Aug 2013 11:20:16 +0800Quoted 4 lines
memcpy_fromiovecis moved tolib/iovec.c. No need to includelinux/socket.hfor it.Signed-off-by Asias He <[email protected]>You can't do this.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Because this file doesn't include the header file that provides the declaration, which is
linux/uio.h
vhost.cincludesdrivers/vhost/vhost.h. Indrivers/vhost/vhost.h, we havelinux/uio.hincluded.Nothing in
vhost.hneedslinux/uio.hright? That's very poor style, include the header where the dependency exists which isvhost.c
It needs struct iovec, which is in include/uapi/linux/uio.h. Do you think it's better to include uapi/linux/uio.h directly? In that case maybe we should update linux/socket.h to pull in uapi/linux/uio.h directly too.
Or even just forward-declare struct iovec.
I tried this last option and the only fall-out seems to be in security/
- though I didn't do an allyes config build yet. Good idea? If yes let me know and I'll do that.
-->
socket: forward-declare struct iovec
We can simplify header dependencies by using a forward declaration of struct iovec in socket.h - it's always used through a pointer there. Do this and fix up users that rely on socket.h including uio.h.
---
include/linux/socket.h +2 -1
@@ -4,7 +4,6 @@#include <asm/socket.h> /* arch-dependent defines */ #include <linux/sockios.h> /* the SIOCxxx I/O controls */ -#include <linux/uio.h> /* iovec support */ #include <linux/types.h> /* pid_t */ #include <linux/compiler.h> /* __user */ #include <uapi/linux/socket.h>
@@ -44,6 +43,8 @@ struct linger {* belong in an obscure libc emulation or the bin. */ +struct iovec ; +struct msghdr {void * msg_name;/* Socket name */ int msg_namelen;/* Length of name */
security/keys/compat.c +1 -0
@@ -13,6 +13,7 @@#include <linux/keyctl.h> #include <linux/compat.h> #include <linux/slab.h> +#include <uapi/linux/uio.h> #include "internal.h" /*
Signature · 1 line
MST