fs2-posix.cpp revision 9fc464631dc4a68fbb5eb6419d61fbe91b6b16bd
/* $Id$ */
/** @file
* IPRT - File System Helpers, POSIX, Part 2.
*/
/*
* Copyright (C) 2006-2012 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 RTTIME_INCL_TIMESPEC
#ifndef DEV_BSIZE
# if defined(RT_OS_HAIKU) && !defined(S_BLKSIZE)
# define S_BLKSIZE 512
# endif
#endif
/**
* Internal worker function which setups RTFSOBJINFO based on a UNIX stat struct.
*
* @param pObjInfo The file system object info structure to setup.
* @param pStat The stat structure to use.
* @param cbName The length of that filename. (optional, set 0)
*/
void rtFsConvertStatToObjInfo(PRTFSOBJINFO pObjInfo, const struct stat *pStat, const char *pszName, unsigned cbName)
{
#ifdef HAVE_STAT_NSEC
RTTimeSpecAddNano(RTTimeSpecSetSeconds(&pObjInfo->AccessTime, pStat->st_atime), pStat->st_atimensec);
RTTimeSpecAddNano(RTTimeSpecSetSeconds(&pObjInfo->ModificationTime, pStat->st_mtime), pStat->st_mtimensec);
RTTimeSpecAddNano(RTTimeSpecSetSeconds(&pObjInfo->ChangeTime, pStat->st_ctime), pStat->st_ctimensec);
#ifdef HAVE_STAT_BIRTHTIME
RTTimeSpecAddNano(RTTimeSpecSetSeconds(&pObjInfo->BirthTime, pStat->st_birthtime), pStat->st_birthtimensec);
#endif
#elif defined(HAVE_STAT_TIMESPEC_BRIEF)
# ifdef HAVE_STAT_BIRTHTIME
# endif
#elif defined(HAVE_STAT_TIMESPEC)
# ifdef HAVE_STAT_BIRTHTIME
# endif
#else /* just the normal stuff */
# ifdef HAVE_STAT_BIRTHTIME
# endif
#endif
#ifndef HAVE_STAT_BIRTHTIME
#endif
/* the file mode */
#ifdef S_ISTXT
#else
#error "S_ISVTX / S_ISTXT isn't defined"
#endif
#ifdef S_IFWHT
#endif
/* additional unix attribs */
#ifdef HAVE_STAT_FLAGS
#else
#endif
#ifdef HAVE_STAT_GEN
#else
#endif
}