VirtualBox

source: vbox/trunk/include/iprt/fs.h@ 99805

Last change on this file since 99805 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.2 KB
Line 
1/** @file
2 * IPRT - Filesystem.
3 */
4
5/*
6 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef IPRT_INCLUDED_fs_h
37#define IPRT_INCLUDED_fs_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/cdefs.h>
43#include <iprt/types.h>
44#include <iprt/time.h>
45
46
47RT_C_DECLS_BEGIN
48
49/** @defgroup grp_rt_fs RTFs - Filesystem and Volume
50 * @ingroup grp_rt
51 * @{
52 */
53
54
55/** @name Filesystem Object Mode Flags.
56 *
57 * There are two sets of flags: the unix mode flags and the dos attributes.
58 *
59 * APIs returning mode flags will provide both sets.
60 *
61 * When specifying mode flags to any API at least one of them must be given. If
62 * one set is missing the API will synthesize it from the one given if it
63 * requires it.
64 *
65 * Both sets match their x86 ABIs, the DOS/NT one is simply shifted up 16 bits.
66 * The DOS/NT range is bits 16 to 31 inclusively. The Unix range is bits 0 to 15
67 * (inclusively).
68 *
69 * @remarks These constants have been comitted to a binary format and must not
70 * be changed in any incompatible ways.
71 *
72 * @{
73 */
74
75/** Set user id on execution (S_ISUID). */
76#define RTFS_UNIX_ISUID 0004000U
77/** Set group id on execution (S_ISGID). */
78#define RTFS_UNIX_ISGID 0002000U
79/** Sticky bit (S_ISVTX / S_ISTXT). */
80#define RTFS_UNIX_ISTXT 0001000U
81
82/** Owner RWX mask (S_IRWXU). */
83#define RTFS_UNIX_IRWXU 0000700U
84/** Owner readable (S_IRUSR). */
85#define RTFS_UNIX_IRUSR 0000400U
86/** Owner writable (S_IWUSR). */
87#define RTFS_UNIX_IWUSR 0000200U
88/** Owner executable (S_IXUSR). */
89#define RTFS_UNIX_IXUSR 0000100U
90
91/** Group RWX mask (S_IRWXG). */
92#define RTFS_UNIX_IRWXG 0000070U
93/** Group readable (S_IRGRP). */
94#define RTFS_UNIX_IRGRP 0000040U
95/** Group writable (S_IWGRP). */
96#define RTFS_UNIX_IWGRP 0000020U
97/** Group executable (S_IXGRP). */
98#define RTFS_UNIX_IXGRP 0000010U
99
100/** Other RWX mask (S_IRWXO). */
101#define RTFS_UNIX_IRWXO 0000007U
102/** Other readable (S_IROTH). */
103#define RTFS_UNIX_IROTH 0000004U
104/** Other writable (S_IWOTH). */
105#define RTFS_UNIX_IWOTH 0000002U
106/** Other executable (S_IXOTH). */
107#define RTFS_UNIX_IXOTH 0000001U
108
109/** All UNIX access permission bits (0777). */
110#define RTFS_UNIX_ALL_ACCESS_PERMS 0000777U
111/** All UNIX permission bits, including set id and sticky bits. */
112#define RTFS_UNIX_ALL_PERMS 0007777U
113
114/** Named pipe (fifo) (S_IFIFO). */
115#define RTFS_TYPE_FIFO 0010000U
116/** Character device (S_IFCHR). */
117#define RTFS_TYPE_DEV_CHAR 0020000U
118/** Directory (S_IFDIR). */
119#define RTFS_TYPE_DIRECTORY 0040000U
120/** Block device (S_IFBLK). */
121#define RTFS_TYPE_DEV_BLOCK 0060000U
122/** Regular file (S_IFREG). */
123#define RTFS_TYPE_FILE 0100000U
124/** Symbolic link (S_IFLNK). */
125#define RTFS_TYPE_SYMLINK 0120000U
126/** Socket (S_IFSOCK). */
127#define RTFS_TYPE_SOCKET 0140000U
128/** Whiteout (S_IFWHT). */
129#define RTFS_TYPE_WHITEOUT 0160000U
130/** Type mask (S_IFMT). */
131#define RTFS_TYPE_MASK 0170000U
132/** The shift count to convert between RTFS_TYPE_MASK and DIRENTRYTYPE. */
133#define RTFS_TYPE_DIRENTRYTYPE_SHIFT 12
134
135/** Unix attribute mask. */
136#define RTFS_UNIX_MASK 0xffffU
137/** The mask of all the NT, OS/2 and DOS attributes. */
138#define RTFS_DOS_MASK (0x7fffU << RTFS_DOS_SHIFT)
139
140/** The shift value. */
141#define RTFS_DOS_SHIFT 16
142/** The mask of the OS/2 and DOS attributes. */
143#define RTFS_DOS_MASK_OS2 (0x003fU << RTFS_DOS_SHIFT)
144/** The mask of the NT attributes. */
145#define RTFS_DOS_MASK_NT (0x7fffU << RTFS_DOS_SHIFT)
146
147/** Readonly object. */
148#define RTFS_DOS_READONLY (0x0001U << RTFS_DOS_SHIFT)
149/** Hidden object. */
150#define RTFS_DOS_HIDDEN (0x0002U << RTFS_DOS_SHIFT)
151/** System object. */
152#define RTFS_DOS_SYSTEM (0x0004U << RTFS_DOS_SHIFT)
153/** Directory. */
154#define RTFS_DOS_DIRECTORY (0x0010U << RTFS_DOS_SHIFT)
155/** Archived object.
156 * This bit is set by the filesystem after each modification of a file. */
157#define RTFS_DOS_ARCHIVED (0x0020U << RTFS_DOS_SHIFT)
158/** Undocumented / Reserved, used to be the FAT volume label. */
159#define RTFS_DOS_NT_DEVICE (0x0040U << RTFS_DOS_SHIFT)
160/** Normal object, no other attribute set (NT). */
161#define RTFS_DOS_NT_NORMAL (0x0080U << RTFS_DOS_SHIFT)
162/** Temporary object (NT). */
163#define RTFS_DOS_NT_TEMPORARY (0x0100U << RTFS_DOS_SHIFT)
164/** Sparse file (NT). */
165#define RTFS_DOS_NT_SPARSE_FILE (0x0200U << RTFS_DOS_SHIFT)
166/** Reparse point (NT). */
167#define RTFS_DOS_NT_REPARSE_POINT (0x0400U << RTFS_DOS_SHIFT)
168/** Compressed object (NT).
169 * For a directory, compression is the default for new files. */
170#define RTFS_DOS_NT_COMPRESSED (0x0800U << RTFS_DOS_SHIFT)
171/** Physically offline data (NT).
172 * MSDN say, don't mess with this one. */
173#define RTFS_DOS_NT_OFFLINE (0x1000U << RTFS_DOS_SHIFT)
174/** Not content indexed by the content indexing service (NT). */
175#define RTFS_DOS_NT_NOT_CONTENT_INDEXED (0x2000U << RTFS_DOS_SHIFT)
176/** Encryped object (NT).
177 * For a directory, encrypted is the default for new files. */
178#define RTFS_DOS_NT_ENCRYPTED (0x4000U << RTFS_DOS_SHIFT)
179
180/** @} */
181
182
183/** @name Filesystem Object Type Predicates.
184 * @{ */
185/** Checks the mode flags indicate a named pipe (fifo) (S_ISFIFO). */
186#define RTFS_IS_FIFO(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_FIFO )
187/** Checks the mode flags indicate a character device (S_ISCHR). */
188#define RTFS_IS_DEV_CHAR(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_DEV_CHAR )
189/** Checks the mode flags indicate a directory (S_ISDIR). */
190#define RTFS_IS_DIRECTORY(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_DIRECTORY )
191/** Checks the mode flags indicate a block device (S_ISBLK). */
192#define RTFS_IS_DEV_BLOCK(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_DEV_BLOCK )
193/** Checks the mode flags indicate a regular file (S_ISREG). */
194#define RTFS_IS_FILE(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_FILE )
195/** Checks the mode flags indicate a symbolic link (S_ISLNK). */
196#define RTFS_IS_SYMLINK(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_SYMLINK )
197/** Checks the mode flags indicate a socket (S_ISSOCK). */
198#define RTFS_IS_SOCKET(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_SOCKET )
199/** Checks the mode flags indicate a whiteout (S_ISWHT). */
200#define RTFS_IS_WHITEOUT(fMode) ( ((fMode) & RTFS_TYPE_MASK) == RTFS_TYPE_WHITEOUT )
201/** @} */
202
203
204/**
205 * Filesystem type IDs returned by RTFsQueryType.
206 *
207 * This enum is subject to changes and must not be used as part of any ABI or
208 * binary format (file, network, etc).
209 *
210 * @remarks When adding new entries, please update RTFsTypeName(). Also, try
211 * add them to the most natural group.
212 */
213typedef enum RTFSTYPE
214{
215 /** Unknown file system. */
216 RTFSTYPE_UNKNOWN = 0,
217
218 /** Universal Disk Format. */
219 RTFSTYPE_UDF,
220 /** ISO 9660, aka Compact Disc File System (CDFS). */
221 RTFSTYPE_ISO9660,
222 /** Filesystem in Userspace. */
223 RTFSTYPE_FUSE,
224 /** VirtualBox shared folders. */
225 RTFSTYPE_VBOXSHF,
226
227 /* Linux: */
228 RTFSTYPE_EXT,
229 RTFSTYPE_EXT2,
230 RTFSTYPE_EXT3,
231 RTFSTYPE_EXT4,
232 RTFSTYPE_XFS,
233 RTFSTYPE_CIFS,
234 RTFSTYPE_SMBFS,
235 RTFSTYPE_TMPFS,
236 RTFSTYPE_SYSFS,
237 RTFSTYPE_PROC,
238 RTFSTYPE_OCFS2,
239 RTFSTYPE_BTRFS,
240
241 /* Windows: */
242 /** New Technology File System. */
243 RTFSTYPE_NTFS,
244 /** FAT12, FAT16 and FAT32 lumped into one basket.
245 * The partition size limit of FAT12 and FAT16 will be the factor
246 * limiting the file size (except, perhaps for the 64KB cluster case on
247 * non-Windows hosts). */
248 RTFSTYPE_FAT,
249 /** Extended File Allocation Table, main target are flash drives. */
250 RTFSTYPE_EXFAT,
251 /** Resilient File System. */
252 RTFSTYPE_REFS,
253
254 /* Solaris: */
255 /** Zettabyte File System. */
256 RTFSTYPE_ZFS,
257 /** Unix File System. */
258 RTFSTYPE_UFS,
259 /** Network File System. */
260 RTFSTYPE_NFS,
261
262 /* Mac OS X: */
263 /** Hierarchical File System. */
264 RTFSTYPE_HFS,
265 /** @todo RTFSTYPE_HFS_PLUS? */
266 RTFSTYPE_APFS,
267 RTFSTYPE_AUTOFS,
268 RTFSTYPE_DEVFS,
269
270 /* *BSD: */
271
272 /* OS/2: */
273 /** High Performance File System. */
274 RTFSTYPE_HPFS,
275 /** Journaled File System (v2). */
276 RTFSTYPE_JFS,
277
278 /** The end of valid Filesystem types IDs. */
279 RTFSTYPE_END,
280 /** The usual 32-bit type blow up. */
281 RTFSTYPE_32BIT_HACK = 0x7fffffff
282} RTFSTYPE;
283/** Pointer to a Filesystem type ID. */
284typedef RTFSTYPE *PRTFSTYPE;
285
286
287/**
288 * The available additional information in a RTFSOBJATTR object.
289 */
290typedef enum RTFSOBJATTRADD
291{
292 /** No additional information is available / requested. */
293 RTFSOBJATTRADD_NOTHING = 1,
294 /** The additional unix attributes (RTFSOBJATTR::u::Unix) are available /
295 * requested. */
296 RTFSOBJATTRADD_UNIX,
297 /** The additional unix attributes (RTFSOBJATTR::u::UnixOwner) are
298 * available / requested. */
299 RTFSOBJATTRADD_UNIX_OWNER,
300 /** The additional unix attributes (RTFSOBJATTR::u::UnixGroup) are
301 * available / requested. */
302 RTFSOBJATTRADD_UNIX_GROUP,
303 /** The additional extended attribute size (RTFSOBJATTR::u::EASize) is available / requested. */
304 RTFSOBJATTRADD_EASIZE,
305 /** The last valid item (inclusive).
306 * The valid range is RTFSOBJATTRADD_NOTHING thru RTFSOBJATTRADD_LAST. */
307 RTFSOBJATTRADD_LAST = RTFSOBJATTRADD_EASIZE,
308
309 /** The usual 32-bit hack. */
310 RTFSOBJATTRADD_32BIT_SIZE_HACK = 0x7fffffff
311} RTFSOBJATTRADD;
312
313/** The number of bytes reserved for the additional attribute union. */
314#define RTFSOBJATTRUNION_MAX_SIZE 128
315
316/**
317 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX).
318 */
319typedef struct RTFSOBJATTRUNIX
320{
321 /** The user owning the filesystem object (st_uid).
322 * This field is NIL_RTUID if not supported. */
323 RTUID uid;
324
325 /** The group the filesystem object is assigned (st_gid).
326 * This field is NIL_RTGID if not supported. */
327 RTGID gid;
328
329 /** Number of hard links to this filesystem object (st_nlink).
330 * This field is 1 if the filesystem doesn't support hardlinking or
331 * the information isn't available.
332 */
333 uint32_t cHardlinks;
334
335 /** The device number of the device which this filesystem object resides on (st_dev).
336 * This field is 0 if this information is not available. */
337 RTDEV INodeIdDevice;
338
339 /** The unique identifier (within the filesystem) of this filesystem object (st_ino).
340 * Together with INodeIdDevice, this field can be used as a OS wide unique id
341 * when both their values are not 0.
342 * This field is 0 if the information is not available.
343 *
344 * @remarks The special '..' dir always shows up with 0 on NTFS/Windows. */
345 RTINODE INodeId;
346
347 /** User flags (st_flags).
348 * This field is 0 if this information is not available. */
349 uint32_t fFlags;
350
351 /** The current generation number (st_gen).
352 * This field is 0 if this information is not available. */
353 uint32_t GenerationId;
354
355 /** The device number of a character or block device type object (st_rdev).
356 * This field is 0 if the file isn't of a character or block device type and
357 * when the OS doesn't subscribe to the major+minor device idenfication scheme. */
358 RTDEV Device;
359} RTFSOBJATTRUNIX;
360
361
362/**
363 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_OWNER).
364 *
365 * @remarks This interface is mainly for TAR.
366 */
367typedef struct RTFSOBJATTRUNIXOWNER
368{
369 /** The user owning the filesystem object (st_uid).
370 * This field is NIL_UID if not supported. */
371 RTUID uid;
372 /** The user name.
373 * Empty if not available or not supported, truncated if too long. */
374 char szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTUID)];
375} RTFSOBJATTRUNIXOWNER;
376
377
378/**
379 * Additional Unix Attributes (RTFSOBJATTRADD_UNIX_GROUP).
380 *
381 * @remarks This interface is mainly for TAR.
382 */
383typedef struct RTFSOBJATTRUNIXGROUP
384{
385 /** The user owning the filesystem object (st_uid).
386 * This field is NIL_GID if not supported. */
387 RTGID gid;
388 /** The group name.
389 * Empty if not available or not supported, truncated if too long. */
390 char szName[RTFSOBJATTRUNION_MAX_SIZE - sizeof(RTGID)];
391} RTFSOBJATTRUNIXGROUP;
392
393
394/**
395 * Filesystem object attributes.
396 */
397typedef struct RTFSOBJATTR
398{
399 /** Mode flags (st_mode). RTFS_UNIX_*, RTFS_TYPE_*, and RTFS_DOS_*. */
400 RTFMODE fMode;
401
402 /** The additional attributes available. */
403 RTFSOBJATTRADD enmAdditional;
404
405 /**
406 * Additional attributes.
407 *
408 * Unless explicitly specified to an API, the API can provide additional
409 * data as it is provided by the underlying OS.
410 */
411 union RTFSOBJATTRUNION
412 {
413 /** Additional Unix Attributes - RTFSOBJATTRADD_UNIX. */
414 RTFSOBJATTRUNIX Unix;
415 /** Additional Unix Owner Attributes - RTFSOBJATTRADD_UNIX_OWNER. */
416 RTFSOBJATTRUNIXOWNER UnixOwner;
417 /** Additional Unix Group Attributes - RTFSOBJATTRADD_UNIX_GROUP. */
418 RTFSOBJATTRUNIXGROUP UnixGroup;
419
420 /**
421 * Extended attribute size is available when RTFS_DOS_HAVE_EA_SIZE is set.
422 */
423 struct RTFSOBJATTREASIZE
424 {
425 /** Size of EAs. */
426 RTFOFF cb;
427 } EASize;
428 /** Reserved space. */
429 uint8_t abReserveSpace[128];
430 } u;
431} RTFSOBJATTR;
432/** Pointer to a filesystem object attributes structure. */
433typedef RTFSOBJATTR *PRTFSOBJATTR;
434/** Pointer to a const filesystem object attributes structure. */
435typedef const RTFSOBJATTR *PCRTFSOBJATTR;
436
437
438/**
439 * Filesystem object information structure.
440 *
441 * This is returned by the RTPathQueryInfo(), RTFileQueryInfo() and RTDirRead() APIs.
442 */
443typedef struct RTFSOBJINFO
444{
445 /** Logical size (st_size).
446 * For normal files this is the size of the file.
447 * For symbolic links, this is the length of the path name contained
448 * in the symbolic link.
449 * For other objects this fields needs to be specified.
450 */
451 RTFOFF cbObject;
452
453 /** Disk allocation size (st_blocks * DEV_BSIZE). */
454 RTFOFF cbAllocated;
455
456 /** Time of last access (st_atime). */
457 RTTIMESPEC AccessTime;
458
459 /** Time of last data modification (st_mtime). */
460 RTTIMESPEC ModificationTime;
461
462 /** Time of last status change (st_ctime).
463 * If not available this is set to ModificationTime.
464 */
465 RTTIMESPEC ChangeTime;
466
467 /** Time of file birth (st_birthtime).
468 * If not available this is set to ChangeTime.
469 */
470 RTTIMESPEC BirthTime;
471
472 /** Attributes. */
473 RTFSOBJATTR Attr;
474
475} RTFSOBJINFO;
476/** Pointer to a filesystem object information structure. */
477typedef RTFSOBJINFO *PRTFSOBJINFO;
478/** Pointer to a const filesystem object information structure. */
479typedef const RTFSOBJINFO *PCRTFSOBJINFO;
480
481
482#ifdef IN_RING3
483
484/**
485 * Query the sizes of a filesystem.
486 *
487 * @returns iprt status code.
488 * @param pszFsPath Path within the mounted filesystem.
489 * @param pcbTotal Where to store the total filesystem space. (Optional)
490 * @param pcbFree Where to store the remaining free space in the filesystem. (Optional)
491 * @param pcbBlock Where to store the block size. (Optional)
492 * @param pcbSector Where to store the sector size. (Optional)
493 *
494 * @sa RTFileQueryFsSizes
495 */
496RTR3DECL(int) RTFsQuerySizes(const char *pszFsPath, PRTFOFF pcbTotal, RTFOFF *pcbFree,
497 uint32_t *pcbBlock, uint32_t *pcbSector);
498
499/**
500 * Query the mountpoint of a filesystem.
501 *
502 * @returns iprt status code.
503 * @returns VERR_BUFFER_OVERFLOW if cbMountpoint isn't enough.
504 * @param pszFsPath Path within the mounted filesystem.
505 * @param pszMountpoint Where to store the mountpoint path.
506 * @param cbMountpoint Size of the buffer pointed to by pszMountpoint.
507 */
508RTR3DECL(int) RTFsQueryMountpoint(const char *pszFsPath, char *pszMountpoint, size_t cbMountpoint);
509
510/**
511 * Query the label of a filesystem.
512 *
513 * @returns iprt status code.
514 * @returns VERR_BUFFER_OVERFLOW if cbLabel isn't enough.
515 * @param pszFsPath Path within the mounted filesystem.
516 * @param pszLabel Where to store the label.
517 * @param cbLabel Size of the buffer pointed to by pszLabel.
518 */
519RTR3DECL(int) RTFsQueryLabel(const char *pszFsPath, char *pszLabel, size_t cbLabel);
520
521/**
522 * Query the serial number of a filesystem.
523 *
524 * @returns iprt status code.
525 * @param pszFsPath Path within the mounted filesystem.
526 * @param pu32Serial Where to store the serial number.
527 */
528RTR3DECL(int) RTFsQuerySerial(const char *pszFsPath, uint32_t *pu32Serial);
529
530/**
531 * Query the name of the filesystem driver.
532 *
533 * @returns iprt status code.
534 * @returns VERR_BUFFER_OVERFLOW if cbFsDriver isn't enough.
535 * @param pszFsPath Path within the mounted filesystem.
536 * @param pszFsDriver Where to store the filesystem driver name.
537 * @param cbFsDriver Size of the buffer pointed to by pszFsDriver.
538 */
539RTR3DECL(int) RTFsQueryDriver(const char *pszFsPath, char *pszFsDriver, size_t cbFsDriver);
540
541/**
542 * Query the name of the filesystem the file is located on.
543 *
544 * @returns iprt status code.
545 * @param pszFsPath Path within the mounted filesystem. It must exist.
546 * In case this is a symlink, the file it refers to is
547 * evaluated.
548 * @param penmType Where to store the filesystem type, this is always
549 * set. See RTFSTYPE for the values.
550 */
551RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType);
552
553#endif /* IN_RING3 */
554
555/**
556 * Gets the name of a filesystem type.
557 *
558 * @returns Pointer to a read-only string containing the name.
559 * @param enmType A valid filesystem ID. If outside the valid range,
560 * the returned string will be pointing to a static
561 * memory buffer which will be changed on subsequent
562 * calls to this function by any thread.
563 */
564RTDECL(const char *) RTFsTypeName(RTFSTYPE enmType);
565
566/**
567 * Filesystem properties.
568 */
569typedef struct RTFSPROPERTIES
570{
571 /** The maximum size of a filesystem object name.
572 * This does not include the '\\0'. */
573 uint32_t cbMaxComponent;
574
575 /** True if the filesystem is remote.
576 * False if the filesystem is local. */
577 bool fRemote;
578
579 /** True if the filesystem is case sensitive.
580 * False if the filesystem is case insensitive. */
581 bool fCaseSensitive;
582
583 /** True if the filesystem is mounted read only.
584 * False if the filesystem is mounted read write. */
585 bool fReadOnly;
586
587 /** True if the filesystem can encode unicode object names.
588 * False if it can't. */
589 bool fSupportsUnicode;
590
591 /** True if the filesystem is compressed.
592 * False if it isn't or we don't know. */
593 bool fCompressed;
594
595 /** True if the filesystem compresses of individual files.
596 * False if it doesn't or we don't know. */
597 bool fFileCompression;
598
599 /** @todo more? */
600} RTFSPROPERTIES;
601/** Pointer to a filesystem properties structure. */
602typedef RTFSPROPERTIES *PRTFSPROPERTIES;
603/** Pointer to a const filesystem properties structure. */
604typedef RTFSPROPERTIES const *PCRTFSPROPERTIES;
605
606#ifdef IN_RING3
607
608/**
609 * Query the properties of a mounted filesystem.
610 *
611 * @returns iprt status code.
612 * @param pszFsPath Path within the mounted filesystem.
613 * @param pProperties Where to store the properties.
614 */
615RTR3DECL(int) RTFsQueryProperties(const char *pszFsPath, PRTFSPROPERTIES pProperties);
616
617/**
618 * Checks if the given volume is case sensitive or not.
619 *
620 * This may be misleading in some cases as we lack the necessary APIs to query
621 * the information on some system (or choose not to use them) and are instead
622 * returning the general position on case sensitive file name of the system.
623 *
624 * @returns @c true if case sensitive, @c false if not.
625 * @param pszFsPath Path within the mounted file system.
626 */
627RTR3DECL(bool) RTFsIsCaseSensitive(const char *pszFsPath);
628
629/**
630 * Mountpoint enumerator callback.
631 *
632 * @returns iprt status code. Failure terminates the enumeration.
633 * @param pszMountpoint The mountpoint name.
634 * @param pvUser The user argument.
635 */
636typedef DECLCALLBACKTYPE(int, FNRTFSMOUNTPOINTENUM,(const char *pszMountpoint, void *pvUser));
637/** Pointer to a FNRTFSMOUNTPOINTENUM(). */
638typedef FNRTFSMOUNTPOINTENUM *PFNRTFSMOUNTPOINTENUM;
639
640/**
641 * Enumerate mount points.
642 *
643 * @returns iprt status code.
644 * @param pfnCallback The callback function.
645 * @param pvUser The user argument to the callback.
646 */
647RTR3DECL(int) RTFsMountpointsEnum(PFNRTFSMOUNTPOINTENUM pfnCallback, void *pvUser);
648
649
650/**
651 * A /bin/ls clone.
652 *
653 * @returns Program exit code.
654 *
655 * @param cArgs The number of arguments.
656 * @param papszArgs The argument vector. (Note that this may be
657 * reordered, so the memory must be writable.)
658 */
659RTR3DECL(RTEXITCODE) RTFsCmdLs(unsigned cArgs, char **papszArgs);
660
661#endif /* IN_RING3 */
662
663/** @} */
664
665RT_C_DECLS_END
666
667#endif /* !IPRT_INCLUDED_fs_h */
668
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette