From 22282b4fb82b83621c15773c4c44ff3d28a82e3c Mon Sep 17 00:00:00 2001 From: Rajesh Amaravathi Date: Wed, 4 Jan 2012 13:06:29 +0530 Subject: lib/mount-broker: move utility functions to common-utils functions skipwhite and nwstrtail have been moved from mount-broker to common-utils library for general use. Change-Id: I9cfefb28bbfcf5d0bd37e35865ff3f3b7923fc53 BUG: 765464 Signed-off-by: Rajesh Amaravathi Reviewed-on: http://review.gluster.com/2560 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur Reviewed-by: Csaba Henk --- libglusterfs/src/common-utils.c | 24 +++++++++++++++++++++ libglusterfs/src/common-utils.h | 2 ++ xlators/mgmt/glusterd/src/glusterd-mountbroker.c | 27 +----------------------- 3 files changed, 27 insertions(+), 26 deletions(-) diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 6a5e2504b..1d0fb822f 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -1583,6 +1583,30 @@ strtail (char *str, const char *pattern) return NULL; } +void +skipwhite (char **s) +{ + while (isspace (**s)) + (*s)++; +} + +char * +nwstrtail (char *str, char *pattern) +{ + for (;;) { + skipwhite (&str); + skipwhite (&pattern); + + if (*str != *pattern || !*str) + break; + + str++; + pattern++; + } + + return *pattern ? NULL : str; +} + /* RFC 1123 & 952 */ char valid_host_name (char *address, int length) diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index a253e6751..4cb3843d9 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -407,6 +407,8 @@ int log_base2 (unsigned long x); int get_checksum_for_path (char *path, uint32_t *checksum); char *strtail (char *str, const char *pattern); +void skipwhite (char **s); +char *nwstrtail (char *str, char *pattern); char valid_host_name (char *address, int length); char valid_ipv4_address (char *address, int length); diff --git a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c index b00145f8c..32adf4ddd 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mountbroker.c +++ b/xlators/mgmt/glusterd/src/glusterd-mountbroker.c @@ -38,7 +38,7 @@ #include "glusterd-mem-types.h" #include "glusterd.h" #include "glusterd-utils.h" - +#include "common-utils.h" #include "glusterd-mountbroker.h" #include "glusterd-op-sm.h" @@ -63,31 +63,6 @@ seq_dict_foreach (dict_t *dict, } } -static void -skipwhite (char **s) -{ - while (isspace (**s)) - (*s)++; -} - -static char * -nwstrtail (char *str, char *pattern) -{ - for (;;) { - skipwhite (&str); - skipwhite (&pattern); - - if (*str != *pattern || !*str) - break; - - str++; - pattern++; - } - - return *pattern ? NULL : str; -} - - int parse_mount_pattern_desc (gf_mount_spec_t *mspec, char *pdesc) #define SYNTAX_ERR -2 -- cgit