mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 02/14] Add kmemdup
Date: Tue,  2 Oct 2018 16:03:51 +0200	[thread overview]
Message-ID: <20181002140403.3735-3-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20181002140403.3735-1-s.hauer@pengutronix.de>

We have kmemdup as a UBIFS specific variant, put it into the correct
header files. Instead of reimplementing it just use memdup we already
have.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/ubifs/ubifs.c       | 17 -----------------
 fs/ubifs/ubifs.h       |  2 --
 include/linux/string.h |  7 +++++++
 include/string.h       |  1 -
 4 files changed, 7 insertions(+), 20 deletions(-)

diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index f9b4f4babc..97cbe4991f 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -86,23 +86,6 @@ struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
 #ifdef __BAREBOX__
 /* from mm/util.c */
 
-/**
- * kmemdup - duplicate region of memory
- *
- * @src: memory region to duplicate
- * @len: memory region length
- * @gfp: GFP mask to use
- */
-void *kmemdup(const void *src, size_t len, gfp_t gfp)
-{
-	void *p;
-
-	p = kmalloc(len, gfp);
-	if (p)
-		memcpy(p, src, len);
-	return p;
-}
-
 struct crypto_comp {
 	int compressor;
 };
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 19af05ade3..d4df668ca6 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -71,8 +71,6 @@ struct page {
 	struct inode *inode;
 };
 
-void *kmemdup(const void *src, size_t len, gfp_t gfp);
-
 /* uapi/linux/limits.h */
 #define XATTR_LIST_MAX 65536	/* size of extended attribute namelist (64k) */
 
diff --git a/include/linux/string.h b/include/linux/string.h
index ed4eeb5519..3418b4fbe4 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -115,4 +115,11 @@ void *memchr_inv(const void *start, int c, size_t bytes);
 }
 #endif
 
+void *memdup(const void *, size_t);
+
+static inline void *kmemdup(const void *src, size_t len, gfp_t gfp)
+{
+	return memdup(src, len);
+}
+
 #endif /* _LINUX_STRING_H_ */
diff --git a/include/string.h b/include/string.h
index 6ceb33224e..8c63f22491 100644
--- a/include/string.h
+++ b/include/string.h
@@ -3,7 +3,6 @@
 
 #include <linux/string.h>
 
-void *memdup(const void *, size_t);
 int strtobool(const char *str, int *val);
 
 void *__default_memset(void *, int, __kernel_size_t);
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-10-02 14:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 14:03 [PATCH 00/14] UBIFS update Sascha Hauer
2018-10-02 14:03 ` [PATCH 01/14] Add linux/slab.h Sascha Hauer
2018-10-02 14:03 ` Sascha Hauer [this message]
2018-10-02 14:03 ` [PATCH 03/14] Add more mutex no-ops Sascha Hauer
2018-10-02 14:03 ` [PATCH 04/14] fs: let dir_emit_dots return int Sascha Hauer
2018-10-02 14:03 ` [PATCH 05/14] fs: Add fscrypt no-op headers Sascha Hauer
2018-10-02 14:03 ` [PATCH 06/14] fs: Add SB_* flags Sascha Hauer
2018-10-02 14:03 ` [PATCH 07/14] fs: implement file_inode Sascha Hauer
2018-10-02 14:03 ` [PATCH 08/14] fs: implement iget_locked and iget_failed Sascha Hauer
2018-10-02 14:03 ` [PATCH 09/14] fs: implement clear_nlink and set_nlink Sascha Hauer
2018-10-02 14:03 ` [PATCH 10/14] fs: ubifs: remove not needed code Sascha Hauer
2018-10-02 14:04 ` [PATCH 11/14] compiler: Update to v4.19-rc6 Sascha Hauer
2018-10-02 14:04 ` [PATCH 12/14] vsprintf: implement %pV Sascha Hauer
2018-10-02 14:04 ` [PATCH 13/14] ubifs: Update to v4.18-rc6 Sascha Hauer
2018-10-02 14:04 ` [PATCH 14/14] fs: ubifs: optionally allow to mount UBIFS images with encrypted files Sascha Hauer
2018-10-03 20:50 ` [PATCH 00/14] UBIFS update Sam Ravnborg
2018-10-08  7:36   ` Sascha Hauer
2018-10-09 15:19     ` Sam Ravnborg

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=20181002140403.3735-3-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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