diff options
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/xlator.c | 22 | ||||
-rw-r--r-- | libglusterfs/src/xlator.h | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 6db27e9a4c4..b42bc3bcc83 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -344,6 +344,28 @@ out: return search; } +xlator_t * +xlator_search_by_xl_type (xlator_t *any, const char *type) +{ + xlator_t *search = NULL; + + GF_VALIDATE_OR_GOTO ("xlator", any, out); + GF_VALIDATE_OR_GOTO ("xlator", type, out); + + search = any; + + while (search->prev) + search = search->prev; + + while (search) { + if (!strcmp (search->type, type)) + break; + search = search->next; + } + +out: + return search; +} static int __xlator_init(xlator_t *xl) diff --git a/libglusterfs/src/xlator.h b/libglusterfs/src/xlator.h index ec58dc170f1..1e21b63c55d 100644 --- a/libglusterfs/src/xlator.h +++ b/libglusterfs/src/xlator.h @@ -865,6 +865,7 @@ void xlator_foreach (xlator_t *this, void *data); xlator_t *xlator_search_by_name (xlator_t *any, const char *name); +xlator_t *xlator_search_by_xl_type (xlator_t *any, const char *type); void inode_destroy_notify (inode_t *inode, const char *xlname); |