Changeset 92538 in vbox
- Timestamp:
- Nov 22, 2021 1:53:20 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
doc/manual/en_US/man_VBoxManage-modifyvm.xml (modified) (3 diffs)
-
src/VBox/Frontends/VBoxManage/VBoxManage.cpp (modified) (1 diff)
-
src/VBox/Frontends/VBoxManage/VBoxManage.h (modified) (3 diffs)
-
src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp (modified) (5 diffs)
-
src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp (modified) (2 diffs)
-
src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/manual/en_US/man_VBoxManage-modifyvm.xml
r92534 r92538 617 617 <arg>--pci-detach=<replaceable>host-PCI-address</replaceable></arg> 618 618 </cmdsynopsis> 619 620 <cmdsynopsis id="synopsis-vboxmanage-modifyvm-testing"> 621 <command>VBoxManage modifyvm</command> 622 <group choice="req"> 623 <arg choice="plain"><replaceable>uuid</replaceable></arg> 624 <arg choice="plain"><replaceable>vmname</replaceable></arg> 625 </group> 626 <arg>--testing-enabled=<group choice="plain"><arg choice="plain">on</arg><arg choice="plain">off</arg></group></arg> 627 <arg>--testing-mmio=<group choice="plain"><arg choice="plain">on</arg><arg choice="plain">off</arg></group></arg> 628 <arg>--testing-cfg-dword<replaceable>idx</replaceable>=<replaceable>value</replaceable></arg> 629 </cmdsynopsis> 619 630 </refsynopsisdiv> 620 631 … … 2652 2663 </variablelist> 2653 2664 </refsect2> 2665 <refsect2 id="vboxmanage-modifyvm-testing"> 2666 <title>Testing (ValidationKit / Bootsector)</title> 2667 <para> 2668 These options are for configuring the testing functionality of the VMM 2669 device and almost exclusively used by the bootsector testcases in the 2670 ValidationKit. 2671 </para> 2672 <remark role="help-copy-synopsis"/> 2673 <variablelist> 2674 <varlistentry> 2675 <term><option>--testing-enabled=on | off</option></term> 2676 <listitem><para>Enabled the testing functionality of the VMMDev. See VMMDevTesting.h for details. </para></listitem> 2677 </varlistentry> 2678 <varlistentry> 2679 <term><option>--testing-mmio=on | off</option></term> 2680 <listitem><para>Enabled the MMIO region of the VMMDev testing feature.</para></listitem> 2681 </varlistentry> 2682 <varlistentry> 2683 <term><option>--testing-cfg-dword<replaceable>idx</replaceable>=<replaceable>value</replaceable></option></term> 2684 <listitem><para> 2685 This sets one of the 10 dword configuration values. The 2686 <replaceable>idx</replaceable> must be in the range 0 thru 9. 2687 The <replaceable>value</replaceable> is limited to 32 bits (dword). 2688 </para></listitem> 2689 </varlistentry> 2690 </variablelist> 2691 </refsect2> 2692 2654 2693 </refsect1> 2655 2694 … … 2672 2711 <title>See Also</title> 2673 2712 <para> 2713 <xref linkend="vboxmanage-showvminfo" />, 2674 2714 <xref linkend="vboxmanage-controlvm" />, 2675 2715 <xref linkend="vboxmanage-createvm" />, 2676 <xref linkend="vboxmanage-list" />,2677 2716 <xref linkend="vboxmanage-startvm" /> 2717 <xref linkend="vboxmanage-list" /> 2678 2718 </para> 2679 2719 </refsect1> -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.cpp
r92404 r92538 296 296 * react a little slower than in the ideal case). 297 297 */ 298 HRESULT showProgress(ComPtr<IProgress> progress, u nsigned int fFlags)298 HRESULT showProgress(ComPtr<IProgress> progress, uint32_t fFlags) 299 299 { 300 300 using namespace com; -
trunk/src/VBox/Frontends/VBoxManage/VBoxManage.h
r92534 r92538 238 238 RTEXITCODE errorGetOpt(USAGECATEGORY enmCommand, int rc, union RTGETOPTUNION const *pValueUnion); 239 239 RTEXITCODE errorGetOptEx(USAGECATEGORY enmCommand, uint64_t fSubcommandScope, int rc, union RTGETOPTUNION const *pValueUnion); 240 RTEXITCODE errorArgument(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);241 240 242 241 void printUsageInternal(USAGECATEGORY enmCommand, PRTSTREAM pStrm); … … 253 252 RTEXITCODE errorGetOpt(int rcGetOpt, union RTGETOPTUNION const *pValueUnion); 254 253 RTEXITCODE errorFetchValue(int iValueNo, const char *pszOption, int rcGetOptFetchValue, union RTGETOPTUNION const *pValueUnion); 255 RTEXITCODE errorSyntax(const char *pszFormat, ...); 256 257 258 #define SHOW_PROGRESS_NONE 0 259 #define SHOW_PROGRESS_DESC (1u << 0) 260 #define SHOW_PROGRESS (1u << 1) 261 #define SHOW_PROGRESS_DETAILS (1u << 2) 262 HRESULT showProgress(ComPtr<IProgress> progress, unsigned int fFlags = SHOW_PROGRESS); 254 RTEXITCODE errorSyntax(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 255 RTEXITCODE errorSyntaxV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0); 256 HRESULT errorSyntaxHr(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 257 RTEXITCODE errorArgument(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 258 HRESULT errorArgumentHr(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2); 259 260 # define SHOW_PROGRESS_NONE 0 261 # define SHOW_PROGRESS_DESC RT_BIT_32(0) 262 # define SHOW_PROGRESS RT_BIT_32(1) 263 # define SHOW_PROGRESS_DETAILS RT_BIT_32(2) 264 HRESULT showProgress(ComPtr<IProgress> progress, uint32_t fFlags = SHOW_PROGRESS); 263 265 #endif 264 266 … … 309 311 HRESULT showBandwidthGroups(ComPtr<IBandwidthControl> &bwCtrl, 310 312 VMINFO_DETAILS details); 311 void outputMachineReadableString(const char *pszName, const char *pszValue); 312 void outputMachineReadableString(const char *pszName, com::Bstr const *pbstrValue); 313 void outputMachineReadableString(const char *pszName, const char *pszValue, bool fQuoteName = false); 314 void outputMachineReadableString(const char *pszName, com::Bstr const *pbstrValue, bool fQuoteName = false); 315 void outputMachineReadableStringWithFmtName(const char *pszValue, bool fQuoteName, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR(3, 4); 316 void outputMachineReadableStringWithFmtName(com::Bstr const *pbstrValue, bool fQuoteName, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR(3, 4); 313 317 void outputMachineReadableBool(const char *pszName, BOOL const *pfValue); 314 318 void outputMachineReadableBool(const char *pszName, bool const *pfValue); -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r92432 r92538 247 247 * @returns RTEXITCODE_SYNTAX. 248 248 * @param pszFormat Custom error message format string. 249 * @param ...Format arguments.250 */ 251 RTEXITCODE errorSyntax (const char *pszFormat, ...)249 * @param va Format arguments. 250 */ 251 RTEXITCODE errorSyntaxV(const char *pszFormat, va_list va) 252 252 { 253 253 Assert(g_enmCurCommand != HELP_CMD_VBOXMANAGE_INVALID); … … 255 255 showLogo(g_pStdErr); 256 256 257 va_list va ;258 va_ start(va, pszFormat);259 RTMsgErrorV(pszFormat, va );260 va_end(va );257 va_list vaCopy; 258 va_copy(vaCopy, va); 259 RTMsgErrorV(pszFormat, vaCopy); 260 va_end(vaCopy); 261 261 262 262 RTStrmPutCh(g_pStdErr, '\n'); … … 266 266 /* Usage was very long, repeat the error message. */ 267 267 RTStrmPutCh(g_pStdErr, '\n'); 268 va_start(va, pszFormat);269 268 RTMsgErrorV(pszFormat, va); 270 va_end(va);271 269 } 272 270 return RTEXITCODE_SYNTAX; 271 } 272 273 274 /** 275 * Display current (sub)command usage and the custom error message. 276 * 277 * @returns RTEXITCODE_SYNTAX. 278 * @param pszFormat Custom error message format string. 279 * @param ... Format arguments. 280 */ 281 RTEXITCODE errorSyntax(const char *pszFormat, ...) 282 { 283 va_list va; 284 va_start(va, pszFormat); 285 RTEXITCODE rcExit = errorSyntaxV(pszFormat, va); 286 va_end(va); 287 return rcExit; 288 } 289 290 291 /** 292 * Display current (sub)command usage and the custom error message. 293 * 294 * @returns E_INVALIDARG 295 * @param pszFormat Custom error message format string. 296 * @param ... Format arguments. 297 */ 298 HRESULT errorSyntaxHr(const char *pszFormat, ...) 299 { 300 va_list va; 301 va_start(va, pszFormat); 302 errorSyntaxV(pszFormat, va); 303 va_end(va); 304 return E_INVALIDARG; 305 } 306 307 308 /** 309 * Print an error message without the syntax stuff. 310 * 311 * @returns RTEXITCODE_SYNTAX. 312 */ 313 RTEXITCODE errorArgument(const char *pszFormat, ...) 314 { 315 va_list args; 316 va_start(args, pszFormat); 317 RTMsgErrorV(pszFormat, args); 318 va_end(args); 319 return RTEXITCODE_SYNTAX; 320 } 321 322 323 /** 324 * Print an error message without the syntax stuff. 325 * 326 * @returns E_INVALIDARG. 327 */ 328 HRESULT errorArgumentHr(const char *pszFormat, ...) 329 { 330 va_list args; 331 va_start(args, pszFormat); 332 RTMsgErrorV(pszFormat, args); 333 va_end(args); 334 return E_INVALIDARG; 273 335 } 274 336 … … 1060 1122 } 1061 1123 1124 1062 1125 /** 1063 1126 * errorSyntax for RTGetOpt users. … … 1074 1137 } 1075 1138 1076 /**1077 * Print an error message without the syntax stuff.1078 *1079 * @returns RTEXITCODE_SYNTAX.1080 */1081 RTEXITCODE errorArgument(const char *pszFormat, ...)1082 {1083 va_list args;1084 va_start(args, pszFormat);1085 RTMsgErrorV(pszFormat, args);1086 va_end(args);1087 return RTEXITCODE_SYNTAX;1088 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp
r92537 r92538 613 613 { 614 614 RTPrintf("%s=\"%llu\"\n", pszName, *puValue); 615 } 616 617 618 /** 619 * Helper for parsing extra data config. 620 * @returns true, false, or -1 if invalid. 621 */ 622 static int parseCfgmBool(Bstr const *pbstr) 623 { 624 /* GetExtraData returns empty strings if the requested data wasn't 625 found, so fend that off first: */ 626 size_t cwcLeft = pbstr->length(); 627 if (!cwcLeft) 628 return false; 629 PCRTUTF16 pwch = pbstr->raw(); 630 631 /* Skip type prefix: */ 632 if ( cwcLeft >= 8 633 && pwch[0] == 'i' 634 && pwch[1] == 'n' 635 && pwch[2] == 't' 636 && pwch[3] == 'e' 637 && pwch[4] == 'g' 638 && pwch[5] == 'e' 639 && pwch[6] == 'r' 640 && pwch[7] == ':') 641 { 642 pwch += 8; 643 cwcLeft -= 8; 644 } 645 646 /* Hex prefix? */ 647 bool fHex = false; 648 if ( cwcLeft >= 2 649 && pwch[0] == '0' 650 && (pwch[1] == 'x' || pwch[1] == 'X')) 651 { 652 pwch += 2; 653 cwcLeft -= 2; 654 fHex = true; 655 } 656 657 /* Empty string is wrong: */ 658 if (cwcLeft == 0) 659 return -1; 660 661 /* Check that it's all digits and return when we find a non-zero 662 one or reaches the end: */ 663 do 664 { 665 RTUTF16 const wc = *pwch++; 666 if (!RT_C_IS_DIGIT(wc) && (!fHex || !RT_C_IS_XDIGIT(wc))) 667 return -1; 668 if (wc != '0') 669 return true; 670 } while (--cwcLeft > 0); 671 return false; 615 672 } 616 673 … … 2773 2830 } 2774 2831 2832 /* VMMDev testing config (extra data) */ 2833 if (details != VMINFO_MACHINEREADABLE) 2834 { 2835 Bstr bstr; 2836 CHECK_ERROR2I_RET(machine, GetExtraData(Bstr("VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled").raw(), 2837 bstr.asOutParam()), hrcCheck); 2838 int const fEnabled = parseCfgmBool(&bstr); 2839 2840 CHECK_ERROR2I_RET(machine, GetExtraData(Bstr("VBoxInternal/Devices/VMMDev/0/Config/TestingMMIO").raw(), 2841 bstr.asOutParam()), hrcCheck); 2842 int const fMmio = parseCfgmBool(&bstr); 2843 if (fEnabled || fMmio) 2844 { 2845 RTPrintf("%-28s %s, %s %s\n", 2846 Info::tr("VMMDev Testing"), 2847 fEnabled > 0 ? Info::tr("enabled") : fEnabled == 0 ? Info::tr("disabled") : Info::tr("misconfigured"), 2848 Info::tr("MMIO:"), 2849 fMmio > 0 ? Info::tr("enabled") : fMmio == 0 ? Info::tr("disabled") : Info::tr("misconfigured")); 2850 for (uint32_t i = 0; i < 10; i++) 2851 { 2852 BstrFmt bstrName("VBoxInternal/Devices/VMMDev/0/Config/TestingCfgDword%u", i); 2853 CHECK_ERROR2I_RET(machine, GetExtraData(bstrName.raw(), bstr.asOutParam()), hrcCheck); 2854 if (bstr.isNotEmpty()) 2855 RTPrintf("%-28s %ls\n", FmtNm(szNm, "VMMDev Testing Cfg Dword%u:", i), bstr.raw()); 2856 } 2857 } 2858 } 2859 2775 2860 /* 2776 2861 * Snapshots. -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp
r92534 r92538 249 249 #endif 250 250 MODIFYVM_DEFAULTFRONTEND, 251 MODIFYVM_VMPROC_PRIORITY 251 MODIFYVM_VMPROC_PRIORITY, 252 MODIFYVM_TESTING_ENABLED, 253 MODIFYVM_TESTING_MMIO, 254 MODIFYVM_TESTING_CFG_DWORD, 252 255 }; 253 256 … … 452 455 OPT2("--default-frontend", "--defaultfrontend", MODIFYVM_DEFAULTFRONTEND, RTGETOPT_REQ_STRING), 453 456 OPT1("--vm-process-priority", MODIFYVM_VMPROC_PRIORITY, RTGETOPT_REQ_STRING), 457 OPT1("--testing-enabled", MODIFYVM_TESTING_ENABLED, RTGETOPT_REQ_BOOL_ONOFF), 458 OPT1("--testing-mmio", MODIFYVM_TESTING_MMIO, RTGETOPT_REQ_BOOL_ONOFF), 459 OPT1("--testing-cfg-dword", MODIFYVM_TESTING_CFG_DWORD, RTGETOPT_REQ_UINT32 | RTGETOPT_FLAG_INDEX), 454 460 }; 455 461 … … 458 464 RTStrmPrintf(g_pStdErr, ModifyVM::tr("Warning: '--vrdp%s' is deprecated. Use '--vrde%s'.\n"), pszOption, pszOption); 459 465 } 466 467 468 /** 469 * Wrapper around IMachine::SetExtraData that does the error reporting. 470 * 471 * @returns COM result code. 472 * @param rSessionMachine The IMachine. 473 * @param pszVariable The variable to set. 474 * @param pszValue The value to set. To delete pass empty string, not 475 * NULL. 476 */ 477 static HRESULT setExtraData(ComPtr<IMachine> &rSessionMachine, const char *pszVariable, const char *pszValue) 478 { 479 HRESULT hrc = rSessionMachine->SetExtraData(Bstr(pszVariable).raw(), Bstr(pszValue).raw()); 480 if (FAILED(hrc)) 481 { 482 char *pszContext = RTStrAPrintf2(ModifyVM::tr("IMachine::SetExtraData('%s', '%s')"), pszVariable, pszValue); 483 com::GlueHandleComError(rSessionMachine, pszContext, hrc, __FILE__, __LINE__); 484 RTStrFree(pszContext); 485 } 486 return hrc; 487 } 488 460 489 461 490 #ifdef VBOX_WITH_PCI_PASSTHROUGH … … 3413 3442 } 3414 3443 3444 case MODIFYVM_TESTING_ENABLED: 3445 rc = setExtraData(sessionMachine, "VBoxInternal/Devices/VMMDev/0/Config/TestingEnabled", ValueUnion.f ? "1" : ""); 3446 break; 3447 3448 case MODIFYVM_TESTING_MMIO: 3449 rc = setExtraData(sessionMachine, "VBoxInternal/Devices/VMMDev/0/Config/TestingMMIO", ValueUnion.f ? "1" : ""); 3450 break; 3451 3452 case MODIFYVM_TESTING_CFG_DWORD: 3453 if (GetOptState.uIndex <= 9) 3454 { 3455 char szVar[128]; 3456 RTStrPrintf(szVar, sizeof(szVar), "VBoxInternal/Devices/VMMDev/0/Config/TestingCfgDword%u", 3457 GetOptState.uIndex); 3458 char szValue[32]; 3459 RTStrPrintf(szValue, sizeof(szValue), "%u", ValueUnion.u32); 3460 rc = setExtraData(sessionMachine, szVar, szValue); 3461 } 3462 else 3463 rc = errorArgumentHr(ModifyVM::tr("--testing-cfg-dword index %u is out of range: 0 thru 9"), 3464 GetOptState.uIndex); 3465 break; 3466 3415 3467 default: 3416 {3417 3468 errorGetOpt(USAGE_MODIFYVM, c, &ValueUnion); 3418 3469 rc = E_FAIL; 3419 3470 break; 3420 }3421 3471 } 3422 3472 }
Note:
See TracChangeset
for help on using the changeset viewer.

