VirtualBox

Changeset 102749 in vbox for trunk/src


Ignore:
Timestamp:
Jan 3, 2024 3:17:55 PM (13 months ago)
Author:
vboxsync
Message:

Guest Control/VBoxManage: Implemented a "mount" sub command for the new GetMountPoints API. bugref:10415

File:
1 edited

Legend:

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

    r102679 r102749  
    24172417}
    24182418
     2419static DECLCALLBACK(RTEXITCODE) gctlHandleMount(PGCTLCMDCTX pCtx, int argc, char **argv)
     2420{
     2421    AssertPtrReturn(pCtx, RTEXITCODE_FAILURE);
     2422
     2423    static const RTGETOPTDEF s_aOptions[] =
     2424    {
     2425        GCTLCMD_COMMON_OPTION_DEFS()
     2426    };
     2427
     2428    int ch;
     2429    RTGETOPTUNION ValueUnion;
     2430    RTGETOPTSTATE GetState;
     2431    RTGetOptInit(&GetState, argc, argv, s_aOptions, RT_ELEMENTS(s_aOptions), 1, RTGETOPTINIT_FLAGS_OPTS_FIRST);
     2432
     2433    while ((ch = RTGetOpt(&GetState, &ValueUnion)) != 0)
     2434    {
     2435        /* For options that require an argument, ValueUnion has received the value. */
     2436        switch (ch)
     2437        {
     2438            GCTLCMD_COMMON_OPTION_CASES(pCtx, ch, &ValueUnion);
     2439
     2440            default:
     2441                return errorGetOpt(ch, &ValueUnion);
     2442        }
     2443    }
     2444
     2445    RTEXITCODE rcExit = gctlCtxPostOptionParsingInit(pCtx);
     2446    if (rcExit != RTEXITCODE_SUCCESS)
     2447        return rcExit;
     2448
     2449    HRESULT hrc = S_OK;
     2450
     2451    com::SafeArray<BSTR> mountPoints;
     2452    CHECK_ERROR(pCtx->pGuestSession, COMGETTER(MountPoints)(ComSafeArrayAsOutParam(mountPoints)));
     2453
     2454    for (size_t i = 0; i < mountPoints.size(); ++i)
     2455        RTPrintf("%ls\n", mountPoints[i]);
     2456
     2457    if (pCtx->cVerbose)
     2458        RTPrintf("Found %zu mount points\n", mountPoints.size());
     2459
     2460    return FAILED(hrc) ? RTEXITCODE_FAILURE : RTEXITCODE_SUCCESS;
     2461}
     2462
    24192463static DECLCALLBACK(RTEXITCODE) gctlHandleFsInfo(PGCTLCMDCTX pCtx, int argc, char **argv)
    24202464{
     
    38023846        { "createtemporary",    gctlHandleMkTemp,           HELP_SCOPE_GUESTCONTROL_MKTEMP,    0 },
    38033847
     3848        { "mount",              gctlHandleMount,            HELP_SCOPE_GUESTCONTROL_MOUNT,     0 },
     3849
    38043850        { "df",                 gctlHandleFsInfo,           HELP_SCOPE_GUESTCONTROL_FSINFO,    0 },
    38053851        { "fsinfo",             gctlHandleFsInfo,           HELP_SCOPE_GUESTCONTROL_FSINFO,    0 },
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