]> git.proxmox.com Git - librados2-perl.git/blobdiff - RADOS.xs
Split method pve_rados_connect
[librados2-perl.git] / RADOS.xs
index 66fa65a50222ee54560b274dbb801a9fb8c62921..ad3cf96b1f6417a9d67506385c44bd290cdc304b 100644 (file)
--- a/RADOS.xs
+++ b/RADOS.xs
@@ -47,19 +47,35 @@ CODE:
 }
 
 void
-pve_rados_connect(cluster)
+pve_rados_conf_read_file(cluster, path)
 rados_t cluster
-PROTOTYPE: $
+SV *path
+PROTOTYPE: $$
 CODE:
 {
-    DPRINTF("pve_rados_connect\n");
+    char *p = NULL;
 
-    int res = rados_conf_read_file(cluster, NULL);
+    if (SvOK(path)) {
+       p = SvPV_nolen(path);
+    }
+
+    DPRINTF("pve_rados_conf_read_file %s\n", p);
+
+    int res = rados_conf_read_file(cluster, p);
     if (res < 0) {
         die("rados_conf_read_file failed - %s\n", strerror(-res));
     }
+}
+
+void
+pve_rados_connect(cluster)
+rados_t cluster
+PROTOTYPE: $
+CODE:
+{
+    DPRINTF("pve_rados_connect\n");
 
-    res = rados_connect(cluster);
+    int res = rados_connect(cluster);
     if (res < 0) {
         die("rados_connect failed - %s\n", strerror(-res));
     }