Skip to content

Commit

Permalink
Merge pull request #33 from cryptomator/feature/enodata
Browse files Browse the repository at this point in the history
Feature: Add error ENODATA for xattr support
  • Loading branch information
infeo committed Aug 30, 2023
2 parents 884ffd2 + 6f58712 commit 901eb64
Show file tree
Hide file tree
Showing 17 changed files with 108 additions and 7 deletions.
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,15 +1,21 @@
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")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
@MethodSource("errnoNameProvider")
public void testErrnoIsNotZero(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);
}

}
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,15 +1,21 @@
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")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
@MethodSource("errnoNameProvider")
public void testErrnoIsNotZero(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,15 +1,20 @@
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")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
@MethodSource("errnoNameProvider")
public void testErrnoIsNotZero(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,15 +1,21 @@
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")
@ParameterizedTest(name = "{0}()")
@ValueSource(strings = {"enoent", "enosys", "enomem", "eacces", "eio", "erofs", "ebadf", "eexist", "enotdir", "eisdir", "enotempty", "einval"})
@MethodSource("errnoNameProvider")
public void testErrnoIsNotZero(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);
}

}

0 comments on commit 901eb64

Please sign in to comment.