mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
qemuNamespacePrepareOneItem: Don't pass count of elements
The only caller is passing a NULL terminated string list as 'devMountsPath' thus we don't need to get the count of elements. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0fcf40dc8b
commit
b28cf6a44e
@ -1187,12 +1187,10 @@ qemuNamespacePrepareOneItem(qemuNamespaceMknodData *data,
|
||||
virQEMUDriverConfig *cfg,
|
||||
virDomainObj *vm,
|
||||
const char *file,
|
||||
char * const *devMountsPath,
|
||||
size_t ndevMountsPath)
|
||||
GStrv devMountsPath)
|
||||
{
|
||||
long ttl = sysconf(_SC_SYMLOOP_MAX);
|
||||
g_autofree char *next = g_strdup(file);
|
||||
size_t i;
|
||||
|
||||
while (1) {
|
||||
g_auto(qemuNamespaceMknodItem) item = { 0 };
|
||||
@ -1213,14 +1211,19 @@ qemuNamespacePrepareOneItem(qemuNamespaceMknodData *data,
|
||||
next = g_strdup(item.target);
|
||||
|
||||
if (STRPREFIX(item.file, QEMU_DEVPREFIX)) {
|
||||
for (i = 0; i < ndevMountsPath; i++) {
|
||||
if (STREQ(devMountsPath[i], "/dev"))
|
||||
GStrv n;
|
||||
bool found = false;
|
||||
|
||||
for (n = devMountsPath; n && *n; n++) {
|
||||
if (STREQ(*n, "/dev"))
|
||||
continue;
|
||||
if (STRPREFIX(item.file, devMountsPath[i]))
|
||||
if (STRPREFIX(item.file, *n)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == ndevMountsPath)
|
||||
if (!found)
|
||||
VIR_APPEND_ELEMENT(data->items, data->nitems, item);
|
||||
}
|
||||
|
||||
@ -1269,8 +1272,7 @@ qemuNamespaceMknodPaths(virDomainObj *vm,
|
||||
for (next = paths; next; next = next->next) {
|
||||
const char *path = next->data;
|
||||
|
||||
if (qemuNamespacePrepareOneItem(&data, cfg, vm, path,
|
||||
devMountsPath, ndevMountsPath) < 0)
|
||||
if (qemuNamespacePrepareOneItem(&data, cfg, vm, path, devMountsPath) < 0)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user