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,
|
virQEMUDriverConfig *cfg,
|
||||||
virDomainObj *vm,
|
virDomainObj *vm,
|
||||||
const char *file,
|
const char *file,
|
||||||
char * const *devMountsPath,
|
GStrv devMountsPath)
|
||||||
size_t ndevMountsPath)
|
|
||||||
{
|
{
|
||||||
long ttl = sysconf(_SC_SYMLOOP_MAX);
|
long ttl = sysconf(_SC_SYMLOOP_MAX);
|
||||||
g_autofree char *next = g_strdup(file);
|
g_autofree char *next = g_strdup(file);
|
||||||
size_t i;
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
g_auto(qemuNamespaceMknodItem) item = { 0 };
|
g_auto(qemuNamespaceMknodItem) item = { 0 };
|
||||||
@ -1213,14 +1211,19 @@ qemuNamespacePrepareOneItem(qemuNamespaceMknodData *data,
|
|||||||
next = g_strdup(item.target);
|
next = g_strdup(item.target);
|
||||||
|
|
||||||
if (STRPREFIX(item.file, QEMU_DEVPREFIX)) {
|
if (STRPREFIX(item.file, QEMU_DEVPREFIX)) {
|
||||||
for (i = 0; i < ndevMountsPath; i++) {
|
GStrv n;
|
||||||
if (STREQ(devMountsPath[i], "/dev"))
|
bool found = false;
|
||||||
|
|
||||||
|
for (n = devMountsPath; n && *n; n++) {
|
||||||
|
if (STREQ(*n, "/dev"))
|
||||||
continue;
|
continue;
|
||||||
if (STRPREFIX(item.file, devMountsPath[i]))
|
if (STRPREFIX(item.file, *n)) {
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == ndevMountsPath)
|
if (!found)
|
||||||
VIR_APPEND_ELEMENT(data->items, data->nitems, item);
|
VIR_APPEND_ELEMENT(data->items, data->nitems, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1269,8 +1272,7 @@ qemuNamespaceMknodPaths(virDomainObj *vm,
|
|||||||
for (next = paths; next; next = next->next) {
|
for (next = paths; next; next = next->next) {
|
||||||
const char *path = next->data;
|
const char *path = next->data;
|
||||||
|
|
||||||
if (qemuNamespacePrepareOneItem(&data, cfg, vm, path,
|
if (qemuNamespacePrepareOneItem(&data, cfg, vm, path, devMountsPath) < 0)
|
||||||
devMountsPath, ndevMountsPath) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user