mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8030048: (fs) Support UserDefinedFileAttributeView/extended attributes on OS X / HFS+
Reviewed-by: alanb
This commit is contained in:
parent
bbb93ca3c8
commit
afd3f78aec
7 changed files with 573 additions and 0 deletions
|
@ -65,6 +65,67 @@ class BsdNativeDispatcher extends UnixNativeDispatcher {
|
|||
}
|
||||
static native byte[] getmntonname0(long pathAddress) throws UnixException;
|
||||
|
||||
/**
|
||||
* ssize_t fgetxattr(int fd, const char *name, void *value, size_t size,
|
||||
* u_int32_t position, int options);
|
||||
*/
|
||||
static int fgetxattr(int fd, byte[] name, long valueAddress,
|
||||
int valueLen) throws UnixException
|
||||
{
|
||||
NativeBuffer buffer = NativeBuffers.asNativeBuffer(name);
|
||||
try {
|
||||
return fgetxattr0(fd, buffer.address(), valueAddress, valueLen, 0L, 0);
|
||||
} finally {
|
||||
buffer.release();
|
||||
}
|
||||
}
|
||||
|
||||
private static native int fgetxattr0(int fd, long nameAddress,
|
||||
long valueAddress, int valueLen, long position, int options) throws UnixException;
|
||||
|
||||
/**
|
||||
* int fsetxattr(int fd, const char *name, void *value, size_t size,
|
||||
* u_int32_t position, int options);
|
||||
*/
|
||||
static void fsetxattr(int fd, byte[] name, long valueAddress,
|
||||
int valueLen) throws UnixException
|
||||
{
|
||||
NativeBuffer buffer = NativeBuffers.asNativeBuffer(name);
|
||||
try {
|
||||
fsetxattr0(fd, buffer.address(), valueAddress, valueLen, 0L, 0);
|
||||
} finally {
|
||||
buffer.release();
|
||||
}
|
||||
}
|
||||
|
||||
private static native void fsetxattr0(int fd, long nameAddress,
|
||||
long valueAddress, int valueLen, long position, int options) throws UnixException;
|
||||
|
||||
/**
|
||||
* int fremovexattr(int fd, const char *name, int options);
|
||||
*/
|
||||
static void fremovexattr(int fd, byte[] name) throws UnixException {
|
||||
NativeBuffer buffer = NativeBuffers.asNativeBuffer(name);
|
||||
try {
|
||||
fremovexattr0(fd, buffer.address(), 0);
|
||||
} finally {
|
||||
buffer.release();
|
||||
}
|
||||
}
|
||||
|
||||
private static native void fremovexattr0(int fd, long nameAddress, int options)
|
||||
throws UnixException;
|
||||
|
||||
/**
|
||||
* ssize_t flistxattr(int fd, char *namebuf, size_t size, int options);
|
||||
*/
|
||||
static int flistxattr(int fd, long nameBufAddress, int size) throws UnixException {
|
||||
return flistxattr0(fd, nameBufAddress, size, 0);
|
||||
}
|
||||
|
||||
private static native int flistxattr0(int fd, long nameBufAddress, int size,
|
||||
int options) throws UnixException;
|
||||
|
||||
// initialize field IDs
|
||||
private static native void initIDs();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue