Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing the "Easy"-Dokan-API #35

Draft
wants to merge 35 commits into
base: develop
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
665adea
Made isImplemented()-method public
JaniruTEC May 2, 2020
97bb432
Re-added API for conversion from FileTime to FILETIME
JaniruTEC May 2, 2020
670147d
Merge pull request #1 from JaniruTEC/jt-develop
JaniruTEC May 2, 2020
ecda6a6
Updated README.md with info about versioning
JaniruTEC May 4, 2020
64f66e4
Added multiple Enums to wrap native bitmasks
JaniruTEC May 5, 2020
caf890c
Added FileInfo-API
JaniruTEC May 7, 2020
495e9cd
Readded VolumeInformation
JaniruTEC May 7, 2020
c07a563
Moved VolumeInformation
JaniruTEC May 7, 2020
a11aa0e
Removed misplaced license templates
JaniruTEC May 8, 2020
fb4489b
Added DesiredAccessMask and DiskSpaceInfo
JaniruTEC May 9, 2020
08b9e89
Added Filesystem and Handle
JaniruTEC May 14, 2020
0b9450c
Fixed typos/unfinished renaming of classes in EasyDokanyFileSystem
JaniruTEC May 14, 2020
74ff4eb
Merge branch 'develop'
JaniruTEC May 21, 2020
5204c3b
Unified naming-scheme of wrapper-classes
JaniruTEC May 22, 2020
45fe7a3
Unified naming scheme
JaniruTEC May 22, 2020
01e50b1
Renamed DokanyFileHandle to DokanFileHandle
JaniruTEC May 23, 2020
ff1d27e
Renamed EasyDokanyFileSystem to EasyDokanFileSystem
JaniruTEC May 23, 2020
9646e1a
Renamed SecurityContext to EasyDokanIOSecurityContext
JaniruTEC May 23, 2020
562e0b4
Merge remote-tracking branch 'upstream/develop'
JaniruTEC May 24, 2020
817b87f
Merge remote-tracking branch 'upstream/develop'
JaniruTEC May 26, 2020
317ad69
Added overloaded constructor to DokanOptions to allow an int as Options
JaniruTEC May 28, 2020
e600a8f
Added MountInfo-API
JaniruTEC May 28, 2020
461777d
Merge remote-tracking branch 'upstream/develop'
JaniruTEC May 28, 2020
98e1497
Added last basic API-Classes
JaniruTEC May 28, 2020
13a5054
Merge remote-tracking branch 'upstream/develop'
JaniruTEC Jun 2, 2020
bbc2004
Fixed issues that arose from merging
JaniruTEC Jun 2, 2020
bffbce0
Improved support for generic/non-MS ReparsePointTags
JaniruTEC Jun 3, 2020
8ba91fd
Updated DokanFileHandle to use ROMountInfo and added missing method
JaniruTEC Jun 8, 2020
37eb216
Added check if only a single bit (flag) is set
JaniruTEC Jun 9, 2020
31330ab
Added check if only a single bit (flag) is set to updateFlag
JaniruTEC Jun 9, 2020
2ef3c1e
Merge remote-tracking branch 'upstream/develop'
JaniruTEC Jun 18, 2020
5736a1a
Merge branch 'develop'
JaniruTEC Jun 18, 2020
72296c4
Adopted changes of AccessMaskFlags to DesiredAccessMask
JaniruTEC Jun 18, 2020
05c1c39
Moved support for Basic Rights to a new base class
JaniruTEC Jun 18, 2020
a163954
Merge remote-tracking branch 'upstream/develop'
JaniruTEC Jul 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added check if only a single bit (flag) is set to updateFlag
Added check if only a single bit (flag) is set to make sure that updateFlag operates reliably
Externalized check
  • Loading branch information
JaniruTEC committed Jun 9, 2020
commit 31330ab2060eccfae8a279c958b6d710df837dcd
25 changes: 18 additions & 7 deletions src/main/java/dev/dokan/dokan_java/wrappers/DesiredAccessMask.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,8 @@ public boolean silentGetFlag(DirectoryAccessMask flag) {
}

public boolean getFlag(int flag) {
/*
* This may be more performant, but it doesn't really matter
* Integer.highestOneBit(flag) != Integer.lowestOneBit(flag)
*/
if(Integer.bitCount(flag) != 1) {
throw new IllegalArgumentException("Result for more than one flag is undefined!");
}
ensureSingleFlag(flag);

return (this.accessMask.get() & flag) != 0;
}

Expand Down Expand Up @@ -136,10 +131,26 @@ public boolean silentUpdateFlag(DirectoryAccessMask flag, boolean value) {
}

public boolean updateFlag(int flag, boolean value) {
ensureSingleFlag(flag);

int prev = this.accessMask.getAndUpdate(current -> current & (value ? flag : ~flag));
return (prev & flag) != 0;
}

private void ensureSingleFlag(int flag) {
if(!isSingleFlag(flag)) {
throw new IllegalArgumentException("Result for more than one flag is undefined!");
}
}

private boolean isSingleFlag(int flag) {
/*
* This may be more performant, but it doesn't really matter
* Integer.highestOneBit(flag) != Integer.lowestOneBit(flag)
*/
return Integer.bitCount(flag) == 1;
}

private FileAccessMask getFileAccessMask(DirectoryAccessMask attribute) {
//This lookup is fine, but a different kind of mapping would be preferable
switch(attribute) {
Expand Down