You need to sign in or sign up before continuing.
提交 8dc867e9 编写于 作者: M Michal Privoznik

qemu_domain: Don't pass virDomainDeviceDefPtr to ns helpers

There is no need for this. None of the namespace helpers uses it.
Historically it was used when calling secdriver APIs, but we
don't to that anymore.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 848dbe19
...@@ -7643,7 +7643,6 @@ qemuDomainCreateNamespace(virQEMUDriverPtr driver, ...@@ -7643,7 +7643,6 @@ qemuDomainCreateNamespace(virQEMUDriverPtr driver,
struct qemuDomainAttachDeviceMknodData { struct qemuDomainAttachDeviceMknodData {
virQEMUDriverPtr driver; virQEMUDriverPtr driver;
virDomainObjPtr vm; virDomainObjPtr vm;
virDomainDeviceDefPtr devDef;
const char *file; const char *file;
const char *target; const char *target;
struct stat sb; struct stat sb;
...@@ -7747,7 +7746,6 @@ qemuDomainAttachDeviceMknodHelper(pid_t pid ATTRIBUTE_UNUSED, ...@@ -7747,7 +7746,6 @@ qemuDomainAttachDeviceMknodHelper(pid_t pid ATTRIBUTE_UNUSED,
static int static int
qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver, qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainDeviceDefPtr devDef,
const char *file, const char *file,
unsigned int ttl) unsigned int ttl)
{ {
...@@ -7767,7 +7765,6 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver, ...@@ -7767,7 +7765,6 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver,
data.driver = driver; data.driver = driver;
data.vm = vm; data.vm = vm;
data.devDef = devDef;
data.file = file; data.file = file;
if (lstat(file, &data.sb) < 0) { if (lstat(file, &data.sb) < 0) {
...@@ -7840,8 +7837,7 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver, ...@@ -7840,8 +7837,7 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver,
} }
if (isLink && if (isLink &&
qemuDomainAttachDeviceMknodRecursive(driver, vm, devDef, qemuDomainAttachDeviceMknodRecursive(driver, vm, target, ttl -1) < 0)
target, ttl -1) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -7858,13 +7854,11 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver, ...@@ -7858,13 +7854,11 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver,
static int static int
qemuDomainAttachDeviceMknod(virQEMUDriverPtr driver, qemuDomainAttachDeviceMknod(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainDeviceDefPtr devDef,
const char *file) const char *file)
{ {
long symloop_max = sysconf(_SC_SYMLOOP_MAX); long symloop_max = sysconf(_SC_SYMLOOP_MAX);
return qemuDomainAttachDeviceMknodRecursive(driver, vm, devDef, return qemuDomainAttachDeviceMknodRecursive(driver, vm, file, symloop_max);
file, symloop_max);
} }
...@@ -7888,7 +7882,6 @@ qemuDomainDetachDeviceUnlinkHelper(pid_t pid ATTRIBUTE_UNUSED, ...@@ -7888,7 +7882,6 @@ qemuDomainDetachDeviceUnlinkHelper(pid_t pid ATTRIBUTE_UNUSED,
static int static int
qemuDomainDetachDeviceUnlink(virQEMUDriverPtr driver ATTRIBUTE_UNUSED, qemuDomainDetachDeviceUnlink(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
const char *file) const char *file)
{ {
if (virProcessRunInMountNamespace(vm->pid, if (virProcessRunInMountNamespace(vm->pid,
...@@ -7905,7 +7898,6 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver, ...@@ -7905,7 +7898,6 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainDiskDefPtr disk) virDomainDiskDefPtr disk)
{ {
virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_DISK, .data.disk = disk};
virStorageSourcePtr next; virStorageSourcePtr next;
const char *src = NULL; const char *src = NULL;
struct stat sb; struct stat sb;
...@@ -7935,7 +7927,6 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver, ...@@ -7935,7 +7927,6 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
if (qemuDomainAttachDeviceMknod(driver, if (qemuDomainAttachDeviceMknod(driver,
vm, vm,
&dev,
next->path) < 0) next->path) < 0)
goto cleanup; goto cleanup;
} }
...@@ -7966,7 +7957,6 @@ qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver, ...@@ -7966,7 +7957,6 @@ qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev) virDomainHostdevDefPtr hostdev)
{ {
virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_HOSTDEV, .data.hostdev = hostdev};
int ret = -1; int ret = -1;
char *path = NULL; char *path = NULL;
...@@ -7984,7 +7974,6 @@ qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver, ...@@ -7984,7 +7974,6 @@ qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver,
if (qemuDomainAttachDeviceMknod(driver, if (qemuDomainAttachDeviceMknod(driver,
vm, vm,
&dev,
path) < 0) path) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -7999,7 +7988,6 @@ qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver, ...@@ -7999,7 +7988,6 @@ qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev) virDomainHostdevDefPtr hostdev)
{ {
virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_HOSTDEV, .data.hostdev = hostdev};
int ret = -1; int ret = -1;
char *path = NULL; char *path = NULL;
...@@ -8015,7 +8003,7 @@ qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver, ...@@ -8015,7 +8003,7 @@ qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (qemuDomainDetachDeviceUnlink(driver, vm, &dev, path) < 0) if (qemuDomainDetachDeviceUnlink(driver, vm, path) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -8030,7 +8018,6 @@ qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver, ...@@ -8030,7 +8018,6 @@ qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainChrDefPtr chr) virDomainChrDefPtr chr)
{ {
virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_CHR, .data.chr = chr};
const char *path; const char *path;
int ret = -1; int ret = -1;
...@@ -8044,7 +8031,6 @@ qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver, ...@@ -8044,7 +8031,6 @@ qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver,
if (qemuDomainAttachDeviceMknod(driver, if (qemuDomainAttachDeviceMknod(driver,
vm, vm,
&dev,
path) < 0) path) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -8058,7 +8044,6 @@ qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver, ...@@ -8058,7 +8044,6 @@ qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainChrDefPtr chr) virDomainChrDefPtr chr)
{ {
virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_CHR, .data.chr = chr};
int ret = -1; int ret = -1;
const char *path = NULL; const char *path = NULL;
...@@ -8070,7 +8055,7 @@ qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver, ...@@ -8070,7 +8055,7 @@ qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver,
path = chr->source->data.file.path; path = chr->source->data.file.path;
if (qemuDomainDetachDeviceUnlink(driver, vm, &dev, path) < 0) if (qemuDomainDetachDeviceUnlink(driver, vm, path) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -8084,7 +8069,6 @@ qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver, ...@@ -8084,7 +8069,6 @@ qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainRNGDefPtr rng) virDomainRNGDefPtr rng)
{ {
virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_RNG, .data.rng = rng};
const char *path = NULL; const char *path = NULL;
int ret = -1; int ret = -1;
...@@ -8104,7 +8088,6 @@ qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver, ...@@ -8104,7 +8088,6 @@ qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver,
if (qemuDomainAttachDeviceMknod(driver, if (qemuDomainAttachDeviceMknod(driver,
vm, vm,
&dev,
path) < 0) path) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
...@@ -8118,7 +8101,6 @@ qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver, ...@@ -8118,7 +8101,6 @@ qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver,
virDomainObjPtr vm, virDomainObjPtr vm,
virDomainRNGDefPtr rng) virDomainRNGDefPtr rng)
{ {
virDomainDeviceDef dev = {.type = VIR_DOMAIN_DEVICE_RNG, .data.rng = rng};
int ret = -1; int ret = -1;
const char *path = NULL; const char *path = NULL;
...@@ -8136,7 +8118,7 @@ qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver, ...@@ -8136,7 +8118,7 @@ qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver,
goto cleanup; goto cleanup;
} }
if (qemuDomainDetachDeviceUnlink(driver, vm, &dev, path) < 0) if (qemuDomainDetachDeviceUnlink(driver, vm, path) < 0)
goto cleanup; goto cleanup;
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册