]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Remove conn parameter from util functions
authorMatthias Bolte <matthias.bolte@googlemail.com>
Thu, 4 Feb 2010 22:41:52 +0000 (23:41 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 9 Feb 2010 00:04:54 +0000 (01:04 +0100)
It was used for error reporting only.

35 files changed:
daemon/libvirtd.c
daemon/remote.c
docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
src/lxc/lxc_driver.c
src/lxc/veth.c
src/network/bridge_driver.c
src/node_device/node_device_driver.c
src/openvz/openvz_conf.c
src/openvz/openvz_driver.c
src/phyp/phyp_driver.c
src/qemu/qemu_conf.c
src/qemu/qemu_driver.c
src/remote/remote_driver.c
src/secret/secret_driver.c
src/security/security_apparmor.c
src/security/virt-aa-helper.c
src/storage/storage_backend.c
src/storage/storage_backend_disk.c
src/storage/storage_backend_fs.c
src/storage/storage_backend_iscsi.c
src/storage/storage_backend_logical.c
src/storage/storage_backend_mpath.c
src/storage/storage_backend_scsi.c
src/storage/storage_backend_scsi.h
src/storage/storage_driver.c
src/uml/uml_driver.c
src/util/bridge.c
src/util/cgroup.c
src/util/ebtables.c
src/util/iptables.c
src/util/pci.c
src/util/util.c
src/util/util.h
src/xen/proxy_internal.c
tools/virsh.c

index 1c7e791fdf0ea7b7508c7657fa0a23fcb4d49e6b..fefa7aa01f774b3c8a8887856ba0d59d16b2abf6 100644 (file)
@@ -755,7 +755,7 @@ static int qemudInitPaths(struct qemud_server *server,
                 goto snprintf_error;
         } else {
             uid_t uid = geteuid();
-            dir_prefix = virGetUserDirectory(NULL, uid);
+            dir_prefix = virGetUserDirectory(uid);
             if (dir_prefix == NULL) {
                 /* Do not diagnose here; virGetUserDirectory does that.  */
                 goto snprintf_error;
index 132e578c028a7b3af4d548b1b587f056f936ed22..ba3c6708ab58cf29c364fd35a3b99650b337f156 100644 (file)
@@ -3423,7 +3423,7 @@ remoteDispatchAuthPolkit (struct qemud_server *server,
         goto authfail;
     }
 
-    if (virRun(NULL, pkcheck, &status) < 0) {
+    if (virRun(pkcheck, &status) < 0) {
         VIR_ERROR(_("Cannot invoke %s"), PKCHECK_PATH);
         goto authfail;
     }
index 09ddc65ef5bd7c55720a4d6ed711bfdcd2c3c021..807ed78d8fb42825aba56014631752f554fa0d8e 100644 (file)
@@ -478,7 +478,7 @@ index b84729f..4f73baf 100644
 +     * If this fails for any reason, we still have the backup of polling for
 +     * 5 seconds for device nodes.
 +     */
-+    virRun(conn, settleprog, &exitstatus);
++    virRun(settleprog, &exitstatus);
 +}
 +#else
 +void virNodeDeviceWaitForDevices(virConnectPtr conn ATTRIBUTE_UNUSED) {}
@@ -1131,7 +1131,7 @@ index b154140..74759cf 100644
 -     * If this fails for any reason, we still have the backup of polling for
 -     * 5 seconds for device nodes.
 -     */
--    virRun(conn, settleprog, &exitstatus);
+-    virRun(settleprog, &exitstatus);
 +    virNodeDeviceWaitForDevices(conn);
 +    return;
  }
index 923aa038916c7b017d5905decbffec74fcf80a63..1e728488bc15dca9c3a701b782754c6a867d0d8f 100644 (file)
@@ -1120,7 +1120,7 @@ static int lxcControllerStart(virConnectPtr conn,
 
     FD_SET(appPty, &keepfd);
 
-    if (virExec(conn, largv, lenv, &keepfd, &child,
+    if (virExec(largv, lenv, &keepfd, &child,
                 -1, &logfd, &logfd,
                 VIR_EXEC_NONE) < 0)
         goto cleanup;
@@ -1575,7 +1575,7 @@ static int lxcCheckNetNsSupport(void)
     const char *argv[] = {"ip", "link", "set", "lo", "netns", "-1", NULL};
     int ip_rc;
 
-    if (virRun(NULL, argv, &ip_rc) < 0 ||
+    if (virRun(argv, &ip_rc) < 0 ||
         !(WIFEXITED(ip_rc) && (WEXITSTATUS(ip_rc) != 255)))
         return 0;
 
index ede85cee177e4191e4748fad3bdc4b40c397f29c..34f7faa07aff1b94593f5190c8d93e93205439c4 100644 (file)
@@ -102,7 +102,7 @@ int vethCreate(char* veth1, int veth1MaxLen,
     }
 
     DEBUG("veth1: %s veth2: %s", veth1, veth2);
-    rc = virRun(NULL, argv, &cmdResult);
+    rc = virRun(argv, &cmdResult);
 
     if (0 == rc) {
        rc = cmdResult;
@@ -135,7 +135,7 @@ int vethDelete(const char *veth)
 
     DEBUG("veth: %s", veth);
 
-    rc = virRun(NULL, argv, &cmdResult);
+    rc = virRun(argv, &cmdResult);
 
     if (0 == rc) {
        rc = cmdResult;
@@ -170,7 +170,7 @@ int vethInterfaceUpOrDown(const char* veth, int upOrDown)
     else
         argv[2] = "up";
 
-    rc = virRun(NULL, argv, &cmdResult);
+    rc = virRun(argv, &cmdResult);
 
     if (0 == rc) {
        rc = cmdResult;
@@ -208,7 +208,7 @@ int moveInterfaceToNetNs(const char* iface, int pidInNs)
         goto error_out;
 
     argv[5] = pid;
-    rc = virRun(NULL, argv, &cmdResult);
+    rc = virRun(argv, &cmdResult);
     if (0 == rc)
         rc = cmdResult;
 
@@ -240,7 +240,7 @@ int setMacAddr(const char* iface, const char* macaddr)
         goto error_out;
     }
 
-    rc = virRun(NULL, argv, &cmdResult);
+    rc = virRun(argv, &cmdResult);
     if (0 == rc)
         rc = cmdResult;
 
@@ -271,7 +271,7 @@ int setInterfaceName(const char* iface, const char* new)
         goto error_out;
     }
 
-    rc = virRun(NULL, argv, &cmdResult);
+    rc = virRun(argv, &cmdResult);
     if (0 == rc)
         rc = cmdResult;
 
index 63cd53e234c1da41e49f1f41284bfd0cd8e49f53..a3c6b9c69848cb1e8e5068a342a6ae6401990b44 100644 (file)
@@ -211,7 +211,7 @@ networkStartup(int privileged) {
         if ((base = strdup (SYSCONF_DIR "/libvirt")) == NULL)
             goto out_of_memory;
     } else {
-        char *userdir = virGetUserDirectory(NULL, uid);
+        char *userdir = virGetUserDirectory(uid);
 
         if (!userdir)
             goto error;
@@ -562,7 +562,7 @@ dhcpStartDhcpDaemon(virConnectPtr conn,
         return -1;
     }
 
-    if (virRun(conn, argv, NULL) < 0)
+    if (virRun(argv, NULL) < 0)
         goto cleanup;
 
     /*
index fd96874dcc04ba5f3b74f17e9adfe70f82a381dd..ad5503bd3c8ab0e9c4573a028261f4762d9bf0d5 100644 (file)
@@ -510,7 +510,7 @@ find_new_device(virConnectPtr conn, const char *wwnn, const char *wwpn)
 
     while ((now - start) < LINUX_NEW_DEVICE_WAIT_TIME) {
 
-        virFileWaitForDevices(conn);
+        virFileWaitForDevices();
 
         dev = nodeDeviceLookupByWWN(conn, wwnn, wwpn);
 
index 6baaea2bc69a277a92dce8145f5dc27c5e8ec1c1..f4b81994666350441a5a23e0f31ca1f98492c313 100644 (file)
@@ -84,7 +84,7 @@ openvzExtractVersionInfo(const char *cmd, int *retversion)
     if (retversion)
         *retversion = 0;
 
-    if (virExec(NULL, vzarg, vzenv, NULL,
+    if (virExec(vzarg, vzenv, NULL,
                 &child, -1, &newstdout, NULL, VIR_EXEC_NONE) < 0)
         return -1;
 
index ad3ef627036278eb401a91ceb1958210431b4333..a3f0a5bc59c07df9266de063a123899c6968cab3 100644 (file)
@@ -256,7 +256,7 @@ static int openvzSetInitialConfig(virConnectPtr conn,
             goto cleanup;
         }
 
-        if (virRun(conn, prog, NULL) < 0) {
+        if (virRun(prog, NULL) < 0) {
             openvzError(conn, VIR_ERR_INTERNAL_ERROR,
                    _("Could not exec %s"), VZCTL);
             goto cleanup;
@@ -530,7 +530,7 @@ static int openvzDomainShutdown(virDomainPtr dom) {
         goto cleanup;
     }
 
-    if (virRun(dom->conn, prog, NULL) < 0)
+    if (virRun(prog, NULL) < 0)
         goto cleanup;
 
     vm->def->id = -1;
@@ -567,7 +567,7 @@ static int openvzDomainReboot(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (virRun(dom->conn, prog, NULL) < 0)
+    if (virRun(prog, NULL) < 0)
         goto cleanup;
     ret = 0;
 
@@ -727,7 +727,7 @@ openvzDomainSetNetwork(virConnectPtr conn, const char *vpsid,
 
     if (prog[0] != NULL){
         ADD_ARG_LIT("--save");
-        if (virRun(conn, prog, NULL) < 0) {
+        if (virRun(prog, NULL) < 0) {
            openvzError(conn, VIR_ERR_INTERNAL_ERROR,
                     _("Could not exec %s"), VZCTL);
            rc = -1;
@@ -929,7 +929,7 @@ openvzDomainCreateXML(virConnectPtr conn, const char *xml,
 
     openvzSetProgramSentinal(progstart, vm->def->name);
 
-    if (virRun(conn, progstart, NULL) < 0) {
+    if (virRun(progstart, NULL) < 0) {
         openvzError(conn, VIR_ERR_INTERNAL_ERROR,
                _("Could not exec %s"), VZCTL);
         goto cleanup;
@@ -984,7 +984,7 @@ openvzDomainCreate(virDomainPtr dom)
     }
 
     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(dom->conn, prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0) {
         openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
                     _("Could not exec %s"), VZCTL);
         goto cleanup;
@@ -1022,7 +1022,7 @@ openvzDomainUndefine(virDomainPtr dom)
     }
 
     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(dom->conn, prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0) {
         openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR,
                     _("Could not exec %s"), VZCTL);
         goto cleanup;
@@ -1059,7 +1059,7 @@ openvzDomainSetAutostart(virDomainPtr dom, int autostart)
     }
 
     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(dom->conn, prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0) {
         openvzError(dom->conn, VIR_ERR_INTERNAL_ERROR, _("Could not exec %s"), VZCTL);
         goto cleanup;
     }
@@ -1136,7 +1136,7 @@ static int openvzDomainSetVcpusInternal(virConnectPtr conn, virDomainObjPtr vm,
     str_vcpus[31] = '\0';
 
     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(conn, prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0) {
         openvzError(conn, VIR_ERR_INTERNAL_ERROR,
                 _("Could not exec %s"), VZCTL);
         return -1;
@@ -1301,7 +1301,7 @@ static int openvzListDomains(virConnectPtr conn, int *ids, int nids) {
     char *endptr;
     const char *cmd[] = {VZLIST, "-ovpsid", "-H" , NULL};
 
-    ret = virExec(conn, cmd, NULL, NULL,
+    ret = virExec(cmd, NULL, NULL,
                   &pid, -1, &outfd, &errfd, VIR_EXEC_NONE);
     if(ret == -1) {
         openvzError(conn, VIR_ERR_INTERNAL_ERROR,
@@ -1347,7 +1347,7 @@ static int openvzListDefinedDomains(virConnectPtr conn,
     const char *cmd[] = {VZLIST, "-ovpsid", "-H", "-S", NULL};
 
     /* the -S options lists only stopped domains */
-    ret = virExec(conn, cmd, NULL, NULL,
+    ret = virExec(cmd, NULL, NULL,
                   &pid, -1, &outfd, &errfd, VIR_EXEC_NONE);
     if(ret == -1) {
         openvzError(conn, VIR_ERR_INTERNAL_ERROR,
@@ -1447,7 +1447,7 @@ openvzDomainSetMemoryInternal(virConnectPtr conn, virDomainObjPtr vm,
     snprintf(str_mem, sizeof(str_mem), "%lu", mem * 1024);
 
     openvzSetProgramSentinal(prog, vm->def->name);
-    if (virRun(conn, prog, NULL) < 0) {
+    if (virRun(prog, NULL) < 0) {
         openvzError(conn, VIR_ERR_INTERNAL_ERROR,
                     _("Could not exec %s"), VZCTL);
         goto cleanup;
index 053249074b91e1fab988c5204ba311171202ecab..11b62274d6773322d649a8438137dc6803a7b4b3 100644 (file)
@@ -253,7 +253,7 @@ openSSHSession(virConnectPtr conn, virConnectAuthPtr auth,
     int ret;
     char *pubkey = NULL;
     char *pvtkey = NULL;
-    char *userhome = virGetUserDirectory(NULL, geteuid());
+    char *userhome = virGetUserDirectory(geteuid());
     struct stat pvt_stat, pub_stat;
 
     if (userhome == NULL)
index 3d16ed9f0276683d2c49f1401182f24db5afe7a5..257b4a48c860cff041e1f631c9bce71205bd4cab 100644 (file)
@@ -217,7 +217,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         virConfFree(conf);
         return -1;
     }
-    if (virGetUserID(NULL, user, &driver->user) < 0) {
+    if (virGetUserID(user, &driver->user) < 0) {
         VIR_FREE(user);
         virConfFree(conf);
         return -1;
@@ -232,7 +232,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         virConfFree(conf);
         return -1;
     }
-    if (virGetGroupID(NULL, group, &driver->group) < 0) {
+    if (virGetGroupID(group, &driver->group) < 0) {
         VIR_FREE(group);
         virConfFree(conf);
         return -1;
@@ -485,7 +485,7 @@ qemudProbeMachineTypes(const char *binary,
     int newstdout = -1, len;
     int ret = -1, status;
 
-    if (virExec(NULL, qemuarg, qemuenv, NULL,
+    if (virExec(qemuarg, qemuenv, NULL,
                 &child, -1, &newstdout, NULL, VIR_EXEC_CLEAR_CAPS) < 0)
         return -1;
 
@@ -719,7 +719,7 @@ qemudProbeCPUModels(const char *qemu,
         return 0;
     }
 
-    if (virExec(NULL, qemuarg, qemuenv, NULL,
+    if (virExec(qemuarg, qemuenv, NULL,
                 &child, -1, &newstdout, NULL, VIR_EXEC_CLEAR_CAPS) < 0)
         return -1;
 
@@ -1330,7 +1330,7 @@ int qemudExtractVersionInfo(const char *qemu,
     if (retversion)
         *retversion = 0;
 
-    if (virExec(NULL, qemuarg, qemuenv, NULL,
+    if (virExec(qemuarg, qemuenv, NULL,
                 &child, -1, &newstdout, NULL, VIR_EXEC_CLEAR_CAPS) < 0)
         return -1;
 
index 0ba1211446b90b9ded322bf5ba0bd3915396c6a0..e1ee25a18d080c9b4108c0aa56fe6564a14edf76 100644 (file)
@@ -1033,7 +1033,7 @@ qemudStartup(int privileged) {
             goto out_of_memory;
     } else {
         uid_t uid = geteuid();
-        char *userdir = virGetUserDirectory(NULL, uid);
+        char *userdir = virGetUserDirectory(uid);
         if (!userdir)
             goto error;
 
@@ -2691,7 +2691,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
     for (i = 0 ; i < ntapfds ; i++)
         FD_SET(tapfds[i], &keepfd);
 
-    ret = virExecDaemonize(conn, argv, progenv, &keepfd, &child,
+    ret = virExecDaemonize(argv, progenv, &keepfd, &child,
                            stdin_fd, &logfile, &logfile,
                            VIR_EXEC_NONBLOCK | VIR_EXEC_CLEAR_CAPS,
                            qemudSecurityHook, &hookData,
@@ -4556,7 +4556,7 @@ static int qemudDomainRestore(virConnectPtr conn,
             intermediate_argv[0] = prog;
             intermediatefd = fd;
             fd = -1;
-            if (virExec(conn, intermediate_argv, NULL, NULL,
+            if (virExec(intermediate_argv, NULL, NULL,
                         &intermediate_pid, intermediatefd, &fd, NULL, 0) < 0) {
                 qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  _("Failed to start decompression binary %s"),
index d44da7d999ebfac89d9f4da5ad55427a1238b421..e17db3d5204c32ede8b278a9c1bdc5f723d13459 100644 (file)
@@ -330,7 +330,7 @@ remoteForkDaemon(virConnectPtr conn)
         return -1;
     }
 
-    if (virExecDaemonize(NULL, daemonargs, NULL, NULL,
+    if (virExecDaemonize(daemonargs, NULL, NULL,
                          &pid, -1, NULL, NULL,
                          VIR_EXEC_CLEAR_CAPS,
                          NULL, NULL, NULL) < 0)
@@ -656,7 +656,7 @@ doRemoteOpen (virConnectPtr conn,
     case trans_unix: {
         if (!sockname) {
             if (flags & VIR_DRV_OPEN_REMOTE_USER) {
-                char *userdir = virGetUserDirectory(conn, getuid());
+                char *userdir = virGetUserDirectory(getuid());
 
                 if (!userdir)
                     goto failed;
@@ -793,7 +793,7 @@ doRemoteOpen (virConnectPtr conn,
             goto failed;
         }
 
-        if (virExec(conn, (const char**)cmd_argv, NULL, NULL,
+        if (virExec((const char**)cmd_argv, NULL, NULL,
                     &pid, sv[1], &(sv[1]), NULL,
                     VIR_EXEC_CLEAR_CAPS) < 0)
             goto failed;
index f4c8aef67cf4dd1508999542584f7590f7a0144d..85c7e7c8fe3c0a8f1dae01867dabef9f38b46084 100644 (file)
@@ -1003,7 +1003,7 @@ secretDriverStartup(int privileged)
             goto out_of_memory;
     } else {
         uid_t uid = geteuid();
-        char *userdir = virGetUserDirectory(NULL, uid);
+        char *userdir = virGetUserDirectory(uid);
 
         if (!userdir)
             goto error;
index b67df3f1a11376d90c24b23d96ee28f9ae145faa..2d5f9445a0c6d532ea632ae3068ebfd5e4229e6d 100644 (file)
@@ -173,19 +173,19 @@ load_profile(virConnectPtr conn, const char *profile, virDomainObjPtr vm,
         const char *const argv[] = {
             VIRT_AA_HELPER, "-c", "-u", profile, NULL
         };
-        ret = virExec(conn, argv, NULL, NULL, &child,
+        ret = virExec(argv, NULL, NULL, &child,
                       pipefd[0], NULL, NULL, VIR_EXEC_CLEAR_CAPS);
     } else if (disk && disk->src) {
         const char *const argv[] = {
             VIRT_AA_HELPER, "-r", "-u", profile, "-f", disk->src, NULL
         };
-        ret = virExec(conn, argv, NULL, NULL, &child,
+        ret = virExec(argv, NULL, NULL, &child,
                       pipefd[0], NULL, NULL, VIR_EXEC_CLEAR_CAPS);
     } else {
         const char *const argv[] = {
             VIRT_AA_HELPER, "-r", "-u", profile, NULL
         };
-        ret = virExec(conn, argv, NULL, NULL, &child,
+        ret = virExec(argv, NULL, NULL, &child,
                       pipefd[0], NULL, NULL, VIR_EXEC_CLEAR_CAPS);
     }
     if (ret < 0)
@@ -230,7 +230,7 @@ remove_profile(const char *profile)
         VIRT_AA_HELPER, "-R", "-u", profile, NULL
     };
 
-    if (virRun(NULL, argv, NULL) == 0)
+    if (virRun(argv, NULL) == 0)
         rc = 0;
 
     return rc;
index 3e7481d6960e940ba050f24953b2e53de80face3..81ba1ae24da01d94d88cb6f89d56d66af93e62f1 100644 (file)
@@ -203,7 +203,7 @@ parserCommand(const char *profile_name, const char cmd)
         const char * const argv[] = {
             "/sbin/apparmor_parser", flag, profile, NULL
         };
-        if (virRun(NULL, argv, NULL) != 0) {
+        if (virRun(argv, NULL) != 0) {
             vah_error(NULL, 0, "failed to run apparmor_parser");
             return -1;
         }
index 2e781684e7cebdfdca8cb30c072ae2dd0c4512a3..8d85de8a11976b49cb43a9b4f64566d4d73d2156 100644 (file)
@@ -509,8 +509,7 @@ static int virStorageBuildSetUIDHook(void *data) {
     return 0;
 }
 
-static int virStorageBackendCreateExecCommand(virConnectPtr conn,
-                                              virStoragePoolObjPtr pool,
+static int virStorageBackendCreateExecCommand(virStoragePoolObjPtr pool,
                                               virStorageVolDefPtr vol,
                                               const char **cmdargv) {
     struct stat st;
@@ -521,7 +520,7 @@ static int virStorageBackendCreateExecCommand(virConnectPtr conn,
     if ((pool->def->type == VIR_STORAGE_POOL_NETFS)
         && (getuid() == 0)
         && ((vol->target.perms.uid != 0) || (vol->target.perms.gid != 0))) {
-        if (virRunWithHook(conn, cmdargv,
+        if (virRunWithHook(cmdargv,
                            virStorageBuildSetUIDHook, vol, NULL) == 0) {
             /* command was successfully run, check if the file was created */
             if (stat(vol->target.path, &st) >=0)
@@ -529,7 +528,7 @@ static int virStorageBackendCreateExecCommand(virConnectPtr conn,
         }
     }
     if (!filecreated) {
-        if (virRun(conn, cmdargv, NULL) < 0) {
+        if (virRun(cmdargv, NULL) < 0) {
             virReportSystemError(errno,
                                  _("Cannot run %s to create %s"),
                                  cmdargv[0], vol->target.path);
@@ -727,7 +726,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
     /* Size in KB */
     snprintf(size, sizeof(size), "%lluK", vol->capacity/1024);
 
-    ret = virStorageBackendCreateExecCommand(conn, pool, vol, imgargv);
+    ret = virStorageBackendCreateExecCommand(pool, vol, imgargv);
     VIR_FREE(imgargv[0]);
 
     return ret;
@@ -781,7 +780,7 @@ virStorageBackendCreateQcowCreate(virConnectPtr conn,
     imgargv[2] = vol->target.path;
     imgargv[3] = NULL;
 
-    ret = virStorageBackendCreateExecCommand(conn, pool, vol, imgargv);
+    ret = virStorageBackendCreateExecCommand(pool, vol, imgargv);
     VIR_FREE(imgargv[0]);
 
     return ret;
@@ -1250,7 +1249,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
 
 
     /* Run the program and capture its output */
-    if (virExec(conn, prog, NULL, NULL,
+    if (virExec(prog, NULL, NULL,
                 &child, -1, &fd, NULL, VIR_EXEC_NONE) < 0) {
         goto cleanup;
     }
@@ -1386,7 +1385,7 @@ virStorageBackendRunProgNul(virConnectPtr conn,
         v[i] = NULL;
 
     /* Run the program and capture its output */
-    if (virExec(conn, prog, NULL, NULL,
+    if (virExec(prog, NULL, NULL,
                 &child, -1, &fd, NULL, VIR_EXEC_NONE) < 0) {
         goto cleanup;
     }
index a86c1938dd88184eda716a18f8639d393442bffa..2082841c5db6af9e7fe268c18ab8b3a5ff1bf199 100644 (file)
@@ -323,7 +323,7 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn,
     VIR_FREE(pool->def->source.devices[0].freeExtents);
     pool->def->source.devices[0].nfreeExtent = 0;
 
-    virFileWaitForDevices(conn);
+    virFileWaitForDevices();
 
     if (virStorageBackendDiskReadGeometry(conn, pool) != 0) {
         return -1;
@@ -337,7 +337,7 @@ virStorageBackendDiskRefreshPool(virConnectPtr conn,
  * Write a new partition table header
  */
 static int
-virStorageBackendDiskBuildPool(virConnectPtr conn,
+virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                virStoragePoolObjPtr pool,
                                unsigned int flags ATTRIBUTE_UNUSED)
 {
@@ -352,7 +352,7 @@ virStorageBackendDiskBuildPool(virConnectPtr conn,
         NULL,
     };
 
-    if (virRun(conn, prog, NULL) < 0)
+    if (virRun(prog, NULL) < 0)
         return -1;
 
     return 0;
@@ -577,11 +577,11 @@ virStorageBackendDiskCreateVol(virConnectPtr conn,
     snprintf(end, sizeof(end)-1, "%lluB", endOffset);
     end[sizeof(end)-1] = '\0';
 
-    if (virRun(conn, cmdargv, NULL) < 0)
+    if (virRun(cmdargv, NULL) < 0)
         return -1;
 
     /* wait for device node to show up */
-    virFileWaitForDevices(conn);
+    virFileWaitForDevices();
 
     /* Blow away free extent info, as we're about to re-populate it */
     VIR_FREE(pool->def->source.devices[0].freeExtents);
@@ -662,7 +662,7 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn,
         NULL,
     };
 
-    if (virRun(conn, prog, NULL) < 0)
+    if (virRun(prog, NULL) < 0)
         goto cleanup;
 
     rc = 0;
index f1e1371553fdcccfc6ae9cb10f0395dc4f66927b..dcc5bf9ba466076534758f88db7e5efc98a1b43c 100644 (file)
@@ -403,7 +403,7 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
         mntargv[option_index] = options;
     }
 
-    if (virRun(conn, mntargv, NULL) < 0) {
+    if (virRun(mntargv, NULL) < 0) {
         VIR_FREE(src);
         return -1;
     }
@@ -457,7 +457,7 @@ virStorageBackendFileSystemUnmount(virConnectPtr conn,
     mntargv[1] = pool->def->target.path;
     mntargv[2] = NULL;
 
-    if (virRun(conn, mntargv, NULL) < 0) {
+    if (virRun(mntargv, NULL) < 0) {
         return -1;
     }
     return 0;
index 8a93edc73c0ce8e58d3ae59566de5982e479d13a..4e2a75eaf10c73df74bc75a38d72abed9e9a1a4c 100644 (file)
@@ -182,7 +182,7 @@ virStorageBackendIQNFound(virConnectPtr conn,
 
     memset(line, 0, LINE_SIZE);
 
-    if (virExec(conn, prog, NULL, NULL, &child, -1, &fd, NULL, VIR_EXEC_NONE) < 0) {
+    if (virExec(prog, NULL, NULL, &child, -1, &fd, NULL, VIR_EXEC_NONE) < 0) {
         virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run '%s' when looking for existing interface with IQN '%s'"),
                               prog[0], pool->def->source.initiator.iqn);
@@ -279,7 +279,7 @@ virStorageBackendCreateIfaceIQN(virConnectPtr conn,
      * tools returned an exit status of > 0, even if they succeeded.
      * We will just rely on whether the interface got created
      * properly. */
-    if (virRun(conn, cmdargv1, &exitstatus) < 0) {
+    if (virRun(cmdargv1, &exitstatus) < 0) {
         virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run command '%s' to create new iscsi interface"),
                               cmdargv1[0]);
@@ -295,7 +295,7 @@ virStorageBackendCreateIfaceIQN(virConnectPtr conn,
     /* Note that we ignore the exitstatus.  Older versions of iscsiadm tools
      * returned an exit status of > 0, even if they succeeded.  We will just
      * rely on whether iface file got updated properly. */
-    if (virRun(conn, cmdargv2, &exitstatus) < 0) {
+    if (virRun(cmdargv2, &exitstatus) < 0) {
         virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run command '%s' to update iscsi interface with IQN '%s'"),
                               cmdargv1[0], pool->def->source.initiator.iqn);
@@ -348,7 +348,7 @@ virStorageBackendISCSIConnectionIQN(virConnectPtr conn,
     const char *const sendtargets[] = {
         ISCSIADM, "--mode", "discovery", "--type", "sendtargets", "--portal", portal, NULL
     };
-    if (virRun(conn, sendtargets, NULL) < 0) {
+    if (virRun(sendtargets, NULL) < 0) {
         virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run %s to get target list"),
                               sendtargets[0]);
@@ -361,7 +361,7 @@ virStorageBackendISCSIConnectionIQN(virConnectPtr conn,
         ifacename, action, NULL
     };
 
-    if (virRun(conn, cmdargv, NULL) < 0) {
+    if (virRun(cmdargv, NULL) < 0) {
         virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
                               _("Failed to run command '%s' with action '%s'"),
                               cmdargv[0], action);
@@ -395,7 +395,7 @@ virStorageBackendISCSIConnection(virConnectPtr conn,
             "--targetname", pool->def->source.devices[0].path, action, NULL
         };
 
-        if (virRun(conn, cmdargv, NULL) < 0) {
+        if (virRun(cmdargv, NULL) < 0) {
             ret = -1;
         }
 
@@ -417,7 +417,7 @@ virStorageBackendISCSIFindLUs(virConnectPtr conn,
     snprintf(sysfs_path, PATH_MAX,
              "/sys/class/iscsi_session/session%s/device", session);
 
-    if (virStorageBackendSCSIGetHostNumber(conn, sysfs_path, &host) < 0) {
+    if (virStorageBackendSCSIGetHostNumber(sysfs_path, &host) < 0) {
         virReportSystemError(errno,
                              _("Failed to get host number for iSCSI session "
                                "with path '%s'"),
@@ -435,7 +435,7 @@ virStorageBackendISCSIFindLUs(virConnectPtr conn,
 }
 
 static int
-virStorageBackendISCSIRescanLUNs(virConnectPtr conn,
+virStorageBackendISCSIRescanLUNs(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                  const char *session)
 {
@@ -443,7 +443,7 @@ virStorageBackendISCSIRescanLUNs(virConnectPtr conn,
         ISCSIADM, "--mode", "session", "-r", session, "-R", NULL,
     };
 
-    if (virRun(conn, cmdargv, NULL) < 0)
+    if (virRun(cmdargv, NULL) < 0)
         return -1;
 
     return 0;
@@ -460,7 +460,7 @@ virStorageBackendISCSILogin(virConnectPtr conn,
         "--portal", portal, NULL
     };
 
-    if (virRun(conn, cmdsendtarget, NULL) < 0)
+    if (virRun(cmdsendtarget, NULL) < 0)
         return -1;
 
     return virStorageBackendISCSIConnection(conn, pool, portal, "--login");
index 06ae8651af881c347595db388d6fec4c2e5a8441..35bedc06d894a15401419367406f103712ebb3e4 100644 (file)
@@ -44,8 +44,7 @@
 
 
 static int
-virStorageBackendLogicalSetActive(virConnectPtr conn,
-                                  virStoragePoolObjPtr pool,
+virStorageBackendLogicalSetActive(virStoragePoolObjPtr pool,
                                   int on)
 {
     const char *cmdargv[4];
@@ -55,7 +54,7 @@ virStorageBackendLogicalSetActive(virConnectPtr conn,
     cmdargv[2] = pool->def->source.name;
     cmdargv[3] = NULL;
 
-    if (virRun(conn, cmdargv, NULL) < 0)
+    if (virRun(cmdargv, NULL) < 0)
         return -1;
 
     return 0;
@@ -337,7 +336,7 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn,
      * that might be hanging around, so if this fails for some reason, the
      * worst that happens is that scanning doesn't pick everything up
      */
-    if (virRun(conn, scanprog, &exitstatus) < 0) {
+    if (virRun(scanprog, &exitstatus) < 0) {
         VIR_WARN0("Failure when running vgscan to refresh physical volumes");
     }
 
@@ -367,10 +366,10 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn,
 
 
 static int
-virStorageBackendLogicalStartPool(virConnectPtr conn,
+virStorageBackendLogicalStartPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                   virStoragePoolObjPtr pool)
 {
-    if (virStorageBackendLogicalSetActive(conn, pool, 1) < 0)
+    if (virStorageBackendLogicalSetActive(pool, 1) < 0)
         return -1;
 
     return 0;
@@ -378,7 +377,7 @@ virStorageBackendLogicalStartPool(virConnectPtr conn,
 
 
 static int
-virStorageBackendLogicalBuildPool(virConnectPtr conn,
+virStorageBackendLogicalBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                   virStoragePoolObjPtr pool,
                                   unsigned int flags ATTRIBUTE_UNUSED)
 {
@@ -431,14 +430,14 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn,
          */
         vgargv[n++] = pool->def->source.devices[i].path;
         pvargv[1] = pool->def->source.devices[i].path;
-        if (virRun(conn, pvargv, NULL) < 0)
+        if (virRun(pvargv, NULL) < 0)
             goto cleanup;
     }
 
     vgargv[n] = NULL;
 
     /* Now create the volume group itself */
-    if (virRun(conn, vgargv, NULL) < 0)
+    if (virRun(vgargv, NULL) < 0)
         goto cleanup;
 
     VIR_FREE(vgargv);
@@ -476,7 +475,7 @@ virStorageBackendLogicalRefreshPool(virConnectPtr conn,
     };
     int exitstatus;
 
-    virFileWaitForDevices(conn);
+    virFileWaitForDevices();
 
     /* Get list of all logical volumes */
     if (virStorageBackendLogicalFindLVs(conn, pool, NULL) < 0) {
@@ -512,17 +511,17 @@ virStorageBackendLogicalRefreshPool(virConnectPtr conn,
  * "Can't deactivate volume group "VolGroup00" with 3 open logical volume(s)"
  */
 static int
-virStorageBackendLogicalStopPool(virConnectPtr conn,
+virStorageBackendLogicalStopPool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                  virStoragePoolObjPtr pool)
 {
-    if (virStorageBackendLogicalSetActive(conn, pool, 0) < 0)
+    if (virStorageBackendLogicalSetActive(pool, 0) < 0)
         return -1;
 
     return 0;
 }
 
 static int
-virStorageBackendLogicalDeletePool(virConnectPtr conn,
+virStorageBackendLogicalDeletePool(virConnectPtr conn ATTRIBUTE_UNUSED,
                                    virStoragePoolObjPtr pool,
                                    unsigned int flags ATTRIBUTE_UNUSED)
 {
@@ -533,7 +532,7 @@ virStorageBackendLogicalDeletePool(virConnectPtr conn,
     int i, error;
 
     /* first remove the volume group */
-    if (virRun(conn, cmdargv, NULL) < 0)
+    if (virRun(cmdargv, NULL) < 0)
         return -1;
 
     /* now remove the pv devices and clear them out */
@@ -542,7 +541,7 @@ virStorageBackendLogicalDeletePool(virConnectPtr conn,
     pvargv[2] = NULL;
     for (i = 0 ; i < pool->def->source.ndevice ; i++) {
         pvargv[1] = pool->def->source.devices[i].path;
-        if (virRun(conn, pvargv, NULL) < 0) {
+        if (virRun(pvargv, NULL) < 0) {
             error = -1;
             virReportSystemError(errno,
                                  _("cannot remove PV device '%s'"),
@@ -607,7 +606,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
         return -1;
     }
 
-    if (virRun(conn, cmdargv, NULL) < 0)
+    if (virRun(cmdargv, NULL) < 0)
         return -1;
 
     if ((fd = open(vol->target.path, O_RDONLY)) < 0) {
@@ -675,7 +674,7 @@ virStorageBackendLogicalBuildVolFrom(virConnectPtr conn,
 }
 
 static int
-virStorageBackendLogicalDeleteVol(virConnectPtr conn,
+virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
                                   virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                   virStorageVolDefPtr vol,
                                   unsigned int flags ATTRIBUTE_UNUSED)
@@ -684,7 +683,7 @@ virStorageBackendLogicalDeleteVol(virConnectPtr conn,
         LVREMOVE, "-f", vol->target.path, NULL
     };
 
-    if (virRun(conn, cmdargv, NULL) < 0)
+    if (virRun(cmdargv, NULL) < 0)
         return -1;
 
     return 0;
index 87e0fc8accab4e4c21172af9d4a2672ee4673ae5..8b8fba53bd2547e8ef1f6c19debe00dd6a2b2c86 100644 (file)
@@ -329,7 +329,7 @@ virStorageBackendMpathRefreshPool(virConnectPtr conn,
 
     pool->def->allocation = pool->def->capacity = pool->def->available = 0;
 
-    virFileWaitForDevices(conn);
+    virFileWaitForDevices();
 
     virStorageBackendGetMaps(conn, pool);
 
index 505175dfdb1eb56856d3b6e7e8ba2a6528d95d8a..9c13deea4bcd3d0595fdcf5359cd5c69b7a55e16 100644 (file)
@@ -505,7 +505,7 @@ virStorageBackendSCSIFindLUs(virConnectPtr conn,
 
     VIR_DEBUG(_("Discovering LUs on host %u"), scanhost);
 
-    virFileWaitForDevices(conn);
+    virFileWaitForDevices();
 
     if (virAsprintf(&device_path, "/sys/bus/scsi/devices") < 0) {
         virReportOOMError();
@@ -543,8 +543,7 @@ out:
 
 
 int
-virStorageBackendSCSIGetHostNumber(virConnectPtr conn,
-                                   const char *sysfs_path,
+virStorageBackendSCSIGetHostNumber(const char *sysfs_path,
                                    uint32_t *host)
 {
     int retval = 0;
@@ -553,7 +552,7 @@ virStorageBackendSCSIGetHostNumber(virConnectPtr conn,
 
     VIR_DEBUG(_("Finding host number from '%s'"), sysfs_path);
 
-    virFileWaitForDevices(conn);
+    virFileWaitForDevices();
 
     sysdir = opendir(sysfs_path);
 
index d13008691e749a47127800e99849a251f7ea94ef..846799373e98f66987bbfc1dffb769e060649ee2 100644 (file)
@@ -33,8 +33,7 @@
 extern virStorageBackend virStorageBackendSCSI;
 
 int
-virStorageBackendSCSIGetHostNumber(virConnectPtr conn,
-                                   const char *sysfs_path,
+virStorageBackendSCSIGetHostNumber(const char *sysfs_path,
                                    uint32_t *host);
 int
 virStorageBackendSCSIFindLUs(virConnectPtr conn,
index 09153a23ff10cdd49f53ee311061a6285ad21ed3..fd5e51d24b7e768c3d6c60372c41eec6a32de462 100644 (file)
@@ -124,7 +124,7 @@ storageDriverStartup(int privileged) {
             goto out_of_memory;
     } else {
         uid_t uid = geteuid();
-        char *userdir = virGetUserDirectory(NULL, uid);
+        char *userdir = virGetUserDirectory(uid);
 
         if (!userdir)
             goto error;
index 7bfb67f86ebd23a119a8ce8759e8871bde0d458d..cb6bf3acc14d9f70424121c5f23df669784251e5 100644 (file)
@@ -365,7 +365,7 @@ umlStartup(int privileged) {
     if (virDomainObjListInit(&uml_driver->domains) < 0)
         goto error;
 
-    userdir = virGetUserDirectory(NULL, uid);
+    userdir = virGetUserDirectory(uid);
     if (!userdir)
         goto error;
 
@@ -899,7 +899,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
 
     priv->monitor = -1;
 
-    ret = virExecDaemonize(conn, argv, progenv, &keepfd, &pid,
+    ret = virExecDaemonize(argv, progenv, &keepfd, &pid,
                            -1, &logfd, &logfd,
                            VIR_EXEC_CLEAR_CAPS,
                            NULL, NULL, NULL);
index f9a7668bc86e2e4de20ac9e64d835d0ef32c3fc4..4a5ab4b3acc13ab7eef3209d1ab6ad275e25ccf4 100644 (file)
@@ -792,7 +792,7 @@ brSetForwardDelay(brControl *ctl ATTRIBUTE_UNUSED,
 
     snprintf(delayStr, sizeof(delayStr), "%d", delay);
 
-    if (virRun(NULL, progargv, NULL) < 0)
+    if (virRun(progargv, NULL) < 0)
         return -1;
 
     return 0;
@@ -819,7 +819,7 @@ brSetEnableSTP(brControl *ctl ATTRIBUTE_UNUSED,
         BRCTL, "stp", bridge, setting, NULL
     };
 
-    if (virRun(NULL, progargv, NULL) < 0)
+    if (virRun(progargv, NULL) < 0)
         return -1;
 
     return 0;
index 4446c7f1ea86c6f3154b40544a507690add3b3e1..ad0d5955a42de6d3cedf0e9096f243d7da914fb1 100644 (file)
@@ -533,7 +533,7 @@ static int virCgroupAppRoot(int privileged,
     } else {
         char *rootname;
         char *username;
-        username = virGetUserName(NULL, getuid());
+        username = virGetUserName(getuid());
         if (!username) {
             rc = -ENOMEM;
             goto cleanup;
index 4244adc7759fdd123e7e961589a4a5a4a898c326..dba9f82d026a23188d1a1bb34c9ab3490cc16b0c 100644 (file)
@@ -228,7 +228,7 @@ ebtablesAddRemoveRule(ebtRules *rules, int action, const char *arg, ...)
             goto error;
     }
 
-    if (virRun(NULL, argv, NULL) < 0) {
+    if (virRun(argv, NULL) < 0) {
         retval = errno;
         goto error;
     }
index 3c02ea6bc2e4d0b6a0fef11d1e4a36fdc7e66f78..b5791736cc624597ebd764e09ddcb4197b7f141c 100644 (file)
@@ -146,7 +146,7 @@ iptablesAddRemoveRule(iptRules *rules, int action, const char *arg, ...)
 
     va_end(args);
 
-    if (virRun(NULL, argv, NULL) < 0) {
+    if (virRun(argv, NULL) < 0) {
         retval = errno;
         goto error;
     }
index bbaf235ab2f57f4d8d1a26561b62a79860810083..88d163f64e30dca92fba09ee08fdb4e88f054432 100644 (file)
@@ -699,7 +699,7 @@ pciDeviceFile(char *buf, size_t buflen, const char *device, const char *file)
 
 
 static const char *
-pciFindStubDriver(virConnectPtr conn)
+pciFindStubDriver(void)
 {
     char drvpath[PATH_MAX];
     int probed = 0;
@@ -723,8 +723,8 @@ recheck:
          * On Xen though, we want to prefer pciback, so probe
          * for that first, because that will only work on Xen
          */
-        if (virRun(conn, backprobe, NULL) < 0 &&
-            virRun(conn, stubprobe, NULL) < 0) {
+        if (virRun(backprobe, NULL) < 0 &&
+            virRun(stubprobe, NULL) < 0) {
             char ebuf[1024];
             VIR_WARN(_("failed to load pci-stub or pciback drivers: %s"),
                      virStrerror(errno, ebuf, sizeof ebuf));
@@ -812,7 +812,7 @@ pciBindDeviceToStub(pciDevice *dev, const char *driver)
 int
 pciDettachDevice(virConnectPtr conn, pciDevice *dev)
 {
-    const char *driver = pciFindStubDriver(conn);
+    const char *driver = pciFindStubDriver();
     if (!driver) {
         pciReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
                        _("cannot find any PCI stub module"));
@@ -873,7 +873,7 @@ pciUnBindDeviceFromStub(pciDevice *dev, const char *driver)
 int
 pciReAttachDevice(virConnectPtr conn, pciDevice *dev)
 {
-    const char *driver = pciFindStubDriver(conn);
+    const char *driver = pciFindStubDriver();
     if (!driver) {
         pciReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s",
                        _("cannot find any PCI stub module"));
index 5e70339dc5c6baa8d937ebadcbadbd7539a8006f..cdab300021d54fe9408a891b44c7a9cef1ad859d 100644 (file)
@@ -84,9 +84,9 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
-#define ReportError(conn, code, fmt...)                                      \
-        virReportErrorHelper(conn, VIR_FROM_NONE, code, __FILE__,          \
-                               __FUNCTION__, __LINE__, fmt)
+#define virUtilError(code, fmt...)                                         \
+        virReportErrorHelper(NULL, VIR_FROM_NONE, code, __FILE__,          \
+                             __FUNCTION__, __LINE__, fmt)
 
 /* Like read(), but restarts after EINTR */
 int saferead(int fd, void *buf, size_t count)
@@ -297,7 +297,6 @@ static int virClearCapabilities(void)
 #endif
 
 /*
- * @conn Connection to report errors against
  * @argv argv to exec
  * @envp optional environment to use for exec
  * @keepfd options fd_ret to keep open for child process
@@ -318,8 +317,7 @@ static int virClearCapabilities(void)
  * @pidfile path to use as pidfile for daemonized process (needs DAEMON flag)
  */
 static int
-__virExec(virConnectPtr conn,
-          const char *const*argv,
+__virExec(const char *const*argv,
           const char *const*envp,
           const fd_set *keepfd,
           pid_t *retpid,
@@ -454,9 +452,6 @@ __virExec(virConnectPtr conn,
 
     /* child */
 
-    /* Don't want to report errors against this accidentally, so
-       just discard it */
-    conn = NULL;
     /* Remove any error callback too, so errors in child now
        get sent to stderr where they stand a fighting chance
        of being seen / logged */
@@ -593,7 +588,7 @@ __virExec(virConnectPtr conn,
     /* This is cleanup of parent process only - child
        should never jump here on error */
 
-    /* NB we don't ReportError() on any failures here
+    /* NB we don't virUtilError() on any failures here
        because the code which jumped hre already raised
        an error condition which we must not overwrite */
     if (pipeerr[0] > 0)
@@ -610,8 +605,7 @@ __virExec(virConnectPtr conn,
 }
 
 int
-virExecWithHook(virConnectPtr conn,
-                const char *const*argv,
+virExecWithHook(const char *const*argv,
                 const char *const*envp,
                 const fd_set *keepfd,
                 pid_t *retpid,
@@ -642,7 +636,7 @@ virExecWithHook(virConnectPtr conn,
     }
     VIR_FREE(argv_str);
 
-    return __virExec(conn, argv, envp, keepfd, retpid, infd, outfd, errfd,
+    return __virExec(argv, envp, keepfd, retpid, infd, outfd, errfd,
                      flags, hook, data, pidfile);
 }
 
@@ -654,15 +648,14 @@ virExecWithHook(virConnectPtr conn,
  * list.
  */
 int
-virExec(virConnectPtr conn,
-        const char *const*argv,
+virExec(const char *const*argv,
         const char *const*envp,
         const fd_set *keepfd,
         pid_t *retpid,
         int infd, int *outfd, int *errfd,
         int flags)
 {
-    return virExecWithHook(conn, argv, envp, keepfd, retpid,
+    return virExecWithHook(argv, envp, keepfd, retpid,
                            infd, outfd, errfd,
                            flags, NULL, NULL, NULL);
 }
@@ -681,8 +674,7 @@ virExec(virConnectPtr conn,
  *          occured and when in the process occured, the error output
  *          could have gone to stderr or the passed errfd).
  */
-int virExecDaemonize(virConnectPtr conn,
-                     const char *const*argv,
+int virExecDaemonize(const char *const*argv,
                      const char *const*envp,
                      const fd_set *keepfd,
                      pid_t *retpid,
@@ -694,7 +686,7 @@ int virExecDaemonize(virConnectPtr conn,
     int ret;
     int childstat = 0;
 
-    ret = virExecWithHook(conn, argv, envp, keepfd, retpid,
+    ret = virExecWithHook(argv, envp, keepfd, retpid,
                           infd, outfd, errfd,
                           flags | VIR_EXEC_DAEMON,
                           hook, data, pidfile);
@@ -708,9 +700,9 @@ int virExecDaemonize(virConnectPtr conn,
                    errno == EINTR);
 
     if (childstat != 0) {
-        ReportError(conn, VIR_ERR_INTERNAL_ERROR,
-                    _("Intermediate daemon process exited with status %d."),
-                    WEXITSTATUS(childstat));
+        virUtilError(VIR_ERR_INTERNAL_ERROR,
+                     _("Intermediate daemon process exited with status %d."),
+                     WEXITSTATUS(childstat));
         ret = -2;
     }
 
@@ -718,7 +710,7 @@ int virExecDaemonize(virConnectPtr conn,
 }
 
 static int
-virPipeReadUntilEOF(virConnectPtr conn, int outfd, int errfd,
+virPipeReadUntilEOF(int outfd, int errfd,
                     char **outbuf, char **errbuf) {
 
     struct pollfd fds[2];
@@ -753,8 +745,8 @@ virPipeReadUntilEOF(virConnectPtr conn, int outfd, int errfd,
                 if (fds[i].revents & POLLHUP)
                     continue;
 
-                ReportError(conn, VIR_ERR_INTERNAL_ERROR,
-                            "%s", _("Unknown poll response."));
+                virUtilError(VIR_ERR_INTERNAL_ERROR,
+                             "%s", _("Unknown poll response."));
                 goto error;
             }
 
@@ -798,7 +790,6 @@ error:
 }
 
 /**
- * @conn connection to report errors against
  * @argv NULL terminated argv to run
  * @status optional variable to return exit status in
  *
@@ -813,8 +804,7 @@ error:
  * only if the command could not be run.
  */
 int
-virRunWithHook(virConnectPtr conn,
-               const char *const*argv,
+virRunWithHook(const char *const*argv,
                virExecHook hook,
                void *data,
                int *status) {
@@ -832,14 +822,14 @@ virRunWithHook(virConnectPtr conn,
     }
     DEBUG0(argv_str);
 
-    if ((execret = __virExec(conn, argv, NULL, NULL,
+    if ((execret = __virExec(argv, NULL, NULL,
                              &childpid, -1, &outfd, &errfd,
                              VIR_EXEC_NONE, hook, data, NULL)) < 0) {
         ret = execret;
         goto error;
     }
 
-    if (virPipeReadUntilEOF(conn, outfd, errfd, &outbuf, &errbuf) < 0) {
+    if (virPipeReadUntilEOF(outfd, errfd, &outbuf, &errbuf) < 0) {
         while (waitpid(childpid, &exitstatus, 0) == -1 && errno == EINTR)
             ;
         goto error;
@@ -862,12 +852,12 @@ virRunWithHook(virConnectPtr conn,
     if (status == NULL) {
         errno = EINVAL;
         if (WIFEXITED(exitstatus) && WEXITSTATUS(exitstatus) != 0) {
-            ReportError(conn, VIR_ERR_INTERNAL_ERROR,
-                        _("'%s' exited with non-zero status %d and "
-                          "signal %d: %s"), argv_str,
-                        WIFEXITED(exitstatus) ? WEXITSTATUS(exitstatus) : 0,
-                        WIFSIGNALED(exitstatus) ? WTERMSIG(exitstatus) : 0,
-                        (errbuf ? errbuf : ""));
+            virUtilError(VIR_ERR_INTERNAL_ERROR,
+                         _("'%s' exited with non-zero status %d and "
+                           "signal %d: %s"), argv_str,
+                         WIFEXITED(exitstatus) ? WEXITSTATUS(exitstatus) : 0,
+                         WIFSIGNALED(exitstatus) ? WTERMSIG(exitstatus) : 0,
+                         (errbuf ? errbuf : ""));
             goto error;
         }
     } else {
@@ -890,8 +880,7 @@ virRunWithHook(virConnectPtr conn,
 #else /* __MINGW32__ */
 
 int
-virRunWithHook(virConnectPtr conn,
-               const char *const *argv ATTRIBUTE_UNUSED,
+virRunWithHook(const char *const *argv ATTRIBUTE_UNUSED,
                virExecHook hook ATTRIBUTE_UNUSED,
                void *data ATTRIBUTE_UNUSED,
                int *status)
@@ -899,13 +888,12 @@ virRunWithHook(virConnectPtr conn,
     if (status)
         *status = ENOTSUP;
     else
-        ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
+        virUtilError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
     return -1;
 }
 
 int
-virExec(virConnectPtr conn,
-        const char *const*argv ATTRIBUTE_UNUSED,
+virExec(const char *const*argv ATTRIBUTE_UNUSED,
         const char *const*envp ATTRIBUTE_UNUSED,
         const fd_set *keepfd ATTRIBUTE_UNUSED,
         int *retpid ATTRIBUTE_UNUSED,
@@ -914,17 +902,16 @@ virExec(virConnectPtr conn,
         int *errfd ATTRIBUTE_UNUSED,
         int flags ATTRIBUTE_UNUSED)
 {
-    ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
+    virUtilError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
     return -1;
 }
 
 #endif /* __MINGW32__ */
 
 int
-virRun(virConnectPtr conn,
-       const char *const*argv,
+virRun(const char *const*argv,
        int *status) {
-    return virRunWithHook(conn, argv, NULL, NULL, status);
+    return virRunWithHook(argv, NULL, NULL, status);
 }
 
 /* Like gnulib's fread_file, but read no more than the specified maximum
@@ -2178,8 +2165,8 @@ char *virIndexToDiskName(int idx, const char *prefix)
     int i, k, offset;
 
     if (idx < 0) {
-        ReportError(NULL, VIR_ERR_INTERNAL_ERROR,
-                    _("Disk index %d is negative"), idx);
+        virUtilError(VIR_ERR_INTERNAL_ERROR,
+                     _("Disk index %d is negative"), idx);
         return NULL;
     }
 
@@ -2206,7 +2193,7 @@ char *virIndexToDiskName(int idx, const char *prefix)
 #define AI_CANONIDN 0
 #endif
 
-char *virGetHostname(virConnectPtr conn)
+char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
 {
     int r;
     char hostname[HOST_NAME_MAX+1], *result;
@@ -2225,14 +2212,14 @@ char *virGetHostname(virConnectPtr conn)
     hints.ai_family = AF_UNSPEC;
     r = getaddrinfo(hostname, NULL, &hints, &info);
     if (r != 0) {
-        ReportError(conn, VIR_ERR_INTERNAL_ERROR,
-                    _("getaddrinfo failed for '%s': %s"),
-                    hostname, gai_strerror(r));
+        virUtilError(VIR_ERR_INTERNAL_ERROR,
+                     _("getaddrinfo failed for '%s': %s"),
+                     hostname, gai_strerror(r));
         return NULL;
     }
     if (info->ai_canonname == NULL) {
-        ReportError(conn, VIR_ERR_INTERNAL_ERROR,
-                    "%s", _("could not determine canonical host name"));
+        virUtilError(VIR_ERR_INTERNAL_ERROR,
+                     "%s", _("could not determine canonical host name"));
         freeaddrinfo(info);
         return NULL;
     }
@@ -2386,21 +2373,18 @@ static char *virGetUserEnt(uid_t uid,
     return ret;
 }
 
-char *virGetUserDirectory(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                          uid_t uid)
+char *virGetUserDirectory(uid_t uid)
 {
     return virGetUserEnt(uid, VIR_USER_ENT_DIRECTORY);
 }
 
-char *virGetUserName(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                     uid_t uid)
+char *virGetUserName(uid_t uid)
 {
     return virGetUserEnt(uid, VIR_USER_ENT_NAME);
 }
 
 
-int virGetUserID(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                 const char *name,
+int virGetUserID(const char *name,
                  uid_t *uid)
 {
     char *strbuf;
@@ -2442,8 +2426,7 @@ int virGetUserID(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
 }
 
 
-int virGetGroupID(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                  const char *name,
+int virGetGroupID(const char *name,
                   gid_t *gid)
 {
     char *strbuf;
@@ -2521,7 +2504,7 @@ cleanup:
 
 #ifndef PROXY
 #if defined(UDEVADM) || defined(UDEVSETTLE)
-void virFileWaitForDevices(virConnectPtr conn)
+void virFileWaitForDevices(void)
 {
 #ifdef UDEVADM
     const char *const settleprog[] = { UDEVADM, "settle", NULL };
@@ -2539,11 +2522,11 @@ void virFileWaitForDevices(virConnectPtr conn)
      * If this fails for any reason, we still have the backup of polling for
      * 5 seconds for device nodes.
      */
-    if (virRun(conn, settleprog, &exitstatus) < 0)
+    if (virRun(settleprog, &exitstatus) < 0)
     {}
 }
 #else
-void virFileWaitForDevices(virConnectPtr conn ATTRIBUTE_UNUSED) {}
+void virFileWaitForDevices(void) {}
 #endif
 #endif
 
index b0219cc3fcc2b7a45664550b335866a74680dd6a..bb545acd8afcd804b1e52f186dccb04a51c4fd00 100644 (file)
@@ -49,8 +49,7 @@ int virSetCloseExec(int fd) ATTRIBUTE_RETURN_CHECK;
  * after fork() but before execve() */
 typedef int (*virExecHook)(void *data);
 
-int virExecDaemonize(virConnectPtr conn,
-                     const char *const*argv,
+int virExecDaemonize(const char *const*argv,
                      const char *const*envp,
                      const fd_set *keepfd,
                      pid_t *retpid,
@@ -59,8 +58,7 @@ int virExecDaemonize(virConnectPtr conn,
                      virExecHook hook,
                      void *data,
                      char *pidfile) ATTRIBUTE_RETURN_CHECK;
-int virExecWithHook(virConnectPtr conn,
-                    const char *const*argv,
+int virExecWithHook(const char *const*argv,
                     const char *const*envp,
                     const fd_set *keepfd,
                     int *retpid,
@@ -71,8 +69,7 @@ int virExecWithHook(virConnectPtr conn,
                     virExecHook hook,
                     void *data,
                     char *pidfile) ATTRIBUTE_RETURN_CHECK;
-int virExec(virConnectPtr conn,
-            const char *const*argv,
+int virExec(const char *const*argv,
             const char *const*envp,
             const fd_set *keepfd,
             pid_t *retpid,
@@ -80,8 +77,8 @@ int virExec(virConnectPtr conn,
             int *outfd,
             int *errfd,
             int flags) ATTRIBUTE_RETURN_CHECK;
-int virRun(virConnectPtr conn, const char *const*argv, int *status) ATTRIBUTE_RETURN_CHECK;
-int virRunWithHook(virConnectPtr conn, const char *const*argv,
+int virRun(const char *const*argv, int *status) ATTRIBUTE_RETURN_CHECK;
+int virRunWithHook(const char *const*argv,
                    virExecHook hook, void *data,
                    int *status) ATTRIBUTE_RETURN_CHECK;
 
@@ -241,15 +238,11 @@ char *virGetHostname(virConnectPtr conn);
 int virKillProcess(pid_t pid, int sig);
 
 #ifdef HAVE_GETPWUID_R
-char *virGetUserDirectory(virConnectPtr conn,
-                          uid_t uid);
-char *virGetUserName(virConnectPtr conn,
-                     uid_t uid);
-int virGetUserID(virConnectPtr conn,
-                 const char *name,
+char *virGetUserDirectory(uid_t uid);
+char *virGetUserName(uid_t uid);
+int virGetUserID(const char *name,
                  uid_t *uid) ATTRIBUTE_RETURN_CHECK;
-int virGetGroupID(virConnectPtr conn,
-                  const char *name,
+int virGetGroupID(const char *name,
                   gid_t *gid) ATTRIBUTE_RETURN_CHECK;
 #endif
 
@@ -260,7 +253,7 @@ int virRandom(int max);
 char *virFileFindMountPoint(const char *type);
 #endif
 
-void virFileWaitForDevices(virConnectPtr conn);
+void virFileWaitForDevices(void);
 
 #define virBuildPath(path, ...) virBuildPathInternal(path, __VA_ARGS__, NULL)
 int virBuildPathInternal(char **path, ...) ATTRIBUTE_SENTINEL;
index 071b3786429f4d287a98356d499ad257e7a09864..8e1c22620261e08a0d96f3d0a9b1882780815c5e 100644 (file)
@@ -155,7 +155,7 @@ virProxyForkServer(void)
     proxyarg[0] = proxyPath;
     proxyarg[1] = NULL;
 
-    if (virExecDaemonize(NULL, proxyarg, NULL, NULL,
+    if (virExecDaemonize(proxyarg, NULL, NULL,
                          &pid, -1, NULL, NULL, 0,
                          NULL, NULL, NULL) < 0)
         VIR_ERROR0("Failed to fork libvirt_proxy");
index 6fa4a4fa6b0464c1c255d8f980c3526e50a994ed..7db48d972aa0378ac698e89a2c1f4835e96fd265 100644 (file)
@@ -7172,7 +7172,7 @@ cmdCd(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
     dir = vshCommandOptString(cmd, "dir", &found);
     if (!found) {
         uid_t uid = geteuid();
-        dir = virGetUserDirectory(NULL, uid);
+        dir = virGetUserDirectory(uid);
     }
     if (!dir)
         dir = "/";
@@ -8773,7 +8773,7 @@ vshReadlineInit(vshControl *ctl)
     stifle_history(500);
 
     /* Prepare to read/write history from/to the ~/.virsh/history file */
-    userdir = virGetUserDirectory(NULL, getuid());
+    userdir = virGetUserDirectory(getuid());
 
     if (userdir == NULL)
         return -1;