VirtualBox

Changeset 99085 in vbox for trunk/include


Ignore:
Timestamp:
Mar 21, 2023 12:15:00 PM (21 months ago)
Author:
vboxsync
Message:

Guest Control: Added directory listing support via IDirectory::list(). Added (randomized) testcase support for it. bugref:9783

Location:
trunk/include/VBox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/GuestHost/GuestControl.h

    r98824 r99085  
    432432/** GSTCTL_PATH_F_XXX flag valid mask. */
    433433#define GSTCTL_PATH_F_VALID_MASK         UINT32_C(0x00000007)
     434/** @} */
     435
     436/** @name GSTCTL_DIRLIST_F_XXX - Flags for guest directory listings.
     437 * @{ */
     438/** No guest listing flags specified. */
     439#define GSTCTL_DIRLIST_F_NONE               UINT32_C(0)
     440/** GSTCTL_DIRLIST_F_XXX valid mask. */
     441#define GSTCTL_DIRLIST_F_VALID_MASK         UINT32_C(0x00000000)
    434442/** @} */
    435443
     
    553561
    554562/** The maximum size (in bytes) of an entry file name (at least RT_UOFFSETOF(GSTCTLDIRENTRYEX, szName[2]). */
    555 #define GSTCTL_DIRENTRY_MAX_SIZE    4096
    556 
     563#define GSTCTL_DIRENTRY_MAX_SIZE                4096
     564/** Maximum characters of the resolved user name. Including terminator. */
     565#define GSTCTL_DIRENTRY_MAX_USER_NAME           255
     566/** Maximum characters of the resolved user groups list. Including terminator. */
     567#define GSTCTL_DIRENTRY_MAX_USER_GROUPS         _1K
     568/** The resolved user groups delimiter as a string. */
     569#define GSTCTL_DIRENTRY_GROUPS_DELIMITER_STR    "\r\n"
     570
     571/**
     572 * Guest directory entry header.
     573 *
     574 * This is needed for (un-)packing multiple directory entries with its resolved user name + groups
     575 * with the HOST_MSG_DIR_LIST command.
     576 *
     577 * The order of the attributes also mark their packed order, so be careful when changing this!
     578 *
     579 * @since 7.1.
     580 */
     581#pragma pack(1)
     582typedef struct GSTCTLDIRENTRYLISTHDR
     583{
     584    /** Size (in bytes) of the directory header). */
     585    uint32_t          cbDirEntryEx;
     586    /** Size (in bytes) of the resolved user name as a string
     587     *  Includes terminator. */
     588    uint32_t          cbUser;
     589    /** Size (in bytes) of the resolved user groups as a string.
     590     *  Delimited by GSTCTL_DIRENTRY_GROUPS_DELIMITER_STR. Includes terminator. */
     591    uint32_t          cbGroups;
     592} GSTCTLDIRENTRYBLOCK;
     593/** Pointer to a guest directory header entry. */
     594typedef GSTCTLDIRENTRYLISTHDR *PGSTCTLDIRENTRYLISTHDR;
     595#pragma pack()
    557596} /* namespace guestControl */
    558597
  • trunk/include/VBox/HostServices/GuestControlSvc.h

    r98824 r99085  
    232232     */
    233233    HOST_MSG_DIR_CREATE = 314,
     234    /**
     235     * Lists one or multiple directory entries at once.
     236     *
     237     * @since   7.1
     238     */
     239    HOST_MSG_DIR_LIST = 315,
    234240#endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
    235241    /**
     
    302308        RT_CASE_RET_STR(HOST_MSG_DIR_REWIND);
    303309        RT_CASE_RET_STR(HOST_MSG_DIR_CREATE);
     310        RT_CASE_RET_STR(HOST_MSG_DIR_LIST);
    304311#endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
    305312        RT_CASE_RET_STR(HOST_MSG_DIR_REMOVE);
     
    729736    /** Guest directory was rewind. */
    730737    GUEST_DIR_NOTIFYTYPE_REWIND = 22,
     738    /** Guest directory listing. */
     739    GUEST_DIR_NOTIFYTYPE_LIST = 23,
    731740#endif
    732741    /** Information about an open guest directory. */
     
    10921101    HGCMFunctionParameter flags;
    10931102} HGCMMsgDirCreate;
     1103
     1104/**
     1105 * Lists the entries of a directory on the guest.
     1106 */
     1107typedef struct HGCMMsgDirList
     1108{
     1109    VBGLIOCHGCMCALL hdr;
     1110    /** Context ID. */
     1111    HGCMFunctionParameter context;
     1112    /** Handle of directory listing to list. */
     1113    HGCMFunctionParameter handle;
     1114    /** Number of entries to read at once.
     1115     *  Specify UINT32_MAX to read as much as possible. 0 is not allowed. */
     1116    HGCMFunctionParameter num_entries;
     1117    /** Listing flags (GSTCTL_DIRLIST_F_XXX). */
     1118    HGCMFunctionParameter flags;
     1119} HGCMMsgDirList;
    10941120#endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
    10951121
     
    15281554    {
    15291555        /**
    1530          * Parameters used for \a type GUEST_DIR_NOTIFYTYPE_OPEN.
     1556         * Parameters used for \a reply_hdr.type GUEST_DIR_NOTIFYTYPE_OPEN.
    15311557         *
    15321558         * @since 7.1
     
    15381564        } open;
    15391565        /**
    1540          * Parameters used for \a type GUEST_DIR_NOTIFYTYPE_READ.
     1566         * Parameters used for \a reply_hdr.type GUEST_DIR_NOTIFYTYPE_READ.
    15411567         *
    15421568         * @since 7.1
     
    15501576            /** Resolved group IDs as a string.
    15511577             *
    1552              *  Multiple groups are delimited by "\r\n", whereas
     1578             *  Multiple groups are delimited by GSTCTL_DIRENTRY_GROUPS_DELIMITER_STR, whereas
    15531579             *  the first group always is the primary group. */
    15541580            HGCMFunctionParameter groups;
    15551581        } read;
     1582        /**
     1583         * Parameters used for \a reply_hdr.type GUEST_DIR_NOTIFYTYPE_LIST.
     1584         *
     1585         * @since 7.1
     1586         */
     1587        struct
     1588        {
     1589            /** Number of entries in \a buffer. */
     1590            HGCMFunctionParameter num_entries;
     1591            /** Buffer containing the GSTCTLDIRENTRYEX entries, immediately followed
     1592             *  by resolved user + groups as a string (empty strings if not resolved).
     1593             *
     1594             *  Only will be sent if \a num_entries > 0. */
     1595            HGCMFunctionParameter buffer;
     1596        } list;
    15561597    } u;
    15571598} HGCMReplyDirNotify;
     
    15821623            /** Resolved group IDs as a string.
    15831624             *
    1584              *  Multiple groups are delimited by "\r\n", whereas
     1625             *  Multiple groups are delimited by GSTCTL_DIRENTRY_GROUPS_DELIMITER_STR, whereas
    15851626             *  the first group always is the primary group. */
    15861627            HGCMFunctionParameter groups;
  • trunk/include/VBox/VBoxGuestLib.h

    r98824 r99085  
    11221122VBGLR3DECL(int) VbglR3GuestCtrlDirGetRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
    11231123VBGLR3DECL(int) VbglR3GuestCtrlDirGetRewind(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle);
     1124VBGLR3DECL(int) VbglR3GuestCtrlDirGetList(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t *puHandle, uint32_t *pcEntries, uint32_t *pfFlags);
    11241125/** @} */
    11251126#  endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
     
    11551156VBGLR3DECL(int) VbglR3GuestCtrlDirCbRead(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, PGSTCTLDIRENTRYEX pEntry, uint32_t cbSize);
    11561157VBGLR3DECL(int) VbglR3GuestCtrlDirCbRewind(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc);
     1158VBGLR3DECL(int) VbglR3GuestCtrlDirCbList(PVBGLR3GUESTCTRLCMDCTX pCtx, uint32_t uRc, uint32_t cEntries, void *pvBuf, uint32_t cbBuf);
    11571159/** @} */
    11581160#  endif /* VBOX_WITH_GSTCTL_TOOLBOX_AS_CMDS */
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