VirtualBox

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

Last change on this file since 75155 was 70422, checked in by vboxsync, 7 years ago

IPRT: Renamed RTCmdLs to RTFsCmdLs and moved it into the runtime, leaving a main wrapper behind. Want to use it in VBoxControl for debugging purposes. [build fix]

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