Skip to content

Commit

Permalink
Merge pull request #33 from eric-ch/s9-oxt-1622
Browse files Browse the repository at this point in the history
S9: OXT-1622: surfman: xc_domain_getinfo usage.
  • Loading branch information
jean-edouard authored Jul 30, 2019
2 parents 6cb6c9a + 69f6146 commit f972c2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 9 additions & 6 deletions libsurfman/src/xc.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,21 @@ void xc_init (void)
}
}

int xc_domid_exists (int domid)
int xc_domid_getinfo(int domid, xc_dominfo_t *info)
{
xc_dominfo_t info;
int rc;

rc = xc_domain_getinfo (xch, domid, 1, &info);
return rc >= 0 ? info.domid == (domid_t)domid : 0;
rc = xc_domain_getinfo (xch, domid, 1, info);
if (rc == 1)
return info->domid == (domid_t)domid ? 1 : -ENOENT;
return rc;
}

int xc_domid_getinfo(int domid, xc_dominfo_t *info)
int xc_domid_exists(int domid)
{
return xc_domain_getinfo (xch, domid, 1, info);
xc_dominfo_t info = { 0 };

return !!xc_domid_getinfo(domid, &info);
}

void *xc_mmap_foreign(void *addr, size_t length, int prot,
Expand Down
2 changes: 1 addition & 1 deletion surfman/src/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ domain_dying (struct domain *d)
{
xc_dominfo_t info;

if (!xc_domid_getinfo (d->domid, &info))
if (xc_domid_getinfo (d->domid, &info) != 1)
return 0;
return info.dying;
}
Expand Down

0 comments on commit f972c2d

Please sign in to comment.