|
@@ -723,6 +723,72 @@ void memzero_explicit(void *s, size_t count)
|
|
|
}
|
|
|
EXPORT_SYMBOL(memzero_explicit);
|
|
|
|
|
|
+#ifndef __HAVE_ARCH_MEMSET16
|
|
|
+/**
|
|
|
+ * memset16() - Fill a memory area with a uint16_t
|
|
|
+ * @s: Pointer to the start of the area.
|
|
|
+ * @v: The value to fill the area with
|
|
|
+ * @count: The number of values to store
|
|
|
+ *
|
|
|
+ * Differs from memset() in that it fills with a uint16_t instead
|
|
|
+ * of a byte. Remember that @count is the number of uint16_ts to
|
|
|
+ * store, not the number of bytes.
|
|
|
+ */
|
|
|
+void *memset16(uint16_t *s, uint16_t v, size_t count)
|
|
|
+{
|
|
|
+ uint16_t *xs = s;
|
|
|
+
|
|
|
+ while (count--)
|
|
|
+ *xs++ = v;
|
|
|
+ return s;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(memset16);
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifndef __HAVE_ARCH_MEMSET32
|
|
|
+/**
|
|
|
+ * memset32() - Fill a memory area with a uint32_t
|
|
|
+ * @s: Pointer to the start of the area.
|
|
|
+ * @v: The value to fill the area with
|
|
|
+ * @count: The number of values to store
|
|
|
+ *
|
|
|
+ * Differs from memset() in that it fills with a uint32_t instead
|
|
|
+ * of a byte. Remember that @count is the number of uint32_ts to
|
|
|
+ * store, not the number of bytes.
|
|
|
+ */
|
|
|
+void *memset32(uint32_t *s, uint32_t v, size_t count)
|
|
|
+{
|
|
|
+ uint32_t *xs = s;
|
|
|
+
|
|
|
+ while (count--)
|
|
|
+ *xs++ = v;
|
|
|
+ return s;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(memset32);
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifndef __HAVE_ARCH_MEMSET64
|
|
|
+/**
|
|
|
+ * memset64() - Fill a memory area with a uint64_t
|
|
|
+ * @s: Pointer to the start of the area.
|
|
|
+ * @v: The value to fill the area with
|
|
|
+ * @count: The number of values to store
|
|
|
+ *
|
|
|
+ * Differs from memset() in that it fills with a uint64_t instead
|
|
|
+ * of a byte. Remember that @count is the number of uint64_ts to
|
|
|
+ * store, not the number of bytes.
|
|
|
+ */
|
|
|
+void *memset64(uint64_t *s, uint64_t v, size_t count)
|
|
|
+{
|
|
|
+ uint64_t *xs = s;
|
|
|
+
|
|
|
+ while (count--)
|
|
|
+ *xs++ = v;
|
|
|
+ return s;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(memset64);
|
|
|
+#endif
|
|
|
+
|
|
|
#ifndef __HAVE_ARCH_MEMCPY
|
|
|
/**
|
|
|
* memcpy - Copy one area of memory to another
|