VirtualBox

Changeset 34002 in vbox for trunk/include


Ignore:
Timestamp:
Nov 11, 2010 5:16:37 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
67667
Message:

iprt: Working on tar vfs.

Location:
trunk/include/iprt
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/err.h

    r33945 r34002  
    12941294/** The tar end of file record was read. */
    12951295#define VERR_TAR_END_OF_FILE                    (-926)
     1296/** The tar file ended unexpectedly. */
     1297#define VERR_TAR_UNEXPECTED_EOS                 (-927)
    12961298/** @} */
    12971299
  • trunk/include/iprt/fs.h

    r33993 r34002  
    263263    /** No additional information is available / requested. */
    264264    RTFSOBJATTRADD_NOTHING = 1,
    265     /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available / requested. */
     265    /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available /
     266     *  requested. */
    266267    RTFSOBJATTRADD_UNIX,
     268    /** The additional unix attributes (RTFSOBJATTR::u::UnixOwner) are
     269     * available / requested. */
     270    RTFSOBJATTRADD_UNIX_OWNER,
     271    /** The additional unix attributes (RTFSOBJATTR::u::UnixGroup) are
     272     * available / requested. */
     273    RTFSOBJATTRADD_UNIX_GROUP,
    267274    /** The additional extended attribute size (RTFSOBJATTR::u::EASize) is available / requested. */
    268275    RTFSOBJATTRADD_EASIZE,
     
    275282} RTFSOBJATTRADD;
    276283
     284/** The number of bytes reserved for the additional attribute union. */
     285#define RTFSOBJATTRUNION_MAX_SIZE       128
     286
     287/**
     288 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX).
     289 */
     290typedef struct RTFSOBJATTRUNIX
     291{
     292    /** The user owning the filesystem object (st_uid).
     293     * This field is NIL_UID if not supported. */
     294    RTUID           uid;
     295
     296    /** The group the filesystem object is assigned (st_gid).
     297     * This field is NIL_GID if not supported. */
     298    RTGID           gid;
     299
     300    /** Number of hard links to this filesystem object (st_nlink).
     301     * This field is 1 if the filesystem doesn't support hardlinking or
     302     * the information isn't available.
     303     */
     304    uint32_t        cHardlinks;
     305
     306    /** The device number of the device which this filesystem object resides on (st_dev).
     307     * This field is 0 if this information is not available. */
     308    RTDEV           INodeIdDevice;
     309
     310    /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
     311     * Together with INodeIdDevice, this field can be used as a OS wide unique id
     312     * when both their values are not 0.
     313     * This field is 0 if the information is not available. */
     314    RTINODE         INodeId;
     315
     316    /** User flags (st_flags).
     317     * This field is 0 if this information is not available. */
     318    uint32_t        fFlags;
     319
     320    /** The current generation number (st_gen).
     321     * This field is 0 if this information is not available. */
     322    uint32_t        GenerationId;
     323
     324    /** The device number of a character or block device type object (st_rdev).
     325     * This field is 0 if the file isn't of a character or block device type and
     326     * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
     327    RTDEV           Device;
     328} RTFSOBJATTRUNIX;
     329
     330
     331/**
     332 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_OWNER).
     333 *
     334 * @remarks This interface is mainly for TAR.
     335 */
     336typedef struct RTFSOBJATTRUNIXOWNER
     337{
     338    /** The user owning the filesystem object (st_uid).
     339     * This field is NIL_UID if not supported. */
     340    RTUID           uid;
     341    /** The user name.
     342     * Empty if not available or not supported, truncated if too long. */
     343    char            szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTUID)];
     344} RTFSOBJATTRUNIXOWNER;
     345
     346
     347/**
     348 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_GROUP).
     349 *
     350 * @remarks This interface is mainly for TAR.
     351 */
     352typedef struct RTFSOBJATTRUNIXGROUP
     353{
     354    /** The user owning the filesystem object (st_uid).
     355     * This field is NIL_GID if not supported. */
     356    RTGID           gid;
     357    /** The group name.
     358     * Empty if not available or not supported, truncated if too long. */
     359    char            szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTGID)];
     360} RTFSOBJATTRUNIXGROUP;
     361
    277362
    278363/**
    279364 * Filesystem object attributes.
    280365 */
    281 #pragma pack(1)
    282366typedef struct RTFSOBJATTR
    283367{
     
    296380    union RTFSOBJATTRUNION
    297381    {
    298         /** Additional Unix Attributes
    299          * These are available when RTFSOBJATTRADD is set in fUnix.
    300          */
    301          struct RTFSOBJATTRUNIX
    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;
     382        /** Additional Unix Attributes - RTFSOBJATTRADD_UNIX. */
     383        RTFSOBJATTRUNIX         Unix;
     384        /** Additional Unix Owner Attributes - RTFSOBJATTRADD_UNIX_OWNER. */
     385        RTFSOBJATTRUNIXOWNER    UnixOwner;
     386        /** Additional Unix Group Attributes - RTFSOBJATTRADD_UNIX_GROUP. */
     387        RTFSOBJATTRUNIXGROUP    UnixGroup;
    340388
    341389        /**
     
    347395            RTFOFF          cb;
    348396        } EASize;
     397        /** Reserved space. */
     398        uint8_t         abReserveSpace[128];
    349399    } u;
    350400} RTFSOBJATTR;
    351 #pragma pack()
    352401/** Pointer to a filesystem object attributes structure. */
    353402typedef RTFSOBJATTR *PRTFSOBJATTR;
     
    361410 * This is returned by the RTPathQueryInfo(), RTFileQueryInfo() and RTDirRead() APIs.
    362411 */
    363 #pragma pack(1)
    364412typedef struct RTFSOBJINFO
    365413{
     
    395443
    396444} RTFSOBJINFO;
    397 #pragma pack()
    398445/** Pointer to a filesystem object information structure. */
    399446typedef RTFSOBJINFO *PRTFSOBJINFO;
  • trunk/include/iprt/path.h

    r33802 r34002  
    628628 *
    629629 * @param   pszPath     Path to the file system object.
    630  * @param   pObjInfo    Object information structure to be filled on successful return.
     630 * @param   pObjInfo    Object information structure to be filled on successful
     631 *                      return.
    631632 * @param   enmAdditionalAttribs
    632633 *                      Which set of additional attributes to request.
  • trunk/include/iprt/vfs.h

    r33973 r34002  
    119119
    120120
    121 /** @defgroup grp_vfs_dir           VFS Directory API
     121/** @defgroup grp_vfs_dir           VFS Base Object API
    122122 * @{
    123123 */
    124124
    125 RTDECL(RTVFS)           RTVfsObjToVfs(RTVFSOBJ hVfsObj);
    126 RTDECL(RTVFSFSSTREAM)   RTVfsObjToFsStream(RTVFSOBJ hVfsObj);
    127 RTDECL(RTVFSDIR)        RTVfsObjToDir(RTVFSOBJ hVfsObj);
    128 RTDECL(RTVFSIOSTREAM)   RTVfsObjToIoStream(RTVFSOBJ hVfsObj);
    129 RTDECL(RTVFSFILE)       RTVfsObjToFile(RTVFSOBJ hVfsObj);
    130 RTDECL(RTVFSSYMLINK)    RTVfsObjToSymlink(RTVFSOBJ hVfsObj);
    131 
    132 RTDECL(RTVFSOBJ)        RTVfsObjFromVfs(RTVFS hVfs);
    133 RTDECL(RTVFSOBJ)        RTVfsObjFromFsStream(RTVFSFSSTREAM hVfsFss);
    134 RTDECL(RTVFSOBJ)        RTVfsObjFromDir(RTVFSDIR hVfsDir);
    135 RTDECL(RTVFSOBJ)        RTVfsObjFromIoStream(RTVFSIOSTREAM hVfsIos);
    136 RTDECL(RTVFSOBJ)        RTVfsObjFromFile(RTVFSFILE hVfsFile);
    137 RTDECL(RTVFSOBJ)        RTVfsObjFromSymlink(RTVFSSYMLINK hVfsSym);
     125/**
     126 * Retains a reference to the VFS base object handle.
     127 *
     128 * @returns New reference count on success, UINT32_MAX on failure.
     129 * @param   hVfsObj         The VFS base object handle.
     130 */
     131RTDECL(uint32_t)        RTVfsObjRetain(RTVFSOBJ hVfsObj);
     132
     133/**
     134 * Releases a reference to the VFS base handle.
     135 *
     136 * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
     137 * @param   hVfsObj         The VFS base object handle.
     138 */
     139RTDECL(uint32_t)        RTVfsObjRelease(RTVFSOBJ hVfsObj);
    138140
    139141/**
     
    141143 *
    142144 * @returns IPRT status code.
     145 * @retval  VERR_NOT_SUPPORTED if the @a enmAddAttr value is not handled by the
     146 *          implementation.
     147 *
    143148 * @param   hVfsObj         The VFS object handle.
    144149 * @param   pObjInfo        Where to return the info.
     
    146151 * @sa      RTFileQueryInfo, RTPathQueryInfo
    147152 */
    148 RTDECL(int)         RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
     153RTDECL(int)             RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
     154
     155
     156/**
     157 * Converts a VFS base object handle to a VFS handle.
     158 *
     159 * @returns Referenced handle on success, NIL on failure.
     160 * @param   hVfsObj         The VFS base object handle.
     161 */
     162RTDECL(RTVFS)           RTVfsObjToVfs(RTVFSOBJ hVfsObj);
     163
     164/**
     165 * Converts a VFS base object handle to a VFS filesystem stream handle.
     166 *
     167 * @returns Referenced handle on success, NIL on failure.
     168 * @param   hVfsObj         The VFS base object handle.
     169 */
     170RTDECL(RTVFSFSSTREAM)   RTVfsObjToFsStream(RTVFSOBJ hVfsObj);
     171
     172/**
     173 * Converts a VFS base object handle to a VFS directory handle.
     174 *
     175 * @returns Referenced handle on success, NIL on failure.
     176 * @param   hVfsObj         The VFS base object handle.
     177 */
     178RTDECL(RTVFSDIR)        RTVfsObjToDir(RTVFSOBJ hVfsObj);
     179
     180/**
     181 * Converts a VFS base object handle to a VFS I/O stream handle.
     182 *
     183 * @returns Referenced handle on success, NIL on failure.
     184 * @param   hVfsObj         The VFS base object handle.
     185 */
     186RTDECL(RTVFSIOSTREAM)   RTVfsObjToIoStream(RTVFSOBJ hVfsObj);
     187
     188/**
     189 * Converts a VFS base object handle to a VFS file handle.
     190 *
     191 * @returns Referenced handle on success, NIL on failure.
     192 * @param   hVfsObj         The VFS base object handle.
     193 */
     194RTDECL(RTVFSFILE)       RTVfsObjToFile(RTVFSOBJ hVfsObj);
     195
     196/**
     197 * Converts a VFS base object handle to a VFS symbolic link handle.
     198 *
     199 * @returns Referenced handle on success, NIL on failure.
     200 * @param   hVfsObj         The VFS base object handle.
     201 */
     202RTDECL(RTVFSSYMLINK)    RTVfsObjToSymlink(RTVFSOBJ hVfsObj);
     203
     204
     205/**
     206 * Converts a VFS handle to a VFS base object handle.
     207 *
     208 * @returns Referenced handle on success, NIL if the input handle was invalid.
     209 * @param   hVfs            The VFS handle.
     210 */
     211RTDECL(RTVFSOBJ)        RTVfsObjFromVfs(RTVFS hVfs);
     212
     213/**
     214 * Converts a VFS filesystem stream handle to a VFS base object handle.
     215 *
     216 * @returns Referenced handle on success, NIL if the input handle was invalid.
     217 * @param   hVfsFSs         The VFS filesystem stream handle.
     218 */
     219RTDECL(RTVFSOBJ)        RTVfsObjFromFsStream(RTVFSFSSTREAM hVfsFss);
     220
     221/**
     222 * Converts a VFS directory handle to a VFS base object handle.
     223 *
     224 * @returns Referenced handle on success, NIL if the input handle was invalid.
     225 * @param   hVfsDir          The VFS directory handle.
     226 */
     227RTDECL(RTVFSOBJ)        RTVfsObjFromDir(RTVFSDIR hVfsDir);
     228
     229/**
     230 * Converts a VFS I/O stream handle to a VFS base object handle.
     231 *
     232 * @returns Referenced handle on success, NIL if the input handle was invalid.
     233 * @param   hVfsIos          The VFS I/O stream handle.
     234 */
     235RTDECL(RTVFSOBJ)        RTVfsObjFromIoStream(RTVFSIOSTREAM hVfsIos);
     236
     237/**
     238 * Converts a VFS file handle to a VFS base object handle.
     239 *
     240 * @returns Referenced handle on success, NIL if the input handle was invalid.
     241 * @param   hVfsFile         The VFS file handle.
     242 */
     243RTDECL(RTVFSOBJ)        RTVfsObjFromFile(RTVFSFILE hVfsFile);
     244
     245/**
     246 * Converts a VFS symbolic link handle to a VFS base object handle.
     247 *
     248 * @returns Referenced handle on success, NIL if the input handle was invalid.
     249 * @param   hVfsSym            The VFS symbolic link handle.
     250 */
     251RTDECL(RTVFSOBJ)        RTVfsObjFromSymlink(RTVFSSYMLINK hVfsSym);
    149252
    150253/** @} */
     
    182285 * @retval  VINF_SUCCESS if a new object was retrieved.
    183286 * @retval  VERR_EOF when there are no more objects.
     287 *
    184288 * @param   pvThis      The implementation specific directory data.
    185289 * @param   ppszName    Where to return the object name.  Must be freed by
     
    323427 * @retval  VERR_EOF when trying to read __beyond__ the end of the stream and
    324428 *          @a pcbRead is NULL.
     429 * @retval  VERR_ACCESS_DENIED if the stream is not readable.
    325430 *
    326431 * @param   hVfsIos         The VFS I/O stream handle.
     
    339444 *
    340445 * @returns IPRT status code.
     446 * @retval  VERR_ACCESS_DENIED if the stream is not writable.
     447 *
    341448 * @param   hVfsIos         The VFS I/O stream handle.
    342449 * @param   pvBuf           The bytes to write.
     
    366473 * @retval  VERR_EOF when trying to read __beyond__ the end of the stream and
    367474 *          @a pcbRead is NULL.
     475 * @retval  VERR_ACCESS_DENIED if the stream is not readable.
    368476 *
    369477 * @param   hVfsIos         The VFS I/O stream handle.
     
    383491 *
    384492 * @returns IPRT status code.
     493 * @retval  VERR_ACCESS_DENIED if the stream is not writable.
     494 *
    385495 * @param   hVfsIos         The VFS I/O stream handle.
    386496 * @param   pSgBuf          Pointer to a gather buffer descriptor.  The number
  • trunk/include/iprt/vfslowlevel.h

    r33973 r34002  
    125125     * Get information about the file.
    126126     *
    127      * @returns IPRT status code.
     127     * @returns IPRT status code. See RTVfsObjQueryInfo.
    128128     * @param   pvThis      The implementation specific file data.
    129129     * @param   pObjInfo    Where to return the object info on success.
    130130     * @param   enmAddAttr  Which set of additional attributes to request.
    131      * @sa      RTFileQueryInfo
     131     * @sa      RTVfsObjQueryInfo, RTFileQueryInfo, RTPathQueryInfo
    132132     */
    133133    DECLCALLBACKMEMBER(int, pfnQueryInfo)(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
     
    234234     * @param   hVfsObj     Where to return the object handle (referenced).
    235235     *                      This must be cast to the desired type before use.
     236     * @sa      RTVfsFsStrmNext
    236237     */
    237238    DECLCALLBACKMEMBER(int, pfnNext)(void *pvThis, char **ppszName, RTVFSOBJTYPE *penmType, PRTVFSOBJ phVfsObj);
     
    245246/** The RTVFSFSSTREAMOPS structure version. */
    246247#define RTVFSFSSTREAMOPS_VERSION    RT_MAKE_U32_FROM_U8(0xff,0x3f,1,0)
     248
     249
     250/**
     251 * Creates a new VFS filesystem stream handle.
     252 *
     253 * @returns IPRT status code
     254 * @param   pFsStreamOps        The filesystem stream operations.
     255 * @param   cbInstance          The size of the instance data.
     256 * @param   hVfs                The VFS handle to associate this filesystem
     257 *                              steram with.  NIL_VFS is ok.
     258 * @param   hSemRW              The read-write semaphore to use to protect the
     259 *                              handle if this differs from the one the VFS
     260 *                              uses.  NIL_RTSEMRW is ok if no locking is
     261 *                              desired.
     262 * @param   phVfsFss            Where to return the new handle.
     263 * @param   ppvInstance         Where to return the pointer to the instance data
     264 *                              (size is @a cbInstance).
     265 */
     266RTDECL(int) RTVfsNewFsStream(PCRTVFSFSSTREAMOPS pFsStreamOps, size_t cbInstance, RTVFS hVfs, RTSEMRW hSemRW,
     267                             PRTVFSFSSTREAM phVfsFss, void **ppvInstance);
    247268
    248269
     
    553574 * @param   cbInstance          The size of the instance data.
    554575 * @param   fOpen               The open flags.  The minimum is the access mask.
    555  * @param   hVfs                The VFS handle to associate this file with.
    556  *                              NIL_VFS is ok.
     576 * @param   hVfs                The VFS handle to associate this I/O stream
     577 *                              with.  NIL_VFS is ok.
    557578 * @param   hSemRW              The read-write semaphore to use to protect the
    558579 *                              handle if this differs from the one the VFS
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