Skip to content

Commit 0de6abd

Browse files
overheadhunterAlan Bateman
authored and
Alan Bateman
committed
8260966: (fs) Consolidate Linux and macOS implementations of UserDefinedFileAttributeView
8260691: (fs) LinuxNativeDispatcher should link to xattr functions Reviewed-by: alanb
1 parent 5f4bc0a commit 0de6abd

16 files changed

+555
-977
lines changed

src/java.base/linux/classes/sun/nio/fs/LinuxFileStore.java

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -105,27 +105,6 @@ UnixMountEntry findMountEntry() throws IOException {
105105
throw new IOException("Mount point not found");
106106
}
107107

108-
// returns true if extended attributes enabled on file system where given
109-
// file resides, returns false if disabled or unable to determine.
110-
private boolean isExtendedAttributesEnabled(UnixPath path) {
111-
int fd = -1;
112-
try {
113-
fd = path.openForAttributeAccess(false);
114-
115-
// fgetxattr returns size if called with size==0
116-
byte[] name = Util.toBytes("user.java");
117-
LinuxNativeDispatcher.fgetxattr(fd, name, 0L, 0);
118-
return true;
119-
} catch (UnixException e) {
120-
// attribute does not exist
121-
if (e.errno() == UnixConstants.ENODATA)
122-
return true;
123-
} finally {
124-
UnixNativeDispatcher.close(fd);
125-
}
126-
return false;
127-
}
128-
129108
// get kernel version as a three element array {major, minor, micro}
130109
private static int[] getKernelVersion() {
131110
Pattern pattern = Pattern.compile("\\D+");

src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public Set<String> supportedFileAttributeViews() {
6969

7070
@Override
7171
void copyNonPosixAttributes(int ofd, int nfd) {
72-
LinuxUserDefinedFileAttributeView.copyExtendedAttributes(ofd, nfd);
72+
UnixUserDefinedFileAttributeView.copyExtendedAttributes(ofd, nfd);
7373
}
7474

7575
/**

src/java.base/linux/classes/sun/nio/fs/LinuxNativeDispatcher.java

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -69,61 +69,6 @@ static native int getmntent0(long fp, UnixMountEntry entry, long buffer, int buf
6969
*/
7070
static native void endmntent(long stream) throws UnixException;
7171

72-
/**
73-
* ssize_t fgetxattr(int filedes, const char *name, void *value, size_t size);
74-
*/
75-
static int fgetxattr(int filedes, byte[] name, long valueAddress,
76-
int valueLen) throws UnixException
77-
{
78-
NativeBuffer buffer = NativeBuffers.asNativeBuffer(name);
79-
try {
80-
return fgetxattr0(filedes, buffer.address(), valueAddress, valueLen);
81-
} finally {
82-
buffer.release();
83-
}
84-
}
85-
86-
private static native int fgetxattr0(int filedes, long nameAddress,
87-
long valueAddress, int valueLen) throws UnixException;
88-
89-
/**
90-
* fsetxattr(int filedes, const char *name, const void *value, size_t size, int flags);
91-
*/
92-
static void fsetxattr(int filedes, byte[] name, long valueAddress,
93-
int valueLen) throws UnixException
94-
{
95-
NativeBuffer buffer = NativeBuffers.asNativeBuffer(name);
96-
try {
97-
fsetxattr0(filedes, buffer.address(), valueAddress, valueLen);
98-
} finally {
99-
buffer.release();
100-
}
101-
}
102-
103-
private static native void fsetxattr0(int filedes, long nameAddress,
104-
long valueAddress, int valueLen) throws UnixException;
105-
106-
/**
107-
* fremovexattr(int filedes, const char *name);
108-
*/
109-
static void fremovexattr(int filedes, byte[] name) throws UnixException {
110-
NativeBuffer buffer = NativeBuffers.asNativeBuffer(name);
111-
try {
112-
fremovexattr0(filedes, buffer.address());
113-
} finally {
114-
buffer.release();
115-
}
116-
}
117-
118-
private static native void fremovexattr0(int filedes, long nameAddress)
119-
throws UnixException;
120-
121-
/**
122-
* size_t flistxattr(int filedes, const char *list, size_t size)
123-
*/
124-
static native int flistxattr(int filedes, long listAddress, int size)
125-
throws UnixException;
126-
12772
// initialize
12873
private static native void init();
12974

0 commit comments

Comments
 (0)