vfs.h revision 43af8389304c77c3d4db525de8907cb74207c380
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * IPRT - Virtual Filesystem.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * Copyright (C) 2010 Oracle Corporation
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * This file is part of VirtualBox Open Source Edition (OSE), as
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * available from http://www.virtualbox.org. This file is free software;
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * you can redistribute it and/or modify it under the terms of the GNU
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * General Public License (GPL) as published by the Free Software
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * Foundation, in version 2 as it comes in the "COPYING" file of the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * The contents of this file may alternatively be used under the terms
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * of the Common Development and Distribution License Version 1.0
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * VirtualBox OSE distribution, in which case the provisions of the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * CDDL are applicable instead of those of the GPL.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * You may elect to license modified versions of this file under the
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * terms and conditions of either the GPL or the CDDL or both.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk/** @defgroup grp_rt_fs RTVfs - Virtual Filesystem
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * @ingroup grp_rt
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * The virtual filesystem APIs are intended to make it possible to work on
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * container files, file system sub-trees, file system overlays and other custom
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * filesystem configurations. It also makes it possible to create filters, like
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * automatically gunzipping a tar.gz file before feeding it to the RTTar API for
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * unpacking - or wise versa.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * The virtual filesystem APIs are intended to mirror the RTDir, RTFile, RTPath
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * and RTFs APIs pretty closely so that rewriting a piece of code to work with
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * it should be easy. However there are some differences to the way the APIs
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * works and the user should heed the documentation. The differences are
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * usually motivated by simplification and in some case to make the VFS more
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * flexible.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * The object type.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Invalid type. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Pure base object.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * This is returned by the filesystem stream to represent directories,
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * devices, fifos and similar that needs to be created. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Virtual filesystem. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Filesystem stream. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Pure I/O stream. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Directory. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** File. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Symbolic link. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** End of valid object types. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk /** Pure I/O stream. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk/** Pointer to a VFS object type. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk/** @name RTVfsCreate flags
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk/** Whether the file system is read-only. */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk/** Whether we the VFS should be thread safe (i.e. automaticaly employ
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * locks). */
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * Creates an empty virtual filesystem.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * @returns IPRT status code.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * @param pszName Name, for logging and such.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * @param fFlags Flags, MBZ.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * @param phVfs Where to return the VFS handle. Release the returned
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpk * reference by calling RTVfsRelease.
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkRTDECL(int) RTVfsCreate(const char *pszName, uint32_t fFlags, PRTVFS phVfs);
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkRTDECL(int) RTVfsAttach(RTVFS hVfs, const char *pszMountPoint, uint32_t fFlags, RTVFS hVfsAttach);
45916cd2fec6e79bca5dee0421bd39e3c2910d1ejpkRTDECL(int) RTVfsDetach(RTVFS hVfs, const char *pszMountPoint, RTVFS hVfsToDetach, PRTVFS *phVfsDetached);
RTDECL(int) RTVfsGetAttachment(RTVFS hVfs, uint32_t iOrdinal, PRTVFS *phVfsAttached, uint32_t *pfFlags,
RTDECL(int) RTVfsFsStrmQueryInfo(RTVFSFSSTREAM hVfsFss, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
RTDECL(int) RTVfsFsStrmNext(RTVFSFSSTREAM hVfsFss, char **ppszName, RTVFSOBJTYPE *penmType, PRTVFSOBJ phVfsObj);
RTDECL(int) RTVfsIoStrmFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSIOSTREAM phVfsIos);
RTDECL(int) RTVfsIoStrmQueryInfo(RTVFSIOSTREAM hVfsIos, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
RTDECL(int) RTVfsIoStrmRead(RTVFSIOSTREAM hVfsIos, void *pvBuf, size_t cbToRead, bool fBlocking, size_t *pcbRead);
RTDECL(int) RTVfsIoStrmWrite(RTVFSIOSTREAM hVfsIos, const void *pvBuf, size_t cbToWrite, bool fBlocking, size_t *pcbWritten);
RTDECL(int) RTVfsIoStrmSgRead(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbRead);
RTDECL(int) RTVfsIoStrmSgWrite(RTVFSIOSTREAM hVfsIos, PCRTSGBUF pSgBuf, bool fBlocking, size_t *pcbWritten);
RTDECL(RTFOFF) RTVfsIoStrmPoll(RTVFSIOSTREAM hVfsIos, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
RTDECL(int) RTVfsFileOpen(RTVFS hVfs, const char *pszFilename, uint32_t fOpen, PRTVFSFILE phVfsFile);
RTDECL(int) RTVfsFileFromRTFile(RTFILE hFile, uint32_t fOpen, bool fLeaveOpen, PRTVFSFILE phVfsFile);
RTDECL(int) RTVfsFileQueryInfo(RTVFSFILE hVfsFile, PRTFSOBJINFO pObjInfo, RTFSOBJATTRADD enmAddAttr);
RTDECL(int) RTVfsFileReadAt(RTVFSFILE hVfsFile, RTFOFF off, void *pvBuf, size_t cbToRead, size_t *pcbRead);
RTDECL(int) RTVfsFileWrite(RTVFSFILE hVfsFile, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
RTDECL(int) RTVfsFileWriteAt(RTVFSFILE hVfsFile, RTFOFF off, const void *pvBuf, size_t cbToWrite, size_t *pcbWritten);
RTDECL(RTFOFF) RTVfsFilePoll(RTVFSFILE hVfsFile, uint32_t fEvents, RTMSINTERVAL cMillies, bool fIntr,
RTDECL(int) RTVfsFileSeek(RTVFSFILE hVfsFile, RTFOFF offSeek, uint32_t uMethod, uint64_t *poffActual);
RTDECL(int) RTVfsChainOpenFsStream( const char *pszSpec, PRTVFSFSSTREAM phVfsFss, const char **ppszError);
RTDECL(int) RTVfsChainOpenDir( const char *pszSpec, uint32_t fOpen, PRTVFSDIR phVfsDir, const char **ppszError);
RTDECL(int) RTVfsChainOpenFile( const char *pszSpec, uint32_t fOpen, PRTVFSFILE phVfsFile, const char **ppszError);
RTDECL(int) RTVfsChainOpenSymlink( const char *pszSpec, PRTVFSSYMLINK phVfsSym, const char **ppszError);
RTDECL(int) RTVfsChainOpenIoStream( const char *pszSpec, uint32_t fOpen, PRTVFSIOSTREAM phVfsIos, const char **ppszError);