Fix: build failure on 2.6.36
authorMichael Jeanson <mjeanson@efficios.com>
Mon, 31 Aug 2015 13:57:18 +0000 (09:57 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 31 Aug 2015 15:27:31 +0000 (11:27 -0400)
Fixes build failure on the 2.6.36 kernel branch which misses the
vzalloc() function.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-events.c
wrapper/vzalloc.h [new file with mode: 0644]

index d8cf337de93bf75d92b81754a7325fc0e2d0d1ee..d02f4dff0596934ad256c92fe45c01fa3edf5b8c 100644 (file)
@@ -44,6 +44,7 @@
 #include "lttng-events.h"
 #include "lttng-tracer.h"
 #include "lttng-abi-old.h"
+#include "wrapper/vzalloc.h"
 
 #define METADATA_CACHE_DEFAULT_SIZE 4096
 
@@ -98,7 +99,7 @@ struct lttng_session *lttng_session_create(void)
                        GFP_KERNEL);
        if (!metadata_cache)
                goto err_free_session;
-       metadata_cache->data = vzalloc(METADATA_CACHE_DEFAULT_SIZE);
+       metadata_cache->data = lttng_vzalloc(METADATA_CACHE_DEFAULT_SIZE);
        if (!metadata_cache->data)
                goto err_free_cache;
        metadata_cache->cache_alloc = METADATA_CACHE_DEFAULT_SIZE;
@@ -688,7 +689,7 @@ int lttng_metadata_printf(struct lttng_session *session,
                tmp_cache_alloc_size = max_t(unsigned int,
                                session->metadata_cache->cache_alloc + len,
                                session->metadata_cache->cache_alloc << 1);
-               tmp_cache_realloc = vzalloc(tmp_cache_alloc_size);
+               tmp_cache_realloc = lttng_vzalloc(tmp_cache_alloc_size);
                if (!tmp_cache_realloc)
                        goto err;
                if (session->metadata_cache->data) {
diff --git a/wrapper/vzalloc.h b/wrapper/vzalloc.h
new file mode 100644 (file)
index 0000000..c052778
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef _LTTNG_WRAPPER_VZALLOC_H
+#define _LTTNG_WRAPPER_VZALLOC_H
+
+/*
+ * wrapper/vzalloc.h
+ *
+ * Copyright (C) 2015 Michael Jeanson <mjeanson@efficios.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; only
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <linux/version.h>
+#include <linux/vmalloc.h>
+
+#if LTTNG_KERNEL_RANGE(2,6,36, 2,6,37)
+static inline
+void *lttng_vzalloc(unsigned long size)
+{
+       void *ret;
+       ret = vmalloc(size);
+       if (!ret)
+               return NULL;
+       memset(ret, 0, size);
+       return ret;
+}
+#else
+static inline
+void *lttng_vzalloc(unsigned long size)
+{
+       return vzalloc(size);
+}
+#endif
+
+
+#endif /* _LTTNG_WRAPPER_VZALLOC_H */
This page took 0.029073 seconds and 4 git commands to generate.