VirtualBox

Ignore:
Timestamp:
May 31, 2017 11:14:37 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
115842
Message:

IPRT/vfstarwriter.cpp: Initial push-file implementation (untested).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/vfs/vfsbase.cpp

    r67123 r67166  
    20372037    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    20382038    AssertReturn(pThis->uMagic == RTVFSFSSTREAM_MAGIC, VERR_INVALID_HANDLE);
    2039     AssertPtrNullReturn(pszPath, VERR_INVALID_POINTER);
     2039    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
     2040    AssertReturn(*pszPath != '\0', VERR_INVALID_NAME);
    20402041    AssertPtrReturn(hVfsObj, VERR_INVALID_HANDLE);
    20412042    AssertReturn(hVfsObj->uMagic == RTVFSOBJ_MAGIC, VERR_INVALID_HANDLE);
     
    20442045
    20452046    return pThis->pOps->pfnAdd(pThis->Base.pvThis, pszPath, hVfsObj, fFlags);
     2047}
     2048
     2049
     2050RTDECL(int)         RTVfsFsStrmPushFile(RTVFSFSSTREAM hVfsFss, const char *pszPath, uint64_t cbFile,
     2051                                        PCRTFSOBJINFO paObjInfo, uint32_t cObjInfo, uint32_t fFlags, PRTVFSIOSTREAM phVfsIos)
     2052{
     2053    RTVFSFSSTREAMINTERNAL *pThis = hVfsFss;
     2054    AssertPtrReturn(phVfsIos, VERR_INVALID_POINTER);
     2055    *phVfsIos = NIL_RTVFSIOSTREAM;
     2056
     2057    AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
     2058    AssertReturn(pThis->uMagic == RTVFSFSSTREAM_MAGIC, VERR_INVALID_HANDLE);
     2059
     2060    AssertPtrReturn(pszPath, VERR_INVALID_POINTER);
     2061    AssertReturn(*pszPath != '\0', VERR_INVALID_NAME);
     2062
     2063    AssertReturn(!(fFlags & RTVFSFSSTRM_PUSH_F_VALID_MASK), VERR_INVALID_FLAGS);
     2064    AssertReturn(RT_BOOL(cbFile == UINT64_MAX) == RT_BOOL(fFlags & RTVFSFSSTRM_PUSH_F_STREAM), VERR_INVALID_FLAGS);
     2065
     2066    if (cObjInfo)
     2067    {
     2068        AssertPtrReturn(paObjInfo, VERR_INVALID_POINTER);
     2069        AssertReturn(paObjInfo[0].Attr.enmAdditional == RTFSOBJATTRADD_UNIX, VERR_INVALID_PARAMETER);
     2070    }
     2071
     2072    AssertReturn(pThis->fFlags & RTFILE_O_WRITE, VERR_INVALID_FUNCTION);
     2073    if (pThis->pOps->pfnPushFile)
     2074        return pThis->pOps->pfnPushFile(pThis->Base.pvThis, pszPath, cbFile, paObjInfo, cObjInfo, fFlags, phVfsIos);
     2075    return VERR_NOT_SUPPORTED;
    20462076}
    20472077
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