1 | /* $Id: fs.h 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - Internal RTFs header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * The contents of this file may alternatively be used under the terms
|
---|
26 | * of the Common Development and Distribution License Version 1.0
|
---|
27 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
28 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
29 | * CDDL are applicable instead of those of the GPL.
|
---|
30 | *
|
---|
31 | * You may elect to license modified versions of this file under the
|
---|
32 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
33 | *
|
---|
34 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
35 | */
|
---|
36 |
|
---|
37 | #ifndef IPRT_INCLUDED_INTERNAL_fs_h
|
---|
38 | #define IPRT_INCLUDED_INTERNAL_fs_h
|
---|
39 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
40 | # pragma once
|
---|
41 | #endif
|
---|
42 |
|
---|
43 | #include <iprt/types.h>
|
---|
44 | #ifndef RT_OS_WINDOWS
|
---|
45 | # include <sys/stat.h>
|
---|
46 | #endif
|
---|
47 | #ifdef RT_OS_FREEBSD
|
---|
48 | # include <osreldate.h>
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | RT_C_DECLS_BEGIN
|
---|
52 |
|
---|
53 | /** IO_REPARSE_TAG_SYMLINK */
|
---|
54 | #define RTFSMODE_SYMLINK_REPARSE_TAG UINT32_C(0xa000000c)
|
---|
55 |
|
---|
56 | RTFMODE rtFsModeFromDos(RTFMODE fMode, const char *pszName, size_t cbName, uint32_t uReparseTag, RTFMODE fType);
|
---|
57 | RTFMODE rtFsModeFromUnix(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType);
|
---|
58 | RTFMODE rtFsModeNormalize(RTFMODE fMode, const char *pszName, size_t cbName, RTFMODE fType);
|
---|
59 | bool rtFsModeIsValid(RTFMODE fMode);
|
---|
60 | bool rtFsModeIsValidPermissions(RTFMODE fMode);
|
---|
61 |
|
---|
62 | #ifndef RT_OS_WINDOWS
|
---|
63 | void rtFsConvertStatToObjInfo(PRTFSOBJINFO pObjInfo, const struct stat *pStat, const char *pszName, unsigned cbName);
|
---|
64 | void rtFsObjInfoAttrSetUnixOwner(PRTFSOBJINFO pObjInfo, RTUID uid);
|
---|
65 | void rtFsObjInfoAttrSetUnixGroup(PRTFSOBJINFO pObjInfo, RTUID gid);
|
---|
66 | #else /* RT_OS_WINDOWS */
|
---|
67 | # ifdef DECLARE_HANDLE
|
---|
68 | int rtNtQueryFsType(HANDLE hHandle, PRTFSTYPE penmType);
|
---|
69 | # endif
|
---|
70 | #endif /* RT_OS_WINDOWS */
|
---|
71 |
|
---|
72 | #ifdef RT_OS_LINUX
|
---|
73 | # ifdef __USE_MISC
|
---|
74 | # define HAVE_STAT_TIMESPEC_BRIEF
|
---|
75 | # else
|
---|
76 | # define HAVE_STAT_NSEC
|
---|
77 | # endif
|
---|
78 | #endif
|
---|
79 |
|
---|
80 | #ifdef RT_OS_FREEBSD
|
---|
81 | # if __FreeBSD_version >= 500000 /* 5.0 */
|
---|
82 | # define HAVE_STAT_BIRTHTIME
|
---|
83 | # endif
|
---|
84 | # if __FreeBSD_version >= 900000 /* 9.0 */
|
---|
85 | # define HAVE_STAT_TIMESPEC_BRIEF
|
---|
86 | # else
|
---|
87 | # ifndef __BSD_VISIBLE
|
---|
88 | # define __BSD_VISIBLE
|
---|
89 | # endif
|
---|
90 | # define HAVE_STAT_TIMESPEC
|
---|
91 | # endif
|
---|
92 | #endif
|
---|
93 |
|
---|
94 | RT_C_DECLS_END
|
---|
95 |
|
---|
96 | #endif /* !IPRT_INCLUDED_INTERNAL_fs_h */
|
---|