-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathDokanOptions.java
99 lines (79 loc) · 3.11 KB
/
DokanOptions.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package dev.dokan.dokan_java.structure;
import dev.dokan.dokan_java.DokanNativeMethods;
import dev.dokan.dokan_java.constants.dokany.MountOption;
import com.sun.jna.Structure;
import com.sun.jna.WString;
import dev.dokan.dokan_java.masking.MaskValueSet;
import java.util.Arrays;
import java.util.List;
/**
* Dokan mount options used to describe Dokan device behavior.
*
* @see <a href="https://dokan-dev.github.io/dokany-doc/html/struct_d_o_k_a_n___o_p_t_i_o_n_s.html">Dokany Documentation of PDOKAN_OPTIONS</a>
*/
public class DokanOptions extends Structure implements Structure.ByReference {
/**
* Version of the Dokan features requested (version "123" is equal to Dokan version 1.2.3).
*/
public short Version = DokanNativeMethods.getMinimumRequiredDokanVersion();
/**
* Number of threads to be used internally by Dokan library. More thread will handle more events at the same time.
*/
public short ThreadCount;
/**
* Features enable for the mount. It is a combination of {@link MountOption} masks.
*/
public int Options;
/**
* FileSystem can store anything here
*/
public long GlobalContext = 0L;
/**
* Mount point. It can be a drive letter like \"M:\\\" or a folder path \"C:\\mount\\dokany\" on a NTFS partition.
*/
public WString MountPoint;
/**
* UNC name used for the Network Redirector.
*
* @see <a href="https://docs.microsoft.com/de-de/windows-hardware/drivers/ifs/support-for-unc-naming-and-mup">Support for UNC Naming</a>
*/
public WString UNCName;
/**
* Max timeout in milliseconds of each request before Dokan gives up to wait events to complete.
*/
public long Timeout;
/**
* Allocation Unit Size of the volume. This will affect the file size.
*/
public long AllocationUnitSize;
/**
* Sector Size of the volume. This will affect then file size.
*/
public long SectorSize;
public DokanOptions() {
}
public DokanOptions(final String mountPoint, final short threadCount, final MaskValueSet<MountOption> mountOptions, final String uncName, final long timeout, final long allocationUnitSize, final long sectorSize) {
MountPoint = new WString(mountPoint);
ThreadCount = threadCount;
Options = mountOptions.intValue();
if (uncName != null) {
UNCName = new WString(uncName);
} else {
UNCName = null;
}
Timeout = timeout;
AllocationUnitSize = allocationUnitSize;
SectorSize = sectorSize;
}
public MaskValueSet<MountOption> getMountOptions() {
return MaskValueSet.maskValueSet(this.Options, MountOption.values());
}
@Override
protected List<String> getFieldOrder() {
return Arrays.asList("Version", "ThreadCount", "Options", "GlobalContext", "MountPoint", "UNCName", "Timeout", "AllocationUnitSize", "SectorSize");
}
@Override
public String toString() {
return "DeviceOptions(Version=" + this.Version + ", ThreadCount=" + this.ThreadCount + ", Options=" + this.Options + ", mountOptions=" + this.getMountOptions() + ", GlobalContext=" + this.GlobalContext + ", MountPoint=" + this.MountPoint + ", UNCName=" + this.UNCName + ", Timeout=" + this.Timeout + ", AllocationUnitSize=" + this.AllocationUnitSize + ", SectorSize=" + this.SectorSize + ")";
}
}