summaryrefslogtreecommitdiffstats
path: root/api/src/glfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/glfs.c')
-rw-r--r--api/src/glfs.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index bcabb29f857..c7c4c00450a 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -554,6 +554,43 @@ glfs_new (const char *volname)
}
+struct glfs *
+glfs_new_from_ctx (glusterfs_ctx_t *ctx)
+{
+ struct glfs *fs = NULL;
+
+ if (!ctx)
+ return NULL;
+
+ fs = GF_CALLOC (1, sizeof (*fs), glfs_mt_glfs_t);
+ if (!fs)
+ return NULL;
+ fs->ctx = ctx;
+
+ (void) pthread_cond_init (&fs->cond, NULL);
+
+ (void) pthread_mutex_init (&fs->mutex, NULL);
+
+ INIT_LIST_HEAD (&fs->openfds);
+
+ return fs;
+}
+
+
+void
+glfs_free_from_ctx (struct glfs *fs)
+{
+ if (!fs)
+ return;
+
+ (void) pthread_cond_destroy (&fs->cond);
+
+ (void) pthread_mutex_destroy (&fs->mutex);
+
+ GF_FREE (fs);
+}
+
+
int
glfs_set_volfile (struct glfs *fs, const char *volfile)
{