---
...-Step-7-of-8-Implement-the-driver-methods.patch | 4 +-
src/conf/domain_conf.c | 12 +-
src/conf/network_conf.c | 12 +-
src/conf/storage_conf.c | 10 +-
src/lxc/lxc_container.c | 60 +++++-----
src/lxc/lxc_controller.c | 62 +++++-----
src/lxc/lxc_driver.c | 30 +++---
src/network/bridge_driver.c | 80 ++++++-------
src/node_device/node_device_driver.c | 12 +-
src/nodeinfo.c | 2 +-
src/qemu/qemu_bridge_filter.c | 14 +--
src/qemu/qemu_bridge_filter.h | 10 +-
src/qemu/qemu_conf.c | 27 ++--
src/qemu/qemu_conf.h | 3 +-
src/qemu/qemu_driver.c | 126 ++++++++++----------
src/qemu/qemu_monitor.c | 6 +-
src/qemu/qemu_monitor_json.c | 4 +-
src/qemu/qemu_monitor_text.c | 2 +-
src/qemu/qemu_security_dac.c | 49 ++++----
src/remote/remote_driver.c | 34 +++---
src/secret/secret_driver.c | 32 +++---
src/security/security_apparmor.c | 8 +-
src/security/security_selinux.c | 69 +++++------
src/storage/storage_backend.c | 101 +++++++---------
src/storage/storage_backend.h | 15 +--
src/storage/storage_backend_disk.c | 6 +-
src/storage/storage_backend_fs.c | 36 +++---
src/storage/storage_backend_iscsi.c | 4 +-
src/storage/storage_backend_logical.c | 20 ++--
src/storage/storage_backend_mpath.c | 9 +-
src/storage/storage_backend_scsi.c | 41 +++----
src/storage/storage_driver.c | 9 +-
src/test/test_driver.c | 36 +++---
src/uml/uml_conf.c | 6 +-
src/uml/uml_driver.c | 38 +++---
src/util/hostusb.c | 2 +-
src/util/pci.c | 39 +++---
src/util/processinfo.c | 12 +-
src/util/storage_file.c | 4 +-
src/util/util.c | 129 ++++++++++----------
src/util/virterror.c | 6 +-
src/util/virterror_internal.h | 10 +-
src/xen/proxy_internal.c | 6 +-
src/xen/xen_hypervisor.c | 6 +-
src/xen/xen_inotify.c | 6 +-
src/xen/xend_internal.c | 6 +-
src/xen/xm_internal.c | 12 +-
47 files changed, 589 insertions(+), 638 deletions(-)
diff --git a/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
b/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
index f820b2c..7586cd4 100644
--- a/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
+++ b/docs/api_extension/0007-Step-7-of-8-Implement-the-driver-methods.patch
@@ -151,7 +151,7 @@ index b84729f..4f73baf 100644
+ fd = open(operation_path, O_WRONLY);
+
+ if (fd < 0) {
-+ virReportSystemError(conn, errno,
++ virReportSystemError(errno,
+ _("Could not open '%s' for vport
operation"),
+ operation_path);
+ retval = -1;
@@ -171,7 +171,7 @@ index b84729f..4f73baf 100644
+ towrite = strlen(vport_name);
+ written = safewrite(fd, vport_name, towrite);
+ if (written != towrite) {
-+ virReportSystemError(conn, errno,
++ virReportSystemError(errno,
+ _("Write of '%s' to '%s' during
"
+ "vport create/delete failed "
+ "(towrite: %lu written: %d)"),
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ee5be58..daa63a9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5597,7 +5597,7 @@ int virDomainSaveXML(virConnectPtr conn,
goto cleanup;
if (virFileMakePath(configDir)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot create config directory '%s'"),
configDir);
goto cleanup;
@@ -5606,7 +5606,7 @@ int virDomainSaveXML(virConnectPtr conn,
if ((fd = open(configFile,
O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR )) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot create config file '%s'"),
configFile);
goto cleanup;
@@ -5614,14 +5614,14 @@ int virDomainSaveXML(virConnectPtr conn,
towrite = strlen(xml);
if (safewrite(fd, xml, towrite) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot write config file '%s'"),
configFile);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot save config file '%s'"),
configFile);
goto cleanup;
@@ -5792,7 +5792,7 @@ int virDomainLoadAllConfigs(virConnectPtr conn,
if (!(dir = opendir(configDir))) {
if (errno == ENOENT)
return 0;
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to open dir '%s'"),
configDir);
return -1;
@@ -5857,7 +5857,7 @@ int virDomainDeleteConfig(virConnectPtr conn,
if (unlink(configFile) < 0 &&
errno != ENOENT) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot remove config %s"),
configFile);
goto cleanup;
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index dd42232..4e4a58c 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -748,7 +748,7 @@ int virNetworkSaveXML(virConnectPtr conn,
goto cleanup;
if ((err = virFileMakePath(configDir))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot create config directory '%s'"),
configDir);
goto cleanup;
@@ -757,7 +757,7 @@ int virNetworkSaveXML(virConnectPtr conn,
if ((fd = open(configFile,
O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR )) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot create config file '%s'"),
configFile);
goto cleanup;
@@ -765,14 +765,14 @@ int virNetworkSaveXML(virConnectPtr conn,
towrite = strlen(xml);
if (safewrite(fd, xml, towrite) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot write config file '%s'"),
configFile);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot save config file '%s'"),
configFile);
goto cleanup;
@@ -874,7 +874,7 @@ int virNetworkLoadAllConfigs(virConnectPtr conn,
if (!(dir = opendir(configDir))) {
if (errno == ENOENT)
return 0;
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to open dir '%s'"),
configDir);
return -1;
@@ -923,7 +923,7 @@ int virNetworkDeleteConfig(virConnectPtr conn,
unlink(autostartLink);
if (unlink(configFile) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot remove config file '%s'"),
configFile);
goto error;
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 3e250de..9c0981d 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1539,7 +1539,7 @@ virStoragePoolLoadAllConfigs(virConnectPtr conn,
if (!(dir = opendir(configDir))) {
if (errno == ENOENT)
return 0;
- virReportSystemError(conn, errno, _("Failed to open dir
'%s'"),
+ virReportSystemError(errno, _("Failed to open dir '%s'"),
configDir);
return -1;
}
@@ -1596,7 +1596,7 @@ virStoragePoolObjSaveDef(virConnectPtr conn,
char path[PATH_MAX];
if ((err = virFileMakePath(driver->configDir))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot create config directory %s"),
driver->configDir);
return -1;
@@ -1637,7 +1637,7 @@ virStoragePoolObjSaveDef(virConnectPtr conn,
if ((fd = open(pool->configFile,
O_WRONLY | O_CREAT | O_TRUNC,
S_IRUSR | S_IWUSR )) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot create config file %s"),
pool->configFile);
goto cleanup;
@@ -1645,14 +1645,14 @@ virStoragePoolObjSaveDef(virConnectPtr conn,
towrite = strlen(xml);
if (safewrite(fd, xml, towrite) != towrite) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot write config file %s"),
pool->configFile);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot save config file %s"),
pool->configFile);
goto cleanup;
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 2f07db1..1cc7ed0 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -125,13 +125,13 @@ static int lxcContainerSetStdio(int control, int ttyfd)
int open_max, i;
if (setsid() < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("setsid failed"));
goto cleanup;
}
if (ioctl(ttyfd, TIOCSCTTY, NULL) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("ioctl(TIOCSTTY) failed"));
goto cleanup;
}
@@ -144,19 +144,19 @@ static int lxcContainerSetStdio(int control, int ttyfd)
close(i);
if (dup2(ttyfd, 0) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("dup2(stdin) failed"));
goto cleanup;
}
if (dup2(ttyfd, 1) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("dup2(stdout) failed"));
goto cleanup;
}
if (dup2(ttyfd, 2) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("dup2(stderr) failed"));
goto cleanup;
}
@@ -184,7 +184,7 @@ int lxcContainerSendContinue(int control)
writeCount = safewrite(control, &msg, sizeof(msg));
if (writeCount != sizeof(msg)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to send container continue message"));
goto error_out;
}
@@ -213,7 +213,7 @@ static int lxcContainerWaitForContinue(int control)
readLen = saferead(control, &msg, sizeof(msg));
if (readLen != sizeof(msg) ||
msg != LXC_CONTINUE_MSG) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to read the container continue
message"));
return -1;
}
@@ -308,7 +308,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
/* root->parent must be private, so make / private. */
if (mount("", "/", NULL, MS_PRIVATE|MS_REC, NULL) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to make root private"));
goto err;
}
@@ -319,7 +319,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
}
if ((rc = virFileMakePath(oldroot)) != 0) {
- virReportSystemError(NULL, rc,
+ virReportSystemError(rc,
_("Failed to create %s"),
oldroot);
goto err;
@@ -328,7 +328,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
/* Create a tmpfs root since old and new roots must be
* on separate filesystems */
if (mount("tmprootfs", oldroot, "tmpfs", 0, NULL) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to mount empty tmpfs at %s"),
oldroot);
goto err;
@@ -341,7 +341,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
}
if ((rc = virFileMakePath(newroot)) != 0) {
- virReportSystemError(NULL, rc,
+ virReportSystemError(rc,
_("Failed to create %s"),
newroot);
goto err;
@@ -349,7 +349,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
/* ... and mount our root onto it */
if (mount(root->src, newroot, NULL, MS_BIND|MS_REC, NULL) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to bind new root %s into tmpfs"),
root->src);
goto err;
@@ -358,7 +358,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
/* Now we chroot into the tmpfs, then pivot into the
* root->src bind-mounted onto '/new' */
if (chdir(newroot) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to chroot into %s"), newroot);
goto err;
}
@@ -366,7 +366,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root)
/* The old root directory will live at /.oldroot after
* this and will soon be unmounted completely */
if (pivot_root(".", ".oldroot") < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to pivot root"));
goto err;
}
@@ -409,13 +409,13 @@ static int lxcContainerMountBasicFS(virDomainFSDefPtr root)
for (i = 0 ; i < ARRAY_CARDINALITY(mnts) ; i++) {
if (virFileMakePath(mnts[i].dst) != 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to mkdir %s"),
mnts[i].src);
goto cleanup;
}
if (mount(mnts[i].src, mnts[i].dst, mnts[i].type, 0, NULL) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to mount %s on %s"),
mnts[i].type, mnts[i].type);
goto cleanup;
@@ -423,14 +423,14 @@ static int lxcContainerMountBasicFS(virDomainFSDefPtr root)
}
if ((rc = virFileMakePath("/dev/pts") != 0)) {
- virReportSystemError(NULL, rc, "%s",
+ virReportSystemError(rc, "%s",
_("Cannot create /dev/pts"));
goto cleanup;
}
VIR_DEBUG("Trying to move %s to %s", devpts, "/dev/pts");
if ((rc = mount(devpts, "/dev/pts", NULL, MS_MOVE, NULL)) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to mount /dev/pts in container"));
goto cleanup;
}
@@ -465,7 +465,7 @@ static int lxcContainerPopulateDevices(void)
dev_t dev = makedev(devs[i].maj, devs[i].min);
if (mknod(devs[i].path, S_IFCHR, dev) < 0 ||
chmod(devs[i].path, devs[i].mode)) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to make device %s"),
devs[i].path);
return -1;
@@ -474,7 +474,7 @@ static int lxcContainerPopulateDevices(void)
if (access("/dev/pts/ptmx", W_OK) == 0) {
if (symlink("/dev/pts/ptmx", "/dev/ptmx") < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to create symlink /dev/ptmx to
/dev/pts/ptmx"));
return -1;
}
@@ -482,7 +482,7 @@ static int lxcContainerPopulateDevices(void)
dev_t dev = makedev(LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX);
if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 ||
chmod("/dev/ptmx", 0666)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to make device /dev/ptmx"));
return -1;
}
@@ -512,14 +512,14 @@ static int lxcContainerMountNewFS(virDomainDefPtr vmDef)
}
if (virFileMakePath(vmDef->fss[i]->dst) != 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to create %s"),
vmDef->fss[i]->dst);
VIR_FREE(src);
return -1;
}
if (mount(src, vmDef->fss[i]->dst, NULL, MS_BIND, NULL) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to mount %s at %s"),
src, vmDef->fss[i]->dst);
VIR_FREE(src);
@@ -542,7 +542,7 @@ static int lxcContainerUnmountOldFS(void)
char mntbuf[1024];
if (!(procmnt = setmntent("/proc/mounts", "r"))) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to read /proc/mounts"));
return -1;
}
@@ -571,7 +571,7 @@ static int lxcContainerUnmountOldFS(void)
for (i = 0 ; i < nmounts ; i++) {
VIR_DEBUG("Umount %s", mounts[i]);
if (umount(mounts[i]) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to unmount '%s'"),
mounts[i]);
return -1;
@@ -621,7 +621,7 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef)
int i;
if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to make / slave"));
return -1;
}
@@ -635,7 +635,7 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef)
NULL,
MS_BIND,
NULL) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to mount %s at %s"),
vmDef->fss[i]->src,
vmDef->fss[i]->dst);
@@ -645,7 +645,7 @@ static int lxcContainerSetupExtraMounts(virDomainDefPtr vmDef)
/* mount /proc */
if (mount("lxcproc", "/proc", "proc", 0, NULL) < 0)
{
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to mount /proc"));
return -1;
}
@@ -750,7 +750,7 @@ static int lxcContainerChild( void *data )
ttyfd = open(ttyPath, O_RDWR|O_NOCTTY);
if (ttyfd < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to open tty %s"),
ttyPath);
VIR_FREE(ttyPath);
@@ -833,7 +833,7 @@ int lxcContainerStart(virDomainDefPtr def,
DEBUG("clone() returned, %d", pid);
if (pid < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to run clone container"));
return -1;
}
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 7fd9a1b..7a45989 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -88,14 +88,14 @@ static int lxcSetContainerResources(virDomainDefPtr def)
if (rc == -ENXIO || rc == -ENOENT)
return 0;
- virReportSystemError(NULL, -rc, "%s",
+ virReportSystemError(-rc, "%s",
_("Unable to get cgroup for driver"));
return rc;
}
rc = virCgroupForDomain(driver, def->name, &cgroup, 1);
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("Unable to create cgroup for domain %s"),
def->name);
goto cleanup;
@@ -103,7 +103,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
rc = virCgroupSetMemory(cgroup, def->maxmem);
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("Unable to set memory limit for domain %s"),
def->name);
goto cleanup;
@@ -111,7 +111,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
rc = virCgroupDenyAllDevices(cgroup);
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("Unable to deny devices for domain %s"),
def->name);
goto cleanup;
@@ -124,7 +124,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
dev->major,
dev->minor);
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("Unable to allow device %c:%d:%d for domain
%s"),
dev->type, dev->major, dev->minor,
def->name);
goto cleanup;
@@ -133,7 +133,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
rc = virCgroupAllowDeviceMajor(cgroup, 'c', LXC_DEV_MAJ_PTY);
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("Unable to allow PYT devices for domain %s"),
def->name);
goto cleanup;
@@ -141,7 +141,7 @@ static int lxcSetContainerResources(virDomainDefPtr def)
rc = virCgroupAddTask(cgroup, getpid());
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("Unable to add task %d to cgroup for domain
%s"),
getpid(), def->name);
}
@@ -169,7 +169,7 @@ static int lxcMonitorServer(const char *sockpath)
struct sockaddr_un addr;
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("failed to create server socket '%s'"),
sockpath);
goto error;
@@ -185,13 +185,13 @@ static int lxcMonitorServer(const char *sockpath)
}
if (bind(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("failed to bind server socket '%s'"),
sockpath);
goto error;
}
if (listen(fd, 30 /* backlog */ ) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("failed to listen server socket %s"),
sockpath);
goto error;
@@ -225,14 +225,14 @@ static int lxcFdForward(int readFd, int writeFd)
goto cleanup;
}
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("read of fd %d failed"),
readFd);
goto cleanup;
}
if (1 != (safewrite(writeFd, buf, 1))) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("write to fd %d failed"),
writeFd);
goto cleanup;
@@ -305,7 +305,7 @@ static int lxcControllerMain(int monitor,
/* create the epoll fild descriptor */
epollFd = epoll_create(2);
if (0 > epollFd) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_create(2) failed"));
goto cleanup;
}
@@ -315,13 +315,13 @@ static int lxcControllerMain(int monitor,
epollEvent.events = EPOLLIN|EPOLLET; /* edge triggered */
epollEvent.data.fd = appPty;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, appPty, &epollEvent)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_ctl(appPty) failed"));
goto cleanup;
}
epollEvent.data.fd = contPty;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, contPty, &epollEvent)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_ctl(contPty) failed"));
goto cleanup;
}
@@ -329,7 +329,7 @@ static int lxcControllerMain(int monitor,
epollEvent.events = EPOLLIN;
epollEvent.data.fd = monitor;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, monitor, &epollEvent)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_ctl(monitor) failed"));
goto cleanup;
}
@@ -337,7 +337,7 @@ static int lxcControllerMain(int monitor,
epollEvent.events = EPOLLHUP;
epollEvent.data.fd = client;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, client, &epollEvent)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_ctl(client) failed"));
goto cleanup;
}
@@ -357,13 +357,13 @@ static int lxcControllerMain(int monitor,
epollEvent.events = EPOLLHUP;
epollEvent.data.fd = client;
if (0 > epoll_ctl(epollFd, EPOLL_CTL_ADD, client, &epollEvent)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_ctl(client) failed"));
goto cleanup;
}
} else if (client != -1 && epollEvent.data.fd == client) {
if (0 > epoll_ctl(epollFd, EPOLL_CTL_DEL, client, &epollEvent)) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_ctl(client) failed"));
goto cleanup;
}
@@ -401,7 +401,7 @@ static int lxcControllerMain(int monitor,
}
/* error */
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("epoll_wait() failed"));
goto cleanup;
@@ -509,7 +509,7 @@ lxcControllerRun(virDomainDefPtr def,
char *devptmx = NULL;
if (socketpair(PF_UNIX, SOCK_STREAM, 0, control) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("sockpair failed"));
goto cleanup;
}
@@ -539,13 +539,13 @@ lxcControllerRun(virDomainDefPtr def,
if (root) {
VIR_DEBUG0("Setting up private /dev/pts");
if (unshare(CLONE_NEWNS) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Cannot unshare mount namespace"));
goto cleanup;
}
if (mount("", "/", NULL, MS_SLAVE|MS_REC, NULL) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to switch root mount into slave
mode"));
goto cleanup;
}
@@ -557,7 +557,7 @@ lxcControllerRun(virDomainDefPtr def,
}
if (virFileMakePath(devpts) != 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to make path %s"),
devpts);
goto cleanup;
@@ -565,7 +565,7 @@ lxcControllerRun(virDomainDefPtr def,
VIR_DEBUG("Mouting 'devpts' on %s", devpts);
if (mount("devpts", devpts, "devpts", 0,
"newinstance,ptmxmode=0666") < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to mount devpts on %s"),
devpts);
goto cleanup;
@@ -583,7 +583,7 @@ lxcControllerRun(virDomainDefPtr def,
&containerPty,
&containerPtyPath,
0) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to allocate tty"));
goto cleanup;
}
@@ -592,7 +592,7 @@ lxcControllerRun(virDomainDefPtr def,
if (virFileOpenTty(&containerPty,
&containerPtyPath,
0) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to allocate tty"));
goto cleanup;
}
@@ -769,7 +769,7 @@ int main(int argc, char *argv[])
if (pid > 0) {
if ((rc = virFileWritePid(LXC_STATE_DIR, name, pid)) != 0) {
- virReportSystemError(NULL, rc,
+ virReportSystemError(rc,
_("Unable to write pid file
'%s/%s.pid'"),
LXC_STATE_DIR, name);
_exit(1);
@@ -783,13 +783,13 @@ int main(int argc, char *argv[])
/* Don't hold onto any cwd we inherit from libvirtd either */
if (chdir("/") < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to change to root dir"));
goto cleanup;
}
if (setsid() < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to become session leader"));
goto cleanup;
}
@@ -800,7 +800,7 @@ int main(int argc, char *argv[])
/* Accept initial client which is the libvirtd daemon */
if ((client = accept(monitor, NULL, 0)) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to accept a connection from driver"));
goto cleanup;
}
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 858b7d4..a4143f5 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -707,7 +707,7 @@ static int lxcVmCleanup(virConnectPtr conn,
; /* empty */
if ((waitRc != vm->pid) && (errno != ECHILD)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("waitpid failed to wait for container %d: %d"),
vm->pid, waitRc);
}
@@ -838,7 +838,7 @@ static int lxcSetupInterfaces(virConnectPtr conn,
char macaddr[VIR_MAC_STRING_BUFLEN];
virFormatMacAddr(def->nets[i]->mac, macaddr);
if (0 != (rc = setMacAddr(containerVeth, macaddr))) {
- virReportSystemError(conn, rc,
+ virReportSystemError(rc,
_("Failed to set %s to %s"),
macaddr, containerVeth);
goto error_exit;
@@ -846,14 +846,14 @@ static int lxcSetupInterfaces(virConnectPtr conn,
}
if (0 != (rc = brAddInterface(brctl, bridge, parentVeth))) {
- virReportSystemError(conn, rc,
+ virReportSystemError(rc,
_("Failed to add %s device to %s"),
parentVeth, bridge);
goto error_exit;
}
if (0 != (rc = vethInterfaceUpOrDown(parentVeth, 1))) {
- virReportSystemError(conn, rc,
+ virReportSystemError(rc,
_("Failed to enable %s device"),
parentVeth);
goto error_exit;
@@ -884,7 +884,7 @@ static int lxcMonitorClient(virConnectPtr conn,
}
if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to create client socket"));
goto error;
}
@@ -898,7 +898,7 @@ static int lxcMonitorClient(virConnectPtr conn,
}
if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to connect to client socket"));
goto error;
}
@@ -930,7 +930,7 @@ static int lxcVmTerminate(virConnectPtr conn,
if (kill(vm->pid, signum) < 0) {
if (errno != ESRCH) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to kill pid %d"),
vm->pid);
return -1;
@@ -1131,7 +1131,7 @@ static int lxcControllerStart(virConnectPtr conn,
*/
while ((rc = waitpid(child, &status, 0) == -1) && errno == EINTR);
if (rc == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Cannot wait for '%s'"),
largv[0]);
goto cleanup;
@@ -1194,7 +1194,7 @@ static int lxcVmStart(virConnectPtr conn,
lxcDomainObjPrivatePtr priv = vm->privateData;
if ((r = virFileMakePath(driver->logDir)) != 0) {
- virReportSystemError(conn, r,
+ virReportSystemError(r,
_("Cannot create log directory '%s'"),
driver->logDir);
return -1;
@@ -1208,7 +1208,7 @@ static int lxcVmStart(virConnectPtr conn,
/* open parent tty */
if (virFileOpenTty(&parentTty, &parentTtyPath, 1) < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Failed to allocate tty"));
goto cleanup;
}
@@ -1229,7 +1229,7 @@ static int lxcVmStart(virConnectPtr conn,
if ((logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT,
S_IRUSR|S_IWUSR)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to open '%s'"),
logfile);
goto cleanup;
@@ -1249,7 +1249,7 @@ static int lxcVmStart(virConnectPtr conn,
/* And get its pid */
if ((r = virFileReadPid(driver->stateDir, vm->def->name, &vm->pid))
!= 0) {
- virReportSystemError(conn, r,
+ virReportSystemError(r,
_("Failed to read pid file %s/%s.pid"),
driver->stateDir, vm->def->name);
goto cleanup;
@@ -2139,21 +2139,21 @@ static int lxcDomainSetAutostart(virDomainPtr dom,
int err;
if ((err = virFileMakePath(driver->autostartDir))) {
- virReportSystemError(dom->conn, err,
+ virReportSystemError(err,
_("Cannot create autostart directory %s"),
driver->autostartDir);
goto cleanup;
}
if (symlink(configFile, autostartLink) < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Failed to create symlink '%s to
'%s'"),
autostartLink, configFile);
goto cleanup;
}
} else {
if (unlink(autostartLink) < 0 && errno != ENOENT && errno !=
ENOTDIR) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Failed to delete symlink '%s'"),
autostartLink);
goto cleanup;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 27678d0..63cd53e 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -242,7 +242,7 @@ networkStartup(int privileged) {
VIR_FREE(base);
if ((err = brInit(&driverState->brctl))) {
- virReportSystemError(NULL, err, "%s",
+ virReportSystemError(err, "%s",
_("cannot initialize bridge support"));
goto error;
}
@@ -539,13 +539,13 @@ dhcpStartDhcpDaemon(virConnectPtr conn,
}
if ((err = virFileMakePath(NETWORK_PID_DIR)) != 0) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot create directory %s"),
NETWORK_PID_DIR);
return -1;
}
if ((err = virFileMakePath(NETWORK_STATE_DIR)) != 0) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot create directory %s"),
NETWORK_STATE_DIR);
return -1;
@@ -589,16 +589,15 @@ cleanup:
}
static int
-networkAddMasqueradingIptablesRules(virConnectPtr conn,
- struct network_driver *driver,
- virNetworkObjPtr network) {
+networkAddMasqueradingIptablesRules(struct network_driver *driver,
+ virNetworkObjPtr network) {
int err;
/* allow forwarding packets from the bridge interface */
if ((err = iptablesAddForwardAllowOut(driver->iptables,
network->def->network,
network->def->bridge,
network->def->forwardDev))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow forwarding from
'%s'"),
network->def->bridge);
goto masqerr1;
@@ -609,7 +608,7 @@ networkAddMasqueradingIptablesRules(virConnectPtr conn,
network->def->network,
network->def->bridge,
network->def->forwardDev))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow forwarding to
'%s'"),
network->def->bridge);
goto masqerr2;
@@ -619,7 +618,7 @@ networkAddMasqueradingIptablesRules(virConnectPtr conn,
if ((err = iptablesAddForwardMasquerade(driver->iptables,
network->def->network,
network->def->forwardDev))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to enable masquerading
to '%s'\n"),
network->def->forwardDev ?
network->def->forwardDev : NULL);
goto masqerr3;
@@ -642,16 +641,15 @@ networkAddMasqueradingIptablesRules(virConnectPtr conn,
}
static int
-networkAddRoutingIptablesRules(virConnectPtr conn,
- struct network_driver *driver,
- virNetworkObjPtr network) {
+networkAddRoutingIptablesRules(struct network_driver *driver,
+ virNetworkObjPtr network) {
int err;
/* allow routing packets from the bridge interface */
if ((err = iptablesAddForwardAllowOut(driver->iptables,
network->def->network,
network->def->bridge,
network->def->forwardDev))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow routing from
'%s'"),
network->def->bridge);
goto routeerr1;
@@ -662,7 +660,7 @@ networkAddRoutingIptablesRules(virConnectPtr conn,
network->def->network,
network->def->bridge,
network->def->forwardDev))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow routing to
'%s'"),
network->def->bridge);
goto routeerr2;
@@ -681,21 +679,20 @@ networkAddRoutingIptablesRules(virConnectPtr conn,
}
static int
-networkAddIptablesRules(virConnectPtr conn,
- struct network_driver *driver,
- virNetworkObjPtr network) {
+networkAddIptablesRules(struct network_driver *driver,
+ virNetworkObjPtr network) {
int err;
/* allow DHCP requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->def->bridge, 67)))
{
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow DHCP requests
from '%s'"),
network->def->bridge);
goto err1;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->def->bridge, 67)))
{
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow DHCP requests
from '%s'"),
network->def->bridge);
goto err2;
@@ -703,14 +700,14 @@ networkAddIptablesRules(virConnectPtr conn,
/* allow DNS requests through to dnsmasq */
if ((err = iptablesAddTcpInput(driver->iptables, network->def->bridge, 53)))
{
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow DNS requests
from '%s'"),
network->def->bridge);
goto err3;
}
if ((err = iptablesAddUdpInput(driver->iptables, network->def->bridge, 53)))
{
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow DNS requests
from '%s'"),
network->def->bridge);
goto err4;
@@ -720,14 +717,14 @@ networkAddIptablesRules(virConnectPtr conn,
/* Catch all rules to block forwarding to/from bridges */
if ((err = iptablesAddForwardRejectOut(driver->iptables,
network->def->bridge))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to block outbound
traffic from '%s'"),
network->def->bridge);
goto err5;
}
if ((err = iptablesAddForwardRejectIn(driver->iptables,
network->def->bridge))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to block inbound traffic
to '%s'"),
network->def->bridge);
goto err6;
@@ -735,7 +732,7 @@ networkAddIptablesRules(virConnectPtr conn,
/* Allow traffic between guests on the same bridge */
if ((err = iptablesAddForwardAllowCross(driver->iptables,
network->def->bridge))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add iptables rule to allow cross bridge
traffic on '%s'"),
network->def->bridge);
goto err7;
@@ -744,11 +741,11 @@ networkAddIptablesRules(virConnectPtr conn,
/* If masquerading is enabled, set up the rules*/
if (network->def->forwardType == VIR_NETWORK_FORWARD_NAT &&
- !networkAddMasqueradingIptablesRules(conn, driver, network))
+ !networkAddMasqueradingIptablesRules(driver, network))
goto err8;
/* else if routing is enabled, set up the rules*/
else if (network->def->forwardType == VIR_NETWORK_FORWARD_ROUTE &&
- !networkAddRoutingIptablesRules(conn, driver, network))
+ !networkAddRoutingIptablesRules(driver, network))
goto err8;
return 1;
@@ -818,7 +815,7 @@ networkReloadIptablesRules(struct network_driver *driver)
if (virNetworkObjIsActive(driver->networks.objs[i])) {
networkRemoveIptablesRules(driver, driver->networks.objs[i]);
- if (!networkAddIptablesRules(NULL, driver, driver->networks.objs[i])) {
+ if (!networkAddIptablesRules(driver, driver->networks.objs[i])) {
/* failed to add but already logged */
}
}
@@ -836,8 +833,7 @@ networkEnableIpForwarding(void)
#define SYSCTL_PATH "/proc/sys"
-static int networkDisableIPV6(virConnectPtr conn,
- virNetworkObjPtr network)
+static int networkDisableIPV6(virNetworkObjPtr network)
{
char *field = NULL;
int ret = -1;
@@ -854,7 +850,7 @@ static int networkDisableIPV6(virConnectPtr conn,
}
if (virFileWriteStr(field, "1") < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot enable %s"), field);
goto cleanup;
}
@@ -866,7 +862,7 @@ static int networkDisableIPV6(virConnectPtr conn,
}
if (virFileWriteStr(field, "0") < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot disable %s"), field);
goto cleanup;
}
@@ -878,7 +874,7 @@ static int networkDisableIPV6(virConnectPtr conn,
}
if (virFileWriteStr(field, "1") < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot enable %s"), field);
goto cleanup;
}
@@ -901,13 +897,13 @@ static int networkStartNetworkDaemon(virConnectPtr conn,
}
if ((err = brAddBridge(driver->brctl, network->def->bridge))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot create bridge '%s'"),
network->def->bridge);
return -1;
}
- if (networkDisableIPV6(conn, network) < 0)
+ if (networkDisableIPV6(network) < 0)
goto err_delbr;
if (brSetForwardDelay(driver->brctl, network->def->bridge,
network->def->delay) < 0)
@@ -918,7 +914,7 @@ static int networkStartNetworkDaemon(virConnectPtr conn,
if (network->def->ipAddress &&
(err = brSetInetAddress(driver->brctl, network->def->bridge,
network->def->ipAddress))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot set IP address on bridge '%s' to
'%s'"),
network->def->bridge, network->def->ipAddress);
goto err_delbr;
@@ -926,25 +922,25 @@ static int networkStartNetworkDaemon(virConnectPtr conn,
if (network->def->netmask &&
(err = brSetInetNetmask(driver->brctl, network->def->bridge,
network->def->netmask))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot set netmask on bridge '%s' to
'%s'"),
network->def->bridge, network->def->netmask);
goto err_delbr;
}
if ((err = brSetInterfaceUp(driver->brctl, network->def->bridge, 1))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to bring the bridge '%s' up"),
network->def->bridge);
goto err_delbr;
}
- if (!networkAddIptablesRules(conn, driver, network))
+ if (!networkAddIptablesRules(driver, network))
goto err_delbr1;
if (network->def->forwardType != VIR_NETWORK_FORWARD_NONE &&
networkEnableIpForwarding() < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("failed to enable IP forwarding"));
goto err_delbr2;
}
@@ -1519,21 +1515,21 @@ static int networkSetAutostart(virNetworkPtr net,
if (autostart) {
if (virFileMakePath(driver->networkAutostartDir)) {
- virReportSystemError(net->conn, errno,
+ virReportSystemError(errno,
_("cannot create autostart directory
'%s'"),
driver->networkAutostartDir);
goto cleanup;
}
if (symlink(configFile, autostartLink) < 0) {
- virReportSystemError(net->conn, errno,
+ virReportSystemError(errno,
_("Failed to create symlink '%s' to
'%s'"),
autostartLink, configFile);
goto cleanup;
}
} else {
if (unlink(autostartLink) < 0 && errno != ENOENT && errno
!= ENOTDIR) {
- virReportSystemError(net->conn, errno,
+ virReportSystemError(errno,
_("Failed to delete symlink
'%s'"),
autostartLink);
goto cleanup;
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 74258be..fd96874 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -74,8 +74,7 @@ static int update_caps(virNodeDeviceObjPtr dev)
/* Under libudev changes to the driver name should be picked up as
* "change" events, so we don't call update driver name unless we're
* using the HAL backend. */
-static int update_driver_name(virConnectPtr conn,
- virNodeDeviceObjPtr dev)
+static int update_driver_name(virNodeDeviceObjPtr dev)
{
char *driver_link = NULL;
char *devpath = NULL;
@@ -97,7 +96,7 @@ static int update_driver_name(virConnectPtr conn,
}
if (virFileResolveLink(driver_link, &devpath) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot resolve driver link %s"), driver_link);
goto cleanup;
}
@@ -119,8 +118,7 @@ cleanup:
}
#else
/* XXX: Implement me for non-linux */
-static int update_driver_name(virConnectPtr conn ATTRIBUTE_UNUSED,
- virNodeDeviceObjPtr dev ATTRIBUTE_UNUSED)
+static int update_driver_name(virNodeDeviceObjPtr dev ATTRIBUTE_UNUSED)
{
return 0;
}
@@ -282,7 +280,7 @@ static char *nodeDeviceDumpXML(virNodeDevicePtr dev,
goto cleanup;
}
- update_driver_name(dev->conn, obj);
+ update_driver_name(obj);
update_caps(obj);
ret = virNodeDeviceDefFormat(dev->conn, obj->def);
@@ -448,7 +446,7 @@ nodeDeviceVportCreateDelete(virConnectPtr conn,
}
if (virFileWriteStr(operation_path, vport_name) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Write of '%s' to '%s' during "
"vport create/delete failed"),
vport_name, operation_path);
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 7d26b2b..2d44609 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -155,7 +155,7 @@ int nodeGetInfo(virConnectPtr conn,
int ret;
FILE *cpuinfo = fopen(CPUINFO_PATH, "r");
if (!cpuinfo) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open %s"), CPUINFO_PATH);
return -1;
}
diff --git a/src/qemu/qemu_bridge_filter.c b/src/qemu/qemu_bridge_filter.c
index f591917..f700631 100644
--- a/src/qemu/qemu_bridge_filter.c
+++ b/src/qemu/qemu_bridge_filter.c
@@ -39,7 +39,7 @@ networkAddEbtablesRules(struct qemud_driver *driver) {
/* Set forward policy to DROP */
if ((err = ebtablesAddForwardPolicyReject(driver->ebtables))) {
- virReportSystemError(NULL, err,
+ virReportSystemError(err,
_("failed to add ebtables rule to set default policy to drop on
'%s'"),
__FILE__);
return err;
@@ -55,7 +55,7 @@ networkDisableAllFrames(struct qemud_driver *driver) {
/* add default rules */
if ((err = networkAddEbtablesRules(driver))) {
- virReportSystemError(NULL, err,
+ virReportSystemError(err,
_("cannot filter mac addresses on bridge
'%s'"),
__FILE__);
return err;
@@ -64,8 +64,7 @@ networkDisableAllFrames(struct qemud_driver *driver) {
}
int
-networkAllowMacOnPort(virConnectPtr conn,
- struct qemud_driver *driver,
+networkAllowMacOnPort(struct qemud_driver *driver,
const char * ifname,
const unsigned char * mac) {
@@ -76,7 +75,7 @@ networkAllowMacOnPort(virConnectPtr conn,
if ((err = ebtablesAddForwardAllowIn(ebtablescontext,
ifname,
mac))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add ebtables rule to allow routing to
'%s'"),
ifname);
}
@@ -86,8 +85,7 @@ networkAllowMacOnPort(virConnectPtr conn,
int
-networkDisallowMacOnPort(virConnectPtr conn,
- struct qemud_driver *driver,
+networkDisallowMacOnPort(struct qemud_driver *driver,
const char * ifname,
const unsigned char * mac) {
@@ -98,7 +96,7 @@ networkDisallowMacOnPort(virConnectPtr conn,
if ((err = ebtablesRemoveForwardAllowIn(ebtablescontext,
ifname,
mac))) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("failed to add ebtables rule to allow routing to
'%s'"),
ifname);
}
diff --git a/src/qemu/qemu_bridge_filter.h b/src/qemu/qemu_bridge_filter.h
index ccb4710..23937f1 100644
--- a/src/qemu/qemu_bridge_filter.h
+++ b/src/qemu/qemu_bridge_filter.h
@@ -24,12 +24,10 @@
#define __QEMUD_BRIDGE_FILTER_H__
-int networkAllowMacOnPort(virConnectPtr conn,
- struct qemud_driver *driver,
- const char * ifname,
- const unsigned char * mac);
-int networkDisallowMacOnPort(virConnectPtr conn,
- struct qemud_driver *driver,
+int networkAllowMacOnPort(struct qemud_driver *driver,
+ const char * ifname,
+ const unsigned char * mac);
+int networkDisallowMacOnPort(struct qemud_driver *driver,
const char * ifname,
const unsigned char * mac);
int networkDisableAllFrames(struct qemud_driver *driver);
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 0ce5790..3d16ed9 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -119,7 +119,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
if (driver->privileged &&
!(driver->hugetlbfs_mount = virFileFindMountPoint("hugetlbfs"))) {
if (errno != ENOENT) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("unable to find hugetlbfs mountpoint"));
return -1;
}
@@ -333,13 +333,13 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
driver->macFilter = p->l;
if (!(driver->ebtables = ebtablesContextNew("qemu"))) {
driver->macFilter = 0;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("failed to enable mac filter in in
'%s'"),
__FILE__);
}
if ((errno = networkDisableAllFrames(driver))) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("failed to add rule to drop all frames in
'%s'"),
__FILE__);
}
@@ -491,7 +491,7 @@ qemudProbeMachineTypes(const char *binary,
len = virFileReadLimFD(newstdout, MAX_MACHINES_OUTPUT_SIZE, &output);
if (len < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to read 'qemu -M ?' output"));
goto cleanup;
}
@@ -725,7 +725,7 @@ qemudProbeCPUModels(const char *qemu,
len = virFileReadLimFD(newstdout, MAX_MACHINES_OUTPUT_SIZE, &output);
if (len < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to read QEMU supported CPU models"));
goto cleanup;
}
@@ -1338,7 +1338,7 @@ int qemudExtractVersionInfo(const char *qemu,
enum { MAX_HELP_OUTPUT_SIZE = 1024*64 };
int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help);
if (len < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to read QEMU help output"));
goto cleanup2;
}
@@ -1392,8 +1392,7 @@ uname_normalize (struct utsname *ut)
ut->machine[1] = '6';
}
-int qemudExtractVersion(virConnectPtr conn,
- struct qemud_driver *driver) {
+int qemudExtractVersion(struct qemud_driver *driver) {
const char *binary;
struct stat sb;
struct utsname ut;
@@ -1409,7 +1408,7 @@ int qemudExtractVersion(virConnectPtr conn,
return -1;
if (stat(binary, &sb) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Cannot find QEMU binary %s"), binary);
return -1;
}
@@ -1458,7 +1457,7 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
}
if (!driver->brctl && (err = brInit(&driver->brctl))) {
- virReportSystemError(conn, err, "%s",
+ virReportSystemError(err, "%s",
_("cannot initialize bridge support"));
goto cleanup;
}
@@ -1487,11 +1486,11 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
_("Failed to add tap interface to bridge. "
"%s is not a bridge device"), brname);
} else if (template_ifname) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("Failed to add tap interface to bridge
'%s'"),
brname);
} else {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("Failed to add tap interface '%s' to
bridge '%s'"),
net->ifname, brname);
}
@@ -1501,8 +1500,8 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
}
if (driver->macFilter) {
- if ((err = networkAllowMacOnPort(conn, driver, net->ifname, net->mac))) {
- virReportSystemError(conn, err,
+ if ((err = networkAllowMacOnPort(driver, net->ifname, net->mac))) {
+ virReportSystemError(err,
_("failed to add ebtables rule to allow MAC address on
'%s'"),
net->ifname);
}
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 101f187..5525b6c 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -167,8 +167,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
virCapsPtr qemudCapsInit (virCapsPtr old_caps);
-int qemudExtractVersion (virConnectPtr conn,
- struct qemud_driver *driver);
+int qemudExtractVersion (struct qemud_driver *driver);
int qemudExtractVersionInfo (const char *qemu,
unsigned int *version,
unsigned int *flags);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e75e9a2..98086f5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -307,7 +307,7 @@ static int qemuDomainObjBeginJob(virDomainObjPtr obj)
unsigned long long then;
if (gettimeofday(&now, NULL) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("cannot get time of day"));
return -1;
}
@@ -323,7 +323,7 @@ static int qemuDomainObjBeginJob(virDomainObjPtr obj)
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_TIMEOUT,
"%s", _("cannot acquire state change
lock"));
else
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
"%s", _("cannot acquire job
mutex"));
return -1;
}
@@ -349,7 +349,7 @@ static int qemuDomainObjBeginJobWithDriver(struct qemud_driver
*driver,
unsigned long long then;
if (gettimeofday(&now, NULL) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("cannot get time of day"));
return -1;
}
@@ -366,7 +366,7 @@ static int qemuDomainObjBeginJobWithDriver(struct qemud_driver
*driver,
qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_TIMEOUT,
"%s", _("cannot acquire state change
lock"));
else
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
"%s", _("cannot acquire job
mutex"));
qemuDriverLock(driver);
return -1;
@@ -497,7 +497,7 @@ static int qemuCgroupControllerActive(struct qemud_driver *driver,
}
static int
-qemudLogFD(virConnectPtr conn, struct qemud_driver *driver, const char* name)
+qemudLogFD(struct qemud_driver *driver, const char* name)
{
char logfile[PATH_MAX];
mode_t logmode;
@@ -518,13 +518,13 @@ qemudLogFD(virConnectPtr conn, struct qemud_driver *driver, const
char* name)
logmode |= O_TRUNC;
if ((fd = open(logfile, logmode, S_IRUSR | S_IWUSR)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to create logfile %s"),
logfile);
return -1;
}
if (virSetCloseExec(fd) < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to set VM logfile close-on-exec
flag"));
close(fd);
return -1;
@@ -550,19 +550,19 @@ qemudLogReadFD(virConnectPtr conn, const char* logDir, const char*
name, off_t p
if ((fd = open(logfile, logmode)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to create logfile %s"),
logfile);
return -1;
}
if (virSetCloseExec(fd) < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("Unable to set VM logfile close-on-exec
flag"));
close(fd);
return -1;
}
if (pos < 0 || lseek(fd, pos, SEEK_SET) < 0) {
- virReportSystemError(conn, pos < 0 ? 0 : errno,
+ virReportSystemError(pos < 0 ? 0 : errno,
_("Unable to seek to %lld in %s"),
(long long) pos, logfile);
close(fd);
@@ -1114,13 +1114,13 @@ qemudStartup(int privileged) {
if (privileged) {
if (chown(qemu_driver->libDir, qemu_driver->user, qemu_driver->group)
< 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("unable to set ownership of '%s' to user
%d:%d"),
qemu_driver->libDir, qemu_driver->user,
qemu_driver->group);
goto error;
}
if (chown(qemu_driver->cacheDir, qemu_driver->user, qemu_driver->group)
< 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("unable to set ownership of '%s' to
%d:%d"),
qemu_driver->cacheDir, qemu_driver->user,
qemu_driver->group);
goto error;
@@ -1141,14 +1141,14 @@ qemudStartup(int privileged) {
goto out_of_memory;
if ((rc = virFileMakePath(mempath)) != 0) {
- virReportSystemError(NULL, rc,
+ virReportSystemError(rc,
_("unable to create hugepage path %s"),
mempath);
VIR_FREE(mempath);
goto error;
}
if (qemu_driver->privileged &&
chown(mempath, qemu_driver->user, qemu_driver->group) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("unable to set ownership on %s to %d:%d"),
mempath, qemu_driver->user, qemu_driver->group);
VIR_FREE(mempath);
@@ -1348,7 +1348,7 @@ qemudReadLogOutput(virConnectPtr conn,
* always have something useful to report on failure. */
ret = saferead(fd, buf+got, buflen-got-1);
if (ret < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failure while reading %s log output"),
what);
return -1;
@@ -2324,8 +2324,7 @@ static const char *const defaultDeviceACL[] = {
#define DEVICE_PTY_MAJOR 136
#define DEVICE_SND_MAJOR 116
-static int qemuSetupCgroup(virConnectPtr conn,
- struct qemud_driver *driver,
+static int qemuSetupCgroup(struct qemud_driver *driver,
virDomainObjPtr vm)
{
virCgroupPtr cgroup = NULL;
@@ -2341,7 +2340,7 @@ static int qemuSetupCgroup(virConnectPtr conn,
rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 1);
if (rc != 0) {
- virReportSystemError(conn, -rc,
+ virReportSystemError(-rc,
_("Unable to create cgroup for %s"),
vm->def->name);
goto cleanup;
@@ -2355,7 +2354,7 @@ static int qemuSetupCgroup(virConnectPtr conn,
goto done;
}
- virReportSystemError(conn, -rc,
+ virReportSystemError(-rc,
_("Unable to deny all devices for %s"),
vm->def->name);
goto cleanup;
}
@@ -2368,7 +2367,7 @@ static int qemuSetupCgroup(virConnectPtr conn,
rc = virCgroupAllowDevicePath(cgroup,
vm->def->disks[i]->src);
if (rc != 0) {
- virReportSystemError(conn, -rc,
+ virReportSystemError(-rc,
_("Unable to allow device %s for %s"),
vm->def->disks[i]->src,
vm->def->name);
goto cleanup;
@@ -2377,7 +2376,7 @@ static int qemuSetupCgroup(virConnectPtr conn,
rc = virCgroupAllowDeviceMajor(cgroup, 'c', DEVICE_PTY_MAJOR);
if (rc != 0) {
- virReportSystemError(conn, -rc, "%s",
+ virReportSystemError(-rc, "%s",
_("unable to allow /dev/pts/ devices"));
goto cleanup;
}
@@ -2385,7 +2384,7 @@ static int qemuSetupCgroup(virConnectPtr conn,
if (vm->def->nsounds) {
rc = virCgroupAllowDeviceMajor(cgroup, 'c', DEVICE_SND_MAJOR);
if (rc != 0) {
- virReportSystemError(conn, -rc, "%s",
+ virReportSystemError(-rc, "%s",
_("unable to allow /dev/snd/ devices"));
goto cleanup;
}
@@ -2396,7 +2395,7 @@ static int qemuSetupCgroup(virConnectPtr conn,
deviceACL[i]);
if (rc < 0 &&
rc != -ENOENT) {
- virReportSystemError(conn, -rc,
+ virReportSystemError(-rc,
_("unable to allow device %s"),
deviceACL[i]);
goto cleanup;
@@ -2454,7 +2453,7 @@ static int qemuAddToCgroup(struct qemud_driver *driver,
rc = virCgroupForDomain(driver->cgroup, def->name, &cgroup, 0);
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("unable to find cgroup for domain %s"),
def->name);
goto cleanup;
@@ -2462,7 +2461,7 @@ static int qemuAddToCgroup(struct qemud_driver *driver,
rc = virCgroupAddTask(cgroup, getpid());
if (rc != 0) {
- virReportSystemError(NULL, -rc,
+ virReportSystemError(-rc,
_("unable to add domain %s task %d to cgroup"),
def->name, getpid());
goto cleanup;
@@ -2582,13 +2581,13 @@ static int qemudStartVMDaemon(virConnectPtr conn,
}
if (virFileMakePath(driver->logDir) != 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot create log directory %s"),
driver->logDir);
goto cleanup;
}
- if ((logfile = qemudLogFD(conn, driver, vm->def->name)) < 0)
+ if ((logfile = qemudLogFD(driver, vm->def->name)) < 0)
goto cleanup;
emulator = vm->def->emulator;
@@ -2598,7 +2597,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
* in a sub-process so its hard to feed back a useful error
*/
if (stat(emulator, &sb) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Cannot find QEMU binary %s"),
emulator);
goto cleanup;
@@ -2609,7 +2608,7 @@ static int qemudStartVMDaemon(virConnectPtr conn,
&qemuCmdFlags) < 0)
goto cleanup;
- if (qemuSetupCgroup(conn, driver, vm) < 0)
+ if (qemuSetupCgroup(driver, vm) < 0)
goto cleanup;
if (qemuPrepareHostDevices(conn, driver, vm->def) < 0)
@@ -2631,14 +2630,14 @@ static int qemudStartVMDaemon(virConnectPtr conn,
priv->monJSON = 0;
if ((ret = virFileDeletePid(driver->stateDir, vm->def->name)) != 0) {
- virReportSystemError(conn, ret,
+ virReportSystemError(ret,
_("Cannot remove stale PID file for %s"),
vm->def->name);
goto cleanup;
}
if (!(pidfile = virFilePid(driver->stateDir, vm->def->name))) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("Failed to build pidfile
path."));
goto cleanup;
}
@@ -2839,9 +2838,9 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
virDomainNetDefPtr net = def->nets[i];
if (net->ifname == NULL)
continue;
- if ((errno = networkDisallowMacOnPort(conn, driver, net->ifname,
+ if ((errno = networkDisallowMacOnPort(driver, net->ifname,
net->mac))) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to remove ebtables rule to allow MAC address on
'%s'"),
net->ifname);
}
@@ -2850,7 +2849,7 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
if (virKillProcess(vm->pid, 0) == 0 &&
virKillProcess(vm->pid, SIGTERM) < 0)
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to send SIGTERM to %s (%d)"),
vm->def->name, vm->pid);
@@ -3036,7 +3035,7 @@ static int kvmGetMaxVCPUs(void) {
fd = open(KVM_DEVICE, O_RDONLY);
if (fd < 0) {
- virReportSystemError(NULL, errno, _("Unable to open %s"), KVM_DEVICE);
+ virReportSystemError(errno, _("Unable to open %s"), KVM_DEVICE);
return -1;
}
@@ -3282,7 +3281,7 @@ static int qemudGetVersion(virConnectPtr conn, unsigned long
*version) {
int ret = -1;
qemuDriverLock(driver);
- if (qemudExtractVersion(conn, driver) < 0)
+ if (qemudExtractVersion(driver) < 0)
goto cleanup;
*version = qemu_driver->qemuVersion;
@@ -3925,7 +3924,7 @@ static int qemudDomainSave(virDomainPtr dom,
}
if (close(fd) < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("unable to save file %s"),
path);
goto endjob;
@@ -4040,7 +4039,7 @@ static int qemudDomainCoreDump(virDomainPtr dom,
}
if (close(fd) < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("unable to save file %s"),
path);
goto endjob;
@@ -4302,7 +4301,7 @@ qemudDomainGetVcpus(virDomainPtr dom,
&(info[i].cpu),
vm->pid,
priv->vcpupids[i]) < 0) {
- virReportSystemError(dom->conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("cannot get vCPU placement & pCPU
time"));
goto cleanup;
}
@@ -4780,7 +4779,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
* in a sub-process so its hard to feed back a useful error
*/
if (stat(emulator, &sb) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Cannot find QEMU binary %s"),
emulator);
goto cleanup;
@@ -6239,11 +6238,10 @@ qemudDomainDetachNetDevice(virConnectPtr conn,
qemuDomainObjExitMonitorWithDriver(driver, vm);
if ((driver->macFilter) && (detach->ifname != NULL)) {
- if ((errno = networkDisallowMacOnPort(conn,
- driver,
+ if ((errno = networkDisallowMacOnPort(driver,
detach->ifname,
detach->mac))) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to remove ebtables rule on '%s'"),
detach->ifname);
}
@@ -6523,21 +6521,21 @@ static int qemudDomainSetAutostart(virDomainPtr dom,
int err;
if ((err = virFileMakePath(driver->autostartDir))) {
- virReportSystemError(dom->conn, err,
+ virReportSystemError(err,
_("cannot create autostart directory
%s"),
driver->autostartDir);
goto cleanup;
}
if (symlink(configFile, autostartLink) < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Failed to create symlink '%s to
'%s'"),
autostartLink, configFile);
goto cleanup;
}
} else {
if (unlink(autostartLink) < 0 && errno != ENOENT && errno
!= ENOTDIR) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Failed to delete symlink
'%s'"),
autostartLink);
goto cleanup;
@@ -6627,7 +6625,7 @@ static int qemuSetSchedulerParameters(virDomainPtr dom,
rc = virCgroupSetCpuShares(group, params[i].value.ul);
if (rc != 0) {
- virReportSystemError(dom->conn, -rc, "%s",
+ virReportSystemError(-rc, "%s",
_("unable to set cpu shares tunable"));
goto cleanup;
}
@@ -6687,7 +6685,7 @@ static int qemuGetSchedulerParameters(virDomainPtr dom,
rc = virCgroupGetCpuShares(group, &val);
if (rc != 0) {
- virReportSystemError(dom->conn, -rc, "%s",
+ virReportSystemError(-rc, "%s",
_("unable to get cpu shares tunable"));
goto cleanup;
}
@@ -6924,8 +6922,8 @@ qemudDomainBlockPeek (virDomainPtr dom,
/* The path is correct, now try to open it and get its size. */
fd = open (path, O_RDONLY);
if (fd == -1) {
- virReportSystemError (dom->conn, errno,
- _("%s: failed to open"), path);
+ virReportSystemError(errno,
+ _("%s: failed to open"), path);
goto cleanup;
}
@@ -6935,8 +6933,8 @@ qemudDomainBlockPeek (virDomainPtr dom,
*/
if (lseek (fd, offset, SEEK_SET) == (off_t) -1 ||
saferead (fd, buffer, size) == (ssize_t) -1) {
- virReportSystemError (dom->conn, errno,
- _("%s: failed to seek or read"), path);
+ virReportSystemError(errno,
+ _("%s: failed to seek or read"), path);
goto cleanup;
}
@@ -6999,8 +6997,8 @@ qemudDomainMemoryPeek (virDomainPtr dom,
/* Create a temporary filename. */
if ((fd = mkstemp (tmp)) == -1) {
- virReportSystemError (dom->conn, errno,
- _("mkstemp(\"%s\") failed"), tmp);
+ virReportSystemError(errno,
+ _("mkstemp(\"%s\") failed"), tmp);
goto endjob;
}
@@ -7021,9 +7019,9 @@ qemudDomainMemoryPeek (virDomainPtr dom,
/* Read the memory file into buffer. */
if (saferead (fd, buffer, size) == (ssize_t) -1) {
- virReportSystemError (dom->conn, errno,
- _("failed to read temporary file "
- "created with template %s"), tmp);
+ virReportSystemError(errno,
+ _("failed to read temporary file "
+ "created with template %s"), tmp);
goto endjob;
}
@@ -7389,7 +7387,7 @@ retry:
goto retry;
} else {
ret = -1;
- virReportSystemError(st->conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("cannot write to stream"));
}
}
@@ -7529,7 +7527,7 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
virDomainRemoveInactive(&driver->domains, vm);
vm = NULL;
}
- virReportSystemError(dconn, errno,
+ virReportSystemError(errno,
_("cannot open unix socket '%s' for tunnelled
migration"),
unixfile);
goto endjob;
@@ -7833,7 +7831,7 @@ static int doTunnelSendAll(virDomainPtr dom,
nbytes = saferead(sock, buffer, nbytes);
if (nbytes < 0) {
virStreamAbort(st);
- virReportSystemError(dom->conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("tunnelled migration failed to read from
qemu"));
return -1;
}
@@ -7900,7 +7898,7 @@ static int doTunnelMigrate(virDomainPtr dom,
qemu_sock = socket(AF_UNIX, SOCK_STREAM, 0);
if (qemu_sock < 0) {
- virReportSystemError(dom->conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("cannot open tunnelled migration socket"));
goto cleanup;
}
@@ -7915,13 +7913,13 @@ static int doTunnelMigrate(virDomainPtr dom,
}
unlink(unixfile);
if (bind(qemu_sock, (struct sockaddr *)&sa_qemu, sizeof(sa_qemu)) < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Cannot bind to unix socket '%s' for
tunnelled migration"),
unixfile);
goto cleanup;
}
if (listen(qemu_sock, 1) < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Cannot listen on unix socket '%s' for
tunnelled migration"),
unixfile);
goto cleanup;
@@ -8005,7 +8003,7 @@ static int doTunnelMigrate(virDomainPtr dom,
while ((client_sock = accept(qemu_sock, (struct sockaddr *)&sa_client,
&addrlen)) < 0) {
if (errno == EAGAIN || errno == EINTR)
continue;
- virReportSystemError(dom->conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("tunnelled migration failed to accept from
qemu"));
goto cancel;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index c1db64c..b702a81 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -232,7 +232,7 @@ qemuMonitorOpenUnix(const char *monitor)
int ret, i = 0;
if ((monfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
"%s", _("failed to create socket"));
return -1;
}
@@ -257,14 +257,14 @@ qemuMonitorOpenUnix(const char *monitor)
continue;
}
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("failed to connect to monitor socket"));
goto error;
} while ((++i <= timeout*5) && (usleep(.2 * 1000000) <= 0));
if (ret != 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("monitor socket did not show up."));
goto error;
}
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 6ced8cd..25ddfa9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -222,7 +222,7 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
}
if (ret < 0)
- virReportSystemError(NULL, msg.lastErrno,
+ virReportSystemError(msg.lastErrno,
_("cannot send monitor command '%s'"),
cmdstr);
cleanup:
@@ -331,7 +331,7 @@ qemuMonitorJSONCommandAddTimestamp(virJSONValuePtr obj)
virJSONValuePtr timestamp = NULL;
if (gettimeofday(&tv, NULL) < 0) {
- virReportSystemError(NULL, errno, "%s",
+ virReportSystemError(errno, "%s",
_("cannot query time of day"));
return -1;
}
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index ce325f5..b8fa64f 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -250,7 +250,7 @@ qemuMonitorCommandWithHandler(qemuMonitorPtr mon,
}
if (ret < 0) {
- virReportSystemError(NULL, msg.lastErrno,
+ virReportSystemError(msg.lastErrno,
_("cannot send monitor command '%s'"),
cmd);
VIR_FREE(*reply);
}
diff --git a/src/qemu/qemu_security_dac.c b/src/qemu/qemu_security_dac.c
index ea7f904..e6ada9a 100644
--- a/src/qemu/qemu_security_dac.c
+++ b/src/qemu/qemu_security_dac.c
@@ -35,7 +35,7 @@ void qemuSecurityDACSetDriver(struct qemud_driver *newdriver)
static int
-qemuSecurityDACSetOwnership(virConnectPtr conn, const char *path, int uid, int gid)
+qemuSecurityDACSetOwnership(const char *path, int uid, int gid)
{
VIR_INFO("Setting DAC context on '%s' to '%d:%d'", path,
uid, gid);
@@ -67,7 +67,7 @@ qemuSecurityDACSetOwnership(virConnectPtr conn, const char *path, int
uid, int g
VIR_INFO("Setting security context '%d:%d' on '%s' not
possible on readonly filesystem",
uid, gid, path);
} else {
- virReportSystemError(conn, chown_errno,
+ virReportSystemError(chown_errno,
_("unable to set security context '%d:%d'
on '%s'"),
uid, gid, path);
return -1;
@@ -77,8 +77,7 @@ qemuSecurityDACSetOwnership(virConnectPtr conn, const char *path, int
uid, int g
}
static int
-qemuSecurityDACRestoreSecurityFileLabel(virConnectPtr conn,
- const char *path)
+qemuSecurityDACRestoreSecurityFileLabel(const char *path)
{
struct stat buf;
int rc = -1;
@@ -88,7 +87,7 @@ qemuSecurityDACRestoreSecurityFileLabel(virConnectPtr conn,
VIR_INFO("Restoring DAC context on '%s'", path);
if ((err = virFileResolveLink(path, &newpath)) < 0) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot resolve symlink %s"), path);
goto err;
}
@@ -97,7 +96,7 @@ qemuSecurityDACRestoreSecurityFileLabel(virConnectPtr conn,
goto err;
/* XXX record previous ownership */
- rc = qemuSecurityDACSetOwnership(conn, newpath, 0, 0);
+ rc = qemuSecurityDACSetOwnership(newpath, 0, 0);
err:
VIR_FREE(newpath);
@@ -136,8 +135,8 @@ qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
return -1;
if (meta.backingStore != NULL &&
- qemuSecurityDACSetOwnership(conn, meta.backingStore,
- driver->user, driver->group) < 0) {
+ qemuSecurityDACSetOwnership(meta.backingStore,
+ driver->user, driver->group) < 0) {
VIR_FREE(meta.backingStore);
return -1;
}
@@ -145,12 +144,12 @@ qemuSecurityDACSetSecurityImageLabel(virConnectPtr conn,
path = meta.backingStore;
} while (path != NULL);
- return qemuSecurityDACSetOwnership(conn, disk->src, driver->user,
driver->group);
+ return qemuSecurityDACSetOwnership(disk->src, driver->user, driver->group);
}
static int
-qemuSecurityDACRestoreSecurityImageLabel(virConnectPtr conn,
+qemuSecurityDACRestoreSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm ATTRIBUTE_UNUSED,
virDomainDiskDefPtr disk)
{
@@ -171,27 +170,27 @@ qemuSecurityDACRestoreSecurityImageLabel(virConnectPtr conn,
if (!disk->src)
return 0;
- return qemuSecurityDACRestoreSecurityFileLabel(conn, disk->src);
+ return qemuSecurityDACRestoreSecurityFileLabel(disk->src);
}
static int
-qemuSecurityDACSetSecurityPCILabel(virConnectPtr conn,
+qemuSecurityDACSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file,
void *opaque ATTRIBUTE_UNUSED)
{
- return qemuSecurityDACSetOwnership(conn, file, driver->user, driver->group);
+ return qemuSecurityDACSetOwnership(file, driver->user, driver->group);
}
static int
-qemuSecurityDACSetSecurityUSBLabel(virConnectPtr conn,
+qemuSecurityDACSetSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file,
void *opaque ATTRIBUTE_UNUSED)
{
- return qemuSecurityDACSetOwnership(conn, file, driver->user, driver->group);
+ return qemuSecurityDACSetOwnership(file, driver->user, driver->group);
}
@@ -252,22 +251,22 @@ done:
static int
-qemuSecurityDACRestoreSecurityPCILabel(virConnectPtr conn,
+qemuSecurityDACRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file,
void *opaque ATTRIBUTE_UNUSED)
{
- return qemuSecurityDACRestoreSecurityFileLabel(conn, file);
+ return qemuSecurityDACRestoreSecurityFileLabel(file);
}
static int
-qemuSecurityDACRestoreSecurityUSBLabel(virConnectPtr conn,
+qemuSecurityDACRestoreSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file,
void *opaque ATTRIBUTE_UNUSED)
{
- return qemuSecurityDACRestoreSecurityFileLabel(conn, file);
+ return qemuSecurityDACRestoreSecurityFileLabel(file);
}
@@ -380,26 +379,26 @@ qemuSecurityDACSetSecurityAllLabel(virConnectPtr conn,
static int
-qemuSecurityDACSetSavedStateLabel(virConnectPtr conn,
+qemuSecurityDACSetSavedStateLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm ATTRIBUTE_UNUSED,
const char *savefile)
{
if (!driver->privileged || !driver->dynamicOwnership)
return 0;
- return qemuSecurityDACSetOwnership(conn, savefile, driver->user,
driver->group);
+ return qemuSecurityDACSetOwnership(savefile, driver->user, driver->group);
}
static int
-qemuSecurityDACRestoreSavedStateLabel(virConnectPtr conn,
+qemuSecurityDACRestoreSavedStateLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm ATTRIBUTE_UNUSED,
const char *savefile)
{
if (!driver->privileged || !driver->dynamicOwnership)
return 0;
- return qemuSecurityDACRestoreSecurityFileLabel(conn, savefile);
+ return qemuSecurityDACRestoreSecurityFileLabel(savefile);
}
@@ -415,7 +414,7 @@ qemuSecurityDACSetProcessLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
if (driver->group) {
if (setregid(driver->group, driver->group) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot change to '%d' group"),
driver->group);
return -1;
@@ -423,7 +422,7 @@ qemuSecurityDACSetProcessLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
}
if (driver->user) {
if (setreuid(driver->user, driver->user) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot change to '%d' user"),
driver->user);
return -1;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 809d386..c5ed859 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -639,7 +639,7 @@ doRemoteOpen (virConnectPtr conn,
}
freeaddrinfo (res);
- virReportSystemError(conn, saved_errno,
+ virReportSystemError(saved_errno,
_("unable to connect to libvirtd at
'%s'"),
priv->hostname);
goto failed;
@@ -696,7 +696,7 @@ doRemoteOpen (virConnectPtr conn,
priv->is_secure = 1;
priv->sock = socket (AF_UNIX, SOCK_STREAM, 0);
if (priv->sock == -1) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("unable to create socket"));
goto failed;
}
@@ -720,7 +720,7 @@ doRemoteOpen (virConnectPtr conn,
goto autostart_retry;
}
}
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("unable to connect to '%s'"),
sockname);
goto failed;
@@ -788,7 +788,7 @@ doRemoteOpen (virConnectPtr conn,
* to faff around with two file descriptors (a la 'pipe(2)').
*/
if (socketpair (PF_UNIX, SOCK_STREAM, 0, sv) == -1) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("unable to create socket pair"));
goto failed;
}
@@ -821,13 +821,13 @@ doRemoteOpen (virConnectPtr conn,
} /* switch (transport) */
if (virSetNonBlock(priv->sock) < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("unable to make socket non-blocking"));
goto failed;
}
if (pipe(wakeupFD) < 0) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("unable to make pipe"));
goto failed;
}
@@ -1099,11 +1099,11 @@ static gnutls_certificate_credentials_t x509_cred;
static int
-check_cert_file (virConnectPtr conn, const char *type, const char *file)
+check_cert_file(const char *type, const char *file)
{
struct stat sb;
if (stat(file, &sb) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Cannot access %s '%s'"),
type, file);
return -1;
@@ -1132,11 +1132,11 @@ initialise_gnutls (virConnectPtr conn)
}
- if (check_cert_file(conn, "CA certificate", LIBVIRT_CACERT) < 0)
+ if (check_cert_file("CA certificate", LIBVIRT_CACERT) < 0)
return -1;
- if (check_cert_file(conn, "client key", LIBVIRT_CLIENTKEY) < 0)
+ if (check_cert_file("client key", LIBVIRT_CLIENTKEY) < 0)
return -1;
- if (check_cert_file(conn, "client certificate", LIBVIRT_CLIENTCERT) <
0)
+ if (check_cert_file("client certificate", LIBVIRT_CLIENTCERT) < 0)
return -1;
/* Set the trusted CA cert. */
@@ -1292,7 +1292,7 @@ verify_certificate (virConnectPtr conn ATTRIBUTE_UNUSED,
}
if ((now = time(NULL)) == ((time_t)-1)) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("cannot get current time"));
return -1;
}
@@ -6325,7 +6325,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int
in_open,
/* Get local address in form IPADDR:PORT */
salen = sizeof(sa);
if (getsockname(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
- virReportSystemError(in_open ? NULL : conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("failed to get sock address"));
goto cleanup;
}
@@ -6335,7 +6335,7 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, int
in_open,
/* Get remote address in form IPADDR:PORT */
salen = sizeof(sa);
if (getpeername(priv->sock, (struct sockaddr*)&sa, &salen) < 0) {
- virReportSystemError(in_open ? NULL : conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("failed to get peer address"));
goto cleanup;
}
@@ -7649,7 +7649,7 @@ remoteIOWriteBuffer(virConnectPtr conn,
if (errno == EWOULDBLOCK)
return 0;
- virReportSystemError(in_open ? NULL : conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot send data"));
return -1;
@@ -7699,7 +7699,7 @@ remoteIOReadBuffer(virConnectPtr conn,
if (errno == EWOULDBLOCK)
return 0;
- virReportSystemError(in_open ? NULL : conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot recv data"));
} else {
errorf (in_open ? NULL : conn,
@@ -8303,7 +8303,7 @@ remoteIOEventLoop(virConnectPtr conn,
if (ret < 0) {
if (errno == EWOULDBLOCK)
continue;
- virReportSystemError(in_open ? NULL : conn, errno,
+ virReportSystemError(errno,
"%s", _("poll on socket failed"));
goto error;
}
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index 2b72a28..f4c8aef 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -156,7 +156,7 @@ secretFindByUsage(virSecretDriverStatePtr driver, int usageType, const
char *usa
"$basename.base64". "$basename" is in both cases the
base64-encoded UUID. */
static int
-replaceFile(virConnectPtr conn, const char *filename, void *data, size_t size)
+replaceFile(const char *filename, void *data, size_t size)
{
char *tmp_path = NULL;
int fd = -1, ret = -1;
@@ -167,28 +167,28 @@ replaceFile(virConnectPtr conn, const char *filename, void *data,
size_t size)
}
fd = mkstemp (tmp_path);
if (fd == -1) {
- virReportSystemError(conn, errno, _("mkstemp('%s') failed"),
tmp_path);
+ virReportSystemError(errno, _("mkstemp('%s') failed"),
tmp_path);
goto cleanup;
}
if (fchmod(fd, S_IRUSR | S_IWUSR) != 0) {
- virReportSystemError(conn, errno, _("fchmod('%s') failed"),
tmp_path);
+ virReportSystemError(errno, _("fchmod('%s') failed"),
tmp_path);
goto cleanup;
}
ret = safewrite(fd, data, size);
if (ret < 0) {
- virReportSystemError(conn, errno, _("error writing to '%s'"),
+ virReportSystemError(errno, _("error writing to '%s'"),
tmp_path);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno, _("error closing '%s'"),
tmp_path);
+ virReportSystemError(errno, _("error closing '%s'"),
tmp_path);
goto cleanup;
}
fd = -1;
if (rename(tmp_path, filename) < 0) {
- virReportSystemError(conn, errno, _("rename(%s, %s) failed"),
tmp_path,
+ virReportSystemError(errno, _("rename(%s, %s) failed"), tmp_path,
filename);
goto cleanup;
}
@@ -238,10 +238,10 @@ secretBase64Path(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
}
static int
-secretEnsureDirectory(virConnectPtr conn, virSecretDriverStatePtr driver)
+secretEnsureDirectory(virSecretDriverStatePtr driver)
{
if (mkdir(driver->directory, S_IRWXU) < 0 && errno != EEXIST) {
- virReportSystemError(conn, errno, _("cannot create '%s'"),
+ virReportSystemError(errno, _("cannot create '%s'"),
driver->directory);
return -1;
}
@@ -255,7 +255,7 @@ secretSaveDef(virConnectPtr conn, virSecretDriverStatePtr driver,
char *filename = NULL, *xml = NULL;
int ret = -1;
- if (secretEnsureDirectory(conn, driver) < 0)
+ if (secretEnsureDirectory(driver) < 0)
goto cleanup;
filename = secretXMLPath(conn, driver, secret);
@@ -265,7 +265,7 @@ secretSaveDef(virConnectPtr conn, virSecretDriverStatePtr driver,
if (xml == NULL)
goto cleanup;
- if (replaceFile(conn, filename, xml, strlen(xml)) < 0)
+ if (replaceFile(filename, xml, strlen(xml)) < 0)
goto cleanup;
ret = 0;
@@ -286,7 +286,7 @@ secretSaveValue(virConnectPtr conn, virSecretDriverStatePtr driver,
if (secret->value == NULL)
return 0;
- if (secretEnsureDirectory(conn, driver) < 0)
+ if (secretEnsureDirectory(driver) < 0)
goto cleanup;
filename = secretBase64Path(conn, driver, secret);
@@ -299,7 +299,7 @@ secretSaveValue(virConnectPtr conn, virSecretDriverStatePtr driver,
goto cleanup;
}
- if (replaceFile(conn, filename, base64, strlen(base64)) < 0)
+ if (replaceFile(filename, base64, strlen(base64)) < 0)
goto cleanup;
ret = 0;
@@ -375,11 +375,11 @@ secretLoadValue(virConnectPtr conn, virSecretDriverStatePtr driver,
ret = 0;
goto cleanup;
}
- virReportSystemError (conn, errno, _("cannot open '%s'"),
filename);
+ virReportSystemError(errno, _("cannot open '%s'"), filename);
goto cleanup;
}
if (fstat(fd, &st) < 0) {
- virReportSystemError (conn, errno, _("cannot stat '%s'"),
filename);
+ virReportSystemError(errno, _("cannot stat '%s'"), filename);
goto cleanup;
}
if ((size_t)st.st_size != st.st_size) {
@@ -393,7 +393,7 @@ secretLoadValue(virConnectPtr conn, virSecretDriverStatePtr driver,
goto cleanup;
}
if (saferead(fd, contents, st.st_size) != st.st_size) {
- virReportSystemError (conn, errno, _("cannot read '%s'"),
filename);
+ virReportSystemError(errno, _("cannot read '%s'"), filename);
goto cleanup;
}
close(fd);
@@ -484,7 +484,7 @@ loadSecrets(virConnectPtr conn, virSecretDriverStatePtr driver,
if (dir == NULL) {
if (errno == ENOENT)
return 0;
- virReportSystemError(conn, errno, _("cannot open '%s'"),
+ virReportSystemError(errno, _("cannot open '%s'"),
driver->directory);
goto cleanup;
}
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 15a9d59..b67df3f 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -71,7 +71,7 @@ profile_status(const char *str, const int check_enforcing)
}
if (virFileReadAll(APPARMOR_PROFILES_PATH, MAX_FILE_LEN, &content) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to read AppArmor profiles list "
"\'%s\'"), APPARMOR_PROFILES_PATH);
goto clean;
@@ -120,7 +120,7 @@ profile_status_file(const char *str)
goto failed;
if ((len = virFileReadAll(profile, MAX_FILE_LEN, &content)) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Failed to read \'%s\'"), profile);
goto failed;
}
@@ -158,7 +158,7 @@ load_profile(virConnectPtr conn, const char *profile, virDomainObjPtr
vm,
pid_t child;
if (pipe(pipefd) < -1) {
- virReportSystemError(conn, errno, "%s", _("unable to create
pipe"));
+ virReportSystemError(errno, "%s", _("unable to create
pipe"));
return rc;
}
@@ -193,7 +193,7 @@ load_profile(virConnectPtr conn, const char *profile, virDomainObjPtr
vm,
/* parent continues here */
if (safewrite(pipefd[1], xml, strlen(xml)) < 0) {
- virReportSystemError(conn, errno, "%s", _("unable to write to
pipe"));
+ virReportSystemError(errno, "%s", _("unable to write to
pipe"));
goto clean;
}
close(pipefd[1]);
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 67687c6..1b7f995 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -103,21 +103,21 @@ err:
}
static int
-SELinuxInitialize(virConnectPtr conn)
+SELinuxInitialize(void)
{
char *ptr = NULL;
int fd = 0;
fd = open(selinux_virtual_domain_context_path(), O_RDONLY);
if (fd < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open SELinux virtual domain context file
'%s'"),
selinux_virtual_domain_context_path());
return -1;
}
if (saferead(fd, default_domain_context, sizeof(default_domain_context)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read SELinux virtual domain context file
%s"),
selinux_virtual_domain_context_path());
close(fd);
@@ -129,14 +129,14 @@ SELinuxInitialize(virConnectPtr conn)
*ptr = '\0';
if ((fd = open(selinux_virtual_image_context_path(), O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open SELinux virtual image context file
%s"),
selinux_virtual_image_context_path());
return -1;
}
if (saferead(fd, default_image_context, sizeof(default_image_context)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read SELinux virtual image context file
%s"),
selinux_virtual_image_context_path());
close(fd);
@@ -221,7 +221,7 @@ done:
}
static int
-SELinuxReserveSecurityLabel(virConnectPtr conn,
+SELinuxReserveSecurityLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm)
{
security_context_t pctx;
@@ -232,7 +232,7 @@ SELinuxReserveSecurityLabel(virConnectPtr conn,
return 0;
if (getpidcon(vm->pid, &pctx) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("unable to get PID %d security context"),
vm->pid);
return -1;
}
@@ -273,7 +273,7 @@ SELinuxSecurityDriverOpen(virConnectPtr conn, virSecurityDriverPtr
drv)
* configuration? For the moment, we'll just set it to "0".
*/
virSecurityDriverSetDOI(conn, drv, SECURITY_SELINUX_VOID_DOI);
- return SELinuxInitialize(conn);
+ return SELinuxInitialize();
}
static int
@@ -284,7 +284,7 @@ SELinuxGetSecurityProcessLabel(virConnectPtr conn,
security_context_t ctx;
if (getpidcon(vm->pid, &ctx) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("unable to get PID %d security context"),
vm->pid);
return -1;
@@ -303,7 +303,7 @@ SELinuxGetSecurityProcessLabel(virConnectPtr conn,
sec->enforcing = security_getenforce();
if (sec->enforcing == -1) {
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("error calling security_getenforce()"));
return -1;
}
@@ -312,7 +312,7 @@ SELinuxGetSecurityProcessLabel(virConnectPtr conn,
}
static int
-SELinuxSetFilecon(virConnectPtr conn, const char *path, char *tcon)
+SELinuxSetFilecon(const char *path, char *tcon)
{
security_context_t econ;
@@ -337,7 +337,7 @@ SELinuxSetFilecon(virConnectPtr conn, const char *path, char *tcon)
* virt_use_{nfs,usb,pci} boolean tunables to allow it...
*/
if (setfilecon_errno != EOPNOTSUPP) {
- virReportSystemError(conn, setfilecon_errno,
+ virReportSystemError(setfilecon_errno,
_("unable to set security context '%s' on
'%s'"),
tcon, path);
if (security_getenforce() == 1)
@@ -351,8 +351,7 @@ SELinuxSetFilecon(virConnectPtr conn, const char *path, char *tcon)
}
static int
-SELinuxRestoreSecurityFileLabel(virConnectPtr conn,
- const char *path)
+SELinuxRestoreSecurityFileLabel(const char *path)
{
struct stat buf;
security_context_t fcon = NULL;
@@ -363,7 +362,7 @@ SELinuxRestoreSecurityFileLabel(virConnectPtr conn,
VIR_INFO("Restoring SELinux context on '%s'", path);
if ((err = virFileResolveLink(path, &newpath)) < 0) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("cannot resolve symlink %s"), path);
goto err;
}
@@ -372,7 +371,7 @@ SELinuxRestoreSecurityFileLabel(virConnectPtr conn,
goto err;
if (matchpathcon(newpath, buf.st_mode, &fcon) == 0) {
- rc = SELinuxSetFilecon(conn, newpath, fcon);
+ rc = SELinuxSetFilecon(newpath, fcon);
}
err:
VIR_FREE(fcon);
@@ -381,7 +380,7 @@ err:
}
static int
-SELinuxRestoreSecurityImageLabel(virConnectPtr conn,
+SELinuxRestoreSecurityImageLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
virDomainDiskDefPtr disk)
{
@@ -404,7 +403,7 @@ SELinuxRestoreSecurityImageLabel(virConnectPtr conn,
if (!disk->src)
return 0;
- return SELinuxRestoreSecurityFileLabel(conn, disk->src);
+ return SELinuxRestoreSecurityFileLabel(disk->src);
}
static int
@@ -439,7 +438,7 @@ SELinuxSetSecurityImageLabel(virConnectPtr conn,
return -1;
if (meta.backingStore != NULL &&
- SELinuxSetFilecon(conn, meta.backingStore,
+ SELinuxSetFilecon(meta.backingStore,
default_content_context) < 0) {
VIR_FREE(meta.backingStore);
return -1;
@@ -449,11 +448,11 @@ SELinuxSetSecurityImageLabel(virConnectPtr conn,
} while (path != NULL);
if (disk->shared) {
- return SELinuxSetFilecon(conn, disk->src, default_image_context);
+ return SELinuxSetFilecon(disk->src, default_image_context);
} else if (disk->readonly) {
- return SELinuxSetFilecon(conn, disk->src, default_content_context);
+ return SELinuxSetFilecon(disk->src, default_content_context);
} else if (secdef->imagelabel) {
- return SELinuxSetFilecon(conn, disk->src, secdef->imagelabel);
+ return SELinuxSetFilecon(disk->src, secdef->imagelabel);
}
return 0;
@@ -461,25 +460,25 @@ SELinuxSetSecurityImageLabel(virConnectPtr conn,
static int
-SELinuxSetSecurityPCILabel(virConnectPtr conn,
+SELinuxSetSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file, void *opaque)
{
virDomainObjPtr vm = opaque;
const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
- return SELinuxSetFilecon(conn, file, secdef->imagelabel);
+ return SELinuxSetFilecon(file, secdef->imagelabel);
}
static int
-SELinuxSetSecurityUSBLabel(virConnectPtr conn,
+SELinuxSetSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file, void *opaque)
{
virDomainObjPtr vm = opaque;
const virSecurityLabelDefPtr secdef = &vm->def->seclabel;
- return SELinuxSetFilecon(conn, file, secdef->imagelabel);
+ return SELinuxSetFilecon(file, secdef->imagelabel);
}
static int
@@ -540,21 +539,21 @@ done:
static int
-SELinuxRestoreSecurityPCILabel(virConnectPtr conn,
+SELinuxRestoreSecurityPCILabel(virConnectPtr conn ATTRIBUTE_UNUSED,
pciDevice *dev ATTRIBUTE_UNUSED,
const char *file,
void *opaque ATTRIBUTE_UNUSED)
{
- return SELinuxRestoreSecurityFileLabel(conn, file);
+ return SELinuxRestoreSecurityFileLabel(file);
}
static int
-SELinuxRestoreSecurityUSBLabel(virConnectPtr conn,
+SELinuxRestoreSecurityUSBLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
usbDevice *dev ATTRIBUTE_UNUSED,
const char *file,
void *opaque ATTRIBUTE_UNUSED)
{
- return SELinuxRestoreSecurityFileLabel(conn, file);
+ return SELinuxRestoreSecurityFileLabel(file);
}
static int
@@ -664,7 +663,7 @@ SELinuxReleaseSecurityLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
static int
-SELinuxSetSavedStateLabel(virConnectPtr conn,
+SELinuxSetSavedStateLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
const char *savefile)
{
@@ -673,12 +672,12 @@ SELinuxSetSavedStateLabel(virConnectPtr conn,
if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC)
return 0;
- return SELinuxSetFilecon(conn, savefile, secdef->imagelabel);
+ return SELinuxSetFilecon(savefile, secdef->imagelabel);
}
static int
-SELinuxRestoreSavedStateLabel(virConnectPtr conn,
+SELinuxRestoreSavedStateLabel(virConnectPtr conn ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
const char *savefile)
{
@@ -687,7 +686,7 @@ SELinuxRestoreSavedStateLabel(virConnectPtr conn,
if (secdef->type == VIR_DOMAIN_SECLABEL_STATIC)
return 0;
- return SELinuxRestoreSecurityFileLabel(conn, savefile);
+ return SELinuxRestoreSecurityFileLabel(savefile);
}
@@ -727,7 +726,7 @@ SELinuxSetSecurityProcessLabel(virConnectPtr conn,
}
if (setexeccon(secdef->label) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("unable to set security context '%s'"),
secdef->label);
if (security_getenforce() == 1)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index b22c031..2e78168 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -113,9 +113,8 @@ enum {
TOOL_QCOW_CREATE,
};
-static int ATTRIBUTE_NONNULL (3)
-virStorageBackendCopyToFD(virConnectPtr conn,
- virStorageVolDefPtr vol,
+static int ATTRIBUTE_NONNULL (2)
+virStorageBackendCopyToFD(virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
int fd,
unsigned long long *total,
@@ -130,7 +129,7 @@ virStorageBackendCopyToFD(virConnectPtr conn,
char *buf = NULL;
if ((inputfd = open(inputvol->target.path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("could not open input path '%s'"),
inputvol->target.path);
goto cleanup;
@@ -152,7 +151,7 @@ virStorageBackendCopyToFD(virConnectPtr conn,
bytes = remain;
if ((amtread = saferead(inputfd, buf, bytes)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed reading from file '%s'"),
inputvol->target.path);
goto cleanup;
@@ -168,13 +167,13 @@ virStorageBackendCopyToFD(virConnectPtr conn,
if (is_dest_file && memcmp(buf+offset, zerobuf, interval) == 0) {
if (lseek(fd, interval, SEEK_CUR) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot extend file '%s'"),
vol->target.path);
goto cleanup;
}
} else if (safewrite(fd, buf+offset, interval) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed writing to file '%s'"),
vol->target.path);
goto cleanup;
@@ -184,7 +183,7 @@ virStorageBackendCopyToFD(virConnectPtr conn,
}
if (inputfd != -1 && close(inputfd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot close file '%s'"),
inputvol->target.path);
goto cleanup;
@@ -204,7 +203,7 @@ cleanup:
}
static int
-virStorageBackendCreateBlockFrom(virConnectPtr conn,
+virStorageBackendCreateBlockFrom(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
virStorageVolDefPtr vol,
virStorageVolDefPtr inputvol,
@@ -218,7 +217,7 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn,
uid_t uid;
if ((fd = open(vol->target.path, O_RDWR)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot create path '%s'"),
vol->target.path);
goto cleanup;
@@ -227,7 +226,7 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn,
remain = vol->allocation;
if (inputvol) {
- int res = virStorageBackendCopyToFD(conn, vol, inputvol,
+ int res = virStorageBackendCopyToFD(vol, inputvol,
fd, &remain, 0);
if (res < 0)
goto cleanup;
@@ -235,7 +234,7 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn,
if (fstat(fd, &st) == -1) {
ret = errno;
- virReportSystemError(conn, errno, _("stat of '%s' failed"),
+ virReportSystemError(errno, _("stat of '%s' failed"),
vol->target.path);
goto cleanup;
}
@@ -243,20 +242,20 @@ virStorageBackendCreateBlockFrom(virConnectPtr conn,
gid = (vol->target.perms.gid != st.st_gid) ? vol->target.perms.gid : -1;
if (((uid != -1) || (gid != -1))
&& (fchown(fd, vol->target.perms.uid, vol->target.perms.gid) <
0)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot chown '%s' to (%u, %u)"),
vol->target.path, vol->target.perms.uid,
vol->target.perms.gid);
goto cleanup;
}
if (fchmod(fd, vol->target.perms.mode) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
vol->target.path, vol->target.perms.mode);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot close file '%s'"),
vol->target.path);
goto cleanup;
@@ -295,14 +294,14 @@ virStorageBackendCreateRaw(virConnectPtr conn,
vol->target.perms.uid, vol->target.perms.gid,
(pool->def->type == VIR_STORAGE_POOL_NETFS
? VIR_FILE_CREATE_AS_UID : 0))) < 0) {
- virReportSystemError(conn, createstat,
+ virReportSystemError(createstat,
_("cannot create path '%s'"),
vol->target.path);
goto cleanup;
}
if ((fd = open(vol->target.path, O_RDWR | O_EXCL)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open new path '%s'"),
vol->target.path);
goto cleanup;
@@ -311,7 +310,7 @@ virStorageBackendCreateRaw(virConnectPtr conn,
/* Seek to the final size, so the capacity is available upfront
* for progress reporting */
if (ftruncate(fd, vol->capacity) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot extend file '%s'"),
vol->target.path);
goto cleanup;
@@ -320,7 +319,7 @@ virStorageBackendCreateRaw(virConnectPtr conn,
remain = vol->allocation;
if (inputvol) {
- int res = virStorageBackendCopyToFD(conn, vol, inputvol,
+ int res = virStorageBackendCopyToFD(vol, inputvol,
fd, &remain, 1);
if (res < 0)
goto cleanup;
@@ -341,7 +340,7 @@ virStorageBackendCreateRaw(virConnectPtr conn,
bytes = remain;
if ((r = safezero(fd, 0, vol->allocation - remain,
bytes)) != 0) {
- virReportSystemError(conn, r,
+ virReportSystemError(r,
_("cannot fill file '%s'"),
vol->target.path);
goto cleanup;
@@ -352,7 +351,7 @@ virStorageBackendCreateRaw(virConnectPtr conn,
int r;
if ((r = safezero(fd, 0, 0, remain)) != 0) {
- virReportSystemError(conn, r,
+ virReportSystemError(r,
_("cannot fill file '%s'"),
vol->target.path);
goto cleanup;
@@ -361,7 +360,7 @@ virStorageBackendCreateRaw(virConnectPtr conn,
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot close file '%s'"),
vol->target.path);
goto cleanup;
@@ -495,14 +494,14 @@ static int virStorageBuildSetUIDHook(void *data) {
if ((vol->target.perms.gid != 0)
&& (setgid(vol->target.perms.gid) != 0)) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Cannot set gid to %u before creating %s"),
vol->target.perms.gid, vol->target.path);
return -1;
}
if ((vol->target.perms.uid != 0)
&& (setuid(vol->target.perms.uid) != 0)) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("Cannot set uid to %u before creating %s"),
vol->target.perms.uid, vol->target.path);
return -1;
@@ -531,13 +530,13 @@ static int virStorageBackendCreateExecCommand(virConnectPtr conn,
}
if (!filecreated) {
if (virRun(conn, cmdargv, NULL) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Cannot run %s to create %s"),
cmdargv[0], vol->target.path);
return -1;
}
if (stat(vol->target.path, &st) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("%s failed to create %s"),
cmdargv[0], vol->target.path);
return -1;
@@ -548,14 +547,14 @@ static int virStorageBackendCreateExecCommand(virConnectPtr conn,
gid = (vol->target.perms.gid != st.st_gid) ? vol->target.perms.gid : -1;
if (((uid != -1) || (gid != -1))
&& (chown(vol->target.path, uid, gid) < 0)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot chown %s to (%u, %u)"),
vol->target.path, vol->target.perms.uid,
vol->target.perms.gid);
return -1;
}
if (chmod(vol->target.path, vol->target.perms.mode) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
vol->target.path, vol->target.perms.mode);
return -1;
@@ -655,7 +654,7 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
return -1;
}
if (access(vol->backingStore.path, R_OK) != 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("inaccessible backing store volume %s"),
vol->backingStore.path);
return -1;
@@ -877,22 +876,20 @@ virStorageBackendForType(int type) {
int
-virStorageBackendUpdateVolTargetInfo(virConnectPtr conn,
- virStorageVolTargetPtr target,
+virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
unsigned long long *allocation,
unsigned long long *capacity)
{
int ret, fd;
if ((fd = open(target->path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open volume '%s'"),
target->path);
return -1;
}
- ret = virStorageBackendUpdateVolTargetInfoFD(conn,
- target,
+ ret = virStorageBackendUpdateVolTargetInfoFD(target,
fd,
allocation,
capacity);
@@ -903,21 +900,18 @@ virStorageBackendUpdateVolTargetInfo(virConnectPtr conn,
}
int
-virStorageBackendUpdateVolInfo(virConnectPtr conn,
- virStorageVolDefPtr vol,
+virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
int withCapacity)
{
int ret;
- if ((ret = virStorageBackendUpdateVolTargetInfo(conn,
- &vol->target,
+ if ((ret = virStorageBackendUpdateVolTargetInfo(&vol->target,
&vol->allocation,
withCapacity ? &vol->capacity
: NULL)) < 0)
return ret;
if (vol->backingStore.path &&
- (ret = virStorageBackendUpdateVolTargetInfo(conn,
- &vol->backingStore,
+ (ret = virStorageBackendUpdateVolTargetInfo(&vol->backingStore,
NULL, NULL)) < 0)
return ret;
@@ -936,8 +930,7 @@ virStorageBackendUpdateVolInfo(virConnectPtr conn,
* -2 if passed FD isn't a regular, char, or block file.
*/
int
-virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
- virStorageVolTargetPtr target,
+virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
int fd,
unsigned long long *allocation,
unsigned long long *capacity)
@@ -948,7 +941,7 @@ virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
#endif
if (fstat(fd, &sb) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot stat file '%s'"),
target->path);
return -1;
@@ -981,7 +974,7 @@ virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
*/
end = lseek(fd, 0, SEEK_END);
if (end == (off_t)-1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot seek to end of file
'%s'"),
target->path);
return -1;
@@ -1002,7 +995,7 @@ virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
/* XXX: make this a security driver call */
if (fgetfilecon(fd, &filecon) == -1) {
if (errno != ENODATA && errno != ENOTSUP) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot get file context of '%s'"),
target->path);
return -1;
@@ -1059,8 +1052,7 @@ static struct diskType const disk_types[] = {
int
-virStorageBackendUpdateVolTargetFormatFD(virConnectPtr conn,
- virStorageVolTargetPtr target,
+virStorageBackendUpdateVolTargetFormatFD(virStorageVolTargetPtr target,
int fd)
{
int i;
@@ -1073,14 +1065,14 @@ virStorageBackendUpdateVolTargetFormatFD(virConnectPtr conn,
start = lseek(fd, 0, SEEK_SET);
if (start < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot seek to beginning of file
'%s'"),
target->path);
return -1;
}
bytes = saferead(fd, buffer, sizeof(buffer));
if (bytes < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read beginning of file '%s'"),
target->path);
return -1;
@@ -1114,8 +1106,7 @@ virStorageBackendUpdateVolTargetFormatFD(virConnectPtr conn,
* with stable paths.
*/
char *
-virStorageBackendStablePath(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+virStorageBackendStablePath(virStoragePoolObjPtr pool,
const char *devpath)
{
DIR *dh;
@@ -1146,7 +1137,7 @@ virStorageBackendStablePath(virConnectPtr conn,
usleep(100 * 1000);
goto reopen;
}
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read dir '%s'"),
pool->def->target.path);
return NULL;
@@ -1338,7 +1329,7 @@ virStorageBackendRunProgRegex(virConnectPtr conn,
return -1;
if (err == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to wait for command '%s'"),
prog[0]);
return -1;
@@ -1434,7 +1425,7 @@ virStorageBackendRunProgNul(virConnectPtr conn,
if (feof (fp))
err = 0;
else
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("read error on pipe to '%s'"),
prog[0]);
cleanup:
@@ -1455,7 +1446,7 @@ virStorageBackendRunProgNul(virConnectPtr conn,
return -1;
if (w_err == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to wait for command '%s'"),
prog[0]);
return -1;
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index 988539c..a69aeee 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -83,26 +83,21 @@ struct _virStorageBackend {
virStorageBackendPtr virStorageBackendForType(int type);
-int virStorageBackendUpdateVolInfo(virConnectPtr conn,
- virStorageVolDefPtr vol,
+int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
int withCapacity);
-int virStorageBackendUpdateVolTargetInfo(virConnectPtr conn,
- virStorageVolTargetPtr target,
+int virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
unsigned long long *allocation,
unsigned long long *capacity);
-int virStorageBackendUpdateVolTargetInfoFD(virConnectPtr conn,
- virStorageVolTargetPtr target,
+int virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
int fd,
unsigned long long *allocation,
unsigned long long *capacity);
int
-virStorageBackendUpdateVolTargetFormatFD(virConnectPtr conn,
- virStorageVolTargetPtr target,
+virStorageBackendUpdateVolTargetFormatFD(virStorageVolTargetPtr target,
int fd);
-char *virStorageBackendStablePath(virConnectPtr conn,
- virStoragePoolObjPtr pool,
+char *virStorageBackendStablePath(virStoragePoolObjPtr pool,
const char *devpath);
typedef int (*virStorageBackendListVolRegexFunc)(virConnectPtr conn,
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 16eba4e..a86c193 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -82,7 +82,7 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
* dir every time its run. Should figure out a more efficient
* way of doing this...
*/
- vol->target.path = virStorageBackendStablePath(conn, pool, devpath);
+ vol->target.path = virStorageBackendStablePath(pool, devpath);
VIR_FREE(devpath);
if (vol->target.path == NULL)
return -1;
@@ -125,7 +125,7 @@ virStorageBackendDiskMakeDataVol(virConnectPtr conn,
}
/* Refresh allocation/capacity/perms */
- if (virStorageBackendUpdateVolInfo(conn, vol, 1) < 0)
+ if (virStorageBackendUpdateVolInfo(vol, 1) < 0)
return -1;
/* set partition type */
@@ -626,7 +626,7 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn,
int rc = -1;
if ((err = virFileResolveLink(vol->target.path, &devpath)) < 0) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("Couldn't read volume target path
'%s'"),
vol->target.path);
goto cleanup;
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 47cdd6a..f1e1371 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -63,13 +63,13 @@ virStorageBackendProbeTarget(virConnectPtr conn,
*encryption = NULL;
if ((fd = open(target->path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open volume '%s'"),
target->path);
return -1;
}
- if ((ret = virStorageBackendUpdateVolTargetInfoFD(conn, target, fd,
+ if ((ret = virStorageBackendUpdateVolTargetInfoFD(target, fd,
allocation,
capacity)) < 0) {
close(fd);
@@ -254,14 +254,13 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn,
* Return 0 if not mounted, 1 if mounted, -1 on error
*/
static int
-virStorageBackendFileSystemIsMounted(virConnectPtr conn,
- virStoragePoolObjPtr pool) {
+virStorageBackendFileSystemIsMounted(virStoragePoolObjPtr pool) {
FILE *mtab;
struct mntent ent;
char buf[1024];
if ((mtab = fopen(_PATH_MOUNTED, "r")) == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read mount list '%s'"),
_PATH_MOUNTED);
return -1;
@@ -371,7 +370,7 @@ virStorageBackendFileSystemMount(virConnectPtr conn,
}
/* Short-circuit if already mounted */
- if ((ret = virStorageBackendFileSystemIsMounted(conn, pool)) != 0) {
+ if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 0) {
if (ret < 0)
return -1;
else
@@ -447,7 +446,7 @@ virStorageBackendFileSystemUnmount(virConnectPtr conn,
}
/* Short-circuit if already unmounted */
- if ((ret = virStorageBackendFileSystemIsMounted(conn, pool)) != 1) {
+ if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 1) {
if (ret < 0)
return -1;
else
@@ -525,7 +524,7 @@ virStorageBackendFileSystemBuild(virConnectPtr conn,
* exist, with default uid/gid/mode. */
*p = '\0';
if ((err = virFileMakePath(parent)) != 0) {
- virReportSystemError(conn, err, _("cannot create path
'%s'"),
+ virReportSystemError(err, _("cannot create path '%s'"),
parent);
goto error;
}
@@ -541,7 +540,7 @@ virStorageBackendFileSystemBuild(virConnectPtr conn,
VIR_FILE_CREATE_ALLOW_EXIST |
(pool->def->type == VIR_STORAGE_POOL_NETFS
? VIR_FILE_CREATE_AS_UID : 0)) != 0)) {
- virReportSystemError(conn, err, _("cannot create path '%s'"),
+ virReportSystemError(err, _("cannot create path '%s'"),
pool->def->target.path);
goto error;
}
@@ -566,7 +565,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
virStorageVolDefPtr vol = NULL;
if (!(dir = opendir(pool->def->target.path))) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open path '%s'"),
pool->def->target.path);
goto cleanup;
@@ -625,8 +624,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
memmove(backingStore, path, strlen(path) + 1);
vol->backingStore.path = backingStore;
- if (virStorageBackendUpdateVolTargetInfo(conn,
-
&vol->backingStore,
+ if
(virStorageBackendUpdateVolTargetInfo(&vol->backingStore,
NULL,
NULL) < 0)
VIR_FREE(vol->backingStore);
@@ -662,7 +660,7 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn,
if (statvfs(pool->def->target.path, &sb) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot statvfs path '%s'"),
pool->def->target.path);
return -1;
@@ -722,14 +720,14 @@ virStorageBackendFileSystemStop(virConnectPtr conn,
* Returns 0 on success, -1 on error
*/
static int
-virStorageBackendFileSystemDelete(virConnectPtr conn,
+virStorageBackendFileSystemDelete(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool,
unsigned int flags ATTRIBUTE_UNUSED)
{
/* XXX delete all vols first ? */
if (rmdir(pool->def->target.path) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to remove pool '%s'"),
pool->def->target.path);
return -1;
@@ -789,7 +787,7 @@ static int createFileDir(virConnectPtr conn,
vol->target.perms.uid, vol->target.perms.gid,
(pool->def->type == VIR_STORAGE_POOL_NETFS
? VIR_FILE_CREATE_AS_UID : 0))) != 0) {
- virReportSystemError(conn, err, _("cannot create path '%s'"),
+ virReportSystemError(err, _("cannot create path '%s'"),
vol->target.path);
return -1;
}
@@ -867,7 +865,7 @@ virStorageBackendFileSystemVolBuildFrom(virConnectPtr conn,
* Remove a volume - just unlinks for now
*/
static int
-virStorageBackendFileSystemVolDelete(virConnectPtr conn,
+virStorageBackendFileSystemVolDelete(virConnectPtr conn ATTRIBUTE_UNUSED,
virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
virStorageVolDefPtr vol,
unsigned int flags ATTRIBUTE_UNUSED)
@@ -875,7 +873,7 @@ virStorageBackendFileSystemVolDelete(virConnectPtr conn,
if (unlink(vol->target.path) < 0) {
/* Silently ignore failures where the vol has already gone away */
if (errno != ENOENT) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot unlink file '%s'"),
vol->target.path);
return -1;
@@ -896,7 +894,7 @@ virStorageBackendFileSystemVolRefresh(virConnectPtr conn,
int ret;
/* Refresh allocation / permissions info in case its changed */
- ret = virStorageBackendUpdateVolInfo(conn, vol, 0);
+ ret = virStorageBackendUpdateVolInfo(vol, 0);
if (ret < 0)
return ret;
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index 74e63f3..8a93edc 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -418,7 +418,7 @@ virStorageBackendISCSIFindLUs(virConnectPtr conn,
"/sys/class/iscsi_session/session%s/device", session);
if (virStorageBackendSCSIGetHostNumber(conn, sysfs_path, &host) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to get host number for iSCSI session "
"with path '%s'"),
sysfs_path);
@@ -426,7 +426,7 @@ virStorageBackendISCSIFindLUs(virConnectPtr conn,
}
if (virStorageBackendSCSIFindLUs(conn, pool, host) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to find LUs on host %u"), host);
retval = -1;
}
diff --git a/src/storage/storage_backend_logical.c
b/src/storage/storage_backend_logical.c
index 8caf8cb..06ae865 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -132,7 +132,7 @@ virStorageBackendLogicalMakeVol(virConnectPtr conn,
return -1;
}
- if (virStorageBackendUpdateVolInfo(conn, vol, 1) < 0)
+ if (virStorageBackendUpdateVolInfo(vol, 1) < 0)
return -1;
@@ -406,20 +406,20 @@ virStorageBackendLogicalBuildPool(virConnectPtr conn,
* rather than trying to figure out if we're a disk or partition
*/
if ((fd = open(pool->def->source.devices[i].path, O_WRONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open device '%s'"),
pool->def->source.devices[i].path);
goto cleanup;
}
if (safewrite(fd, zeros, sizeof(zeros)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot clear device header of
'%s'"),
pool->def->source.devices[i].path);
close(fd);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot close device '%s'"),
pool->def->source.devices[i].path);
goto cleanup;
@@ -544,7 +544,7 @@ virStorageBackendLogicalDeletePool(virConnectPtr conn,
pvargv[1] = pool->def->source.devices[i].path;
if (virRun(conn, pvargv, NULL) < 0) {
error = -1;
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot remove PV device '%s'"),
pool->def->source.devices[i].path);
break;
@@ -611,7 +611,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
return -1;
if ((fd = open(vol->target.path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read path '%s'"),
vol->target.path);
goto cleanup;
@@ -620,21 +620,21 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
/* We can only chown/grp if root */
if (getuid() == 0) {
if (fchown(fd, vol->target.perms.uid, vol->target.perms.gid) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot set file owner '%s'"),
vol->target.path);
goto cleanup;
}
}
if (fchmod(fd, vol->target.perms.mode) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot set file mode '%s'"),
vol->target.path);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot close file '%s'"),
vol->target.path);
goto cleanup;
@@ -643,7 +643,7 @@ virStorageBackendLogicalCreateVol(virConnectPtr conn,
/* Fill in data about this new vol */
if (virStorageBackendLogicalFindLVs(conn, pool, vol) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot find newly created volume
'%s'"),
vol->target.path);
goto cleanup;
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index 029ff3b..87e0fc8 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -48,15 +48,14 @@ virStorageBackendMpathUpdateVolTargetInfo(virConnectPtr conn,
int fd = -1;
if ((fd = open(target->path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open volume '%s'"),
target->path);
ret = -1;
goto out;
}
- if (virStorageBackendUpdateVolTargetInfoFD(conn,
- target,
+ if (virStorageBackendUpdateVolTargetInfoFD(target,
fd,
allocation,
capacity) < 0) {
@@ -69,9 +68,7 @@ virStorageBackendMpathUpdateVolTargetInfo(virConnectPtr conn,
goto out;
}
- if (virStorageBackendUpdateVolTargetFormatFD(conn,
- target,
- fd) < 0) {
+ if (virStorageBackendUpdateVolTargetFormatFD(target, fd) < 0) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("Failed to update volume target format for
'%s'"),
target->path);
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 1405f10..505175d 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -61,7 +61,7 @@ getDeviceType(virConnectPtr conn,
typefile = fopen(type_path, "r");
if (typefile == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Could not find typefile '%s'"),
type_path);
/* there was no type file; that doesn't seem right */
@@ -73,7 +73,7 @@ getDeviceType(virConnectPtr conn,
fclose(typefile);
if (gottype == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Could not read typefile '%s'"),
type_path);
/* we couldn't read the type file; have to give up */
@@ -132,8 +132,7 @@ static struct diskType const disk_types[] = {
};
static int
-virStorageBackendSCSIUpdateVolTargetInfo(virConnectPtr conn,
- virStorageVolTargetPtr target,
+virStorageBackendSCSIUpdateVolTargetInfo(virStorageVolTargetPtr target,
unsigned long long *allocation,
unsigned long long *capacity)
{
@@ -143,14 +142,13 @@ virStorageBackendSCSIUpdateVolTargetInfo(virConnectPtr conn,
ssize_t bytes;
if ((fd = open(target->path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open volume '%s'"),
target->path);
return -1;
}
- if (virStorageBackendUpdateVolTargetInfoFD(conn,
- target,
+ if (virStorageBackendUpdateVolTargetInfoFD(target,
fd,
allocation,
capacity) < 0)
@@ -161,14 +159,14 @@ virStorageBackendSCSIUpdateVolTargetInfo(virConnectPtr conn,
start = lseek(fd, 0, SEEK_SET);
if (start < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot seek to beginning of file
'%s'"),
target->path);
goto cleanup;
}
bytes = saferead(fd, buffer, sizeof(buffer));
if (bytes < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read beginning of file '%s'"),
target->path);
goto cleanup;
@@ -233,8 +231,7 @@ virStorageBackendSCSINewLun(virConnectPtr conn,
* dir every time its run. Should figure out a more efficient
* way of doing this...
*/
- if ((vol->target.path = virStorageBackendStablePath(conn,
- pool,
+ if ((vol->target.path = virStorageBackendStablePath(pool,
devpath)) == NULL) {
retval = -1;
goto free_vol;
@@ -251,8 +248,7 @@ virStorageBackendSCSINewLun(virConnectPtr conn,
goto free_vol;
}
- if (virStorageBackendSCSIUpdateVolTargetInfo(conn,
- &vol->target,
+ if (virStorageBackendSCSIUpdateVolTargetInfo(&vol->target,
&vol->allocation,
&vol->capacity) < 0) {
@@ -293,7 +289,7 @@ out:
static int
-getNewStyleBlockDevice(virConnectPtr conn,
+getNewStyleBlockDevice(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
const char *lun_path,
const char *block_name ATTRIBUTE_UNUSED,
char **block_device)
@@ -312,7 +308,7 @@ getNewStyleBlockDevice(virConnectPtr conn,
block_dir = opendir(block_path);
if (block_dir == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to opendir sysfs path '%s'"),
block_path);
retval = -1;
@@ -403,7 +399,7 @@ getBlockDevice(virConnectPtr conn,
lun_dir = opendir(lun_path);
if (lun_dir == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to opendir sysfs path '%s'"),
lun_path);
retval = -1;
@@ -519,7 +515,7 @@ virStorageBackendSCSIFindLUs(virConnectPtr conn,
devicedir = opendir(device_path);
if (devicedir == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to opendir path '%s'"),
device_path);
retval = -1;
goto out;
@@ -562,7 +558,7 @@ virStorageBackendSCSIGetHostNumber(virConnectPtr conn,
sysdir = opendir(sysfs_path);
if (sysdir == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to opendir path '%s'"),
sysfs_path);
retval = -1;
goto out;
@@ -586,8 +582,7 @@ out:
static int
-virStorageBackendSCSITriggerRescan(virConnectPtr conn,
- uint32_t host)
+virStorageBackendSCSITriggerRescan(uint32_t host)
{
int fd = -1;
int retval = 0;
@@ -606,7 +601,7 @@ virStorageBackendSCSITriggerRescan(virConnectPtr conn,
fd = open(path, O_WRONLY);
if (fd < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Could not open '%s' to trigger host
scan"),
path);
retval = -1;
@@ -617,7 +612,7 @@ virStorageBackendSCSITriggerRescan(virConnectPtr conn,
LINUX_SYSFS_SCSI_HOST_SCAN_STRING,
sizeof(LINUX_SYSFS_SCSI_HOST_SCAN_STRING)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Write to '%s' to trigger host scan
failed"),
path);
retval = -1;
@@ -650,7 +645,7 @@ virStorageBackendSCSIRefreshPool(virConnectPtr conn,
VIR_DEBUG(_("Scanning host%u"), host);
- if (virStorageBackendSCSITriggerRescan(conn, host) < 0) {
+ if (virStorageBackendSCSITriggerRescan(host) < 0) {
retval = -1;
goto out;
}
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 0c805da..09153a2 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1014,14 +1014,14 @@ storagePoolSetAutostart(virStoragePoolPtr obj,
int err;
if ((err = virFileMakePath(driver->autostartDir))) {
- virReportSystemError(obj->conn, err,
+ virReportSystemError(err,
_("cannot create autostart directory
%s"),
driver->autostartDir);
goto cleanup;
}
if (symlink(pool->configFile, pool->autostartLink) < 0) {
- virReportSystemError(obj->conn, errno,
+ virReportSystemError(errno,
_("Failed to create symlink '%s' to
'%s'"),
pool->autostartLink, pool->configFile);
goto cleanup;
@@ -1029,7 +1029,7 @@ storagePoolSetAutostart(virStoragePoolPtr obj,
} else {
if (unlink(pool->autostartLink) < 0 &&
errno != ENOENT && errno != ENOTDIR) {
- virReportSystemError(obj->conn, errno,
+ virReportSystemError(errno,
_("Failed to delete symlink
'%s'"),
pool->autostartLink);
goto cleanup;
@@ -1210,8 +1210,7 @@ storageVolumeLookupByPath(virConnectPtr conn,
virStorageVolDefPtr vol;
const char *stable_path;
- stable_path = virStorageBackendStablePath(conn,
- driver->pools.objs[i],
+ stable_path = virStorageBackendStablePath(driver->pools.objs[i],
path);
/*
* virStorageBackendStablePath already does
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 52e8eec..14b467b 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -514,7 +514,7 @@ static int testOpenDefault(virConnectPtr conn) {
conn->privateData = privconn;
if (gettimeofday(&tv, NULL) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("getting time of day"));
goto error;
}
@@ -765,7 +765,7 @@ static int testOpenFromFile(virConnectPtr conn,
goto error;
if ((fd = open(file, O_RDONLY)) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("loading host definition file '%s'"),
file);
goto error;
@@ -1712,40 +1712,40 @@ static int testDomainSave(virDomainPtr domain,
VIR_DOMAIN_XML_SECURE);
if (xml == NULL) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("saving domain '%s' failed to allocate space
for metadata"),
domain->name);
goto cleanup;
}
if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("saving domain '%s' to '%s': open
failed"),
domain->name, path);
goto cleanup;
}
len = strlen(xml);
if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("saving domain '%s' to '%s': write
failed"),
domain->name, path);
goto cleanup;
}
if (safewrite(fd, (char*)&len, sizeof(len)) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("saving domain '%s' to '%s': write
failed"),
domain->name, path);
goto cleanup;
}
if (safewrite(fd, xml, len) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("saving domain '%s' to '%s': write
failed"),
domain->name, path);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("saving domain '%s' to '%s': write
failed"),
domain->name, path);
goto cleanup;
@@ -1797,13 +1797,13 @@ static int testDomainRestore(virConnectPtr conn,
int ret = -1;
if ((fd = open(path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read domain image '%s'"),
path);
goto cleanup;
}
if (saferead(fd, magic, sizeof(magic)) != sizeof(magic)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("incomplete save header in '%s'"),
path);
goto cleanup;
@@ -1814,7 +1814,7 @@ static int testDomainRestore(virConnectPtr conn,
goto cleanup;
}
if (saferead(fd, (char*)&len, sizeof(len)) != sizeof(len)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to read metadata length in
'%s'"),
path);
goto cleanup;
@@ -1829,7 +1829,7 @@ static int testDomainRestore(virConnectPtr conn,
goto cleanup;
}
if (saferead(fd, xml, len) != len) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("incomplete metdata in '%s'"), path);
goto cleanup;
}
@@ -1892,19 +1892,19 @@ static int testDomainCoreDump(virDomainPtr domain,
}
if ((fd = open(to, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("domain '%s' coredump: failed to open
%s"),
domain->name, to);
goto cleanup;
}
if (safewrite(fd, TEST_SAVE_MAGIC, sizeof(TEST_SAVE_MAGIC)) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("domain '%s' coredump: failed to write header
to %s"),
domain->name, to);
goto cleanup;
}
if (close(fd) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("domain '%s' coredump: write failed:
%s"),
domain->name, to);
goto cleanup;
@@ -2108,7 +2108,7 @@ static int testDomainGetVcpus(virDomainPtr domain,
privdomdata = privdom->privateData;
if (gettimeofday(&tv, NULL) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
"%s", _("getting time of day"));
goto cleanup;
}
@@ -2603,7 +2603,7 @@ static int testDomainBlockStats(virDomainPtr domain,
}
if (gettimeofday(&tv, NULL) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
"%s", _("getting time of day"));
goto error;
}
@@ -2658,7 +2658,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
}
if (gettimeofday(&tv, NULL) < 0) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
"%s", _("getting time of day"));
goto error;
}
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index d0aa219..6e7bc59 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -110,7 +110,7 @@ umlConnectTapDevice(virConnectPtr conn,
int err;
if ((err = brInit(&brctl))) {
- virReportSystemError(conn, err, "%s",
+ virReportSystemError(err, "%s",
_("cannot initialize bridge support"));
goto error;
}
@@ -133,11 +133,11 @@ umlConnectTapDevice(virConnectPtr conn,
_("Failed to add tap interface to bridge. "
"%s is not a bridge device"), bridge);
} else if (template_ifname) {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("Failed to add tap interface to bridge
'%s'"),
bridge);
} else {
- virReportSystemError(conn, err,
+ virReportSystemError(err,
_("Failed to add tap interface '%s' to
bridge '%s'"),
net->ifname, bridge);
}
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 2152dbf..732c3d4 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -109,8 +109,7 @@ static void umlDriverUnlock(struct uml_driver *driver)
static int umlOpenMonitor(virConnectPtr conn,
struct uml_driver *driver,
virDomainObjPtr vm);
-static int umlReadPidFile(virConnectPtr conn,
- struct uml_driver *driver,
+static int umlReadPidFile(struct uml_driver *driver,
virDomainObjPtr vm);
static int umlSetCloseExec(int fd) {
@@ -313,7 +312,7 @@ reread:
continue;
}
- if (umlReadPidFile(NULL, driver, dom) < 0) {
+ if (umlReadPidFile(driver, dom) < 0) {
virDomainObjUnlock(dom);
continue;
}
@@ -559,8 +558,7 @@ umlShutdown(void) {
}
-static int umlReadPidFile(virConnectPtr conn,
- struct uml_driver *driver,
+static int umlReadPidFile(struct uml_driver *driver,
virDomainObjPtr vm)
{
int rc = -1;
@@ -598,7 +596,7 @@ reopen:
cleanup:
if (rc != 0)
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to read pid: %s"),
pidfile);
VIR_FREE(pidfile);
@@ -652,7 +650,7 @@ restat:
}
if ((priv->monitor = socket(PF_UNIX, SOCK_DGRAM, 0)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot open socket"));
return -1;
}
@@ -661,7 +659,7 @@ restat:
sprintf(addr.sun_path + 1, "libvirt-uml-%u", vm->pid);
VIR_DEBUG("Reply address for monitor is '%s'", addr.sun_path+1);
if (bind(priv->monitor, (struct sockaddr *)&addr, sizeof addr) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot bind socket"));
close(priv->monitor);
priv->monitor = -1;
@@ -717,7 +715,7 @@ static int umlMonitorCommand(virConnectPtr conn,
req.version = MONITOR_VERSION;
req.length = strlen(cmd);
if (req.length > (MONITOR_BUFLEN-1)) {
- virReportSystemError(conn, EINVAL,
+ virReportSystemError(EINVAL,
_("cannot send too long command %s (%d bytes)"),
cmd, req.length);
return -1;
@@ -730,7 +728,7 @@ static int umlMonitorCommand(virConnectPtr conn,
if (sendto(priv->monitor, &req, sizeof req, 0,
(struct sockaddr *)&addr, sizeof addr) != (sizeof req)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot send command %s"),
cmd);
return -1;
@@ -740,7 +738,7 @@ static int umlMonitorCommand(virConnectPtr conn,
addrlen = sizeof(addr);
if (recvfrom(priv->monitor, &res, sizeof res, 0,
(struct sockaddr *)&addr, &addrlen) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read reply %s"),
cmd);
goto error;
@@ -832,14 +830,14 @@ static int umlStartVMDaemon(virConnectPtr conn,
* in a sub-process so its hard to feed back a useful error
*/
if (stat(vm->def->os.kernel, &sb) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Cannot find UML kernel %s"),
vm->def->os.kernel);
return -1;
}
if (virFileMakePath(driver->logDir) != 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot create log directory %s"),
driver->logDir);
return -1;
@@ -853,7 +851,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
if ((logfd = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
S_IRUSR | S_IWUSR)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("failed to create logfile %s"),
logfile);
VIR_FREE(logfile);
@@ -862,7 +860,7 @@ static int umlStartVMDaemon(virConnectPtr conn,
VIR_FREE(logfile);
if (umlSetCloseExec(logfd) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("Unable to set VM logfile
close-on-exec flag"));
close(logfd);
return -1;
@@ -1739,21 +1737,21 @@ static int umlDomainSetAutostart(virDomainPtr dom,
int err;
if ((err = virFileMakePath(driver->autostartDir))) {
- virReportSystemError(dom->conn, err,
+ virReportSystemError(err,
_("cannot create autostart directory
%s"),
driver->autostartDir);
goto cleanup;
}
if (symlink(configFile, autostartLink) < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Failed to create symlink '%s to
'%s'"),
autostartLink, configFile);
goto cleanup;
}
} else {
if (unlink(autostartLink) < 0 && errno != ENOENT && errno
!= ENOTDIR) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("Failed to delete symlink
'%s'"),
autostartLink);
goto cleanup;
@@ -1815,7 +1813,7 @@ umlDomainBlockPeek (virDomainPtr dom,
/* The path is correct, now try to open it and get its size. */
fd = open (path, O_RDONLY);
if (fd == -1) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("cannot open %s"), path);
goto cleanup;
}
@@ -1826,7 +1824,7 @@ umlDomainBlockPeek (virDomainPtr dom,
*/
if (lseek (fd, offset, SEEK_SET) == (off_t) -1 ||
saferead (fd, buffer, size) == (ssize_t) -1) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("cannot read %s"), path);
goto cleanup;
}
diff --git a/src/util/hostusb.c b/src/util/hostusb.c
index 11a0426..96ece38 100644
--- a/src/util/hostusb.c
+++ b/src/util/hostusb.c
@@ -100,7 +100,7 @@ static int usbFindBusByVendor(virConnectPtr conn,
dir = opendir(USB_SYSFS "/devices");
if (!dir) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Could not open directory %s"),
USB_SYSFS "/devices");
goto cleanup;
diff --git a/src/util/pci.c b/src/util/pci.c
index 12e6e91..bbaf235 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -617,10 +617,10 @@ pciTryPowerManagementReset(virConnectPtr conn ATTRIBUTE_UNUSED,
pciDevice *dev)
}
static int
-pciInitDevice(virConnectPtr conn, pciDevice *dev)
+pciInitDevice(pciDevice *dev)
{
if (pciOpenConfig(dev) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to open config space file
'%s'"),
dev->path);
return -1;
@@ -647,7 +647,7 @@ pciResetDevice(virConnectPtr conn,
return -1;
}
- if (!dev->initted && pciInitDevice(conn, dev) < 0)
+ if (!dev->initted && pciInitDevice(dev) < 0)
return -1;
/* KVM will perform FLR when starting and stopping
@@ -739,7 +739,7 @@ recheck:
static int
-pciBindDeviceToStub(virConnectPtr conn, pciDevice *dev, const char *driver)
+pciBindDeviceToStub(pciDevice *dev, const char *driver)
{
char drvdir[PATH_MAX];
char path[PATH_MAX];
@@ -754,7 +754,7 @@ pciBindDeviceToStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
*/
pciDriverFile(path, sizeof(path), driver, "new_id");
if (virFileWriteStr(path, dev->id) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to add PCI device ID '%s' to
%s"),
dev->id, driver);
return -1;
@@ -767,7 +767,7 @@ pciBindDeviceToStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
*/
pciDeviceFile(path, sizeof(path), dev->name, "driver/unbind");
if (virFileExists(path) && virFileWriteStr(path, dev->name) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to unbind PCI device '%s'"),
dev->name);
return -1;
}
@@ -780,7 +780,7 @@ pciBindDeviceToStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
/* Xen's pciback.ko wants you to use new_slot first */
pciDriverFile(path, sizeof(path), driver, "new_slot");
if (virFileExists(path) && virFileWriteStr(path, dev->name) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to add slot for PCI device '%s'
to %s"),
dev->name, driver);
return -1;
@@ -788,7 +788,7 @@ pciBindDeviceToStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
pciDriverFile(path, sizeof(path), driver, "bind");
if (virFileWriteStr(path, dev->name) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to bind PCI device '%s' to
%s"),
dev->name, driver);
return -1;
@@ -800,7 +800,7 @@ pciBindDeviceToStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
*/
pciDriverFile(path, sizeof(path), driver, "remove_id");
if (virFileExists(path) && virFileWriteStr(path, dev->id) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to remove PCI ID '%s' from
%s"),
dev->id, driver);
return -1;
@@ -819,11 +819,11 @@ pciDettachDevice(virConnectPtr conn, pciDevice *dev)
return -1;
}
- return pciBindDeviceToStub(conn, dev, driver);
+ return pciBindDeviceToStub(dev, driver);
}
static int
-pciUnBindDeviceFromStub(virConnectPtr conn, pciDevice *dev, const char *driver)
+pciUnBindDeviceFromStub(pciDevice *dev, const char *driver)
{
char drvdir[PATH_MAX];
char path[PATH_MAX];
@@ -835,7 +835,7 @@ pciUnBindDeviceFromStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
if (virFileExists(drvdir) && virFileLinkPointsTo(path, drvdir)) {
pciDriverFile(path, sizeof(path), driver, "unbind");
if (virFileWriteStr(path, dev->name) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to bind PCI device '%s' to
%s"),
dev->name, driver);
return -1;
@@ -845,7 +845,7 @@ pciUnBindDeviceFromStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
/* Xen's pciback.ko wants you to use remove_slot on the specific device */
pciDriverFile(path, sizeof(path), driver, "remove_slot");
if (virFileExists(path) && virFileWriteStr(path, dev->name) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to remove slot for PCI device '%s' to
%s"),
dev->name, driver);
return -1;
@@ -860,7 +860,7 @@ pciUnBindDeviceFromStub(virConnectPtr conn, pciDevice *dev, const char
*driver)
pciDriverFile(path, sizeof(path), driver, "remove_id");
if (!virFileExists(drvdir) || virFileExists(path)) {
if (virFileWriteStr(PCI_SYSFS "drivers_probe", dev->name) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to trigger a re-probe for PCI device
'%s'"),
dev->name);
return -1;
@@ -880,7 +880,7 @@ pciReAttachDevice(virConnectPtr conn, pciDevice *dev)
return -1;
}
- return pciUnBindDeviceFromStub(conn, dev, driver);
+ return pciUnBindDeviceFromStub(dev, driver);
}
/* Certain hypervisors (like qemu/kvm) map the PCI bar(s) on
@@ -1221,7 +1221,7 @@ int pciDeviceFileIterate(virConnectPtr conn,
}
if (!(dir = opendir(pcidir))) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open %s"), pcidir);
goto cleanup;
}
@@ -1255,14 +1255,13 @@ cleanup:
}
static int
-pciDeviceDownstreamLacksACS(virConnectPtr conn,
- pciDevice *dev)
+pciDeviceDownstreamLacksACS(pciDevice *dev)
{
uint16_t flags;
uint16_t ctrl;
unsigned int pos;
- if (!dev->initted && pciInitDevice(conn, dev) < 0)
+ if (!dev->initted && pciInitDevice(dev) < 0)
return -1;
pos = dev->pcie_cap_pos;
@@ -1319,7 +1318,7 @@ pciDeviceIsBehindSwitchLackingACS(virConnectPtr conn,
pciDevice *tmp;
int acs;
- acs = pciDeviceDownstreamLacksACS(conn, parent);
+ acs = pciDeviceDownstreamLacksACS(parent);
if (acs) {
pciFreeDevice(conn, parent);
diff --git a/src/util/processinfo.c b/src/util/processinfo.c
index 66efa8b..5ae19f8 100644
--- a/src/util/processinfo.c
+++ b/src/util/processinfo.c
@@ -73,7 +73,7 @@ realloc:
numcpus = numcpus << 2;
goto realloc;
}
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set CPU affinity on process %d"), pid);
return -1;
}
@@ -89,7 +89,7 @@ realloc:
}
if (sched_setaffinity(pid, sizeof(mask), &mask) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set CPU affinity on process %d"), pid);
return -1;
}
@@ -134,7 +134,7 @@ realloc:
numcpus = numcpus << 2;
goto realloc;
}
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set CPU affinity on process %d"), pid);
return -1;
}
@@ -148,7 +148,7 @@ realloc:
CPU_ZERO(&mask);
if (sched_getaffinity(pid, sizeof(mask), &mask) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set CPU affinity on process %d"), pid);
return -1;
}
@@ -168,7 +168,7 @@ int virProcessInfoSetAffinity(pid_t pid ATTRIBUTE_UNUSED,
size_t maplen ATTRIBUTE_UNUSED,
int maxcpu ATTRIBUTE_UNUSED)
{
- virReportSystemError(NULL, ENOSYS, "%s",
+ virReportSystemError(ENOSYS, "%s",
_("Process CPU affinity is not supported on this
platform"));
return -1;
}
@@ -178,7 +178,7 @@ int virProcessInfoGetAffinity(pid_t pid ATTRIBUTE_UNUSED,
size_t maplen ATTRIBUTE_UNUSED,
int maxcpu ATTRIBUTE_UNUSED)
{
- virReportSystemError(NULL, ENOSYS, "%s",
+ virReportSystemError(ENOSYS, "%s",
_("Process CPU affinity is not supported on this
platform"));
return -1;
}
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index 1a490ba..d78e236 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -286,7 +286,7 @@ virStorageFileGetMetadataFromFD(virConnectPtr conn,
meta->format = VIR_STORAGE_FILE_RAW;
if ((len = read(fd, head, sizeof(head))) < 0) {
- virReportSystemError(conn, errno, _("cannot read header '%s'"),
path);
+ virReportSystemError(errno, _("cannot read header '%s'"),
path);
return -1;
}
@@ -412,7 +412,7 @@ virStorageFileGetMetadata(virConnectPtr conn,
int fd, ret;
if ((fd = open(path, O_RDONLY)) < 0) {
- virReportSystemError(conn, errno, _("cannot open file '%s'"),
path);
+ virReportSystemError(errno, _("cannot open file '%s'"), path);
return -1;
}
diff --git a/src/util/util.c b/src/util/util.c
index d40a790..92b2958 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -345,13 +345,13 @@ __virExec(virConnectPtr conn,
*/
sigfillset(&newmask);
if (pthread_sigmask(SIG_SETMASK, &newmask, &oldmask) != 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot block signals"));
return -1;
}
if ((null = open("/dev/null", O_RDONLY)) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot open %s"),
"/dev/null");
goto cleanup;
@@ -360,20 +360,20 @@ __virExec(virConnectPtr conn,
if (outfd != NULL) {
if (*outfd == -1) {
if (pipe(pipeout) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot create pipe"));
goto cleanup;
}
if ((flags & VIR_EXEC_NONBLOCK) &&
virSetNonBlock(pipeout[0]) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("Failed to set non-blocking
file descriptor flag"));
goto cleanup;
}
if (virSetCloseExec(pipeout[0]) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("Failed to set close-on-exec
file descriptor flag"));
goto cleanup;
}
@@ -389,20 +389,20 @@ __virExec(virConnectPtr conn,
if (errfd != NULL) {
if (*errfd == -1) {
if (pipe(pipeerr) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("Failed to create
pipe"));
goto cleanup;
}
if ((flags & VIR_EXEC_NONBLOCK) &&
virSetNonBlock(pipeerr[0]) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("Failed to set non-blocking
file descriptor flag"));
goto cleanup;
}
if (virSetCloseExec(pipeerr[0]) == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("Failed to set close-on-exec
file descriptor flag"));
goto cleanup;
}
@@ -424,7 +424,7 @@ __virExec(virConnectPtr conn,
virLogUnlock();
if (pid < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot fork child process"));
goto cleanup;
}
@@ -443,7 +443,7 @@ __virExec(virConnectPtr conn,
/* Restore our original signal mask now child is safely
running */
if (pthread_sigmask(SIG_SETMASK, &oldmask, NULL) != 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot unblock signals"));
return -1;
}
@@ -487,7 +487,7 @@ __virExec(virConnectPtr conn,
and don't want to propagate that to children */
sigemptyset(&newmask);
if (pthread_sigmask(SIG_SETMASK, &newmask, NULL) != 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot unblock signals"));
_exit(1);
}
@@ -503,19 +503,19 @@ __virExec(virConnectPtr conn,
close(i);
if (dup2(infd >= 0 ? infd : null, STDIN_FILENO) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("failed to setup stdin file
handle"));
_exit(1);
}
if (childout > 0 &&
dup2(childout, STDOUT_FILENO) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("failed to setup stdout file
handle"));
_exit(1);
}
if (childerr > 0 &&
dup2(childerr, STDERR_FILENO) < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("failed to setup stderr file
handle"));
_exit(1);
}
@@ -533,20 +533,20 @@ __virExec(virConnectPtr conn,
* the above errors with wait* */
if (flags & VIR_EXEC_DAEMON) {
if (setsid() < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot become session
leader"));
_exit(1);
}
if (chdir("/") < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot change to root directory:
%s"));
_exit(1);
}
pid = fork();
if (pid < 0) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot fork child
process"));
_exit(1);
}
@@ -556,7 +556,7 @@ __virExec(virConnectPtr conn,
kill(pid, SIGTERM);
usleep(500*1000);
kill(pid, SIGTERM);
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("could not write pidfile %s for %d"),
pidfile, pid);
_exit(1);
@@ -583,7 +583,7 @@ __virExec(virConnectPtr conn,
else
execvp(argv[0], (char **) argv);
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot execute binary %s"),
argv[0]);
@@ -783,7 +783,7 @@ virPipeReadUntilEOF(virConnectPtr conn, int outfd, int errfd,
continue;
pollerr:
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("poll error"));
goto error;
}
@@ -852,7 +852,7 @@ virRunWithHook(virConnectPtr conn,
while ((waitret = waitpid(childpid, &exitstatus, 0) == -1) &&
errno == EINTR);
if (waitret == -1) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot wait for '%s'"),
argv[0]);
goto error;
@@ -996,14 +996,14 @@ int virFileReadAll(const char *path, int maxlen, char **buf)
{
int fd = open(path, O_RDONLY);
if (fd < 0) {
- virReportSystemError(NULL, errno, _("Failed to open file
'%s'"), path);
+ virReportSystemError(errno, _("Failed to open file '%s'"),
path);
return -1;
}
int len = virFileReadLimFD(fd, maxlen, buf);
close(fd);
if (len < 0) {
- virReportSystemError(NULL, errno, _("Failed to read file
'%s'"), path);
+ virReportSystemError(errno, _("Failed to read file '%s'"),
path);
return -1;
}
@@ -1170,32 +1170,32 @@ static int virFileCreateSimple(const char *path, mode_t mode,
uid_t uid, gid_t g
if ((fd = open(path, open_flags, mode)) < 0) {
ret = errno;
- virReportSystemError(NULL, errno, _("failed to create file
'%s'"),
+ virReportSystemError(errno, _("failed to create file '%s'"),
path);
goto error;
}
if (fstat(fd, &st) == -1) {
ret = errno;
- virReportSystemError(NULL, errno, _("stat of '%s' failed"),
path);
+ virReportSystemError(errno, _("stat of '%s' failed"), path);
goto error;
}
if (((st.st_uid != uid) || (st.st_gid != gid))
&& (fchown(fd, uid, gid) < 0)) {
ret = errno;
- virReportSystemError(NULL, errno, _("cannot chown '%s' to (%u,
%u)"),
+ virReportSystemError(errno, _("cannot chown '%s' to (%u,
%u)"),
path, uid, gid);
goto error;
}
if (fchmod(fd, mode) < 0) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
path, mode);
goto error;
}
if (close(fd) < 0) {
ret = errno;
- virReportSystemError(NULL, errno, _("failed to close new file
'%s'"),
+ virReportSystemError(errno, _("failed to close new file
'%s'"),
path);
fd = -1;
goto error;
@@ -1216,26 +1216,26 @@ static int virDirCreateSimple(const char *path, mode_t mode, uid_t
uid, gid_t gi
&& !((errno == EEXIST) && (flags &
VIR_FILE_CREATE_ALLOW_EXIST)))
{
ret = errno;
- virReportSystemError(NULL, errno, _("failed to create directory
'%s'"),
+ virReportSystemError(errno, _("failed to create directory
'%s'"),
path);
goto error;
}
if (stat(path, &st) == -1) {
ret = errno;
- virReportSystemError(NULL, errno, _("stat of '%s' failed"),
path);
+ virReportSystemError(errno, _("stat of '%s' failed"), path);
goto error;
}
if (((st.st_uid != uid) || (st.st_gid != gid))
&& (chown(path, uid, gid) < 0)) {
ret = errno;
- virReportSystemError(NULL, errno, _("cannot chown '%s' to (%u,
%u)"),
+ virReportSystemError(errno, _("cannot chown '%s' to (%u,
%u)"),
path, uid, gid);
goto error;
}
if (chmod(path, mode) < 0) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
path, mode);
goto error;
@@ -1270,7 +1270,7 @@ int virFileCreate(const char *path, mode_t mode,
if (pid < 0) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot fork o create file '%s'"),
path);
return ret;
}
@@ -1281,7 +1281,7 @@ int virFileCreate(const char *path, mode_t mode,
&& (errno == EINTR));
if (waitret == -1) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("failed to wait for child creating
'%s'"),
path);
goto parenterror;
@@ -1300,21 +1300,21 @@ int virFileCreate(const char *path, mode_t mode,
* setgid. If not, try doing it with chown */
if (stat(path, &st) == -1) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("stat of '%s' failed"),
path);
goto parenterror;
}
if ((st.st_gid != gid) && (chown(path, -1, gid) < 0)) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot chown '%s' to group %u"),
path, gid);
goto parenterror;
}
if (chmod(path, mode) < 0) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
path, mode);
goto parenterror;
@@ -1327,14 +1327,14 @@ parenterror:
if ((gid != 0) && (setgid(gid) != 0)) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set gid %u creating '%s'"),
gid, path);
goto childerror;
}
if ((uid != 0) && (setuid(uid) != 0)) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set uid %u creating '%s'"),
uid, path);
goto childerror;
@@ -1343,7 +1343,7 @@ parenterror:
ret = errno;
if (ret != EACCES) {
/* in case of EACCES, the parent will retry */
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("child failed to create file
'%s'"),
path);
}
@@ -1351,7 +1351,7 @@ parenterror:
}
if (close(fd) < 0) {
ret = errno;
- virReportSystemError(NULL, errno, _("child failed to close new file
'%s'"),
+ virReportSystemError(errno, _("child failed to close new file
'%s'"),
path);
goto childerror;
}
@@ -1380,7 +1380,7 @@ int virDirCreate(const char *path, mode_t mode,
if (pid < 0) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot fork to create directory
'%s'"),
path);
return ret;
@@ -1391,7 +1391,7 @@ int virDirCreate(const char *path, mode_t mode,
while ((waitret = waitpid(pid, &status, 0) == -1) && (errno ==
EINTR));
if (waitret == -1) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("failed to wait for child creating
'%s'"),
path);
goto parenterror;
@@ -1410,20 +1410,20 @@ int virDirCreate(const char *path, mode_t mode,
* setgid. If not, try doing it with chown */
if (stat(path, &st) == -1) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("stat of '%s' failed"),
path);
goto parenterror;
}
if ((st.st_gid != gid) && (chown(path, -1, gid) < 0)) {
ret = errno;
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot chown '%s' to group %u"),
path, gid);
goto parenterror;
}
if (chmod(path, mode) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"),
path, mode);
goto parenterror;
@@ -1436,13 +1436,13 @@ parenterror:
if ((gid != 0) && (setgid(gid) != 0)) {
ret = errno;
- virReportSystemError(NULL, errno, _("cannot set gid %u creating
'%s'"),
+ virReportSystemError(errno, _("cannot set gid %u creating
'%s'"),
gid, path);
goto childerror;
}
if ((uid != 0) && (setuid(uid) != 0)) {
ret = errno;
- virReportSystemError(NULL, errno, _("cannot set uid %u creating
'%s'"),
+ virReportSystemError(errno, _("cannot set uid %u creating
'%s'"),
uid, path);
goto childerror;
}
@@ -1450,7 +1450,7 @@ parenterror:
ret = errno;
if (ret != EACCES) {
/* in case of EACCES, the parent will retry */
- virReportSystemError(NULL, errno, _("child failed to create directory
'%s'"),
+ virReportSystemError(errno, _("child failed to create directory
'%s'"),
path);
}
goto childerror;
@@ -2213,8 +2213,8 @@ char *virGetHostname(virConnectPtr conn)
r = gethostname (hostname, sizeof(hostname));
if (r == -1) {
- virReportSystemError (conn, errno,
- "%s", _("failed to determine host
name"));
+ virReportSystemError(errno,
+ "%s", _("failed to determine host
name"));
return NULL;
}
NUL_TERMINATE(hostname);
@@ -2338,8 +2338,7 @@ enum {
VIR_USER_ENT_NAME,
};
-static char *virGetUserEnt(virConnectPtr conn,
- uid_t uid,
+static char *virGetUserEnt(uid_t uid,
int field)
{
char *strbuf;
@@ -2350,7 +2349,7 @@ static char *virGetUserEnt(virConnectPtr conn,
size_t strbuflen = val;
if (val < 0) {
- virReportSystemError(conn, errno, "%s", _("sysconf
failed"));
+ virReportSystemError(errno, "%s", _("sysconf failed"));
return NULL;
}
@@ -2367,7 +2366,7 @@ static char *virGetUserEnt(virConnectPtr conn,
* The given name or uid was not found.
*/
if (getpwuid_r(uid, &pwbuf, strbuf, strbuflen, &pw) != 0 || pw == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to find user record for uid
'%d'"),
uid);
VIR_FREE(strbuf);
@@ -2386,20 +2385,20 @@ static char *virGetUserEnt(virConnectPtr conn,
return ret;
}
-char *virGetUserDirectory(virConnectPtr conn,
+char *virGetUserDirectory(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
uid_t uid)
{
- return virGetUserEnt(conn, uid, VIR_USER_ENT_DIRECTORY);
+ return virGetUserEnt(uid, VIR_USER_ENT_DIRECTORY);
}
-char *virGetUserName(virConnectPtr conn,
+char *virGetUserName(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
uid_t uid)
{
- return virGetUserEnt(conn, uid, VIR_USER_ENT_NAME);
+ return virGetUserEnt(uid, VIR_USER_ENT_NAME);
}
-int virGetUserID(virConnectPtr conn,
+int virGetUserID(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
const char *name,
uid_t *uid)
{
@@ -2410,7 +2409,7 @@ int virGetUserID(virConnectPtr conn,
size_t strbuflen = val;
if (val < 0) {
- virReportSystemError(conn, errno, "%s", _("sysconf
failed"));
+ virReportSystemError(errno, "%s", _("sysconf failed"));
return -1;
}
@@ -2427,7 +2426,7 @@ int virGetUserID(virConnectPtr conn,
* The given name or uid was not found.
*/
if (getpwnam_r(name, &pwbuf, strbuf, strbuflen, &pw) != 0 || pw == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to find user record for name
'%s'"),
name);
VIR_FREE(strbuf);
@@ -2442,7 +2441,7 @@ int virGetUserID(virConnectPtr conn,
}
-int virGetGroupID(virConnectPtr conn,
+int virGetGroupID(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
const char *name,
gid_t *gid)
{
@@ -2453,7 +2452,7 @@ int virGetGroupID(virConnectPtr conn,
size_t strbuflen = val;
if (val < 0) {
- virReportSystemError(conn, errno, "%s", _("sysconf
failed"));
+ virReportSystemError(errno, "%s", _("sysconf failed"));
return -1;
}
@@ -2470,7 +2469,7 @@ int virGetGroupID(virConnectPtr conn,
* The given name or uid was not found.
*/
if (getgrnam_r(name, &grbuf, strbuf, strbuflen, &gr) != 0 || gr == NULL) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("Failed to find group record for name
'%s'"),
name);
VIR_FREE(strbuf);
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 1454ea0..bbf5021 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -1197,7 +1197,6 @@ const char *virStrerror(int theerrno, char *errBuf, size_t
errBufLen)
/**
* virReportSystemErrorFull:
- * @conn: the hyperisor connection
* @domcode: the virErrorDomain indicating where it's coming from
* @theerrno: an errno number
* @filename: filename where error was raised
@@ -1208,8 +1207,7 @@ const char *virStrerror(int theerrno, char *errBuf, size_t
errBufLen)
*
* Convenience internal routine called when a system error is detected.
*/
-void virReportSystemErrorFull(virConnectPtr conn,
- int domcode,
+void virReportSystemErrorFull(int domcode,
int theerrno,
const char *filename,
const char *funcname,
@@ -1243,7 +1241,7 @@ void virReportSystemErrorFull(virConnectPtr conn,
if (!msgDetail)
msgDetail = errnoDetail;
- virRaiseErrorFull(conn, filename, funcname, linenr,
+ virRaiseErrorFull(NULL, filename, funcname, linenr,
domcode, VIR_ERR_SYSTEM_ERROR, VIR_ERR_ERROR,
msg, msgDetail, NULL, -1, -1, msg, msgDetail);
}
diff --git a/src/util/virterror_internal.h b/src/util/virterror_internal.h
index e4b644c..fba3078 100644
--- a/src/util/virterror_internal.h
+++ b/src/util/virterror_internal.h
@@ -63,18 +63,16 @@ void virReportErrorHelper(virConnectPtr conn, int domcode, int
errcode,
const char *fmt, ...)
ATTRIBUTE_FMT_PRINTF(7, 8);
-void virReportSystemErrorFull(virConnectPtr conn,
- int domcode,
+void virReportSystemErrorFull(int domcode,
int theerrno,
const char *filename,
const char *funcname,
size_t linenr,
const char *fmt, ...)
- ATTRIBUTE_FMT_PRINTF(7, 8);
+ ATTRIBUTE_FMT_PRINTF(6, 7);
-#define virReportSystemError(conn, theerrno, fmt,...) \
- virReportSystemErrorFull((conn), \
- VIR_FROM_THIS, \
+#define virReportSystemError(theerrno, fmt,...) \
+ virReportSystemErrorFull(VIR_FROM_THIS, \
(theerrno), \
__FILE__, __FUNCTION__, __LINE__, \
(fmt), __VA_ARGS__)
diff --git a/src/xen/proxy_internal.c b/src/xen/proxy_internal.c
index e37bce1..300618b 100644
--- a/src/xen/proxy_internal.c
+++ b/src/xen/proxy_internal.c
@@ -377,7 +377,7 @@ xenProxyCommand(virConnectPtr conn, virProxyPacketPtr request,
request->len);
if (ret < 0) {
if (!quiet)
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("failed to write proxy request"));
goto error;
}
@@ -388,7 +388,7 @@ retry:
sizeof(virProxyPacket));
if (ret < 0) {
if (!quiet)
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("failed to read proxy reply"));
goto error;
}
@@ -411,7 +411,7 @@ retry:
sizeof(virProxyPacket));
if (ret < 0) {
if (!quiet)
- virReportSystemError(conn, errno, "%s",
+ virReportSystemError(errno, "%s",
_("failed to read proxy reply"));
goto error;
}
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 13a5d3d..bdb0c3c 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -2368,7 +2368,7 @@ get_cpu_flags(virConnectPtr conn, const char **hvm, int *pae, int
*longmode)
if ((fd = open("/dev/cpu/self/cpuid", O_RDONLY)) == -1 ||
pread(fd, ®s, sizeof(regs), 0) != sizeof(regs)) {
- virReportSystemError(conn, errno, "%s", _("could not read CPU
flags"));
+ virReportSystemError(errno, "%s", _("could not read CPU
flags"));
goto out;
}
@@ -2649,7 +2649,7 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
cpuinfo = fopen ("/proc/cpuinfo", "r");
if (cpuinfo == NULL) {
if (errno != ENOENT) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read file %s"),
"/proc/cpuinfo");
return NULL;
@@ -2660,7 +2660,7 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
if (capabilities == NULL) {
if (errno != ENOENT) {
fclose(cpuinfo);
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read file %s"),
"/sys/hypervisor/properties/capabilities");
return NULL;
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 2445b58..b061439 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -403,7 +403,7 @@ xenInotifyOpen(virConnectPtr conn,
/* populate initial list */
if (!(dh = opendir(priv->configDir))) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("cannot open directory: %s"),
priv->configDir);
return -1;
@@ -431,7 +431,7 @@ xenInotifyOpen(virConnectPtr conn,
}
if ((priv->inotifyFD = inotify_init()) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
"%s", _("initializing inotify"));
return -1;
}
@@ -442,7 +442,7 @@ xenInotifyOpen(virConnectPtr conn,
IN_CREATE |
IN_CLOSE_WRITE | IN_DELETE |
IN_MOVED_TO | IN_MOVED_FROM) < 0) {
- virReportSystemError(NULL, errno,
+ virReportSystemError(errno,
_("adding watch on %s"),
priv->configDir);
return -1;
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 402a209..bbe2f29 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -845,7 +845,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char
*port)
if (!priv->addrlen) {
/* Don't raise error when unprivileged, since proxy takes over */
if (xenHavePrivilege())
- virReportSystemError(conn, saved_errno,
+ virReportSystemError(saved_errno,
_("unable to connect to '%s:%s'"),
host, port);
return -1;
@@ -5106,7 +5106,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
/* The path is correct, now try to open it and get its size. */
fd = open (path, O_RDONLY);
if (fd == -1) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("failed to open for reading: %s"),
path);
goto cleanup;
@@ -5118,7 +5118,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
*/
if (lseek (fd, offset, SEEK_SET) == (off_t) -1 ||
saferead (fd, buffer, size) == (ssize_t) -1) {
- virReportSystemError(domain->conn, errno,
+ virReportSystemError(errno,
_("failed to lseek or read from file: %s"),
path);
goto cleanup;
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 23e11d7..1dc0f5b 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -395,7 +395,7 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename)
/* Get modified time */
if ((stat(filename, &st) < 0)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot stat: %s"),
filename);
return -1;
@@ -492,7 +492,7 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
struct xenXMConfigReaperData args;
if (now == ((time_t)-1)) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
"%s", _("cannot get time of day"));
return (-1);
}
@@ -505,7 +505,7 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
/* Process the files in the config dir */
if (!(dh = opendir(priv->configDir))) {
- virReportSystemError(conn, errno,
+ virReportSystemError(errno,
_("cannot read directory %s"),
priv->configDir);
return (-1);
@@ -3143,7 +3143,7 @@ int xenXMDomainGetAutostart(virDomainPtr dom, int *autostart)
*autostart = virFileLinkPointsTo(linkname, config);
if (*autostart < 0) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("cannot check link %s points to config %s"),
linkname, config);
goto cleanup;
@@ -3172,7 +3172,7 @@ int xenXMDomainSetAutostart(virDomainPtr dom, int autostart)
if (autostart) {
if (symlink(config, linkname) < 0 &&
errno != EEXIST) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("failed to create link %s to %s"),
config, linkname);
goto cleanup;
@@ -3180,7 +3180,7 @@ int xenXMDomainSetAutostart(virDomainPtr dom, int autostart)
} else {
if (unlink(linkname) < 0 &&
errno != ENOENT) {
- virReportSystemError(dom->conn, errno,
+ virReportSystemError(errno,
_("failed to remove link %s"),
linkname);
goto cleanup;
--
1.6.3.3