VirtualBox

Changeset 104837 in vbox


Ignore:
Timestamp:
Jun 4, 2024 4:32:14 PM (8 months ago)
Author:
vboxsync
Message:

Additions/VBoxGuest/lib/VBoxGuestR0LibSharedFolders: Refactor the
VBOX_INIT_CALL() and VBOX_INIT_CALL_EX() macros to improve readability
and discoverability. The macros cleverly abstracted away the details of
the SHFL_FN_* and SHFL_CPARMS_* manifest constants but they also hid
their names so they couldn't be found by cscope/grok/grep/etc. resulting
in wasted time when trying to find them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR0LibSharedFolders.c

    r98103 r104837  
    5151*   Defined Constants And Macros                                                                                                 *
    5252*********************************************************************************************************************************/
    53 #define VBOX_INIT_CALL(a, b, c) \
    54     LogFunc(("%s, idClient=%d\n", "SHFL_FN_" # b, (c)->idClient)); \
    55     VBGL_HGCM_HDR_INIT(a, (c)->idClient, SHFL_FN_##b, SHFL_CPARMS_##b); \
     53#define VBOX_INIT_CALL(a, b, c, d) \
     54    LogFunc(("%s, idClient=%d\n", #b, (c)->idClient)); \
     55    VBGL_HGCM_HDR_INIT(a, (c)->idClient, b, d); \
    5656    (a)->fInterruptible = false /* Currently we do like nfs with -o hard (default). */
    5757
    58 #define VBOX_INIT_CALL_EX(a, b, c, a_cbReq) \
    59     LogFunc(("%s, idClient=%d\n", "SHFL_FN_" # b, (c)->idClient)); \
    60     VBGL_HGCM_HDR_INIT_EX(a, (c)->idClient, SHFL_FN_##b, SHFL_CPARMS_##b, a_cbReq); \
     58#define VBOX_INIT_CALL_EX(a, b, c, a_cbReq, d) \
     59    LogFunc(("%s, idClient=%d\n", #b, (c)->idClient)); \
     60    VBGL_HGCM_HDR_INIT_EX(a, (c)->idClient, b, d, a_cbReq); \
    6161    (a)->fInterruptible = false /* Currently we do like nfs with -o hard (default). */
    6262
     
    107107    VBGLIOCHGCMCALL callInfo;
    108108
    109     VBOX_INIT_CALL(&callInfo, SET_UTF8, pClient);
     109    VBOX_INIT_CALL(&callInfo, SHFL_FN_SET_UTF8, pClient, SHFL_CPARMS_SET_UTF8);
    110110    rc = VbglR0HGCMCall(pClient->handle, &callInfo, sizeof(callInfo));
    111111/*    Log(("VBOXSF: VbglR0SfSetUtf8: VbglR0HGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.Hdr.rc)); */
     
    133133    VBoxSFQueryMappings data;
    134134
    135     VBOX_INIT_CALL(&data.callInfo, QUERY_MAPPINGS, pClient);
     135    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_QUERY_MAPPINGS, pClient, SHFL_CPARMS_QUERY_MAPPINGS);
    136136
    137137    data.flags.type                      = VMMDevHGCMParmType_32bit;
     
    159159    VBoxSFQueryMapName data;
    160160
    161     VBOX_INIT_CALL(&data.callInfo, QUERY_MAP_NAME, pClient);
     161    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_QUERY_MAP_NAME, pClient, SHFL_CPARMS_QUERY_MAP_NAME);
    162162
    163163    data.root.type                   = VMMDevHGCMParmType_32bit;
     
    178178    VBoxSFMapFolder data;
    179179
    180     VBOX_INIT_CALL(&data.callInfo, MAP_FOLDER, pClient);
     180    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_MAP_FOLDER, pClient, SHFL_CPARMS_MAP_FOLDER);
    181181
    182182    data.path.type                    = VMMDevHGCMParmType_LinAddr;
     
    212212    VBoxSFUnmapFolder data;
    213213
    214     VBOX_INIT_CALL(&data.callInfo, UNMAP_FOLDER, pClient);
     214    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_UNMAP_FOLDER, pClient, SHFL_CPARMS_UNMAP_FOLDER);
    215215
    216216    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    230230    VBoxSFCreate data;
    231231
    232     VBOX_INIT_CALL(&data.callInfo, CREATE, pClient);
     232    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_CREATE, pClient, SHFL_CPARMS_CREATE);
    233233
    234234    data.root.type                    = VMMDevHGCMParmType_32bit;
     
    253253    VBoxSFClose data;
    254254
    255     VBOX_INIT_CALL(&data.callInfo, CLOSE, pClient);
     255    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_CLOSE, pClient, SHFL_CPARMS_CLOSE);
    256256
    257257    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    273273    VBoxSFRemove data;
    274274
    275     VBOX_INIT_CALL(&data.callInfo, REMOVE, pClient);
     275    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_REMOVE, pClient, SHFL_CPARMS_REMOVE);
    276276
    277277    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    295295    VBoxSFRename data;
    296296
    297     VBOX_INIT_CALL(&data.callInfo, RENAME, pClient);
     297    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_RENAME, pClient, SHFL_CPARMS_RENAME);
    298298
    299299    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    322322    VBoxSFRead data;
    323323
    324     VBOX_INIT_CALL(&data.callInfo, READ, pClient);
     324    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_READ, pClient, SHFL_CPARMS_READ);
    325325
    326326    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    360360        return VERR_NO_TMP_MEMORY;
    361361
    362     VBOX_INIT_CALL_EX(&pData->callInfo, READ, pClient, cbData);
     362    VBOX_INIT_CALL_EX(&pData->callInfo, SHFL_FN_READ, pClient, cbData, SHFL_CPARMS_READ);
    363363
    364364    pData->root.type                      = VMMDevHGCMParmType_32bit;
     
    399399    VBoxSFWrite data;
    400400
    401     VBOX_INIT_CALL(&data.callInfo, WRITE, pClient);
     401    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_WRITE, pClient, SHFL_CPARMS_WRITE);
    402402
    403403    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    438438        return VERR_NO_TMP_MEMORY;
    439439
    440     VBOX_INIT_CALL_EX(&pData->callInfo, WRITE, pClient, cbData);
     440    VBOX_INIT_CALL_EX(&pData->callInfo, SHFL_FN_WRITE, pClient, cbData, SHFL_CPARMS_WRITE);
    441441
    442442    pData->root.type                      = VMMDevHGCMParmType_32bit;
     
    486486        return VERR_NO_TMP_MEMORY;
    487487
    488     VBOX_INIT_CALL_EX(&pData->callInfo, WRITE, pClient, cbData);
     488    VBOX_INIT_CALL_EX(&pData->callInfo, SHFL_FN_WRITE, pClient, cbData, SHFL_CPARMS_WRITE);
    489489
    490490    pData->root.type                      = VMMDevHGCMParmType_32bit;
     
    526526    VBoxSFFlush data;
    527527
    528     VBOX_INIT_CALL(&data.callInfo, FLUSH, pClient);
     528    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_FLUSH, pClient, SHFL_CPARMS_FLUSH);
    529529
    530530    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    553553    VBoxSFList data;
    554554
    555     VBOX_INIT_CALL(&data.callInfo, LIST, pClient);
     555    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_LIST, pClient, SHFL_CPARMS_LIST);
    556556
    557557    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    592592    VBoxSFInformation data;
    593593
    594     VBOX_INIT_CALL(&data.callInfo, INFORMATION, pClient);
     594    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_INFORMATION, pClient, SHFL_CPARMS_INFORMATION);
    595595
    596596    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    625625    VBoxSFLock data;
    626626
    627     VBOX_INIT_CALL(&data.callInfo, LOCK, pClient);
     627    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_LOCK, pClient, SHFL_CPARMS_LOCK);
    628628
    629629    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    652652    VBoxSFReadLink data;
    653653
    654     VBOX_INIT_CALL(&data.callInfo, READLINK, pClient);
     654    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_READLINK, pClient, SHFL_CPARMS_READLINK);
    655655
    656656    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    676676    VBoxSFSymlink data;
    677677
    678     VBOX_INIT_CALL(&data.callInfo, SYMLINK, pClient);
     678    VBOX_INIT_CALL(&data.callInfo, SHFL_FN_SYMLINK, pClient, SHFL_CPARMS_SYMLINK);
    679679
    680680    data.root.type                      = VMMDevHGCMParmType_32bit;
     
    703703    VBGLIOCHGCMCALL callInfo;
    704704
    705     VBOX_INIT_CALL(&callInfo, SET_SYMLINKS, pClient);
     705    VBOX_INIT_CALL(&callInfo, SHFL_FN_SET_SYMLINKS, pClient, SHFL_CPARMS_SET_SYMLINKS);
    706706    rc = VbglR0HGCMCall(pClient->handle, &callInfo, sizeof(callInfo));
    707707/*    Log(("VBOXSF: VbglR0SfSetSymlinks: VbglR0HGCMCall rc = %#x, result = %#x\n", rc, data.callInfo.Hdr.rc)); */
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