From: yuan linyu <cugyly@163.com>
To: netdev@vger.kernel.org
Cc: "David S . Miller" <davem@davemloft.net>,
yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Subject: [PATCH net-next 1/2] net: move memcpy_to[from]_msg() from skbuff.h to socket.h
Date: Sat, 14 Oct 2017 10:26:33 +0800 [thread overview]
Message-ID: <1507947993-4728-1-git-send-email-cugyly@163.com> (raw)
From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
these two functions used by skb and other places,
move to socket.h where struct msghdr defined.
Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
---
include/linux/skbuff.h | 10 ----------
include/linux/socket.h | 12 +++++++++++-
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 03634ec2..90868d1 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -3294,16 +3294,6 @@ int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci);
struct sk_buff *pskb_extract(struct sk_buff *skb, int off, int to_copy,
gfp_t gfp);
-static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len)
-{
- return copy_from_iter_full(data, len, &msg->msg_iter) ? 0 : -EFAULT;
-}
-
-static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len)
-{
- return copy_to_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT;
-}
-
struct skb_checksum_ops {
__wsum (*update)(const void *mem, int len, __wsum wsum);
__wsum (*combine)(__wsum csum, __wsum csum2, int offset, int len);
diff --git a/include/linux/socket.h b/include/linux/socket.h
index 8ad963c..c414f1f 100644
--- a/include/linux/socket.h
+++ b/include/linux/socket.h
@@ -53,7 +53,17 @@ struct msghdr {
unsigned int msg_flags; /* flags on received message */
struct kiocb *msg_iocb; /* ptr to iocb for async requests */
};
-
+
+static inline int memcpy_from_msg(void *data, struct msghdr *msg, int len)
+{
+ return copy_from_iter_full(data, len, &msg->msg_iter) ? 0 : -EFAULT;
+}
+
+static inline int memcpy_to_msg(struct msghdr *msg, void *data, int len)
+{
+ return copy_to_iter(data, len, &msg->msg_iter) == len ? 0 : -EFAULT;
+}
+
struct user_msghdr {
void __user *msg_name; /* ptr to socket address structure */
int msg_namelen; /* size of socket address structure */
--
2.7.4
next reply other threads:[~2017-10-14 2:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-14 2:26 yuan linyu [this message]
2017-10-16 8:49 ` [PATCH net-next 1/2] net: move memcpy_to[from]_msg() from skbuff.h to socket.h kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1507947993-4728-1-git-send-email-cugyly@163.com \
--to=cugyly@163.com \
--cc=Linyu.Yuan@alcatel-sbell.com.cn \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox