Avati
On Tue, Jul 17, 2012 at 11:06 PM, Bharata B Rao <bharata.rao@xxxxxxxxx> wrote:
Hi Avati,
In QEMU, this is how I am planning to use libgfapi to set the GlusterFS backend.
struct glfs *glfs;
int ret = 0;
glfs = glfs_new(volname);
if (!glfs) {
ret = -errno;
goto out_glfs_new_failed;
}
ret = glfs_set_volfile_server(glfs, "socket", server, port);
if (ret < 0) {
ret = -errno;
goto out_set_volfile_failed;
}
/* optional */
ret = glfs_set_logging(glfs, logfile, loglevel);
if (ret < 0) {
ret = -errno;
goto out_set_logging_failed;
}
ret = glfs_init(glfs);
if (ret < 0) {
ret = -errno;
goto out_glfs_init_failed;
}
return ret;
out_glfs_init_failed:
glfs_unset_logging(glfs, ...);
out_set_logging_failed:
glfs_unset_volfile_server(glfs, ...);
out_set_volfile_failed:
glfs_free(glfs);
out_glfs_new_failed:
return ret;
I see only glfs_fini() in libgfapi currently. I see that all of the
APIs I am using above at least allocate memory which needs to be freed
up at the end or during failure. Are such cleanup routines already
present in libgfapi that could use ? If not, can you please provide
the clean up routines for the above mentioned 4 APIs that QEMU would
be using ?
Regards,
Bharata.
--
http://bharata.sulekha.com/blog/posts.htm, http://raobharata.wordpress.com/