Index: trunk/include/iprt/err.h
===================================================================
--- trunk/include/iprt/err.h	(revision 33994)
+++ trunk/include/iprt/err.h	(revision 34002)
@@ -1294,4 +1294,6 @@
 /** The tar end of file record was read. */
 #define VERR_TAR_END_OF_FILE                    (-926)
+/** The tar file ended unexpectedly. */
+#define VERR_TAR_UNEXPECTED_EOS                 (-927)
 /** @} */
 
Index: trunk/include/iprt/fs.h
===================================================================
--- trunk/include/iprt/fs.h	(revision 33994)
+++ trunk/include/iprt/fs.h	(revision 34002)
@@ -263,6 +263,13 @@
     /** No additional information is available / requested. */
     RTFSOBJATTRADD_NOTHING = 1,
-    /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available / requested. */
+    /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available /
+     *  requested. */
     RTFSOBJATTRADD_UNIX,
+    /** The additional unix attributes (RTFSOBJATTR::u::UnixOwner) are
+     * available / requested. */
+    RTFSOBJATTRADD_UNIX_OWNER,
+    /** The additional unix attributes (RTFSOBJATTR::u::UnixGroup) are
+     * available / requested. */
+    RTFSOBJATTRADD_UNIX_GROUP,
     /** The additional extended attribute size (RTFSOBJATTR::u::EASize) is available / requested. */
     RTFSOBJATTRADD_EASIZE,
@@ -275,9 +282,86 @@
 } RTFSOBJATTRADD;
 
+/** The number of bytes reserved for the additional attribute union. */
+#define RTFSOBJATTRUNION_MAX_SIZE       128
+
+/**
+ * Additional Unix Attributes (RTFSOBJATTRADD_UNIX).
+ */
+typedef struct RTFSOBJATTRUNIX
+{
+    /** The user owning the filesystem object (st_uid).
+     * This field is NIL_UID if not supported. */
+    RTUID           uid;
+
+    /** The group the filesystem object is assigned (st_gid).
+     * This field is NIL_GID if not supported. */
+    RTGID           gid;
+
+    /** Number of hard links to this filesystem object (st_nlink).
+     * This field is 1 if the filesystem doesn't support hardlinking or
+     * the information isn't available.
+     */
+    uint32_t        cHardlinks;
+
+    /** The device number of the device which this filesystem object resides on (st_dev).
+     * This field is 0 if this information is not available. */
+    RTDEV           INodeIdDevice;
+
+    /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
+     * Together with INodeIdDevice, this field can be used as a OS wide unique id
+     * when both their values are not 0.
+     * This field is 0 if the information is not available. */
+    RTINODE         INodeId;
+
+    /** User flags (st_flags).
+     * This field is 0 if this information is not available. */
+    uint32_t        fFlags;
+
+    /** The current generation number (st_gen).
+     * This field is 0 if this information is not available. */
+    uint32_t        GenerationId;
+
+    /** The device number of a character or block device type object (st_rdev).
+     * This field is 0 if the file isn't of a character or block device type and
+     * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
+    RTDEV           Device;
+} RTFSOBJATTRUNIX;
+
+
+/**
+ * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_OWNER).
+ *
+ * @remarks This interface is mainly for TAR.
+ */
+typedef struct RTFSOBJATTRUNIXOWNER
+{
+    /** The user owning the filesystem object (st_uid).
+     * This field is NIL_UID if not supported. */
+    RTUID           uid;
+    /** The user name.
+     * Empty if not available or not supported, truncated if too long. */
+    char            szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTUID)];
+} RTFSOBJATTRUNIXOWNER;
+
+
+/**
+ * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_GROUP).
+ *
+ * @remarks This interface is mainly for TAR.
+ */
+typedef struct RTFSOBJATTRUNIXGROUP
+{
+    /** The user owning the filesystem object (st_uid).
+     * This field is NIL_GID if not supported. */
+    RTGID           gid;
+    /** The group name.
+     * Empty if not available or not supported, truncated if too long. */
+    char            szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTGID)];
+} RTFSOBJATTRUNIXGROUP;
+
 
 /**
  * Filesystem object attributes.
  */
