int ret = -1;
if ( !status || (end < start) )
- return -EINVAL;
-
+ {
+ errno = EINVAL;
+ return -1;
+ }
if ( xc_hypercall_bounce_pre(xch, status) )
{
ERROR("Could not bounce memory for xc_mark_page_online\n");
- return -EINVAL;
+ return -1;
}
sysctl.cmd = XEN_SYSCTL_page_offline_op;
int ret = -1;
if ( !status || (end < start) )
- return -EINVAL;
-
+ {
+ errno = EINVAL;
+ return -1;
+ }
if ( xc_hypercall_bounce_pre(xch, status) )
{
ERROR("Could not bounce memory for xc_mark_page_offline");
- return -EINVAL;
+ return -1;
}
sysctl.cmd = XEN_SYSCTL_page_offline_op;
int ret = -1;
if ( !status || (end < start) )
- return -EINVAL;
-
+ {
+ errno = EINVAL;
+ return -1;
+ }
if ( xc_hypercall_bounce_pre(xch, status) )
{
ERROR("Could not bounce memory for xc_query_page_offline_status\n");
- return -EINVAL;
+ return -1;
}
sysctl.cmd = XEN_SYSCTL_page_offline_op;
if ( xc_domain_getinfo(xch, domid, 1, &info) != 1 )
{
ERROR("Could not get domain info");
- return -EFAULT;
+ return -1;
}
if (!info.shutdown || info.shutdown_reason != SHUTDOWN_suspend)
{
+ errno = EINVAL;
ERROR("Can't exchange page unless domain is suspended\n");
- return -EINVAL;
+ return -1;
}
-
if (!is_page_exchangable(xch, domid, mfn, &info))
{
ERROR("Could not exchange page\n");
- return -EINVAL;
+ return -1;
}
/* Map M2P and obtain gpfn */
if ( !(m2p_table = xc_map_m2p(xch, max_mfn, PROT_READ, NULL)) )
{
PERROR("Failed to map live M2P table");
- return -EFAULT;
+ return -1;
}
gpfn = m2p_table[mfn];
if ( xc_map_domain_meminfo(xch, domid, &minfo) )
{
PERROR("Could not map domain's memory information\n");
- return -EFAULT;
+ return -1;
}
/* For translation macros */
ret = xc_mark_page_online(xch, mfn, mfn, &status);
if (ret < 0)
- fprintf(stderr, "Onlining page mfn %lx failed, error %x", mfn, ret);
+ fprintf(stderr, "Onlining page mfn %lx failed, error %x", mfn, errno);
else if (status & (PG_ONLINE_FAILED |PG_ONLINE_BROKEN)) {
fprintf(stderr, "Onlining page mfn %lx is broken, "
"Memory online failed\n", mfn);
ret = xc_query_page_offline_status(xch, mfn, mfn, &status);
if (ret < 0)
- fprintf(stderr, "Querying page mfn %lx failed, error %x", mfn, ret);
+ fprintf(stderr, "Querying page mfn %lx failed, error %x", mfn, errno);
else
{
printf("Memory Status %x: [", status);
printf("Prepare to offline MEMORY mfn %lx\n", mfn);
ret = xc_mark_page_offline(xch, mfn, mfn, &status);
if (ret < 0) {
- fprintf(stderr, "Offlining page mfn %lx failed, error %x\n", mfn, ret);
+ fprintf(stderr, "Offlining page mfn %lx failed, error %x\n", mfn, errno);
if (status & (PG_OFFLINE_XENPAGE | PG_OFFLINE_FAILED))
fprintf(stderr, "XEN_PAGE is not permitted be offlined\n");
else if (status & (PG_OFFLINE_FAILED | PG_OFFLINE_NOT_CONV_RAM))