[PATCH 02/14] Add kmemdup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux