summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/statedump.c4
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-algorithm.h2
-rw-r--r--xlators/features/trash/src/trash.c14
-rw-r--r--xlators/performance/io-cache/src/io-cache.c13
-rw-r--r--xlators/performance/io-cache/src/ioc-inode.c12
5 files changed, 24 insertions, 21 deletions
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index 51933a69607..7f1e3e24196 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -18,13 +18,15 @@
*/
#include <stdarg.h>
-#include <malloc.h>
#include "glusterfs.h"
#include "logging.h"
#include "iobuf.h"
#include "statedump.h"
#include "stack.h"
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif /* MALLOC_H */
static pthread_mutex_t gf_proc_dump_mutex;
static int gf_dump_fd = -1;
diff --git a/xlators/cluster/afr/src/afr-self-heal-algorithm.h b/xlators/cluster/afr/src/afr-self-heal-algorithm.h
index 9995ee20bd3..7ef324477e1 100644
--- a/xlators/cluster/afr/src/afr-self-heal-algorithm.h
+++ b/xlators/cluster/afr/src/afr-self-heal-algorithm.h
@@ -29,7 +29,7 @@ struct afr_sh_algorithm {
afr_sh_algo_fn fn;
};
-struct afr_sh_algorithm afr_self_heal_algorithms[3];
+extern struct afr_sh_algorithm afr_self_heal_algorithms[3];
typedef struct {
gf_lock_t lock;
diff --git a/xlators/features/trash/src/trash.c b/xlators/features/trash/src/trash.c
index 378c579b921..aa5cea0d156 100644
--- a/xlators/features/trash/src/trash.c
+++ b/xlators/features/trash/src/trash.c
@@ -111,7 +111,7 @@ trash_unlink_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
- tmp_path = strndup (local->newpath, count);
+ tmp_path = memdup (local->newpath, count);
if (!tmp_path) {
gf_log (this->name, GF_LOG_DEBUG, "out of memory");
}
@@ -154,7 +154,7 @@ trash_unlink_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
- tmp_path = strndup (local->newpath, count);
+ tmp_path = memdup (local->newpath, count);
if (!tmp_path) {
gf_log (this->name, GF_LOG_DEBUG, "out of memory");
}
@@ -410,7 +410,7 @@ trash_rename_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
tmp_dirname = strchr (tmp_str + count + 1, '/');
- tmp_path = strndup (local->newpath, count);
+ tmp_path = memdup (local->newpath, count);
if (!tmp_path) {
gf_log (this->name, GF_LOG_DEBUG, "out of memory");
}
@@ -866,7 +866,7 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
- tmp_path = strndup (local->newpath, count);
+ tmp_path = memdup (local->newpath, count);
if (!tmp_path) {
gf_log (this->name, GF_LOG_DEBUG, "out of memory");
}
@@ -909,7 +909,7 @@ trash_truncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
- tmp_path = strndup (local->newpath, count);
+ tmp_path = memdup (local->newpath, count);
if (!tmp_path) {
gf_log (this->name, GF_LOG_DEBUG, "out of memory");
}
@@ -1227,7 +1227,7 @@ trash_ftruncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
- tmp_path = strndup (local->newpath, count);
+ tmp_path = memdup (local->newpath, count);
if (!tmp_path) {
gf_log (this->name, GF_LOG_DEBUG, "out of memory");
}
@@ -1271,7 +1271,7 @@ trash_ftruncate_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
break;
tmp_dirname = strchr (tmp_str + count + 1, '/');
}
- tmp_path = strndup (local->newpath, count);
+ tmp_path = memdup (local->newpath, count);
if (!tmp_path) {
gf_log (this->name, GF_LOG_DEBUG, "out of memory");
}
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 13811b628b1..60dda3e35a4 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -30,7 +30,7 @@
#include <assert.h>
#include <sys/time.h>
-extern int ioc_log2_page_size;
+int ioc_log2_page_size;
uint32_t
ioc_get_priority (ioc_table_t *table, const char *path);
@@ -38,6 +38,17 @@ ioc_get_priority (ioc_table_t *table, const char *path);
uint32_t
ioc_get_priority (ioc_table_t *table, const char *path);
+
+inline uint32_t
+ioc_hashfn (void *data, int len)
+{
+ off_t offset;
+
+ offset = *(off_t *) data;
+
+ return (offset >> ioc_log2_page_size);
+}
+
inline ioc_inode_t *
ioc_inode_reupdate (ioc_inode_t *ioc_inode)
{
diff --git a/xlators/performance/io-cache/src/ioc-inode.c b/xlators/performance/io-cache/src/ioc-inode.c
index 9ac5469f5e3..74c657fe7c3 100644
--- a/xlators/performance/io-cache/src/ioc-inode.c
+++ b/xlators/performance/io-cache/src/ioc-inode.c
@@ -24,17 +24,7 @@
#include "io-cache.h"
-int ioc_log2_page_size;
-
-inline uint32_t
-ioc_hashfn (void *data, int len)
-{
- off_t offset;
-
- offset = *(off_t *) data;
-
- return (offset >> ioc_log2_page_size);
-}
+extern int ioc_log2_page_size;
/*
* str_to_ptr - convert a string to pointer