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

Feature: Add error ENODATA for xattr support #33

Merged
merged 9 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
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
7 changes: 7 additions & 0 deletions jfuse-api/src/main/java/org/cryptomator/jfuse/api/Errno.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,11 @@ public interface Errno {
*/
int enametoolong();

/**
* The named attribute does not exist, or the process has no access to this attribute;
*
* @return error constant {@code ENODATA}
*/
int enodata();

}
1 change: 1 addition & 0 deletions jfuse-linux-aarch64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
<includeConstant>ERANGE</includeConstant>
<includeConstant>ENOLCK</includeConstant>
<includeConstant>ENAMETOOLONG</includeConstant>
<includeConstant>ENODATA</includeConstant>
</includeConstants>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,9 @@ public int enolck() {
public int enametoolong() {
return errno_h.ENAMETOOLONG();
}

@Override
public int enodata() {
return errno_h.ENODATA();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public static int ENOSYS() {
public static int ENOTEMPTY() {
return (int)39L;
}
/**
* {@snippet :
* #define ENODATA 61
* }
*/
public static int ENODATA() {
return (int)61L;
}
/**
* {@snippet :
* #define ENOTSUP 95
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package org.cryptomator.jfuse.linux.aarch64;

import org.cryptomator.jfuse.api.Errno;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Stream;

public class LinuxErrnoTest {

@DisplayName("make sure method is not a stub")
@DisplayName("make sure no errno method is not a stub")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationException {
@MethodSource("errnoNameProvider")
public void testErrnoIsImplemented(String methodName) throws ReflectiveOperationException {
infeo marked this conversation as resolved.
Show resolved Hide resolved
var errno = new LinuxErrno();
var method = LinuxErrno.class.getMethod(methodName);

Expand All @@ -19,4 +25,8 @@ public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationExce
Assertions.assertNotEquals(0, result);
}

static Stream<String> errnoNameProvider() {
return Arrays.stream(Errno.class.getDeclaredMethods()).map(Method::getName);
}

}
4 changes: 2 additions & 2 deletions jfuse-linux-amd64/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
<includeMacro>ERANGE</includeMacro>
<includeMacro>ENOLCK</includeMacro>
<includeMacro>ENAMETOOLONG</includeMacro>
<includeMacro>ENODATA</includeMacro>
</includeConstants>
</configuration>
</execution>
Expand Down Expand Up @@ -231,5 +232,4 @@
</build>
</profile>
</profiles>

</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,9 @@ public int enolck() {
public int enametoolong() {
return errno_h.ENAMETOOLONG();
}

@Override
public int enodata() {
return errno_h.ENODATA();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public static int ENOSYS() {
public static int ENOTEMPTY() {
return (int)39L;
}
/**
* {@snippet :
* #define ENODATA 61
* }
*/
public static int ENODATA() {
return (int)61L;
}
/**
* {@snippet :
* #define ENOTSUP 95
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package org.cryptomator.jfuse.linux.amd64;

import org.cryptomator.jfuse.api.Errno;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Stream;

public class LinuxErrnoTest {

@DisplayName("make sure method is not a stub")
@DisplayName("make sure no errno method is not a stub")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationException {
@MethodSource("errnoNameProvider")
public void testErrnoIsImplemented(String methodName) throws ReflectiveOperationException {
var errno = new LinuxErrno();
var method = LinuxErrno.class.getMethod(methodName);

Expand All @@ -19,4 +25,8 @@ public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationExce
Assertions.assertNotEquals(0, result);
}

static Stream<String> errnoNameProvider() {
return Arrays.stream(Errno.class.getDeclaredMethods()).map(Method::getName);
}

}
1 change: 1 addition & 0 deletions jfuse-mac/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
<includeConstant>ERANGE</includeConstant>
<includeConstant>ENOLCK</includeConstant>
<includeConstant>ENAMETOOLONG</includeConstant>
<includeConstant>ENODATA</includeConstant>
</includeConstants>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,9 @@ public int enolck() {
public int enametoolong() {
return errno_h.ENAMETOOLONG();
}

@Override
public int enodata() {
return errno_h.ENODATA();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ public static int ENOLCK() {
public static int ENOSYS() {
return (int)78L;
}
/**
* {@snippet :
* #define ENODATA 96
* }
*/
public static int ENODATA() {
return (int)96L;
}
}


Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package org.cryptomator.jfuse.mac;

import org.cryptomator.jfuse.api.Errno;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import org.junit.jupiter.params.provider.MethodSource;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Stream;

public class MacErrnoTest {

@DisplayName("make sure method is not a stub")
@DisplayName("make sure errno method is not a stub")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationException {
@MethodSource("errnoNameProvider")
public void testErrnoIsImplemented(String methodName) throws ReflectiveOperationException {
var errno = new MacErrno();
var method = MacErrno.class.getMethod(methodName);

Expand All @@ -19,4 +24,8 @@ public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationExce
Assertions.assertNotEquals(0, result);
}

static Stream<String> errnoNameProvider() {
return Arrays.stream(Errno.class.getDeclaredMethods()).map(Method::getName);
}

}
1 change: 1 addition & 0 deletions jfuse-win/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
<includeConstant>ERANGE</includeConstant>
<includeConstant>ENOLCK</includeConstant>
<includeConstant>ENAMETOOLONG</includeConstant>
<includeConstant>ENODATA</includeConstant>
</includeConstants>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,9 @@ public int enolck() {
public int enametoolong() {
return errno_h.ENAMETOOLONG();
}

@Override
public int enodata() {
return errno_h.ENODATA();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ public static int EINVAL() {
public static int ERANGE() {
return (int)34L;
}
/**
* {@snippet :
* #define ENODATA 120
* }
*/
public static int ENODATA() {
return (int)120L;
}
/**
* {@snippet :
* #define ENOTSUP 129
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
package org.cryptomator.jfuse.win;

import org.cryptomator.jfuse.api.Errno;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.junit.jupiter.params.provider.ValueSource;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.stream.Stream;

public class WinErrnoTest {

@DisplayName("make sure method is not a stub")
@DisplayName("make sure errno method is not a stub")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationException {
@MethodSource("errnoNameProvider")
public void testErrnoIsImplemented(String methodName) throws ReflectiveOperationException {
var errno = new WinErrno();
var method = WinErrno.class.getMethod(methodName);

Expand All @@ -19,4 +25,8 @@ public void testErrnoIsNotZero(String methodName) throws ReflectiveOperationExce
Assertions.assertNotEquals(0, result);
}

static Stream<String> errnoNameProvider() {
return Arrays.stream(Errno.class.getDeclaredMethods()).map(Method::getName);
}

}