diff options
| -rw-r--r-- | libglusterfs/src/globals.c | 59 | ||||
| -rw-r--r-- | libglusterfs/src/globals.h | 5 | 
2 files changed, 64 insertions, 0 deletions
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index 38727a25afe..ae7fdcd616a 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -149,6 +149,61 @@ glusterfs_this_set (xlator_t *this)  } +/* IS_CENTRAL_LOG */ + +static pthread_key_t central_log_flag_key; + +void +glusterfs_central_log_flag_destroy (void *ptr) +{ +        if (ptr) +                FREE (ptr); +} + + +int +glusterfs_central_log_flag_init () +{ +        int ret = 0; + +        ret = pthread_key_create (¢ral_log_flag_key,  +                                  glusterfs_central_log_flag_destroy); + +        if (ret != 0) { +                return ret; +        } + +        pthread_setspecific (central_log_flag_key, (void *) 0); + +        return ret; +} + + +void +glusterfs_central_log_flag_set () +{ +        pthread_setspecific (central_log_flag_key, (void *) 1); +} + + +long +glusterfs_central_log_flag_get () +{ +        long flag = 0; + +        flag = (long) pthread_getspecific (central_log_flag_key); +         +        return flag; +} + + +void +glusterfs_central_log_flag_unset () +{ +        pthread_setspecific (central_log_flag_key, (void *) 0); +} + +  int  glusterfs_globals_init ()  { @@ -161,6 +216,10 @@ glusterfs_globals_init ()          ret = glusterfs_this_init ();          if (ret)                  goto out; + +        ret = glusterfs_central_log_flag_init (); +        if (ret) +                goto out;  out:          return ret;  } diff --git a/libglusterfs/src/globals.h b/libglusterfs/src/globals.h index f4d252dd9b5..2f284ca9b14 100644 --- a/libglusterfs/src/globals.h +++ b/libglusterfs/src/globals.h @@ -35,6 +35,11 @@ xlator_t **__glusterfs_this_location ();  xlator_t *glusterfs_this_get ();  int glusterfs_this_set (xlator_t *); +void glusterfs_central_log_flag_set (); +long glusterfs_central_log_flag_get (); +void glusterfs_central_log_flag_unset (); + +  /* init */  int glusterfs_globals_init (void);  | 
