VirtualBox

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

Last change on this file since 76585 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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