From f50e5eb7777ee31701f5d757ffa8de2c238b5e50 Mon Sep 17 00:00:00 2001 From: Gaurav Date: Mon, 20 Jun 2011 07:59:27 +0000 Subject: Glusterd: IPV6 support for glusterfs. Signed-off-by: Gaurav Signed-off-by: Anand Avati BUG: 2456 (IPv6 support for glusterd) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2456 --- libglusterfs/src/common-utils.c | 39 +++++++++++++++++++++++++++++++++++++++ libglusterfs/src/common-utils.h | 3 +++ 2 files changed, 42 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 758868343..295435af7 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1785,3 +1785,42 @@ out: return flag; } +int +validate_brick_name (char *brick) +{ + char *delimiter = NULL; + int ret = 0; + delimiter = strrchr (brick, ':'); + if (!delimiter || delimiter == brick + || *(delimiter+1) != '/') { + ret = -1; + } + return ret; +} + +char * +get_host_name (char *word, char **host) +{ + char *delimiter = NULL; + delimiter = strrchr (word, ':'); + if (delimiter) + *delimiter = '\0'; + else + return NULL; + *host = word; + return *host; +} + + +char * +get_path_name (char *word, char **path) +{ + char *delimiter = NULL; + delimiter = strchr (word, '/'); + if (!delimiter) + return NULL; + *path = delimiter; + return *path; +} + + diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index e42945bf0..9afa28058 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -369,4 +369,7 @@ void gf_array_insertionsort (void *a, int l, int r, size_t elem_size, int gf_is_str_int (const char *value); char *gf_uint64_2human_readable (uint64_t); +int validate_brick_name (char *brick); +char *get_host_name (char *word, char **host); +char *get_path_name (char *word, char **path); #endif /* _COMMON_UTILS_H */ -- cgit