提交 be6ff4da 编写于 作者: A Andrea Bolognani 提交者: John Ferlan

virsh: Pass vshControl to all vshCommandOpt*() calls

This will allow us to use vshError() to report errors from inside
vshCommandOpt*(), instead of replicating the same logic and error
messages all over the place.

We also have more context inside the vshCommandOpt*() functions,
for example the actual value used on the command line, which means
we can produce more detailed error messages.

vshCommandOptBool() is the exception here, because it's explicitly
designed not to report any error.
上级 5eaca29f
......@@ -340,7 +340,7 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
/* Providing a period will adjust the balloon driver collection period.
* This is not really an unsigned long, but it
*/
if ((rv = vshCommandOptInt(cmd, "period", &period)) < 0) {
if ((rv = vshCommandOptInt(ctl, cmd, "period", &period)) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"period");
......@@ -1436,7 +1436,7 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
rv = vshCommandOptLongLong(cmd, "time", &seconds);
rv = vshCommandOptLongLong(ctl, cmd, "time", &seconds);
if (rv < 0) {
/* invalid integer format */
......@@ -2165,7 +2165,7 @@ cmdDomstats(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
ndoms = 1;
while ((opt = vshCommandOptArgv(cmd, opt))) {
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
if (!(dom = vshLookupDomainBy(ctl, opt->data,
VSH_BYID | VSH_BYUUID | VSH_BYNAME)))
goto cleanup;
......@@ -2244,9 +2244,9 @@ cmdDomIfAddr(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
if (vshCommandOptString(cmd, "interface", &ifacestr) < 0)
if (vshCommandOptString(ctl, cmd, "interface", &ifacestr) < 0)
goto cleanup;
if (vshCommandOptString(cmd, "source", &sourcestr) < 0)
if (vshCommandOptString(ctl, cmd, "source", &sourcestr) < 0)
goto cleanup;
if (sourcestr) {
......
此差异已折叠。
......@@ -176,7 +176,7 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
if (cellno && vshCommandOptInt(cmd, "cellno", &cell) < 0) {
if (cellno && vshCommandOptInt(ctl, cmd, "cellno", &cell) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"cellno");
......@@ -311,7 +311,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
if (vshCommandOptScaledInt(cmd, "pagesize", &bytes, 1024, UINT_MAX) < 0) {
if (vshCommandOptScaledInt(ctl, cmd, "pagesize", &bytes, 1024, UINT_MAX) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"pagesize");
......@@ -391,7 +391,7 @@ cmdFreepages(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
if (vshCommandOptInt(cmd, "cellno", &cell) < 0) {
if (vshCommandOptInt(ctl, cmd, "cellno", &cell) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"cellno");
......@@ -490,14 +490,14 @@ cmdAllocpages(vshControl *ctl, const vshCmd *cmd)
VSH_EXCLUSIVE_OPTIONS_VAR(all, cellno);
if (cellno && vshCommandOptInt(cmd, "cellno", &startCell) < 0) {
if (cellno && vshCommandOptInt(ctl, cmd, "cellno", &startCell) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"cellno");
return false;
}
if (vshCommandOptScaledInt(cmd, "pagesize", &tmp, 1024, UINT_MAX) < 0) {
if (vshCommandOptScaledInt(ctl, cmd, "pagesize", &tmp, 1024, UINT_MAX) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"cellno");
......@@ -505,7 +505,7 @@ cmdAllocpages(vshControl *ctl, const vshCmd *cmd)
}
pageSizes[0] = VIR_DIV_UP(tmp, 1024);
if (vshCommandOptULongLong(cmd, "pagecount", &pageCounts[0]) < 0) {
if (vshCommandOptULongLong(ctl, cmd, "pagecount", &pageCounts[0]) < 0) {
vshError(ctl, "%s", _("pagecount has to be a number"));
return false;
}
......@@ -764,7 +764,7 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd)
unsigned long long cpu_stats[VSH_CPU_LAST] = { 0 };
bool present[VSH_CPU_LAST] = { false };
if (vshCommandOptInt(cmd, "cpu", &cpuNum) < 0) {
if (vshCommandOptInt(ctl, cmd, "cpu", &cpuNum) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"cpu");
......@@ -875,7 +875,7 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
virNodeMemoryStatsPtr params = NULL;
bool ret = false;
if (vshCommandOptInt(cmd, "cell", &cellNum) < 0) {
if (vshCommandOptInt(ctl, cmd, "cell", &cellNum) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"cell");
......@@ -951,7 +951,7 @@ cmdNodeSuspend(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "target", &target) < 0)
return false;
if (vshCommandOptLongLong(cmd, "duration", &duration) < 0) {
if (vshCommandOptLongLong(ctl, cmd, "duration", &duration) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"duration");
......@@ -1260,7 +1260,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
int rc = -1;
size_t i;
if ((rc = vshCommandOptUInt(cmd, "shm-pages-to-scan", &value)) < 0) {
if ((rc = vshCommandOptUInt(ctl, cmd, "shm-pages-to-scan", &value)) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"shm-pages-to-scan");
......@@ -1272,7 +1272,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
goto save_error;
}
if ((rc = vshCommandOptUInt(cmd, "shm-sleep-millisecs", &value)) < 0) {
if ((rc = vshCommandOptUInt(ctl, cmd, "shm-sleep-millisecs", &value)) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"shm-sleep-millisecs");
......@@ -1284,7 +1284,7 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd)
goto save_error;
}
if ((rc = vshCommandOptUInt(cmd, "shm-merge-across-nodes", &value)) < 0) {
if ((rc = vshCommandOptUInt(ctl, cmd, "shm-merge-across-nodes", &value)) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"shm-merge-across-nodes");
......
......@@ -843,7 +843,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd)
/* use "no-stp" because we want "stp" to default true */
stp = !vshCommandOptBool(cmd, "no-stp");
if (vshCommandOptUInt(cmd, "delay", &delay) < 0) {
if (vshCommandOptUInt(ctl, cmd, "delay", &delay) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"delay");
......
......@@ -936,7 +936,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
if (vshCommandOptInt(cmd, "parent-index", &parentIndex) < 0) {
if (vshCommandOptInt(ctl, cmd, "parent-index", &parentIndex) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"parent-index");
......@@ -1227,7 +1227,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd)
return true;
}
if (vshCommandOptString(cmd, "event", &eventName) < 0)
if (vshCommandOptString(ctl, cmd, "event", &eventName) < 0)
return false;
if (!eventName) {
vshError(ctl, "%s", _("either --list or event type is required"));
......@@ -1337,7 +1337,7 @@ cmdNetworkDHCPLeases(vshControl *ctl, const vshCmd *cmd)
unsigned int flags = 0;
virNetworkPtr network = NULL;
if (vshCommandOptString(cmd, "mac", &mac) < 0)
if (vshCommandOptString(ctl, cmd, "mac", &mac) < 0)
return false;
if (!(network = vshCommandOptNetwork(ctl, cmd, &name)))
......
......@@ -395,7 +395,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
vshNodeDeviceListPtr list = NULL;
int cap_type = -1;
ignore_value(vshCommandOptString(cmd, "cap", &cap_str));
ignore_value(vshCommandOptString(ctl, cmd, "cap", &cap_str));
if (cap_str) {
if (tree) {
......@@ -610,7 +610,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptStringReq(ctl, cmd, "device", &name) < 0)
return false;
ignore_value(vshCommandOptString(cmd, "driver", &driverName));
ignore_value(vshCommandOptString(ctl, cmd, "driver", &driverName));
if (!(device = virNodeDeviceLookupByName(ctl->conn, name))) {
vshError(ctl, _("Could not find matching device '%s'"), name);
......
......@@ -440,7 +440,7 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptBool(cmd, "diskspec")) {
virBufferAddLit(&buf, "<disks>\n");
virBufferAdjustIndent(&buf, 2);
while ((opt = vshCommandOptArgv(cmd, opt))) {
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
if (vshParseSnapshotDiskspec(ctl, &buf, opt->data) < 0)
goto cleanup;
}
......
......@@ -219,7 +219,7 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd)
goto cleanup;
}
if (vshCommandOptString(cmd, "allocation", &allocationStr) > 0 &&
if (vshCommandOptString(ctl, cmd, "allocation", &allocationStr) > 0 &&
vshVolSize(allocationStr, &allocation) < 0) {
vshError(ctl, _("Malformed size %s"), allocationStr);
goto cleanup;
......@@ -693,14 +693,14 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd)
const char *name = NULL;
unsigned long long offset = 0, length = 0;
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
if (vshCommandOptULongLong(ctl, cmd, "offset", &offset) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"offset");
return false;
}
if (vshCommandOptULongLongWrap(cmd, "length", &length) < 0) {
if (vshCommandOptULongLongWrap(ctl, cmd, "length", &length) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"length");
......@@ -806,14 +806,14 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd)
unsigned long long offset = 0, length = 0;
bool created = false;
if (vshCommandOptULongLong(cmd, "offset", &offset) < 0) {
if (vshCommandOptULongLong(ctl, cmd, "offset", &offset) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"offset");
return false;
}
if (vshCommandOptULongLongWrap(cmd, "length", &length) < 0) {
if (vshCommandOptULongLongWrap(ctl, cmd, "length", &length) < 0) {
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"length");
......
......@@ -607,7 +607,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd)
{
const char *name = NULL;
if (vshCommandOptString(cmd, "command", &name) <= 0) {
if (vshCommandOptString(ctl, cmd, "command", &name) <= 0) {
const vshCmdGrp *grp;
const vshCmdDef *def;
......@@ -875,7 +875,7 @@ cmdCd(vshControl *ctl, const vshCmd *cmd)
return false;
}
if (vshCommandOptString(cmd, "dir", &dir) <= 0)
if (vshCommandOptString(ctl, cmd, "dir", &dir) <= 0)
dir = dir_malloced = virGetUserDirectory();
if (!dir)
dir = "/";
......@@ -978,7 +978,7 @@ cmdEcho(vshControl *ctl, const vshCmd *cmd)
if (vshCommandOptBool(cmd, "xml"))
xml = true;
while ((opt = vshCommandOptArgv(cmd, opt))) {
while ((opt = vshCommandOptArgv(ctl, cmd, opt))) {
char *str;
virBuffer xmlbuf = VIR_BUFFER_INITIALIZER;
......@@ -1504,6 +1504,7 @@ vshCommandOpt(const vshCmd *cmd, const char *name, vshCmdOpt **opt,
/**
* vshCommandOptInt:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1515,7 +1516,8 @@ vshCommandOpt(const vshCmd *cmd, const char *name, vshCmdOpt **opt,
* <0 in all other cases (@value untouched)
*/
int
vshCommandOptInt(const vshCmd *cmd, const char *name, int *value)
vshCommandOptInt(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd,
const char *name, int *value)
{
vshCmdOpt *arg;
int ret;
......@@ -1530,7 +1532,8 @@ vshCommandOptInt(const vshCmd *cmd, const char *name, int *value)
}
static int
vshCommandOptUIntInternal(const vshCmd *cmd,
vshCommandOptUIntInternal(vshControl *ctl ATTRIBUTE_UNUSED,
const vshCmd *cmd,
const char *name,
unsigned int *value,
bool wrap)
......@@ -1554,6 +1557,7 @@ vshCommandOptUIntInternal(const vshCmd *cmd,
/**
* vshCommandOptUInt:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1562,13 +1566,15 @@ vshCommandOptUIntInternal(const vshCmd *cmd,
* See vshCommandOptInt()
*/
int
vshCommandOptUInt(const vshCmd *cmd, const char *name, unsigned int *value)
vshCommandOptUInt(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned int *value)
{
return vshCommandOptUIntInternal(cmd, name, value, false);
return vshCommandOptUIntInternal(ctl, cmd, name, value, false);
}
/**
* vshCommandOptUIntWrap:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1577,13 +1583,15 @@ vshCommandOptUInt(const vshCmd *cmd, const char *name, unsigned int *value)
* See vshCommandOptInt()
*/
int
vshCommandOptUIntWrap(const vshCmd *cmd, const char *name, unsigned int *value)
vshCommandOptUIntWrap(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned int *value)
{
return vshCommandOptUIntInternal(cmd, name, value, true);
return vshCommandOptUIntInternal(ctl, cmd, name, value, true);
}
static int
vshCommandOptULInternal(const vshCmd *cmd,
vshCommandOptULInternal(vshControl *ctl ATTRIBUTE_UNUSED,
const vshCmd *cmd,
const char *name,
unsigned long *value,
bool wrap)
......@@ -1607,6 +1615,7 @@ vshCommandOptULInternal(const vshCmd *cmd,
/*
* vshCommandOptUL:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1615,13 +1624,15 @@ vshCommandOptULInternal(const vshCmd *cmd,
* See vshCommandOptInt()
*/
int
vshCommandOptUL(const vshCmd *cmd, const char *name, unsigned long *value)
vshCommandOptUL(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long *value)
{
return vshCommandOptULInternal(cmd, name, value, false);
return vshCommandOptULInternal(ctl, cmd, name, value, false);
}
/**
* vshCommandOptULWrap:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1630,13 +1641,15 @@ vshCommandOptUL(const vshCmd *cmd, const char *name, unsigned long *value)
* See vshCommandOptInt()
*/
int
vshCommandOptULWrap(const vshCmd *cmd, const char *name, unsigned long *value)
vshCommandOptULWrap(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long *value)
{
return vshCommandOptULInternal(cmd, name, value, true);
return vshCommandOptULInternal(ctl, cmd, name, value, true);
}
/**
* vshCommandOptString:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1648,7 +1661,8 @@ vshCommandOptULWrap(const vshCmd *cmd, const char *name, unsigned long *value)
* <0 in all other cases (@value untouched)
*/
int
vshCommandOptString(const vshCmd *cmd, const char *name, const char **value)
vshCommandOptString(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd,
const char *name, const char **value)
{
vshCmdOpt *arg;
int ret;
......@@ -1710,6 +1724,7 @@ vshCommandOptStringReq(vshControl *ctl,
/**
* vshCommandOptLongLong:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1718,8 +1733,8 @@ vshCommandOptStringReq(vshControl *ctl,
* See vshCommandOptInt()
*/
int
vshCommandOptLongLong(const vshCmd *cmd, const char *name,
long long *value)
vshCommandOptLongLong(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd,
const char *name, long long *value)
{
vshCmdOpt *arg;
int ret;
......@@ -1734,7 +1749,8 @@ vshCommandOptLongLong(const vshCmd *cmd, const char *name,
}
static int
vshCommandOptULongLongInternal(const vshCmd *cmd,
vshCommandOptULongLongInternal(vshControl *ctl ATTRIBUTE_UNUSED,
const vshCmd *cmd,
const char *name,
unsigned long long *value,
bool wrap)
......@@ -1758,6 +1774,7 @@ vshCommandOptULongLongInternal(const vshCmd *cmd,
/**
* vshCommandOptULongLong:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1766,14 +1783,15 @@ vshCommandOptULongLongInternal(const vshCmd *cmd,
* See vshCommandOptInt()
*/
int
vshCommandOptULongLong(const vshCmd *cmd, const char *name,
unsigned long long *value)
vshCommandOptULongLong(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long long *value)
{
return vshCommandOptULongLongInternal(cmd, name, value, false);
return vshCommandOptULongLongInternal(ctl, cmd, name, value, false);
}
/**
* vshCommandOptULongLongWrap:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1782,14 +1800,15 @@ vshCommandOptULongLong(const vshCmd *cmd, const char *name,
* See vshCommandOptInt()
*/
int
vshCommandOptULongLongWrap(const vshCmd *cmd, const char *name,
unsigned long long *value)
vshCommandOptULongLongWrap(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long long *value)
{
return vshCommandOptULongLongInternal(cmd, name, value, true);
return vshCommandOptULongLongInternal(ctl, cmd, name, value, true);
}
/**
* vshCommandOptScaledInt:
* @ctl virsh control structure
* @cmd command reference
* @name option name
* @value result
......@@ -1800,9 +1819,9 @@ vshCommandOptULongLongWrap(const vshCmd *cmd, const char *name,
* See vshCommandOptInt()
*/
int
vshCommandOptScaledInt(const vshCmd *cmd, const char *name,
unsigned long long *value, int scale,
unsigned long long max)
vshCommandOptScaledInt(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd,
const char *name, unsigned long long *value,
int scale, unsigned long long max)
{
vshCmdOpt *arg;
char *end;
......@@ -1838,6 +1857,7 @@ vshCommandOptBool(const vshCmd *cmd, const char *name)
/**
* vshCommandOptArgv:
* @ctl virsh control structure
* @cmd command reference
* @opt starting point for the search
*
......@@ -1848,7 +1868,8 @@ vshCommandOptBool(const vshCmd *cmd, const char *name)
* list of supported options in CMD->def->opts.
*/
const vshCmdOpt *
vshCommandOptArgv(const vshCmd *cmd, const vshCmdOpt *opt)
vshCommandOptArgv(vshControl *ctl ATTRIBUTE_UNUSED, const vshCmd *cmd,
const vshCmdOpt *opt)
{
opt = opt ? opt->next : cmd->opts;
......@@ -1876,7 +1897,7 @@ vshCommandOptTimeoutToMs(vshControl *ctl, const vshCmd *cmd, int *timeout)
int ret;
unsigned int utimeout;
if ((ret = vshCommandOptUInt(cmd, "timeout", &utimeout)) < 0)
if ((ret = vshCommandOptUInt(ctl, cmd, "timeout", &utimeout)) < 0)
vshError(ctl,
_("Numeric value for <%s> option is malformed or out of range"),
"timeout");
......
......@@ -279,42 +279,43 @@ bool vshCmddefHelp(vshControl *ctl, const char *name);
const vshCmdGrp *vshCmdGrpSearch(const char *grpname);
bool vshCmdGrpHelp(vshControl *ctl, const char *name);
int vshCommandOptInt(const vshCmd *cmd, const char *name, int *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptUInt(const vshCmd *cmd, const char *name,
unsigned int *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptUIntWrap(const vshCmd *cmd, const char *name,
unsigned int *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptUL(const vshCmd *cmd, const char *name,
unsigned long *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptULWrap(const vshCmd *cmd, const char *name,
unsigned long *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptString(const vshCmd *cmd, const char *name,
const char **value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptInt(vshControl *ctl, const vshCmd *cmd,
const char *name, int *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptUInt(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned int *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptUIntWrap(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned int *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptUL(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptULWrap(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptString(vshControl *ctl, const vshCmd *cmd,
const char *name, const char **value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptStringReq(vshControl *ctl, const vshCmd *cmd,
const char *name, const char **value)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptLongLong(const vshCmd *cmd, const char *name,
long long *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptULongLong(const vshCmd *cmd, const char *name,
unsigned long long *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptULongLongWrap(const vshCmd *cmd, const char *name,
unsigned long long *value)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptScaledInt(const vshCmd *cmd, const char *name,
unsigned long long *value, int scale,
unsigned long long max)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptLongLong(vshControl *ctl, const vshCmd *cmd,
const char *name, long long *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptULongLong(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long long *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptULongLongWrap(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long long *value)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
int vshCommandOptScaledInt(vshControl *ctl, const vshCmd *cmd,
const char *name, unsigned long long *value,
int scale, unsigned long long max)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
bool vshCommandOptBool(const vshCmd *cmd, const char *name);
const vshCmdOpt *vshCommandOptArgv(const vshCmd *cmd,
const vshCmdOpt *vshCommandOptArgv(vshControl *ctl, const vshCmd *cmd,
const vshCmdOpt *opt);
int vshCommandOptTimeoutToMs(vshControl *ctl, const vshCmd *cmd, int *timeout);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册