fs-posix.cpp revision 54e9fb09ac66ecd4609401490475952a7b1bed67
/* $Id$ */
/** @file
* IPRT - File System, Linux.
*/
/*
* Copyright (C) 2006-2007 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP RTLOGGROUP_FS
#include <errno.h>
#include <stdio.h>
#ifdef RT_OS_LINUX
# include <mntent.h>
#endif
#if defined(RT_OS_DARWIN) || defined(RT_OS_FREEBSD)
#endif
{
/*
* Validate input.
*/
/*
* Convert the path and query the information.
*/
char const *pszNativeFsPath;
if (RT_SUCCESS(rc))
{
/** @todo I'm not quite sure if statvfs was properly specified by SuS, I have to check my own
* implementation and FreeBSD before this can eventually be promoted to posix. */
{
/*
* Calc the returned values.
*/
if (pcbTotal)
if (pcbFree)
if (pcbBlock)
/* no idea how to get the sector... */
if (pcbSector)
*pcbSector = 512;
}
else
}
LogFlow(("RTFsQuerySizes(%p:{%s}, %p:{%RTfoff}, %p:{%RTfoff}, %p:{%RX32}, %p:{%RX32}): returns %Rrc\n",
return rc;
}
{
/*
* Validate input.
*/
/*
* Convert the path and query the stats.
* We're simply return the device id.
*/
char const *pszNativeFsPath;
if (RT_SUCCESS(rc))
{
{
if (pu32Serial)
}
else
}
LogFlow(("RTFsQuerySerial(%p:{%s}, %p:{%RX32}: returns %Rrc\n",
return rc;
}
{
/*
* Validate.
*/
/*
* Convert the path and query the information.
*/
char const *pszNativeFsPath;
if (RT_SUCCESS(rc))
{
{
/*
*/
pProperties->fCaseSensitive = true;
pProperties->fCompressed = false;
pProperties->fFileCompression = false;
pProperties->fRemote = false;
pProperties->fSupportsUnicode = true;
}
else
}
LogFlow(("RTFsQueryProperties(%p:{%s}, %p:{.cbMaxComponent=%u, .fReadOnly=%RTbool}): returns %Rrc\n",
return rc;
}
{
/*
* Validate input.
*/
/*
* Convert the path and query the stats.
* We're simply return the device id.
*/
char const *pszNativeFsPath;
if (RT_SUCCESS(rc))
{
{
#if defined(RT_OS_LINUX)
if (!mounted)
if (mounted)
{
char szBuf[1024];
{
{
{
*penmType = RTFSTYPE_JFS;
*penmType = RTFSTYPE_XFS;
*penmType = RTFSTYPE_FAT;
*penmType = RTFSTYPE_UFS;
*penmType = RTFSTYPE_HFS;
*penmType = RTFSTYPE_UDF;
*penmType = RTFSTYPE_NFS;
*penmType = RTFSTYPE_NFS;
else
{
/* sometimes there are more than one entry for the same partition */
continue;
}
break;
}
}
}
}
#elif defined(RT_OS_SOLARIS)
*penmType = RTFSTYPE_ZFS;
*penmType = RTFSTYPE_UFS;
*penmType = RTFSTYPE_NFS;
{
*penmType = RTFSTYPE_HFS;
*penmType = RTFSTYPE_FAT;
*penmType = RTFSTYPE_NFS;
*penmType = RTFSTYPE_UFS;
*penmType = RTFSTYPE_ZFS;
}
else
#endif
}
else
}
return rc;
}