Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
MountedFilesystem.h
Go to the documentation of this file.
1/*
2* Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3*/
4#ifndef _Stroika_Foundation_IO_FileSystem_MountedFilesystem_h_
5#define _Stroika_Foundation_IO_FileSystem_MountedFilesystem_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9#include <filesystem>
10
12#include "Stroika/Foundation/Common/Common.h"
13#include "Stroika/Foundation/Containers/Collection.h"
14#include "Stroika/Foundation/Containers/Set.h"
16
17/**
18 * \file
19 *
20 * \note Code-Status: <a href="Code-Status.md#Beta">Beta</a>
21 *
22 * TODO:
23 * @todo Better integrate with non -performance data from Frameworks/Instrument/Filesystem
24 *
25 * @todo Consider adding the concept of Volume - as it exists mostly on windows, but to some extent on UNIX (LVM)
26 * Not sure needed/helpful, but maybe.
27 *
28 * @todo Consider applying some information from http://smithii.com/dskwipe, and
29 * http://stackoverflow.com/questions/327718/how-to-list-physical-disks
30 */
31
33
34 using Characters::String;
35
36 /**
37 * A 'MountedFilesystem' is a particular mount point, in a particular filesystem format. There is an N <-->M relationship
38 * between devices (disks) and filesystem mount points.
39 *
40 * A filesystem can span multiple disks (as with RAID), or multiple filesystems cover a single disk (as with partitioning).
41 *
42 * In UNIX, a filesystem has only a single point point, where as in windows (???), it CAN have multiple (we don't
43 * currently model that, but we could make mount point be a set).
44 */
46
47 /**
48 * This is where the data for this disk/filesystem appear in the filesystem.
49 *
50 * On unix, it mighth be a place like '/', or '/mnt/usbdisk1'.
51 *
52 * This should be an absolute path.
53 */
54 filesystem::path fMountedOn;
55
56 /**
57 * on UNIX, this is the device path to the raw disk mounted onto.
58 * e.g. /dev/sda1, or /dev/sda
59 *
60 * On Windows, this is typically one name (e.g. '\\.\PhysicalDrive1'), but can be multiple, if the filesystem 'spans' multiple physical disks.
61 *
62 * This value maybe missing if its unable to be collected, but will be present and empty if there are no associated devices.
63 *
64 * \note - for now - fDevicePaths can only be collected on Windows if you have administrator privilges
65 *
66 * \note - on Linux - this may not be a full path, but just a special name, like tmpfs, or proc, or udev etc - for these special devices
67 *
68 * \note - on Linux - this path will frequently be for a PARTITION (like /dev/sda1) - not for the underlying disk block device (e.g /dev/sda)
69 *
70 * \note These should be absolute paths.
71 */
72 optional<Containers::Set<filesystem::path>> fDevicePaths;
73
74 /**
75 * This is an open enumeration indicating the format of the given filesystem:
76 *
77 * Common values include:
78 * o "ext2"
79 * o "ext4"
80 * o "jfs2"
81 * o "nfs"
82 * o "nfs3"
83 * o "vboxsf"
84 * o "NTFS"
85 * o "procfs"
86 */
87 optional<String> fFileSystemType;
88
89 /**
90 * This refers - for now - to a windows concept - Volume ID. I think this is roughly equivalent to physical disk
91 * but I'm not sure.
92 *
93 * Examples include:
94 * \\?\Volume{e99304ff-4c5d-11e4-824c-806e6f6e6963}\'
95 *
96 * This MIGHT be similar to a UNIX GUID that appears on some kinds of disks, but is currently only implemented for Windows.
97 */
98 optional<String> fVolumeID;
99
100 /**
101 * @see Characters::ToString ();
102 */
103 nonvirtual String ToString () const;
104 };
105
106 /**
107 * Fetch all the mounted filesystems on this computer. Somewhat analagous to the UNIX 'df' command, or cat /etc/mtab
108 */
110
111}
112
113/*
114********************************************************************************
115***************************** Implementation Details ***************************
116********************************************************************************
117*/
118#include "MountedFilesystem.inl"
119
120#endif /*_Stroika_Foundation_IO_FileSystem_MountedFilesystem_h_*/
String is like std::u32string, except it is much easier to use, often much more space efficient,...
Definition String.h:201
a cross between Mapping<KEY, T> and Collection<T> and Set<T>
Containers::KeyedCollection< MountedFilesystemType, filesystem::path > GetMountedFilesystems()
optional< Containers::Set< filesystem::path > > fDevicePaths