-#pragma pack(1)
 typedef struct RTFSOBJATTR
 {
@@ -296,46 +380,10 @@
     union RTFSOBJATTRUNION
     {
-        /** Additional Unix Attributes
-         * These are available when RTFSOBJATTRADD is set in fUnix.
-         */
-         struct RTFSOBJATTRUNIX
-         {
-            /** The user owning the filesystem object (st_uid).
-             * This field is ~0U if not supported. */
-            RTUID           uid;
-
-            /** The group the filesystem object is assigned (st_gid).
-             * This field is ~0U if not supported. */
-            RTGID           gid;
-
-            /** Number of hard links to this filesystem object (st_nlink).
-             * This field is 1 if the filesystem doesn't support hardlinking or
-             * the information isn't available.
-             */
-            uint32_t        cHardlinks;
-
-            /** The device number of the device which this filesystem object resides on (st_dev).
-             * This field is 0 if this information is not available. */
-            RTDEV           INodeIdDevice;
-
-            /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
-             * Together with INodeIdDevice, this field can be used as a OS wide unique id
-             * when both their values are not 0.
-             * This field is 0 if the information is not available. */
-            RTINODE         INodeId;
-
-            /** User flags (st_flags).
-             * This field is 0 if this information is not available. */
-            uint32_t        fFlags;
-
-            /** The current generation number (st_gen).
-             * This field is 0 if this information is not available. */
-            uint32_t        GenerationId;
-
-            /** The device number of a character or block device type object (st_rdev).
-             * This field is 0 if the file isn't of a character or block device type and
-             * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
-            RTDEV           Device;
-        } Unix;
+        /** Additional Unix Attributes - RTFSOBJATTRADD_UNIX. */
+        RTFSOBJATTRUNIX         Unix;
+        /** Additional Unix Owner Attributes - RTFSOBJATTRADD_UNIX_OWNER. */
+        RTFSOBJATTRUNIXOWNER    UnixOwner;
+        /** Additional Unix Group Attributes - RTFSOBJATTRADD_UNIX_GROUP. */
+        RTFSOBJATTRUNIXGROUP    UnixGroup;
 
         /**
@@ -347,7 +395,8 @@
             RTFOFF          cb;
         } EASize;
+        /** Reserved space. */
+        uint8_t         abReserveSpace[128];
     } u;
 } RTFSOBJATTR;
-#pragma pack()
 /** Pointer to a filesystem object attributes structure. */
 typedef RTFSOBJATTR *PRTFSOBJATTR;
@@ -361,5 +410,4 @@
  * This is returned by the RTPathQueryInfo(), RTFileQueryInfo() and RTDirRead() APIs.
  */
-#pragma pack(1)
 typedef struct RTFSOBJINFO
 {
@@ -395,5 +443,4 @@
 
 } RTFSOBJINFO;
-#pragma pack()
 /** Pointer to a filesystem object information structure. */
 typedef RTFSOBJINFO *PRTFSOBJINFO;
Index: trunk/include/iprt/path.h
===================================================================
--- trunk/include/iprt/path.h	(revision 33994)
+++ trunk/include/iprt/path.h	(revision 34002)
@@ -628,5 +628,6 @@
  *
  * @param   pszPath     Path to the file system object.
- * @param   pObjInfo    Object information structure to be filled on successful return.
+ * @param   pObjInfo    Object information structure to be filled on successful
+ *                      return.
  * @param   enmAdditionalAttribs
  *                      Which set of additional attributes to request.
Index: trunk/include/iprt/vfs.h
===================================================================
--- trunk/include/iprt/vfs.h	(revision 33994)
+++ trunk/include/iprt/vfs.h	(revision 34002)
@@ -119,21 +119,23 @@
 
 
-/** @defgroup grp_vfs_dir           VFS Directory API
+/** @defgroup grp_vfs_dir           VFS Base Object API
  * @{
  */
 
-RTDECL(RTVFS)           RTVfsObjToVfs(RTVFSOBJ hVfsObj);
-RTDECL(RTVFSFSSTREAM)   RTVfsObjToFsStream(RTVFSOBJ hVfsObj);
-RTDECL(RTVFSDIR)        RTVfsObjToDir(RTVFSOBJ hVfsObj);
-RTDECL(RTVFSIOSTREAM)   RTVfsObjToIoStream(RTVFSOBJ hVfsObj);
-RTDECL(RTVFSFILE)       RTVfsObjToFile(RTVFSOBJ hVfsObj);
-RTDECL(RTVFSSYMLINK)    RTVfsObjToSymlink(RTVFSOBJ hVfsObj);
-
-RTDECL(RTVFSOBJ)        RTVfsObjFromVfs(RTVFS hVfs);
-RTDECL(RTVFSOBJ)        RTVfsObjFromFsStream(RTVFSFSSTREAM hVfsFss);
-RTDECL(RTVFSOBJ)        RTVfsObjFromDir(RTVFSDIR hVfsDir);
-RTDECL(RTVFSOBJ)        RTVfsObjFromIoStream(RTVFSIOSTREAM hVfsIos);
-RTDECL(RTVFSOBJ)        RTVfsObjFromFile(RTVFSFILE hVfsFile);
-RTDECL(RTVFSOBJ)        RTVfsObjFromSymlink(RTVFSSYMLINK hVfsSym);
+/**
+ * Retains a reference to the VFS base object handle.
+ *
+ * @returns New reference count on success, UINT32_MAX on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(uint32_t)        RTVfsObjRetain(RTVFSOBJ hVfsObj);
+
+/**
+ * Releases a reference to the VFS base handle.
+ *
+ * @returns New reference count on success (0 if closed), UINT32_MAX on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(uint32_t)        RTVfsObjRelease(RTVFSOBJ hVfsObj);
 
 /**
@@ -141,4 +143,7 @@
  *
  * @returns IPRT status code.
+ * @retval  VERR_NOT_SUPPORTED if the @a enmAddAttr value is not handled by the
+ *          implementation.
+ *
  * @param   hVfsObj         The VFS object handle.
  * @param   pObjInfo        Where to return the info.
@@ -146,5 +151,103 @@
  * @sa      RTFileQueryInfo, RTPathQueryInfo
  */
-RTDECL(int)         RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
+RTDECL(int)             RTVfsObjQueryInfo(RTVFSOBJ hVfsObj, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
+
+
+/**
+ * Converts a VFS base object handle to a VFS handle.
+ *
+ * @returns Referenced handle on success, NIL on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(RTVFS)           RTVfsObjToVfs(RTVFSOBJ hVfsObj);
+
+/**
+ * Converts a VFS base object handle to a VFS filesystem stream handle.
+ *
+ * @returns Referenced handle on success, NIL on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(RTVFSFSSTREAM)   RTVfsObjToFsStream(RTVFSOBJ hVfsObj);
+
+/**
+ * Converts a VFS base object handle to a VFS directory handle.
+ *
+ * @returns Referenced handle on success, NIL on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(RTVFSDIR)        RTVfsObjToDir(RTVFSOBJ hVfsObj);
+
+/**
+ * Converts a VFS base object handle to a VFS I/O stream handle.
+ *
+ * @returns Referenced handle on success, NIL on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(RTVFSIOSTREAM)   RTVfsObjToIoStream(RTVFSOBJ hVfsObj);
+
+/**
+ * Converts a VFS base object handle to a VFS file handle.
+ *
+ * @returns Referenced handle on success, NIL on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(RTVFSFILE)       RTVfsObjToFile(RTVFSOBJ hVfsObj);
+
+/**
+ * Converts a VFS base object handle to a VFS symbolic link handle.
+ *
+ * @returns Referenced handle on success, NIL on failure.
+ * @param   hVfsObj         The VFS base object handle.
+ */
+RTDECL(RTVFSSYMLINK)    RTVfsObjToSymlink(RTVFSOBJ hVfsObj);
+
+
+/**
+ * Converts a VFS handle to a VFS base object handle.
+ *
+ * @returns Referenced handle on success, NIL if the input handle was invalid.
+ * @param   hVfs            The VFS handle.
+ */
+RTDECL(RTVFSOBJ)        RTVfsObjFromVfs(RTVFS hVfs);
+
+/**
+ * Converts a VFS filesystem stream handle to a VFS base object handle.
+ *
+ * @returns Referenced handle on success, NIL if the input handle was invalid.
+ * @param   hVfsFSs         The VFS filesystem stream handle.
+ */
+RTDECL(RTVFSOBJ)        RTVfsObjFromFsStream(RTVFSFSSTREAM hVfsFss);
+
+/**
+ * Converts a VFS directory handle to a VFS base object handle.
+ *
+ * @returns Referenced handle on success, NIL if the input handle was invalid.
+ * @param   hVfsDir          The VFS directory handle.
+ */
+RTDECL(RTVFSOBJ)        RTVfsObjFromDir(RTVFSDIR hVfsDir);
+
+/**
+ * Converts a VFS I/O stream handle to a VFS base object handle.
+ *
+ * @returns Referenced handle on success, NIL if the input handle was invalid.
+ * @param   hVfsIos          The VFS I/O stream handle.
+ */
+RTDECL(RTVFSOBJ)        RTVfsObjFromIoStream(RTVFSIOSTREAM hVfsIos);
+
+/**
+ * Converts a VFS file handle to a VFS base object handle.
+ *
+ * @returns Referenced handle on success, NIL if the input handle was invalid.
+ * @param   hVfsFile         The VFS file handle.
+ */
+RTDECL(RTVFSOBJ)        RTVfsObjFromFile(RTVFSFILE hVfsFile);
+
+/**
+ * Converts a VFS symbolic link handle to a VFS base object handle.
+ *
+ * @returns Referenced handle on success, NIL if the input handle was invalid.
+ * @param   hVfsSym            The VFS symbolic link handle.
+ */
+RTDECL(RTVFSOBJ)        RTVfsObjFromSymlink(RTVFSSYMLINK hVfsSym);
 
 /** @} */
@@ -182,4 +285,5 @@
  * @retval  VINF_SUCCESS if a new object was retrieved.
  * @retval  VERR_EOF when there are no more objects.
+ *
  * @param   pvThis      The implementation specific directory data.
  * @param   ppszName    Where to return the object name.  Must be freed by
@@ -323,4 +427,5 @@
  * @retval  VERR_EOF when trying to read __beyond__ the end of the stream and
  *          @a pcbRead is NULL.
+ * @retval  VERR_ACCESS_DENIED if the stream is not readable.
  *
  * @param   hVfsIos         The VFS I/O stream handle.
@@ -339,4 +444,6 @@
  *
  * @returns IPRT status code.
+ * @retval  VERR_ACCESS_DENIED if the stream is not writable.
+ *
  * @param   hVfsIos         The VFS I/O stream handle.
  * @param   pvBuf           The bytes to write.
@@ -366,4 +473,5 @@
  * @retval  VERR_EOF when trying to read __beyond__ the end of the stream and
  *          @a pcbRead is NULL.
+ * @retval  VERR_ACCESS_DENIED if the stream is not readable.
  *
  * @param   hVfsIos         The VFS I/O stream handle.
@@ -383,4 +491,6 @@
  *
  * @returns IPRT status code.
+ * @retval  VERR_ACCESS_DENIED if the stream is not writable.
+ *
  * @param   hVfsIos         The VFS I/O stream handle.
  * @param   pSgBuf          Pointer to a gather buffer descriptor.  The number
Index: trunk/include/iprt/vfslowlevel.h
===================================================================
--- trunk/include/iprt/vfslowlevel.h	(revision 33994)
+++ trunk/include/iprt/vfslowlevel.h	(revision 34002)
@@ -125,9 +125,9 @@
      * Get information about the file.
      *
-     * @returns IPRT status code.
+     * @returns IPRT status code. See RTVfsObjQueryInfo.
      * @param   pvThis      The implementation specific file data.
      * @param   pObjInfo    Where to return the object info on success.
      * @param   enmAddAttr  Which set of additional attributes to request.
-     * @sa      RTFileQueryInfo
+     * @sa      RTVfsObjQueryInfo, RTFileQueryInfo, RTPathQueryInfo
      */
     DECLCALLBACKMEMBER(int, pfnQueryInfo)(void *pvThis, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
@@ -234,4 +234,5 @@
      * @param   hVfsObj     Where to return the object handle (referenced).
      *                      This must be cast to the desired type before use.
+     * @sa      RTVfsFsStrmNext
      */
     DECLCALLBACKMEMBER(int, pfnNext)(void *pvThis, char **ppszName, RTVFSOBJTYPE *penmType, PRTVFSOBJ phVfsObj);
@@ -245,4 +246,24 @@
 /** The RTVFSFSSTREAMOPS structure version. */
 #define RTVFSFSSTREAMOPS_VERSION    RT_MAKE_U32_FROM_U8(0xff,0x3f,1,0)
+
+
+/**
+ * Creates a new VFS filesystem stream handle.
+ *
+ * @returns IPRT status code
+ * @param   pFsStreamOps        The filesystem stream operations.
+ * @param   cbInstance          The size of the instance data.
+ * @param   hVfs                The VFS handle to associate this filesystem
+ *                              steram with.  NIL_VFS is ok.
+ * @param   hSemRW              The read-write semaphore to use to protect the
+ *                              handle if this differs from the one the VFS
+ *                              uses.  NIL_RTSEMRW is ok if no locking is
+ *                              desired.
+ * @param   phVfsFss            Where to return the new handle.
+ * @param   ppvInstance         Where to return the pointer to the instance data
+ *                              (size is @a cbInstance).
+ */
+RTDECL(int) RTVfsNewFsStream(PCRTVFSFSSTREAMOPS pFsStreamOps, size_t cbInstance, RTVFS hVfs, RTSEMRW hSemRW,
+                             PRTVFSFSSTREAM phVfsFss, void **ppvInstance);
 
 
@@ -553,6 +574,6 @@
  * @param   cbInstance          The size of the instance data.
  * @param   fOpen               The open flags.  The minimum is the access mask.
- * @param   hVfs                The VFS handle to associate this file with.
- *                              NIL_VFS is ok.
+ * @param   hVfs                The VFS handle to associate this I/O stream
+ *                              with.  NIL_VFS is ok.
  * @param   hSemRW              The read-write semaphore to use to protect the
  *                              handle if this differs from the one the VFS
