You need to sign in or sign up before continuing.
提交 22335e9e 编写于 作者: P Peter Krempa

conf: Introduce virDomainDiskByTarget

Introduce a simpler replacement for virDomainDiskByName when looking up
by disk target.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
上级 40bfdb1e
...@@ -16905,6 +16905,22 @@ virDomainDiskByName(virDomainDefPtr def, ...@@ -16905,6 +16905,22 @@ virDomainDiskByName(virDomainDefPtr def,
return idx < 0 ? NULL : def->disks[idx]; return idx < 0 ? NULL : def->disks[idx];
} }
virDomainDiskDefPtr
virDomainDiskByTarget(virDomainDefPtr def,
const char *dst)
{
size_t i;
for (i = 0; i < def->ndisks; i++) {
if (STREQ(def->disks[i]->dst, dst))
return def->disks[i];
}
return NULL;
}
int virDomainDiskInsert(virDomainDefPtr def, int virDomainDiskInsert(virDomainDefPtr def,
virDomainDiskDefPtr disk) virDomainDiskDefPtr disk)
{ {
......
...@@ -3162,6 +3162,10 @@ int virDomainDiskIndexByName(virDomainDefPtr def, const char *name, ...@@ -3162,6 +3162,10 @@ int virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
virDomainDiskDefPtr virDomainDiskByName(virDomainDefPtr def, virDomainDiskDefPtr virDomainDiskByName(virDomainDefPtr def,
const char *name, const char *name,
bool allow_ambiguous); bool allow_ambiguous);
virDomainDiskDefPtr
virDomainDiskByTarget(virDomainDefPtr def,
const char *dst);
int virDomainDiskInsert(virDomainDefPtr def, int virDomainDiskInsert(virDomainDefPtr def,
virDomainDiskDefPtr disk) virDomainDiskDefPtr disk)
G_GNUC_WARN_UNUSED_RESULT; G_GNUC_WARN_UNUSED_RESULT;
......
...@@ -331,6 +331,7 @@ virDomainDiskBackingStoreParse; ...@@ -331,6 +331,7 @@ virDomainDiskBackingStoreParse;
virDomainDiskBusTypeToString; virDomainDiskBusTypeToString;
virDomainDiskByAddress; virDomainDiskByAddress;
virDomainDiskByName; virDomainDiskByName;
virDomainDiskByTarget;
virDomainDiskCacheTypeFromString; virDomainDiskCacheTypeFromString;
virDomainDiskCacheTypeToString; virDomainDiskCacheTypeToString;
virDomainDiskDefAssignAddress; virDomainDiskDefAssignAddress;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册