VirtualBox

Changeset 92537 in vbox


Ignore:
Timestamp:
Nov 22, 2021 1:10:33 AM (3 years ago)
Author:
vboxsync
Message:

VBoxManage/showvminfo: Tried to make the storage output more readable. Fixed missing port+unit in machine-readable mode and converted the storage stuff to use output functions with proper escaping.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageInfo.cpp

    r92536 r92537  
    289289                 Utf8Str(uuid).c_str(),
    290290                 (fCurrent) ? " *" : "");
    291         if (!description.isEmpty())
     291        if (!description.isEmpty() && RTUtf16Chr(description.raw(), '\n') == NULL)
     292            RTPrintf(Info::tr("   %sDescription: %ls\n"), prefix.c_str(), description.raw());
     293        else if (!description.isEmpty())
    292294            RTPrintf(Info::tr("   %sDescription:\n%ls\n"), prefix.c_str(), description.raw());
    293295    }
     
    417419}
    418420
     421static const char *storageControllerTypeToName(StorageControllerType_T enmCtlType, bool fMachineReadable = false)
     422{
     423    switch (enmCtlType)
     424    {
     425        case StorageControllerType_LsiLogic:
     426            return "LsiLogic";
     427        case StorageControllerType_LsiLogicSas:
     428            return "LsiLogicSas";
     429        case StorageControllerType_BusLogic:
     430            return "BusLogic";
     431        case StorageControllerType_IntelAhci:
     432            return "IntelAhci";
     433        case StorageControllerType_PIIX3:
     434            return "PIIX3";
     435        case StorageControllerType_PIIX4:
     436            return "PIIX4";
     437        case StorageControllerType_ICH6:
     438            return "ICH6";
     439        case StorageControllerType_I82078:
     440            return "I82078";
     441        case StorageControllerType_USB:
     442            return "USB";
     443        case StorageControllerType_NVMe:
     444            return "NVMe";
     445        case StorageControllerType_VirtioSCSI:
     446            return "VirtioSCSI";
     447        default:
     448            return fMachineReadable ? "unknown" : Info::tr("unknown");
     449    }
     450}
     451
     452
     453DECLINLINE(bool) doesMachineReadableStringNeedEscaping(const char *psz)
     454{
     455    return psz == NULL
     456        || *psz == '\0'
     457        || strchr(psz, '"') != NULL
     458        || strchr(psz, '\\') != NULL;
     459}
     460
     461
     462/**
     463 * This simply outputs the string adding necessary escaping and nothing else.
     464 */
     465void outputMachineReadableStringWorker(const char *psz)
     466{
     467    for (;;)
     468    {
     469        const char *pszDoubleQuote = strchr(psz, '"');
     470        const char *pszSlash       = strchr(psz, '\\');
     471        const char *pszNext;
     472        if (pszSlash)
     473            pszNext = !pszDoubleQuote || (uintptr_t)pszSlash < (uintptr_t)pszDoubleQuote ? pszSlash : pszDoubleQuote;
     474        else if (pszDoubleQuote)
     475            pszNext = pszDoubleQuote;
     476        else
     477        {
     478            RTStrmWrite(g_pStdOut, psz, strlen(psz));
     479            break;
     480        }
     481        RTStrmWrite(g_pStdOut, psz, pszNext - psz);
     482        char const szTmp[2] = { '\\', *pszNext };
     483        RTStrmWrite(g_pStdOut, szTmp, sizeof(szTmp));
     484
     485        psz = pszNext + 1;
     486    }
     487}
     488
     489
    419490/**
    420491 * This takes care of escaping double quotes and slashes that the string might
    421492 * contain.
    422493 *
    423  * @param   pszName             The variable name.
    424  * @param   pszValue            The value.
     494 * @param   pszName     The variable name.
     495 * @param   pszValue    The value.
     496 * @param   fQuoteName  Whether to unconditionally quote the name or not.
    425497 */
    426 void outputMachineReadableString(const char *pszName, const char *pszValue)
     498void outputMachineReadableString(const char *pszName, const char *pszValue, bool fQuoteName /*=false*/)
    427499{
    428     Assert(strpbrk(pszName, "\"\\") == NULL);
    429 
    430     if (   !pszValue
    431         || !*pszValue
    432         || (   strchr(pszValue, '"') == NULL
    433             && strchr(pszValue, '\\') == NULL) )
    434         RTPrintf("%s=\"%s\"\n", pszName, pszValue);
     500    if (!fQuoteName)
     501        fQuoteName = strchr(pszName, '=') != NULL;
     502    bool const fEscapeName  = doesMachineReadableStringNeedEscaping(pszName);
     503    bool const fEscapeValue = doesMachineReadableStringNeedEscaping(pszValue);
     504    if (!fEscapeName && !fEscapeValue)
     505        RTPrintf(!fQuoteName ? "%s=\"%s\"\n" : "\"%s\"=\"%s\"\n", pszName, pszValue);
    435506    else
    436507    {
    437         /* The value needs escaping. */
    438         RTPrintf("%s=\"", pszName);
    439         const char *psz = pszValue;
    440         for (;;)
    441         {
    442             const char *pszNext = strpbrk(psz, "\"\\");
    443             if (!pszNext)
    444             {
    445                 RTPrintf("%s", psz);
    446                 break;
    447             }
    448             RTPrintf("%.*s\\%c", pszNext - psz, psz, *pszNext);
    449             psz = pszNext + 1;
    450         }
    451         RTPrintf("\"\n");
     508        /* The name and string quotation: */
     509        if (!fEscapeName)
     510            RTPrintf(fQuoteName ? "\"%s\"=\"" : "%s=\"", pszName);
     511        else
     512        {
     513            if (fQuoteName)
     514                RTStrmWrite(g_pStdOut, RT_STR_TUPLE("\""));
     515            outputMachineReadableStringWorker(pszName);
     516            if (fQuoteName)
     517                RTStrmWrite(g_pStdOut, RT_STR_TUPLE("\"=\""));
     518            else
     519                RTStrmWrite(g_pStdOut, RT_STR_TUPLE("=\""));
     520        }
     521
     522        /* the value and the closing quotation */
     523        outputMachineReadableStringWorker(pszValue);
     524        RTStrmWrite(g_pStdOut, RT_STR_TUPLE("\"\n"));
    452525    }
    453526}
     
    458531 * contain.
    459532 *
    460  * @param   pszName             The variable name.
    461  * @param   pbstrValue          The value.
     533 * @param   pszName     The variable name.
     534 * @param   pbstrValue  The value.
     535 * @param   fQuoteName  Whether to unconditionally quote the name or not.
    462536 */
    463 void outputMachineReadableString(const char *pszName, Bstr const *pbstrValue)
     537void outputMachineReadableString(const char *pszName, Bstr const *pbstrValue, bool fQuoteName /*=false*/)
    464538{
    465539    com::Utf8Str strValue(*pbstrValue);
    466     outputMachineReadableString(pszName, strValue.c_str());
     540    outputMachineReadableString(pszName, strValue.c_str(), fQuoteName);
     541}
     542
     543
     544/**
     545 * Variant that allows formatting the name string, C string value.
     546 *
     547 * @param   pszValue    The value.
     548 * @param   fQuoteName  Whether to unconditionally quote the name or not.
     549 * @param   pszNameFmt  The variable name.
     550 */
     551void outputMachineReadableStringWithFmtName(const char *pszValue, bool fQuoteName, const char *pszNameFmt, ...)
     552{
     553    com::Utf8Str strName;
     554    va_list va;
     555    va_start(va, pszNameFmt);
     556    strName.printfV(pszNameFmt, va);
     557    va_end(va);
     558
     559    outputMachineReadableString(strName.c_str(), pszValue, fQuoteName);
     560}
     561
     562
     563/**
     564 * Variant that allows formatting the name string, Bstr value.
     565 *
     566 * @param   pbstrValue  The value.
     567 * @param   fQuoteName  Whether to unconditionally quote the name or not.
     568 * @param   pszNameFmt  The variable name.
     569 */
     570void outputMachineReadableStringWithFmtName(com::Bstr const *pbstrValue, bool fQuoteName, const char *pszNameFmt, ...)
     571{
     572    com::Utf8Str strName;
     573    va_list va;
     574    va_start(va, pszNameFmt);
     575    strName.printfV(pszNameFmt, va);
     576    va_end(va);
     577
     578    outputMachineReadableString(strName.c_str(), pbstrValue, fQuoteName);
    467579}
    468580
     
    681793    return S_OK;
    682794}
     795
     796/** Displays the medium attachments of the given controller. */
     797static HRESULT showMediumAttachments(ComPtr<IMachine> &machine, ComPtr<IStorageController> ptrStorageCtl, VMINFO_DETAILS details)
     798{
     799    Bstr bstrStorageCtlName;
     800    CHECK_ERROR2I_RET(ptrStorageCtl, COMGETTER(Name)(bstrStorageCtlName.asOutParam()), hrcCheck);
     801    ULONG cDevices;
     802    CHECK_ERROR2I_RET(ptrStorageCtl, COMGETTER(MaxDevicesPerPortCount)(&cDevices), hrcCheck);
     803    ULONG cPorts;
     804    CHECK_ERROR2I_RET(ptrStorageCtl, COMGETTER(PortCount)(&cPorts), hrcCheck);
     805
     806    for (ULONG i = 0; i < cPorts; ++ i)
     807    {
     808        for (ULONG k = 0; k < cDevices; ++ k)
     809        {
     810            ComPtr<IMediumAttachment> mediumAttach;
     811            HRESULT hrc = machine->GetMediumAttachment(bstrStorageCtlName.raw(), i, k, mediumAttach.asOutParam());
     812            if (!SUCCEEDED(hrc) && hrc != VBOX_E_OBJECT_NOT_FOUND)
     813            {
     814                com::GlueHandleComError(machine, "GetMediumAttachment", hrc, __FILE__, __LINE__);
     815                return hrc;
     816            }
     817
     818            BOOL fIsEjected = FALSE;
     819            BOOL fTempEject = FALSE;
     820            DeviceType_T devType = DeviceType_Null;
     821            if (mediumAttach)
     822            {
     823                CHECK_ERROR2I_RET(mediumAttach, COMGETTER(TemporaryEject)(&fTempEject), hrcCheck);
     824                CHECK_ERROR2I_RET(mediumAttach, COMGETTER(IsEjected)(&fIsEjected), hrcCheck);
     825                CHECK_ERROR2I_RET(mediumAttach, COMGETTER(Type)(&devType), hrcCheck);
     826            }
     827
     828            ComPtr<IMedium> medium;
     829            hrc = machine->GetMedium(bstrStorageCtlName.raw(), i, k, medium.asOutParam());
     830            if (SUCCEEDED(hrc) && medium)
     831            {
     832                BOOL fPassthrough = FALSE;
     833                if (mediumAttach)
     834                {
     835                    CHECK_ERROR2I_RET(mediumAttach, COMGETTER(Passthrough)(&fPassthrough), hrcCheck);
     836                }
     837
     838                Bstr bstrFilePath;
     839                CHECK_ERROR2I_RET(medium, COMGETTER(Location)(bstrFilePath.asOutParam()), hrcCheck);
     840                Bstr bstrUuid;
     841                CHECK_ERROR2I_RET(medium, COMGETTER(Id)(bstrUuid.asOutParam()), hrcCheck);
     842
     843                if (details != VMINFO_MACHINEREADABLE)
     844                    RTPrintf(Info::tr("  Port %u, Unit %u: UUID: %ls%s%s%s\n    Location: \"%ls\"\n"),
     845                             i, k, bstrUuid.raw(),
     846                             fPassthrough ? Info::tr(", passthrough enabled") : "",
     847                             fTempEject   ? Info::tr(", temp eject") : "",
     848                             fIsEjected   ? Info::tr(", ejected") : "",
     849                             bstrFilePath.raw());
     850                else
     851                {
     852                    /* Note! dvdpassthough, tempeject and IsEjected was all missed the port
     853                             and unit bits prior to VBox 7.0.  */
     854                    /** @todo This would look better on the "%ls-%d-%d-{tag}" form! */
     855                    outputMachineReadableStringWithFmtName(&bstrFilePath,
     856                                                           true, "%ls-%d-%d", bstrStorageCtlName.raw(), i, k);
     857                    outputMachineReadableStringWithFmtName(&bstrUuid,
     858                                                           true,  "%ls-ImageUUID-%d-%d", bstrStorageCtlName.raw(), i, k);
     859
     860                    if (fPassthrough)
     861                        outputMachineReadableStringWithFmtName("on",
     862                                                               true, "%ls-dvdpassthrough-%d-%d", bstrStorageCtlName.raw(), i, k);
     863                    if (devType == DeviceType_DVD)
     864                    {
     865                        outputMachineReadableStringWithFmtName(fTempEject ? "on" : "off",
     866                                                               true, "%ls-tempeject-%d-%d", bstrStorageCtlName.raw(), i, k);
     867                        outputMachineReadableStringWithFmtName(fIsEjected ? "on" : "off",
     868                                                               true, "%ls-IsEjected-%d-%d", bstrStorageCtlName.raw(), i, k);
     869                    }
     870                }
     871            }
     872            else if (SUCCEEDED(hrc))
     873            {
     874                if (details != VMINFO_MACHINEREADABLE)
     875                    RTPrintf(Info::tr("  Port %u, Unit %u: Empty%s%s\n"), i, k,
     876                             fTempEject ? Info::tr(", temp eject") : "",
     877                             fIsEjected ? Info::tr(", ejected") : "");
     878                else
     879                {
     880                    outputMachineReadableStringWithFmtName("emptydrive", true, "%ls-%d-%d", bstrStorageCtlName.raw(), i, k);
     881                    if (devType == DeviceType_DVD)
     882                        outputMachineReadableStringWithFmtName(fIsEjected ? "on" : "off",
     883                                                               true, "%ls-IsEjected-%d-%d", bstrStorageCtlName.raw(), i, k);
     884                }
     885            }
     886            else if (details == VMINFO_MACHINEREADABLE)
     887                outputMachineReadableStringWithFmtName("none", true, "%ls-%d-%d", bstrStorageCtlName.raw(), i, k);
     888            else if (hrc != VBOX_E_OBJECT_NOT_FOUND)
     889                RTPrintf(Info::tr("  Port %u, Unit %u: GetMedium failed: %Rhrc\n"), i, k, hrc);
     890
     891        }
     892    }
     893    return S_OK;
     894}
     895
    683896
    684897#ifdef VBOX_WITH_IOMMU_AMD
     
    11941407    com::SafeIfaceArray<IStorageController> storageCtls;
    11951408    CHECK_ERROR(machine, COMGETTER(StorageControllers)(ComSafeArrayAsOutParam(storageCtls)));
    1196     for (size_t i = 0; i < storageCtls.size(); ++ i)
    1197     {
    1198         ComPtr<IStorageController> storageCtl = storageCtls[i];
    1199         StorageControllerType_T    enmCtlType = StorageControllerType_Null;
    1200         const char *pszCtl = NULL;
    1201         ULONG ulValue = 0;
    1202         BOOL  fBootable = FALSE;
    1203         Bstr storageCtlName;
    1204 
    1205         storageCtl->COMGETTER(Name)(storageCtlName.asOutParam());
    1206         if (details == VMINFO_MACHINEREADABLE)
    1207             RTPrintf("storagecontrollername%u=\"%ls\"\n", i, storageCtlName.raw());
    1208         else
    1209             RTPrintf(Info::tr("Storage Controller Name (%u):            %ls\n"), i, storageCtlName.raw());
    1210 
    1211         storageCtl->COMGETTER(ControllerType)(&enmCtlType);
    1212         switch (enmCtlType)
    1213         {
    1214             case StorageControllerType_LsiLogic:
    1215                 pszCtl = "LsiLogic";
    1216                 break;
    1217             case StorageControllerType_LsiLogicSas:
    1218                 pszCtl = "LsiLogicSas";
    1219                 break;
    1220             case StorageControllerType_BusLogic:
    1221                 pszCtl = "BusLogic";
    1222                 break;
    1223             case StorageControllerType_IntelAhci:
    1224                 pszCtl = "IntelAhci";
    1225                 break;
    1226             case StorageControllerType_PIIX3:
    1227                 pszCtl = "PIIX3";
    1228                 break;
    1229             case StorageControllerType_PIIX4:
    1230                 pszCtl = "PIIX4";
    1231                 break;
    1232             case StorageControllerType_ICH6:
    1233                 pszCtl = "ICH6";
    1234                 break;
    1235             case StorageControllerType_I82078:
    1236                 pszCtl = "I82078";
    1237                 break;
    1238             case StorageControllerType_USB:
    1239                 pszCtl = "USB";
    1240                 break;
    1241             case StorageControllerType_NVMe:
    1242                 pszCtl = "NVMe";
    1243                 break;
    1244             case StorageControllerType_VirtioSCSI:
    1245                 pszCtl = "VirtioSCSI";
    1246                 break;
    1247 
    1248             default:
    1249                 if (details == VMINFO_MACHINEREADABLE)
    1250                     pszCtl = "unknown";
    1251                 else
    1252                     pszCtl = Info::tr("unknown");
    1253         }
    1254         if (details == VMINFO_MACHINEREADABLE)
    1255             RTPrintf("storagecontrollertype%u=\"%s\"\n", i, pszCtl);
    1256         else
    1257             RTPrintf(Info::tr("Storage Controller Type (%u):            %s\n"), i, pszCtl);
    1258 
    1259         storageCtl->COMGETTER(Instance)(&ulValue);
    1260         if (details == VMINFO_MACHINEREADABLE)
    1261             RTPrintf("storagecontrollerinstance%u=\"%lu\"\n", i, ulValue);
    1262         else
    1263             RTPrintf(Info::tr("Storage Controller Instance Number (%u): %lu\n"), i, ulValue);
    1264 
    1265         storageCtl->COMGETTER(MaxPortCount)(&ulValue);
    1266         if (details == VMINFO_MACHINEREADABLE)
    1267             RTPrintf("storagecontrollermaxportcount%u=\"%lu\"\n", i, ulValue);
    1268         else
    1269             RTPrintf(Info::tr("Storage Controller Max Port Count (%u):  %lu\n"), i, ulValue);
    1270 
    1271         storageCtl->COMGETTER(PortCount)(&ulValue);
    1272         if (details == VMINFO_MACHINEREADABLE)
    1273             RTPrintf("storagecontrollerportcount%u=\"%lu\"\n", i, ulValue);
    1274         else
    1275             RTPrintf(Info::tr("Storage Controller Port Count (%u):      %lu\n"), i, ulValue);
    1276 
    1277         storageCtl->COMGETTER(Bootable)(&fBootable);
    1278         if (details == VMINFO_MACHINEREADABLE)
    1279             RTPrintf("storagecontrollerbootable%u=\"%s\"\n", i, fBootable ? "on" : "off");
    1280         else
    1281             RTPrintf(Info::tr("Storage Controller Bootable (%u):        %s\n"), i, fBootable ? Info::tr("on") : Info::tr("off"));
    1282     }
    1283 
    1284     for (size_t j = 0; j < storageCtls.size(); ++ j)
    1285     {
    1286         ComPtr<IStorageController> storageCtl = storageCtls[j];
    1287         ComPtr<IMedium> medium;
    1288         Bstr storageCtlName;
    1289         Bstr filePath;
    1290         ULONG cDevices;
    1291         ULONG cPorts;
    1292 
    1293         storageCtl->COMGETTER(Name)(storageCtlName.asOutParam());
    1294         storageCtl->COMGETTER(MaxDevicesPerPortCount)(&cDevices);
    1295         storageCtl->COMGETTER(PortCount)(&cPorts);
    1296 
    1297         for (ULONG i = 0; i < cPorts; ++ i)
    1298         {
    1299             for (ULONG k = 0; k < cDevices; ++ k)
    1300             {
    1301                 ComPtr<IMediumAttachment> mediumAttach;
    1302                 machine->GetMediumAttachment(storageCtlName.raw(),
    1303                                              i, k,
    1304                                              mediumAttach.asOutParam());
    1305                 BOOL fIsEjected = FALSE;
    1306                 BOOL fTempEject = FALSE;
    1307                 DeviceType_T devType = DeviceType_Null;
    1308                 if (mediumAttach)
    1309                 {
    1310                     mediumAttach->COMGETTER(TemporaryEject)(&fTempEject);
    1311                     mediumAttach->COMGETTER(IsEjected)(&fIsEjected);
    1312                     mediumAttach->COMGETTER(Type)(&devType);
    1313                 }
    1314                 rc = machine->GetMedium(storageCtlName.raw(), i, k,
    1315                                         medium.asOutParam());
    1316                 if (SUCCEEDED(rc) && medium)
    1317                 {
    1318                     BOOL fPassthrough = FALSE;
    1319 
    1320                     if (mediumAttach)
    1321                         mediumAttach->COMGETTER(Passthrough)(&fPassthrough);
    1322 
    1323                     medium->COMGETTER(Location)(filePath.asOutParam());
    1324                     Bstr uuid;
    1325                     medium->COMGETTER(Id)(uuid.asOutParam());
    1326 
    1327                     if (details == VMINFO_MACHINEREADABLE)
    1328                     {
    1329                         RTPrintf("\"%ls-%d-%d\"=\"%ls\"\n", storageCtlName.raw(),
    1330                                  i, k, filePath.raw());
    1331                         RTPrintf("\"%ls-ImageUUID-%d-%d\"=\"%s\"\n",
    1332                                  storageCtlName.raw(), i, k, Utf8Str(uuid).c_str());
    1333                         if (fPassthrough)
    1334                             RTPrintf("\"%ls-dvdpassthrough\"=\"%s\"\n", storageCtlName.raw(),
    1335                                      fPassthrough ? "on" : "off");
    1336                         if (devType == DeviceType_DVD)
    1337                         {
    1338                             RTPrintf("\"%ls-tempeject\"=\"%s\"\n", storageCtlName.raw(),
    1339                                      fTempEject ? "on" : "off");
    1340                             RTPrintf("\"%ls-IsEjected\"=\"%s\"\n", storageCtlName.raw(),
    1341                                      fIsEjected ? "on" : "off");
    1342                         }
    1343                     }
    1344                     else
    1345                     {
    1346                         RTPrintf("%ls (%d, %d): %ls (UUID: %s)",
    1347                                  storageCtlName.raw(), i, k, filePath.raw(),
    1348                                  Utf8Str(uuid).c_str());
    1349                         if (fPassthrough)
    1350                             RTPrintf(Info::tr(" (passthrough enabled)"));
    1351                         if (fTempEject)
    1352                             RTPrintf(Info::tr(" (temp eject)"));
    1353                         if (fIsEjected)
    1354                             RTPrintf(Info::tr(" (ejected)"));
    1355                         RTPrintf("\n");
    1356                     }
    1357                 }
    1358                 else if (SUCCEEDED(rc))
    1359                 {
    1360                     if (details == VMINFO_MACHINEREADABLE)
    1361                     {
    1362                         RTPrintf("\"%ls-%d-%d\"=\"emptydrive\"\n", storageCtlName.raw(), i, k);
    1363                         if (devType == DeviceType_DVD)
    1364                             RTPrintf("\"%ls-IsEjected\"=\"%s\"\n", storageCtlName.raw(),
    1365                                      fIsEjected ? "on" : "off");
    1366                     }
    1367                     else
    1368                     {
    1369                         RTPrintf(Info::tr("%ls (%d, %d): Empty"), storageCtlName.raw(), i, k);
    1370                         if (fTempEject)
    1371                             RTPrintf(Info::tr(" (temp eject)"));
    1372                         if (fIsEjected)
    1373                             RTPrintf(Info::tr(" (ejected)"));
    1374                         RTPrintf("\n");
    1375                     }
    1376                 }
    1377                 else
    1378                 {
    1379                     if (details == VMINFO_MACHINEREADABLE)
    1380                         RTPrintf("\"%ls-%d-%d\"=\"none\"\n", storageCtlName.raw(), i, k);
    1381                 }
    1382             }
    1383         }
    1384     }
     1409    if (storageCtls.size() > 0)
     1410    {
     1411        if (details != VMINFO_MACHINEREADABLE)
     1412            RTPrintf("%s\n", Info::tr("Storage Controllers:"));
     1413
     1414        for (size_t i = 0; i < storageCtls.size(); ++i)
     1415        {
     1416            ComPtr<IStorageController> storageCtl = storageCtls[i];
     1417
     1418            Bstr bstrName;
     1419            CHECK_ERROR2I_RET(storageCtl, COMGETTER(Name)(bstrName.asOutParam()), hrcCheck);
     1420            StorageControllerType_T enmCtlType = StorageControllerType_Null;
     1421            CHECK_ERROR2I_RET(storageCtl, COMGETTER(ControllerType)(&enmCtlType), hrcCheck);
     1422            ULONG uInstance = 0;
     1423            CHECK_ERROR2I_RET(storageCtl, COMGETTER(Instance)(&uInstance), hrcCheck);
     1424            ULONG cMaxPorts = 0;
     1425            CHECK_ERROR2I_RET(storageCtl, COMGETTER(MaxPortCount)(&cMaxPorts), hrcCheck);
     1426            ULONG cPorts = 0;
     1427            CHECK_ERROR2I_RET(storageCtl, COMGETTER(PortCount)(&cPorts), hrcCheck);
     1428            BOOL fBootable = FALSE;
     1429            CHECK_ERROR2I_RET(storageCtl, COMGETTER(Bootable)(&fBootable), hrcCheck);
     1430            if (details == VMINFO_MACHINEREADABLE)
     1431            {
     1432                outputMachineReadableString(FmtNm(szNm, "storagecontrollername%u", i), &bstrName);
     1433                outputMachineReadableString(FmtNm(szNm, "storagecontrollertype%u", i),
     1434                                            storageControllerTypeToName(enmCtlType, true));
     1435                RTPrintf("storagecontrollerinstance%u=\"%u\"\n", i, uInstance);
     1436                RTPrintf("storagecontrollermaxportcount%u=\"%u\"\n", i, cMaxPorts);
     1437                RTPrintf("storagecontrollerportcount%u=\"%u\"\n", i, cPorts);
     1438                RTPrintf("storagecontrollerbootable%u=\"%s\"\n", i, fBootable ? "on" : "off");
     1439            }
     1440            else
     1441            {
     1442                RTPrintf(Info::tr("#%u: '%ls', Type: %s, Instance: %u, Ports: %u (max %u), %s\n"), i, bstrName.raw(),
     1443                         storageControllerTypeToName(enmCtlType, false), uInstance, cPorts, cMaxPorts,
     1444                         fBootable ? Info::tr("Bootable") : Info::tr("Not bootable"));
     1445                rc = showMediumAttachments(machine, storageCtl, details);
     1446                if (FAILED(rc))
     1447                    return rc;
     1448            }
     1449        }
     1450    }
     1451    else if (details != VMINFO_MACHINEREADABLE)
     1452        RTPrintf("%-28s %s\n", Info::tr("Storage Controllers:"), Info::tr("<none>"));
     1453
     1454    if (details == VMINFO_MACHINEREADABLE)
     1455        for (size_t j = 0; j < storageCtls.size(); ++ j)
     1456        {
     1457            rc = showMediumAttachments(machine, storageCtls[j], details);
     1458            if (FAILED(rc))
     1459                return rc;
     1460        }
    13851461
    13861462    /* get the maximum amount of NICS */
     
    23832459                    if (details != VMINFO_MACHINEREADABLE)
    23842460                        SHOW_UTF8_STRING("index", Info::tr("Index:"), FmtNm(szNm, "%zu", index));
    2385                     SHOW_BOOLEAN_PROP_EX(DevPtr, Active,   FmtNm(szNm, "USBFilterActive%zu", index + 1),       Info::tr("Active:"), Info::tr("yes"), Info::tr("no"));
    2386                     SHOW_STRING_PROP(DevPtr, Name,         FmtNm(szNm, "USBFilterName%zu", index + 1),         Info::tr("Name:"));
    2387                     SHOW_STRING_PROP(DevPtr, VendorId,     FmtNm(szNm, "USBFilterVendorId%zu", index + 1),     Info::tr("VendorId:"));
    2388                     SHOW_STRING_PROP(DevPtr, ProductId,    FmtNm(szNm, "USBFilterProductId%zu", index + 1),    Info::tr("ProductId:"));
    2389                     SHOW_STRING_PROP(DevPtr, Revision,     FmtNm(szNm, "USBFilterRevision%zu", index + 1),     Info::tr("Revision:"));
    2390                     SHOW_STRING_PROP(DevPtr, Manufacturer, FmtNm(szNm, "USBFilterManufacturer%zu", index + 1), Info::tr("Manufacturer:"));
    2391                     SHOW_STRING_PROP(DevPtr, Product,      FmtNm(szNm, "USBFilterProduct%zu", index + 1),      Info::tr("Product:"));
    2392                     SHOW_STRING_PROP(DevPtr, Remote,       FmtNm(szNm, "USBFilterRemote%zu", index + 1),       Info::tr("Remote:"));
    2393                     SHOW_STRING_PROP(DevPtr, SerialNumber, FmtNm(szNm, "USBFilterSerialNumber%zu", index + 1), Info::tr("Serial Number:"));
     2461                    SHOW_BOOLEAN_PROP_EX(DevPtr, Active,   FmtNm(szNm, "USBFilterActive%zu", index + 1),       Info::tr("  Active:"), Info::tr("yes"), Info::tr("no"));
     2462                    SHOW_STRING_PROP(DevPtr, Name,         FmtNm(szNm, "USBFilterName%zu", index + 1),         Info::tr("  Name:"));
     2463                    SHOW_STRING_PROP(DevPtr, VendorId,     FmtNm(szNm, "USBFilterVendorId%zu", index + 1),     Info::tr("  VendorId:"));
     2464                    SHOW_STRING_PROP(DevPtr, ProductId,    FmtNm(szNm, "USBFilterProductId%zu", index + 1),    Info::tr("  ProductId:"));
     2465                    SHOW_STRING_PROP(DevPtr, Revision,     FmtNm(szNm, "USBFilterRevision%zu", index + 1),     Info::tr("  Revision:"));
     2466                    SHOW_STRING_PROP(DevPtr, Manufacturer, FmtNm(szNm, "USBFilterManufacturer%zu", index + 1), Info::tr("  Manufacturer:"));
     2467                    SHOW_STRING_PROP(DevPtr, Product,      FmtNm(szNm, "USBFilterProduct%zu", index + 1),      Info::tr("  Product:"));
     2468                    SHOW_STRING_PROP(DevPtr, Remote,       FmtNm(szNm, "USBFilterRemote%zu", index + 1),       Info::tr("  Remote:"));
     2469                    SHOW_STRING_PROP(DevPtr, SerialNumber, FmtNm(szNm, "USBFilterSerialNumber%zu", index + 1), Info::tr("  Serial Number:"));
    23942470                    if (details != VMINFO_MACHINEREADABLE)
    23952471                    {
     
    23982474                        if (fMaskedIfs)
    23992475                            RTPrintf("%-28s %#010x\n", Info::tr("Masked Interfaces:"), fMaskedIfs);
    2400                         RTPrintf("\n");
    24012476                    }
    24022477                }
     
    26792754        SHOW_BSTR_STRING("captureopts", Info::tr("Capture options:"), bstrOptions);
    26802755
    2681         if (details != VMINFO_MACHINEREADABLE)
    2682             RTPrintf("\n");
    26832756        /** @todo Add more audio capturing profile / information here. */
    26842757    }
     
    27122785        {
    27132786            if (details != VMINFO_MACHINEREADABLE)
    2714                 RTPrintf(Info::tr("Snapshots:\n\n"));
     2787                RTPrintf(Info::tr("* Snapshots:\n"));
    27152788            showSnapshots(snapshot, currentSnapshot, details);
    27162789        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette