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

Conversation

JaniruTEC
Copy link
Member

No description provided.

JaniruTEC and others added 4 commits May 2, 2020 19:06
Re-added API for conversion from java.nio.file.attribute.FileTime to com.sun.jna.platform.win32.WinBase.FILETIME
JaniruTEC added 5 commits May 5, 2020 18:24
Added DokanFileInfoFlag to aid in creating a wrapper ("DokanFileHandle") for DokanFileInfo's getters (e.g. isDirectory())
Added FileShareAccess to wrap paramter rawShareAccess of DokanyFileSystem#zwCreateFile to aid in creating a wrapper ("EasyDokanFileSystem") for DokanyFileSystem
Added MicrosoftReparsePointTag to wrap field dwReserved0 of WinBase.WIN32_FIND_DATA to aid in creating a wrappe ("FindFileInfo") for WinBase.WIN32_FIND_DATA (used by DokanyFileSystem#findFiles)

This commit is part of my effort to fix dokan-java's issue 32 (dokan-dev#32): Adding wrappers for high-level programming
Added EasyFileInfo to wrap the result of DokanyFileSystem#getFileInformation (ByHandleFileInformation)
and Added FindFileInfo to wrap the result of DokanyFileSystem#findFiles (WinBase.WIN32_FIND_DATA) to aid in creating a wrapper ("EasyDokanFileSystem") for DokanyFileSystem
Added AbstractFileInfo as common base class for FileInfos (like EasyFileInfo and FindFileInfo)
Added DefaultFileTimePolicy to help in returning valid FileTimes to Dokan if unavailable to AbstractFileInfo

This commit is part of my effort to fix dokan-java's issue 32 (dokan-dev#32): Adding wrappers for high-level programming
Restored VolumeInformation from commit 99bcbda (party reverting commit 3c343eb) to wrap the result of DokanyFileSystem#getVolumeInformation to aid in creating a wrapper ("EasyDokanFileSystem") for DokanyFileSystem

This commit is part of my effort to fix dokan-java's issue 32 (dokan-dev#32): Adding wrappers for high-level programming
Moved VolumeInformation from original package dev.dokan.dokan_java.legacy.structure to dev.dokan.dokan_java.wrappers
JaniruTEC added 3 commits May 9, 2020 16:44
Added DesiredAccessMask to wrap parameter desiredAccess of DokanyFileSystem#zwCreateFile to aid in creating a wrapper ("EasyDokanFileSystem") for DokanyFileSystem
Added DiskSpaceInfo to wrap the result of DokanyFileSystem#getDiskFreeSpace to  aid in creating a wrapper ("EasyDokanFileSystem") for DokanyFileSystem

This commit is part of my effort to fix dokan-java's issue 32 (dokan-dev#32): Adding wrappers for high-level programming
Added EasyDokanyFileSystem as wrapper for DokanyFileSystem
Added DokanyFileHandle to wrap parameter dokanFileInfo (DokanFileInfo) in various methods of DokanyFileSystem
Added SecurityContext to wrap parameter securityContext (WinBase.SECURITY_ATTRIBUTES) of DokanyFileSystem#zwCreateFile
Added Annotation NativeName to ease the use of NotImplemented on methods of EasyDokayFileSystem that have a name that differs from their counterpart in DokanyFileSystem
@JaniruTEC JaniruTEC marked this pull request as draft May 18, 2020 19:18
@JaniruTEC JaniruTEC marked this pull request as ready for review May 18, 2020 19:26
@JaniruTEC JaniruTEC marked this pull request as draft May 18, 2020 19:26
JaniruTEC and others added 12 commits May 21, 2020 21:36
Renamed SecurityContext to EasyDokanIOSecurityContext to match the fix in the low-level API (Change from WinBase.SECURITY_ATTRIBUTES to DokanIOSecurityContex as argument of DokanFileSystem#zwCreateFile)
Added MountInfo-API to wrap the class DokanOptions for the respective field in DokanFileHandle (wrapper for DokanFileInfo).
Added Interfaces ROMountInfo and RWMountInfo
Added ImmutableMountInfo and MountInfo as implementations

This commit is part of my effort to fix dokan-java's issue dokan-dev#32
Added ForwardingFileSystem as delegator for method-calls between EasyDokanFileSystem-implementations and DokanFileSystem-API
Added EasyDokanFileSystemStub as stub for implementations of EasyDokanFileSystem (similiar to DokanFileSystemStub)
Added AbstractEasyDokanFileSystem as base class for implementations of EasyDokanFileSystem (similiar to AbstractDokanFileSystem)

This commit is part of my effort to fix dokan-java's issue dokan-dev#32
@infeo
Copy link
Member

infeo commented May 28, 2020

As it was discussed between @JaniruTEC and me: The file system should give a developer the Win32API Flags and should return Win32API error codes, which will be automically converted to an NtStatus code (via DokanNtStatusFromWin32Error)

@Liryna
Copy link
Member

Liryna commented May 28, 2020

@infeo Does Win32 error are usually used by Java developers? Like they would understand easier the usage compared to ntstatus?

@infeo
Copy link
Member

infeo commented May 28, 2020

I don't want to speak for every Java developer out there, but from my experience it is. As an example, let's look at the case if an object alrady exists:

  • The win32 error code is ERROR_ALREADY_EXISTS
  • the ntstatus is STATUS_OBJECT_NAME_COLLISION

As a Java dev you are used to nio exceptions like FileAlreadyExistsException, which directly translates to the win32 error code in this case.

The filesystem proposed in this PR should be easier for developers to use and more Javaish, and from my point of view the normal developer deals either only with Java or at most the win32API, but not the Kernel. Of course it would be more desireable to do it more the Java way and catch exceptions and translate those directly to the correct error code, but i thought one step at a time (;

this won't replace the old filesystem. A developer has the possiblitly to choose between the more raw filesystem to implement (less Java, more bitmasks and needs to return NTStatus) and the easy one (more Java, gives user land flags and returns win32 codes)

@infeo
Copy link
Member

infeo commented May 29, 2020

@Liryna What is your opinion? Is it a good plan to use Win32 API codes and flags or should we stick to the Kernel-Layer in the easier-to-use-filesystem?

@Liryna
Copy link
Member

Liryna commented May 30, 2020

Thank for your detail! case like FileAlreadyExistsException is exactly what I was looking for.
I also believe win32 would be a good choice as it make more sense for Java devs 👍

@JaniruTEC JaniruTEC changed the title (Re-Added) Convenience methods for internal development & added info to README Implementing the "Easy"-Dokan-API May 30, 2020
@JaniruTEC JaniruTEC self-assigned this May 31, 2020
JaniruTEC added 2 commits June 2, 2020 22:33
Fixed wrong implements-statements
Added missing convenience methods
Renamed parameters/fields
Replaced outdated constructors
Replaced outdated methods
@JaniruTEC JaniruTEC linked an issue Jun 2, 2020 that may be closed by this pull request
Added ReparsePointTag as base interface for all ReparsePointTags (extends EnumInteger)
Changed MicrosoftReparsePointTag to implement ReparsePointTag
Changed signature of generic/non-MS-specific methods in FindFileInfo to use ReparsePointTag-Interface

See: https://docs.microsoft.com/en-us/windows/win32/fileio/reparse-point-tags
https://web.archive.org/web/20200603151710/https://docs.microsoft.com/en-us/windows/win32/fileio/reparse-point-tags
@JaniruTEC JaniruTEC changed the base branch from master to develop June 4, 2020 23:39
JaniruTEC added 8 commits June 8, 2020 17:23
Updated DokanFileHandle to use ROMountInfo instead of DokanOptions
Added setFileInfo method

This commit led to discovery of dokan-dev#46 which leads to problems with this code.
Added check if only a single bit (flag) is set to make sure that getFlag returns reliable results
Added check if only a single bit (flag) is set to make sure that updateFlag operates reliably
Externalized check
Created BasicDesiredAccessMask as base class for DesiredAccessMask
Moved all methods concerning basic rights to the new base class
Renamed getFileAccessMask to getFileAccessMaskFlag to reflect the changes to the AccessMaskFlags
Fixed Conflicts:
src/main/java/dev/dokan/dokan_java/structure/DokanOptions.java
@infeo infeo mentioned this pull request Jul 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding wrappers for high-level programming
3 participants