summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/globals.c')
-rw-r--r--libglusterfs/src/globals.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c
index 979f84e3296..3121a1f1415 100644
--- a/libglusterfs/src/globals.c
+++ b/libglusterfs/src/globals.c
@@ -305,6 +305,42 @@ synctask_set (void *synctask)
return ret;
}
+//UUID_BUFFER
+
+static pthread_key_t uuid_buf_key;
+static char global_uuid_buf[GF_UUID_BUF_SIZE];
+void
+glusterfs_uuid_buf_destroy (void *ptr)
+{
+ if (ptr)
+ FREE (ptr);
+}
+
+int
+glusterfs_uuid_buf_init ()
+{
+ int ret = 0;
+
+ ret = pthread_key_create (&uuid_buf_key,
+ glusterfs_uuid_buf_destroy);
+ return ret;
+}
+
+char *
+glusterfs_uuid_buf_get ()
+{
+ char *buf;
+ int ret = 0;
+
+ buf = pthread_getspecific (uuid_buf_key);
+ if(!buf) {
+ buf = MALLOC (GF_UUID_BUF_SIZE);
+ ret = pthread_setspecific (uuid_buf_key, (void *) buf);
+ if(ret)
+ buf = global_uuid_buf;
+ }
+ return buf;
+}
int
glusterfs_globals_init ()
@@ -325,6 +361,10 @@ glusterfs_globals_init ()
if (ret)
goto out;
+ ret = glusterfs_uuid_buf_init ();
+ if(ret)
+ goto out;
+
gf_mem_acct_enable_set ();
ret = synctask_init ();