]> git.proxmox.com Git - mirror_zfs.git/blobdiff - lib/libspl/include/umem.h
Remove KMC_NOMAGAZINE
[mirror_zfs.git] / lib / libspl / include / umem.h
index a89cb4950db2133c6c72d04613d73e7d6739eb2f..65f12595e64ffc883f4cca68359b720fb68fc289 100644 (file)
  *
  * https://labs.omniti.com/trac/portableumem
  */
+#include <sys/debug.h>
 
 #include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
 
 #ifdef  __cplusplus
 extern "C" {
@@ -55,10 +57,7 @@ typedef void vmem_t;
 /*
  * Flags for umem_cache_create()
  */
-#define        UMC_NOTOUCH             0x00010000
 #define        UMC_NODEBUG             0x00020000
-#define        UMC_NOMAGAZINE          0x00040000
-#define        UMC_NOHASH              0x00080000
 
 #define        UMEM_CACHE_NAMELEN      31
 
@@ -79,6 +78,11 @@ typedef struct umem_cache {
        int                     cache_cflags;
 } umem_cache_t;
 
+/* Prototypes for functions to provide defaults for umem envvars */
+const char *_umem_debug_init(void);
+const char *_umem_options_init(void);
+const char *_umem_logging_init(void);
+
 static inline void *
 umem_alloc(size_t size, int flags)
 {
@@ -125,13 +129,14 @@ umem_zalloc(size_t size, int flags)
 }
 
 static inline void
-umem_free(void *ptr, size_t size)
+umem_free(void *ptr, size_t size __maybe_unused)
 {
        free(ptr);
 }
 
 static inline void
-umem_nofail_callback(umem_nofail_callback_t *cb) {}
+umem_nofail_callback(umem_nofail_callback_t *cb __maybe_unused)
+{}
 
 static inline umem_cache_t *
 umem_cache_create(
@@ -143,9 +148,9 @@ umem_cache_create(
 {
        umem_cache_t *cp;
 
-       cp = umem_alloc(sizeof (umem_cache_t), UMEM_DEFAULT);
+       cp = (umem_cache_t *)umem_alloc(sizeof (umem_cache_t), UMEM_DEFAULT);
        if (cp) {
-               strncpy(cp->cache_name, name, UMEM_CACHE_NAMELEN);
+               strlcpy(cp->cache_name, name, UMEM_CACHE_NAMELEN);
                cp->cache_bufsize = bufsize;
                cp->cache_align = align;
                cp->cache_constructor = constructor;
@@ -192,7 +197,7 @@ umem_cache_free(umem_cache_t *cp, void *ptr)
 }
 
 static inline void
-umem_cache_reap_now(umem_cache_t *cp)
+umem_cache_reap_now(umem_cache_t *cp __maybe_unused)
 {
 }