View Javadoc
1   /*
2    * Copyright 2016-2022 The OSHI Project Contributors
3    * SPDX-License-Identifier: MIT
4    */
5   package oshi.software.os;
6   
7   import oshi.annotation.concurrent.ThreadSafe;
8   
9   /**
10   * A FileStore represents a storage pool, device, partition, volume, concrete file system or other implementation
11   * specific means of file storage. This object carries the same interpretation as core Java's
12   * {@link java.nio.file.FileStore} class, with additional information.
13   */
14  @ThreadSafe
15  public interface OSFileStore {
16  
17      /**
18       * Name of the File System. A human-readable label that does not necessarily correspond to a file system path.
19       *
20       * @return The file system name
21       */
22      String getName();
23  
24      /**
25       * Volume name of the File System. Generally a path representing the device (e.g., {@code /dev/foo} which is being
26       * mounted.
27       *
28       * @return The volume name of the file system
29       */
30      String getVolume();
31  
32      /**
33       * Label of the File System. An optional replacement for the name on Windows and Linux.
34       *
35       * @return The volume label of the file system. Only relevant on Windows and on Linux, if assigned; otherwise
36       *         defaults to the FileSystem name. On other operating systems is redundant with the name.
37       */
38      String getLabel();
39  
40      /**
41       * Logical volume of the File System.
42       *
43       * Provides an optional alternative volume identifier for the file system. Only supported on Linux, provides symlink
44       * value via '/dev/mapper/' (used with LVM file systems).
45       *
46       * @return The logical volume of the file system
47       */
48      String getLogicalVolume();
49  
50      /**
51       * Mount point of the File System. The directory users will normally use to interface with the file store.
52       *
53       * @return The mountpoint of the file system
54       */
55      String getMount();
56  
57      /**
58       * Description of the File System.
59       *
60       * @return The file system description
61       */
62      String getDescription();
63  
64      /**
65       * Type of the File System (FAT, NTFS, etx2, ext4, etc.)
66       *
67       * @return The file system type
68       */
69      String getType();
70  
71      /**
72       * Filesystem options.
73       *
74       * @return A comma-deimited string of options
75       */
76      String getOptions();
77  
78      /**
79       * UUID/GUID of the File System.
80       *
81       * @return The file system UUID/GUID
82       */
83      String getUUID();
84  
85      /**
86       * Free space on the drive. This space is unallocated but may require elevated permissions to write.
87       *
88       * @return Free space on the drive (in bytes)
89       */
90      long getFreeSpace();
91  
92      /**
93       * Usable space on the drive. This is space available to unprivileged users.
94       *
95       * @return Usable space on the drive (in bytes)
96       */
97      long getUsableSpace();
98  
99      /**
100      * Total space/capacity of the drive.
101      *
102      * @return Total capacity of the drive (in bytes)
103      */
104     long getTotalSpace();
105 
106     /**
107      * Usable / free inodes on the drive. Not applicable on Windows.
108      *
109      * @return Usable / free inodes on the drive (count), or -1 if unimplemented
110      */
111     long getFreeInodes();
112 
113     /**
114      * Total / maximum number of inodes of the filesystem. Not applicable on Windows.
115      *
116      * @return Total / maximum number of inodes of the filesystem (count), or -1 if unimplemented
117      */
118     long getTotalInodes();
119 
120     /**
121      * Make a best effort to update all the statistics about the file store without needing to recreate the file store
122      * list. This method provides for more frequent periodic updates of file store statistics.
123      *
124      * @return True if the update was (probably) successful, false if the disk was not found
125      */
126     boolean updateAttributes();
127 }