summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/common-utils.c
diff options
context:
space:
mode:
authorGaurav <gaurav@gluster.com>2011-06-20 07:59:27 +0000
committerAnand Avati <avati@gluster.com>2011-07-14 01:31:36 -0700
commitf50e5eb7777ee31701f5d757ffa8de2c238b5e50 (patch)
tree1f3ada733a58f0bdc462f11ca09a5a8ba34f7d37 /libglusterfs/src/common-utils.c
parentded0a9a2a0a9024def7a4b199ac3bbfa5d66485a (diff)
Glusterd: IPV6 support for glusterfs.
Signed-off-by: Gaurav <gaurav@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2456 (IPv6 support for glusterd) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2456
Diffstat (limited to 'libglusterfs/src/common-utils.c')
-rw-r--r--libglusterfs/src/common-utils.c39
1 files changed, 39 insertions, 0 deletions
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;
+}
+
+