VirtualBox

Changeset 33994 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Nov 11, 2010 2:26:08 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67658
Message:

shfl: Replaced RTFSOBJINFO and RTFSPROPERTIES with shared folder specific versions. IPRT structures like this should never have been exposed to the guest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/shflsvc.h

    r33540 r33994  
    242242
    243243
     244/**
     245 * The available additional information in a SHFLFSOBJATTR object.
     246 */
     247typedef enum SHFLFSOBJATTRADD
     248{
     249    /** No additional information is available / requested. */
     250    SHFLFSOBJATTRADD_NOTHING = 1,
     251    /** The additional unix attributes (SHFLFSOBJATTR::u::Unix) are
     252     *  available / requested. */
     253    SHFLFSOBJATTRADD_UNIX,
     254    /** The additional extended attribute size (SHFLFSOBJATTR::u::EASize) is
     255     *  available / requested. */
     256    SHFLFSOBJATTRADD_EASIZE,
     257    /** The last valid item (inclusive).
     258     * The valid range is SHFLFSOBJATTRADD_NOTHING thru
     259     * SHFLFSOBJATTRADD_LAST. */
     260    SHFLFSOBJATTRADD_LAST = SHFLFSOBJATTRADD_EASIZE,
     261
     262    /** The usual 32-bit hack. */
     263    SHFLFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
     264} SHFLFSOBJATTRADD;
     265
     266
     267/* Assert sizes of the IRPT types we're using below. */
     268AssertCompileSize(RTFMODE,      4);
     269AssertCompileSize(RTFOFF,       8);
     270AssertCompileSize(RTINODE,      8);
     271AssertCompileSize(RTTIMESPEC,   8);
     272AssertCompileSize(RTDEV,        4);
     273AssertCompileSize(RTUID,        4);
     274
     275/**
     276 * Shared folder filesystem object attributes.
     277 */
     278#pragma pack(1)
     279typedef struct SHFLFSOBJATTR
     280{
     281    /** Mode flags (st_mode). RTFS_UNIX_*, RTFS_TYPE_*, and RTFS_DOS_*.
     282     * @remarks We depend on a number of RTFS_ defines to remain unchanged.
     283     *          Fortuntately, these are depending on windows, dos and unix
     284     *          standard values, so this shouldn't be much of a pain. */
     285    RTFMODE         fMode;
     286
     287    /** The additional attributes available. */
     288    SHFLFSOBJATTRADD  enmAdditional;
     289
     290    /**
     291     * Additional attributes.
     292     *
     293     * Unless explicitly specified to an API, the API can provide additional
     294     * data as it is provided by the underlying OS.
     295     */
     296    union SHFLFSOBJATTRUNION
     297    {
     298        /** Additional Unix Attributes
     299         * These are available when SHFLFSOBJATTRADD is set in fUnix.
     300         */
     301         struct SHFLFSOBJATTRUNIX
     302         {
     303            /** The user owning the filesystem object (st_uid).
     304             * This field is ~0U if not supported. */
     305            RTUID           uid;
     306
     307            /** The group the filesystem object is assigned (st_gid).
     308             * This field is ~0U if not supported. */
     309            RTGID           gid;
     310
     311            /** Number of hard links to this filesystem object (st_nlink).
     312             * This field is 1 if the filesystem doesn't support hardlinking or
     313             * the information isn't available.
     314             */
     315            uint32_t        cHardlinks;
     316
     317            /** The device number of the device which this filesystem object resides on (st_dev).
     318             * This field is 0 if this information is not available. */
     319            RTDEV           INodeIdDevice;
     320
     321            /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
     322             * Together with INodeIdDevice, this field can be used as a OS wide unique id
     323             * when both their values are not 0.
     324             * This field is 0 if the information is not available. */
     325            RTINODE         INodeId;
     326
     327            /** User flags (st_flags).
     328             * This field is 0 if this information is not available. */
     329            uint32_t        fFlags;
     330
     331            /** The current generation number (st_gen).
     332             * This field is 0 if this information is not available. */
     333            uint32_t        GenerationId;
     334
     335            /** The device number of a character or block device type object (st_rdev).
     336             * This field is 0 if the file isn't of a character or block device type and
     337             * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
     338            RTDEV           Device;
     339        } Unix;
     340
     341        /**
     342         * Extended attribute size.
     343         */
     344        struct SHFLFSOBJATTREASIZE
     345        {
     346            /** Size of EAs. */
     347            RTFOFF          cb;
     348        } EASize;
     349    } u;
     350} SHFLFSOBJATTR;
     351#pragma pack()
     352AssertCompileSize(SHFLFSOBJATTR, 44);
     353/** Pointer to a shared folder filesystem object attributes structure. */
     354typedef SHFLFSOBJATTR *PSHFLFSOBJATTR;
     355/** Pointer to a const shared folder filesystem object attributes structure. */
     356typedef const SHFLFSOBJATTR *PCSHFLFSOBJATTR;
     357
     358
     359/**
     360 * Filesystem object information structure.
     361 */
     362#pragma pack(1)
     363typedef struct SHFLFSOBJINFO
     364{
     365   /** Logical size (st_size).
     366    * For normal files this is the size of the file.
     367    * For symbolic links, this is the length of the path name contained
     368    * in the symbolic link.
     369    * For other objects this fields needs to be specified.
     370    */
     371   RTFOFF       cbObject;
     372
     373   /** Disk allocation size (st_blocks * DEV_BSIZE). */
     374   RTFOFF       cbAllocated;
     375
     376   /** Time of last access (st_atime).
     377    * @remarks  Here (and other places) we depend on the IPRT timespec to
     378    *           remain unchanged. */
     379   RTTIMESPEC   AccessTime;
     380
     381   /** Time of last data modification (st_mtime). */
     382   RTTIMESPEC   ModificationTime;
     383
     384   /** Time of last status change (st_ctime).
     385    * If not available this is set to ModificationTime.
     386    */
     387   RTTIMESPEC   ChangeTime;
     388
     389   /** Time of file birth (st_birthtime).
     390    * If not available this is set to ChangeTime.
     391    */
     392   RTTIMESPEC   BirthTime;
     393
     394   /** Attributes. */
     395   SHFLFSOBJATTR Attr;
     396
     397} SHFLFSOBJINFO;
     398#pragma pack()
     399AssertCompileSize(SHFLFSOBJINFO, 92);
     400/** Pointer to a shared folder filesystem object information structure. */
     401typedef SHFLFSOBJINFO *PSHFLFSOBJINFO;
     402/** Pointer to a const shared folder filesystem object information
     403 *  structure. */
     404typedef const SHFLFSOBJINFO *PCSHFLFSOBJINFO;
     405
     406
     407/**
     408 * Copy file system objinfo from IPRT to shared folder format.
     409 *
     410 * @param   pDst                The shared folder structure.
     411 * @param   pSrc                The IPRT structure.
     412 */
     413DECLINLINE(void) vbfsCopyFsObjInfoFromIprt(PSHFLFSOBJINFO pDst, PCRTFSOBJINFO pSrc)
     414{
     415    pDst->cbObject          = pSrc->cbObject;
     416    pDst->cbAllocated       = pSrc->cbAllocated;
     417    pDst->AccessTime        = pSrc->AccessTime;
     418    pDst->ModificationTime  = pSrc->ModificationTime;
     419    pDst->ChangeTime        = pSrc->ChangeTime;
     420    pDst->BirthTime         = pSrc->BirthTime;
     421    pDst->Attr.fMode        = pSrc->Attr.fMode;
     422    RT_ZERO(pDst->Attr.u);
     423    switch (pSrc->Attr.enmAdditional)
     424    {
     425        default:
     426        case RTFSOBJATTRADD_NOTHING:
     427            pDst->Attr.enmAdditional        = SHFLFSOBJATTRADD_NOTHING;
     428            break;
     429
     430        case RTFSOBJATTRADD_UNIX:
     431            pDst->Attr.enmAdditional        = SHFLFSOBJATTRADD_UNIX;
     432            pDst->Attr.u.Unix.uid           = pSrc->Attr.u.Unix.uid;
     433            pDst->Attr.u.Unix.gid           = pSrc->Attr.u.Unix.gid;
     434            pDst->Attr.u.Unix.cHardlinks    = pSrc->Attr.u.Unix.cHardlinks;
     435            pDst->Attr.u.Unix.INodeIdDevice = pSrc->Attr.u.Unix.INodeIdDevice;
     436            pDst->Attr.u.Unix.INodeId       = pSrc->Attr.u.Unix.INodeId;
     437            pDst->Attr.u.Unix.fFlags        = pSrc->Attr.u.Unix.fFlags;
     438            pDst->Attr.u.Unix.GenerationId  = pSrc->Attr.u.Unix.GenerationId;
     439            pDst->Attr.u.Unix.Device        = pSrc->Attr.u.Unix.Device;
     440            break;
     441
     442        case RTFSOBJATTRADD_EASIZE:
     443            pDst->Attr.enmAdditional        = SHFLFSOBJATTRADD_EASIZE;
     444            pDst->Attr.u.EASize.cb          = pSrc->Attr.u.EASize.cb;
     445            break;
     446    }
     447}
     448
     449
    244450/** Result of an open/create request.
    245451 *  Along with handle value the result code
     
    361567     * returned actual attributes of opened/created object.
    362568     */
    363     RTFSOBJINFO Info;
     569    SHFLFSOBJINFO Info;
    364570
    365571} SHFLCREATEPARMS;
     
    397603{
    398604    /** Full information about the object. */
    399     RTFSOBJINFO     Info;
     605    SHFLFSOBJINFO   Info;
    400606    /** The length of the short field (number of RTUTF16 chars).
    401607     * It is 16-bit for reasons of alignment. */
     
    409615} SHFLDIRINFO, *PSHFLDIRINFO;
    410616
     617
     618/**
     619 * Shared folder filesystem properties.
     620 */
     621typedef struct SHFLFSPROPERTIES
     622{
     623    /** The maximum size of a filesystem object name.
     624     * This does not include the '\\0'. */
     625    uint32_t cbMaxComponent;
     626
     627    /** True if the filesystem is remote.
     628     * False if the filesystem is local. */
     629    bool    fRemote;
     630
     631    /** True if the filesystem is case sensitive.
     632     * False if the filesystem is case insensitive. */
     633    bool    fCaseSensitive;
     634
     635    /** True if the filesystem is mounted read only.
     636     * False if the filesystem is mounted read write. */
     637    bool    fReadOnly;
     638
     639    /** True if the filesystem can encode unicode object names.
     640     * False if it can't. */
     641    bool    fSupportsUnicode;
     642
     643    /** True if the filesystem is compresses.
     644     * False if it isn't or we don't know. */
     645    bool    fCompressed;
     646
     647    /** True if the filesystem compresses of individual files.
     648     * False if it doesn't or we don't know. */
     649    bool    fFileCompression;
     650
     651    /** @todo more? */
     652} SHFLFSPROPERTIES;
     653AssertCompileSize(SHFLFSPROPERTIES, 12);
     654/** Pointer to a shared folder filesystem properties structure. */
     655typedef SHFLFSPROPERTIES *PSHFLFSPROPERTIES;
     656/** Pointer to a const shared folder filesystem properties structure. */
     657typedef SHFLFSPROPERTIES const *PCSHFLFSPROPERTIES;
     658
     659
     660/**
     661 * Copy file system properties from IPRT to shared folder format.
     662 *
     663 * @param   pDst                The shared folder structure.
     664 * @param   pSrc                The IPRT structure.
     665 */
     666DECLINLINE(void) vbfsCopyFsPropertiesFromIprt(PSHFLFSPROPERTIES pDst, PCRTFSPROPERTIES pSrc)
     667{
     668    RT_ZERO(*pDst);                     /* zap the implicit padding. */
     669    pDst->cbMaxComponent   = pSrc->cbMaxComponent;
     670    pDst->fRemote          = pSrc->fRemote;
     671    pDst->fCaseSensitive   = pSrc->fCaseSensitive;
     672    pDst->fReadOnly        = pSrc->fReadOnly;
     673    pDst->fSupportsUnicode = pSrc->fSupportsUnicode;
     674    pDst->fCompressed      = pSrc->fCompressed;
     675    pDst->fFileCompression = pSrc->fFileCompression;
     676}
     677
     678
    411679typedef struct _SHFLVOLINFO
    412680{
     
    416684    uint32_t       ulBytesPerSector;
    417685    uint32_t       ulSerial;
    418     RTFSPROPERTIES fsProperties;
     686    SHFLFSPROPERTIES fsProperties;
    419687} SHFLVOLINFO, *PSHFLVOLINFO;
    420688
     
    9481216
    9491217    /** pointer, in/out:
    950      * Information to be set/get (RTFSOBJINFO or SHFLSTRING).
    951      * Do not forget to set the RTFSOBJINFO::Attr::enmAdditional for Get operation as well.
     1218     * Information to be set/get (SHFLFSOBJINFO or SHFLSTRING). Do not forget
     1219     * to set the SHFLFSOBJINFO::Attr::enmAdditional for Get operation as well.
    9521220     */
    9531221    HGCMFunctionParameter info;
Note: See TracChangeset for help on using the changeset viewer.

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