That is what they are used for. Lets make it more clear.
Of all the various sub-commands, the only one that needed
semantic change is XEN_SYSCTL_TMEM_OP_SAVE_BEGIN. That in the
past used 'arg1', and now we are moving it to use 'arg'.
Since that code is only used during migration which is tied
to the toolstack it is OK to change it.
We should increment the XEN_SYSCTL_INTERFACE_VERSION because
of this, and that was fortunatly done in the patch titled:
"tmem/libxc: Squash XEN_SYSCTL_TMEM_OP_[SET|SAVE].."
While at it, also fix xc_tmem_control_oid to properly handle
the 'buf' and bounce it as appropiate.
Acked-by: Andrew cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
*/
int xc_tmem_control_oid(xc_interface *xch, int32_t pool_id, uint32_t subop,
- uint32_t cli_id, uint32_t arg1, uint32_t arg2,
+ uint32_t cli_id, uint32_t len, uint32_t arg,
struct xen_tmem_oid oid, void *buf);
int xc_tmem_control(xc_interface *xch,
int32_t pool_id, uint32_t subop, uint32_t cli_id,
- uint32_t arg1, uint32_t arg2, void *buf);
+ uint32_t len, uint32_t arg, void *buf);
int xc_tmem_auth(xc_interface *xch, int cli_id, char *uuid_str, int arg1);
int xc_tmem_save(xc_interface *xch, int dom, int live, int fd, int field_marker);
int xc_tmem_save_extra(xc_interface *xch, int dom, int fd, int field_marker);
int32_t pool_id,
uint32_t cmd,
uint32_t cli_id,
- uint32_t arg1,
- uint32_t arg2,
+ uint32_t len,
+ uint32_t arg,
void *buf)
{
DECLARE_SYSCTL;
- DECLARE_HYPERCALL_BOUNCE(buf, arg1, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+ DECLARE_HYPERCALL_BOUNCE(buf, len, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
int rc;
sysctl.cmd = XEN_SYSCTL_tmem_op;
sysctl.u.tmem_op.pool_id = pool_id;
sysctl.u.tmem_op.cmd = cmd;
sysctl.u.tmem_op.cli_id = cli_id;
- sysctl.u.tmem_op.arg1 = arg1;
- sysctl.u.tmem_op.arg2 = arg2;
+ sysctl.u.tmem_op.len = len;
+ sysctl.u.tmem_op.arg = arg;
sysctl.u.tmem_op.pad = 0;
sysctl.u.tmem_op.oid.oid[0] = 0;
sysctl.u.tmem_op.oid.oid[1] = 0;
if ( cmd == XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO )
HYPERCALL_BOUNCE_SET_DIR(buf, XC_HYPERCALL_BUFFER_BOUNCE_IN);
-
- if ( arg1 )
+ if ( len )
{
if ( buf == NULL )
{
rc = do_sysctl(xch, &sysctl);
- if ( arg1 )
+ if ( len )
xc_hypercall_bounce_post(xch, buf);
return rc;
int32_t pool_id,
uint32_t cmd,
uint32_t cli_id,
- uint32_t arg1,
- uint32_t arg2,
+ uint32_t len,
+ uint32_t arg,
struct xen_tmem_oid oid,
void *buf)
{
DECLARE_SYSCTL;
- DECLARE_HYPERCALL_BOUNCE(buf, arg1, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
+ DECLARE_HYPERCALL_BOUNCE(buf, len, XC_HYPERCALL_BUFFER_BOUNCE_OUT);
int rc;
sysctl.cmd = XEN_SYSCTL_tmem_op;
sysctl.u.tmem_op.pool_id = pool_id;
sysctl.u.tmem_op.cmd = cmd;
sysctl.u.tmem_op.cli_id = cli_id;
- sysctl.u.tmem_op.arg1 = arg1;
- sysctl.u.tmem_op.arg2 = arg2;
+ sysctl.u.tmem_op.len = len;
+ sysctl.u.tmem_op.arg = arg;
sysctl.u.tmem_op.pad = 0;
sysctl.u.tmem_op.oid = oid;
- if ( cmd == XEN_SYSCTL_TMEM_OP_LIST && arg1 != 0 )
+ if ( len )
{
if ( buf == NULL )
{
rc = do_sysctl(xch, &sysctl);
- if ( cmd == XEN_SYSCTL_TMEM_OP_LIST && arg1 != 0 )
- xc_hypercall_bounce_post(xch, buf);
+ if ( len )
+ xc_hypercall_bounce_post(xch, buf);
return rc;
}
xen_tmem_client_t info;
rc = xc_tmem_control(xch, 0, XEN_SYSCTL_TMEM_OP_SAVE_BEGIN,
- dom, live, 0, NULL);
+ dom, 0 /* len*/ , live, NULL);
if ( rc )
{
/* Nothing to save - no tmem enabled. */
if ( xc_tmem_control(xch, 0 /* pool_id */,
XEN_SYSCTL_TMEM_OP_GET_CLIENT_INFO,
- dom /* cli_id */, sizeof(info) /* arg1 */, 0 /* arg2 */,
+ dom /* cli_id */, sizeof(info), 0 /* arg */,
&info) < 0 )
return -1;
if ( xc_tmem_control(xch, 0 /* pool_id */,
XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO,
- dom /* cli_id */, sizeof(info) /* arg1 */, 0 /* arg2 */,
+ dom /* cli_id */, sizeof(info), 0 /* arg */,
&info) < 0 )
return -1;
r = xc_tmem_control(ctx->xch, -1 /* pool_id */,
XEN_SYSCTL_TMEM_OP_GET_CLIENT_INFO,
- domid, sizeof(info), 0 /* arg2 */, &info);
+ domid, sizeof(info), 0 /* arg */, &info);
if (r < 0) {
LOGE(ERROR, "Can not get tmem data!");
rc = ERROR_FAIL;
}
r = xc_tmem_control(ctx->xch, -1 /* pool_id */,
XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO,
- domid, sizeof(info), 0 /* arg2 */, &info);
+ domid, sizeof(info), 0 /* arg */, &info);
if (r < 0) {
LOGE(ERROR, "Can not set tmem %s", name);
rc = ERROR_FAIL;
int32_t pool_id;
uint32_t subop;
uint32_t cli_id;
- uint32_t arg1;
- uint32_t arg2;
+ uint32_t len;
+ uint32_t arg;
char *buf;
char _buffer[32768], *buffer = _buffer;
int rc;
static char *kwd_list[] = { "pool_id", "subop", "cli_id", "arg1", "arg2", "buf", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiiis", kwd_list,
- &pool_id, &subop, &cli_id, &arg1, &arg2, &buf) )
+ &pool_id, &subop, &cli_id, &len, &arg, &buf) )
return NULL;
- if ( (subop == XEN_SYSCTL_TMEM_OP_LIST) && (arg1 > 32768) )
- arg1 = 32768;
+ if ( (subop == XEN_SYSCTL_TMEM_OP_LIST) && (len > 32768) )
+ len = 32768;
- if ( (rc = xc_tmem_control(self->xc_handle, pool_id, subop, cli_id, arg1, arg2, buffer)) < 0 )
+ if ( (rc = xc_tmem_control(self->xc_handle, pool_id, subop, cli_id, len, arg, buffer)) < 0 )
return Py_BuildValue("i", rc);
switch (subop) {
" pool_id [int]: Identifier of the tmem pool (-1 == all).\n"
" subop [int]: Supplementary Operation.\n"
" cli_id [int]: Client identifier (-1 == all).\n"
- " arg1 [int]: Argument.\n"
- " arg2 [int]: Argument.\n"
+ " len [int]: Length of 'buf'.\n"
+ " arg [int]: Argument.\n"
" buf [str]: Buffer.\n\n"
"Returns: [int] 0 or [str] tmem info on success; exception on error.\n" },
}
static int tmemc_save_subop(int cli_id, uint32_t pool_id,
- uint32_t subop, tmem_cli_va_param_t buf, uint32_t arg1)
+ uint32_t subop, tmem_cli_va_param_t buf, uint32_t arg)
{
struct client *client = tmem_client_from_cli_id(cli_id);
uint32_t p;
client->was_frozen = client->info.flags.u.frozen;
client->info.flags.u.frozen = 1;
- if ( arg1 != 0 )
+ if ( arg != 0 )
client->info.flags.u.migrating = 1;
rc = 0;
break;
case XEN_SYSCTL_TMEM_OP_RESTORE_BEGIN:
case XEN_SYSCTL_TMEM_OP_SAVE_END:
ret = tmemc_save_subop(op->cli_id, pool_id, cmd,
- guest_handle_cast(op->u.buf, char), op->arg1);
+ guest_handle_cast(op->u.buf, char), op->arg);
break;
case XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_PAGE:
ret = tmemc_save_get_next_page(op->cli_id, pool_id,
- guest_handle_cast(op->u.buf, char), op->arg1);
+ guest_handle_cast(op->u.buf, char), op->len);
break;
case XEN_SYSCTL_TMEM_OP_SAVE_GET_NEXT_INV:
ret = tmemc_save_get_next_inv(op->cli_id,
- guest_handle_cast(op->u.buf, char), op->arg1);
+ guest_handle_cast(op->u.buf, char), op->len);
break;
case XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE:
- ret = tmemc_restore_put_page(op->cli_id, pool_id, oidp, op->arg2,
- guest_handle_cast(op->u.buf, char), op->arg1);
+ ret = tmemc_restore_put_page(op->cli_id, pool_id, oidp, op->arg,
+ guest_handle_cast(op->u.buf, char), op->len);
break;
case XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE:
- ret = tmemc_restore_flush_page(op->cli_id, pool_id, oidp, op->arg2);
+ ret = tmemc_restore_flush_page(op->cli_id, pool_id, oidp, op->arg);
break;
default:
ret = -1;
}
static int tmemc_save_subop(int cli_id, uint32_t pool_id, uint32_t subop,
- XEN_GUEST_HANDLE_PARAM(char) buf, uint32_t arg1)
+ XEN_GUEST_HANDLE_PARAM(char) buf, uint32_t arg)
{
struct client *client = tmem_client_from_cli_id(cli_id);
struct tmem_pool *pool = (client == NULL || pool_id >= MAX_POOLS_PER_DOMAIN)
ret = tmemc_freeze_pools(op->cli_id, cmd);
break;
case XEN_SYSCTL_TMEM_OP_FLUSH:
- ret = tmemc_flush_mem(op->cli_id,op->arg1);
+ ret = tmemc_flush_mem(op->cli_id, op->arg);
break;
case XEN_SYSCTL_TMEM_OP_LIST:
ret = tmemc_list(op->cli_id,
- guest_handle_cast(op->u.buf, char), op->arg1, op->arg2);
+ guest_handle_cast(op->u.buf, char), op->len, op->arg);
break;
case XEN_SYSCTL_TMEM_OP_SET_CLIENT_INFO:
ret = tmemc_set_client_info(op->cli_id, op->u.client);
case XEN_SYSCTL_TMEM_OP_SAVE_GET_POOL_NPAGES:
case XEN_SYSCTL_TMEM_OP_SAVE_GET_POOL_UUID:
ret = tmemc_save_subop(op->cli_id, pool_id, cmd,
- guest_handle_cast(op->u.buf, char), op->arg1);
+ guest_handle_cast(op->u.buf, char), op->arg);
break;
default:
ret = do_tmem_control(op);
uint32_t cli_id; /* IN: client id, 0 for XEN_SYSCTL_TMEM_QUERY_FREEABLE_MB
for all others can be the domain id or
XEN_SYSCTL_TMEM_OP_ALL_CLIENTS for all. */
- uint32_t arg1; /* IN: If not applicable to command use 0. */
- uint32_t arg2; /* IN: If not applicable to command use 0. */
+ uint32_t len; /* IN: length of 'buf'. If not applicable to use 0. */
+ uint32_t arg; /* IN: If not applicable to command use 0. */
uint32_t pad; /* Padding so structure is the same under 32 and 64. */
xen_tmem_oid_t oid; /* IN: If not applicable to command use 0s. */
union {