} else {
/* page list terminator */
h = (struct tmem_handle *)buf;
- h->oid[0] = h->oid[1] = h->oid[2] = -1L;
+ h->oid.oid[0] = h->oid.oid[1] = h->oid.oid[2] = -1L;
if ( write_exact(io_fd, &h->oid, sizeof(h->oid)) )
return -1;
break;
if ( write_exact(io_fd, &handle.index, sizeof(handle.index)) )
return -1;
count++;
- checksum += handle.pool_id + handle.oid[0] + handle.oid[1] +
- handle.oid[2] + handle.index;
+ checksum += handle.pool_id + handle.oid.oid[0] + handle.oid.oid[1] +
+ handle.oid.oid[2] + handle.index;
}
if ( count )
DPRINTF("needed %d tmem invalidates, check=%d\n",count,checksum);
struct tmem_pool *pool = (client == NULL || pool_id >= MAX_POOLS_PER_DOMAIN)
? NULL : client->pools[pool_id];
struct tmem_page_descriptor *pgp;
- struct xen_tmem_oid oid;
+ struct xen_tmem_oid *oid;
int ret = 0;
struct tmem_handle h;
pgp = list_entry((&pool->cur_pgp->us.pool_pers_pages)->next,
struct tmem_page_descriptor,us.pool_pers_pages);
pool->cur_pgp = pgp;
- oid = pgp->us.obj->oid;
+ oid = &pgp->us.obj->oid;
h.pool_id = pool_id;
- BUILD_BUG_ON(sizeof(h.oid) != sizeof(oid));
- memcpy(h.oid, oid.oid, sizeof(h.oid));
+ BUILD_BUG_ON(sizeof(h.oid) != sizeof(*oid));
+ memcpy(&(h.oid), oid, sizeof(h.oid));
h.index = pgp->index;
if ( copy_to_guest(guest_handle_cast(buf, void), &h, 1) )
{
goto out;
}
guest_handle_add_offset(buf, sizeof(h));
- ret = do_tmem_get(pool, &oid, pgp->index, 0, buf);
+ ret = do_tmem_get(pool, oid, pgp->index, 0, buf);
out:
spin_unlock(&pers_lists_spinlock);
}
h.pool_id = pgp->pool_id;
BUILD_BUG_ON(sizeof(h.oid) != sizeof(pgp->inv_oid));
- memcpy(h.oid, pgp->inv_oid.oid, sizeof(h.oid));
+ memcpy(&(h.oid), &(pgp->inv_oid), sizeof(h.oid));
h.index = pgp->index;
ret = 1;
if ( copy_to_guest(guest_handle_cast(buf, void), &h, 1) )
#define XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE 32
#define XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE 33
+/*
+ * XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_[PAGE|INV] override the 'buf' in
+ * xen_sysctl_tmem_op with this structure - sometimes with an extra
+ * page tackled on.
+ */
+struct tmem_handle {
+ uint32_t pool_id;
+ uint32_t index;
+ xen_tmem_oid_t oid;
+};
+
struct xen_sysctl_tmem_op {
uint32_t cmd; /* IN: XEN_SYSCTL_TMEM_OP_* . */
int32_t pool_id; /* IN: 0 by default unless _SAVE_*, RESTORE_* .*/