virDomainObjGetShortName: take virDomainDef

So far this function takes virDomainObjPtr which:
1) is an overkill,
2) might be not available in all the places we will use it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2016-11-29 08:36:30 +01:00
parent dc18766b10
commit 7ed6934f3b
4 changed files with 5 additions and 5 deletions

View File

@ -25701,13 +25701,13 @@ virDomainDefHasMemballoon(const virDomainDef *def)
* Shorten domain name to avoid possible path length limitations.
*/
char *
virDomainObjGetShortName(virDomainObjPtr vm)
virDomainObjGetShortName(const virDomainDef *def)
{
const int dommaxlen = 20;
char *ret = NULL;
ignore_value(virAsprintf(&ret, "%d-%.*s",
vm->def->id, dommaxlen, vm->def->name));
def->id, dommaxlen, def->name));
return ret;
}

View File

@ -3205,7 +3205,7 @@ int virDomainDefGetVcpuPinInfoHelper(virDomainDefPtr def,
bool virDomainDefHasMemballoon(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
char *virDomainObjGetShortName(virDomainObjPtr vm);
char *virDomainObjGetShortName(const virDomainDef *def) ATTRIBUTE_NONNULL(1);
int
virDomainGetBlkioParametersAssignFromDef(virDomainDefPtr def,

View File

@ -1475,7 +1475,7 @@ qemuDomainSetPrivatePaths(virQEMUDriverPtr driver,
{
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
char *domname = virDomainObjGetShortName(vm);
char *domname = virDomainObjGetShortName(vm->def);
int ret = -1;
if (!domname)

View File

@ -3885,7 +3885,7 @@ getAutoDumpPath(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
char *dumpfile = NULL;
char *domname = virDomainObjGetShortName(vm);
char *domname = virDomainObjGetShortName(vm->def);
char timestr[100];
struct tm time_info;
time_t curtime = time(NULL);