7191556: (fs) UnixNativeDispatcher.getextmntent should be moved into platform specific code
Reviewed-by: andrew
--- a/jdk/make/java/nio/Makefile Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/make/java/nio/Makefile Thu Aug 16 11:14:42 2012 +0100
@@ -277,7 +277,6 @@
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
- sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/BsdFileStore.java \
sun/nio/fs/BsdFileSystem.java \
sun/nio/fs/BsdFileSystemProvider.java \
@@ -312,7 +311,6 @@
UnixAsynchronousServerSocketChannelImpl.c \
UnixAsynchronousSocketChannelImpl.c \
\
- GnomeFileTypeDetector.c \
BsdNativeDispatcher.c \
MacOSXNativeDispatcher.c \
UnixCopyFile.c \
@@ -329,7 +327,6 @@
sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java \
sun/nio/ch/UnixAsynchronousSocketChannelImpl.java \
\
- sun/nio/fs/GnomeFileTypeDetector.java \
sun/nio/fs/BsdNativeDispatcher.java \
sun/nio/fs/UnixCopyFile.java \
sun/nio/fs/UnixNativeDispatcher.java
--- a/jdk/make/java/nio/mapfile-bsd Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/make/java/nio/mapfile-bsd Thu Aug 16 11:14:42 2012 +0100
@@ -121,10 +121,6 @@
Java_sun_nio_fs_BsdNativeDispatcher_getfsstat;
Java_sun_nio_fs_BsdNativeDispatcher_fsstatEntry;
Java_sun_nio_fs_BsdNativeDispatcher_endfsstat;
- Java_sun_nio_fs_GnomeFileTypeDetector_initializeGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGio;
- Java_sun_nio_fs_GnomeFileTypeDetector_initializeGnomeVfs;
- Java_sun_nio_fs_GnomeFileTypeDetector_probeUsingGnomeVfs;
Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
Java_sun_nio_fs_UnixNativeDispatcher_strerror;
@@ -170,7 +166,6 @@
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
- Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
handleSocketError;
--- a/jdk/make/java/nio/mapfile-linux Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/make/java/nio/mapfile-linux Thu Aug 16 11:14:42 2012 +0100
@@ -143,6 +143,7 @@
Java_sun_nio_fs_LinuxNativeDispatcher_fsetxattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_fremovexattr0;
Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0;
+ Java_sun_nio_fs_LinuxNativeDispatcher_getmntent;
Java_sun_nio_fs_LinuxNativeDispatcher_endmntent;
Java_sun_nio_fs_UnixNativeDispatcher_init;
Java_sun_nio_fs_UnixNativeDispatcher_getcwd;
@@ -189,7 +190,6 @@
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
- Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
handleSocketError;
--- a/jdk/make/java/nio/mapfile-solaris Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/make/java/nio/mapfile-solaris Thu Aug 16 11:14:42 2012 +0100
@@ -169,10 +169,10 @@
Java_sun_nio_fs_UnixNativeDispatcher_getgrgid;
Java_sun_nio_fs_UnixNativeDispatcher_getpwnam0;
Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0;
- Java_sun_nio_fs_UnixNativeDispatcher_getextmntent;
Java_sun_nio_fs_UnixCopyFile_transfer;
Java_sun_nio_fs_SolarisNativeDispatcher_init;
Java_sun_nio_fs_SolarisNativeDispatcher_facl;
+ Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent;
Java_sun_nio_fs_SolarisWatchService_init;
Java_sun_nio_fs_SolarisWatchService_portCreate;
Java_sun_nio_fs_SolarisWatchService_portAssociate;
--- a/jdk/src/solaris/classes/sun/nio/fs/DefaultFileTypeDetector.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/DefaultFileTypeDetector.java Thu Aug 16 11:14:42 2012 +0100
@@ -25,12 +25,15 @@
package sun.nio.fs;
+import java.nio.file.FileSystems;
import java.nio.file.spi.FileTypeDetector;
+import java.nio.file.spi.FileSystemProvider;
public class DefaultFileTypeDetector {
private DefaultFileTypeDetector() { }
public static FileTypeDetector create() {
- return new GnomeFileTypeDetector();
+ FileSystemProvider provider = FileSystems.getDefault().provider();
+ return ((UnixFileSystemProvider)provider).getFileTypeDetector();
}
}
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystem.java Thu Aug 16 11:14:42 2012 +0100
@@ -82,7 +82,7 @@
try {
for (;;) {
UnixMountEntry entry = new UnixMountEntry();
- int res = getextmntent(fp, entry);
+ int res = getmntent(fp, entry);
if (res < 0)
break;
entries.add(entry);
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxFileSystemProvider.java Thu Aug 16 11:14:42 2012 +0100
@@ -27,6 +27,7 @@
import java.nio.file.*;
import java.nio.file.attribute.*;
+import java.nio.file.spi.FileTypeDetector;
import java.io.IOException;
/**
@@ -96,4 +97,9 @@
return super.readAttributes(file, type, options);
}
}
+
+ @Override
+ FileTypeDetector getFileTypeDetector() {
+ return new GnomeFileTypeDetector();
+ }
}
--- a/jdk/src/solaris/classes/sun/nio/fs/LinuxNativeDispatcher.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/LinuxNativeDispatcher.java Thu Aug 16 11:14:42 2012 +0100
@@ -51,9 +51,15 @@
private static native long setmntent0(long pathAddress, long typeAddress)
throws UnixException;
- /**
- * int endmntent(FILE* filep);
- */
+ /**
+ * int getmntent(FILE *fp, struct mnttab *mp, int len);
+ */
+ static native int getmntent(long fp, UnixMountEntry entry)
+ throws UnixException;
+
+ /**
+ * int endmntent(FILE* filep);
+ */
static native void endmntent(long stream) throws UnixException;
/**
@@ -90,7 +96,6 @@
private static native void fsetxattr0(int filedes, long nameAddress,
long valueAdddress, int valueLen) throws UnixException;
-
/**
* fremovexattr(int filedes, const char *name);
*/
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystem.java Thu Aug 16 11:14:42 2012 +0100
@@ -30,7 +30,7 @@
import java.util.*;
import java.security.AccessController;
import sun.security.action.GetPropertyAction;
-import static sun.nio.fs.UnixNativeDispatcher.*;
+import static sun.nio.fs.SolarisNativeDispatcher.*;
/**
* Solaris implementation of FileSystem
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisFileSystemProvider.java Thu Aug 16 11:14:42 2012 +0100
@@ -27,6 +27,7 @@
import java.nio.file.*;
import java.nio.file.attribute.*;
+import java.nio.file.spi.FileTypeDetector;
import java.io.IOException;
/**
@@ -79,4 +80,9 @@
Util.followLinks(options));
return super.getFileAttributeView(obj, name, options);
}
+
+ @Override
+ FileTypeDetector getFileTypeDetector() {
+ return new GnomeFileTypeDetector();
+ }
}
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisNativeDispatcher.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisNativeDispatcher.java Thu Aug 16 11:14:42 2012 +0100
@@ -36,6 +36,12 @@
private SolarisNativeDispatcher() { }
/**
+ * int getextmntent(FILE *fp, struct extmnttab *mp, int len);
+ */
+ static native int getextmntent(long fp, UnixMountEntry entry)
+ throws UnixException;
+
+ /**
* int facl(int filedes, int cmd, int nentries, void aclbufp)
*/
static native int facl(int fd, int cmd, int nentries, long aclbufp)
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixFileSystemProvider.java Thu Aug 16 11:14:42 2012 +0100
@@ -27,6 +27,7 @@
import java.nio.file.*;
import java.nio.file.attribute.*;
+import java.nio.file.spi.FileTypeDetector;
import java.nio.channels.*;
import java.net.URI;
import java.util.concurrent.ExecutorService;
@@ -495,4 +496,17 @@
return null; // keep compiler happy
}
}
+
+ /**
+ * Returns a {@code FileTypeDetector} for this platform.
+ */
+ FileTypeDetector getFileTypeDetector() {
+ return new AbstractFileTypeDetector() {
+ @Override
+ public String implProbeContentType(Path file) {
+ return null;
+ }
+ };
+ }
+
}
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixNativeDispatcher.java Thu Aug 16 11:14:42 2012 +0100
@@ -498,11 +498,6 @@
private static native int getgrnam0(long nameAddress) throws UnixException;
/**
- * int getextmntent(FILE *fp, struct extmnttab *mp, int len);
- */
- static native int getextmntent(long fp, UnixMountEntry entry) throws UnixException;
-
- /**
* statvfs(const char* path, struct statvfs *buf)
*/
static void statvfs(UnixPath path, UnixFileStoreAttributes attrs)
--- a/jdk/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/native/sun/nio/fs/BsdNativeDispatcher.c Thu Aug 16 11:14:42 2012 +0100
@@ -46,8 +46,6 @@
static jfieldID entry_dir;
static jfieldID entry_fstype;
static jfieldID entry_options;
-static jfieldID entry_dev;
-
struct fsstat_iter {
struct statfs *buf;
@@ -81,7 +79,6 @@
entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
- entry_dev = (*env)->GetFieldID(env, clazz, "dev", "J");
}
JNIEXPORT jlong JNICALL
@@ -160,7 +157,6 @@
options="ro";
else
options="";
- dev = 0;
iter->pos++;
@@ -192,9 +188,6 @@
(*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
(*env)->SetObjectField(env, entry, entry_options, bytes);
- if (dev != 0)
- (*env)->SetLongField(env, entry, entry_dev, (jlong)dev);
-
return 0;
}
@@ -208,3 +201,4 @@
free(iter);
}
}
+
--- a/jdk/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/native/sun/nio/fs/GnomeFileTypeDetector.c Thu Aug 16 11:14:42 2012 +0100
@@ -35,7 +35,7 @@
#include <strings.h>
#endif
-#if defined(__linux__) || defined(__APPLE__)
+#if defined(__linux__)
#include <string.h>
#endif
--- a/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/native/sun/nio/fs/LinuxNativeDispatcher.c Thu Aug 16 11:14:42 2012 +0100
@@ -29,6 +29,7 @@
#include "jlong.h"
#include <stdio.h>
+#include <string.h>
#include <dlfcn.h>
#include <errno.h>
#include <mntent.h>
@@ -45,6 +46,11 @@
fremovexattr_func* my_fremovexattr_func = NULL;
flistxattr_func* my_flistxattr_func = NULL;
+static jfieldID entry_name;
+static jfieldID entry_dir;
+static jfieldID entry_fstype;
+static jfieldID entry_options;
+
static void throwUnixException(JNIEnv* env, int errnum) {
jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException",
"(I)V", errnum);
@@ -60,6 +66,15 @@
my_fsetxattr_func = (fsetxattr_func*)dlsym(RTLD_DEFAULT, "fsetxattr");
my_fremovexattr_func = (fremovexattr_func*)dlsym(RTLD_DEFAULT, "fremovexattr");
my_flistxattr_func = (flistxattr_func*)dlsym(RTLD_DEFAULT, "flistxattr");
+
+ clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
+ if (clazz == NULL)
+ return;
+
+ entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+ entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+ entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+ entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
}
JNIEXPORT jint JNICALL
@@ -151,6 +166,61 @@
return ptr_to_jlong(fp);
}
+JNIEXPORT jint JNICALL
+Java_sun_nio_fs_LinuxNativeDispatcher_getmntent(JNIEnv* env, jclass this,
+ jlong value, jobject entry)
+{
+ struct mntent ent;
+ char buf[1024];
+ int buflen = sizeof(buf);
+ struct mntent* m;
+ FILE* fp = jlong_to_ptr(value);
+ jsize len;
+ jbyteArray bytes;
+ char* name;
+ char* dir;
+ char* fstype;
+ char* options;
+
+ m = getmntent_r(fp, &ent, (char*)&buf, buflen);
+ if (m == NULL)
+ return -1;
+ name = m->mnt_fsname;
+ dir = m->mnt_dir;
+ fstype = m->mnt_type;
+ options = m->mnt_opts;
+
+ len = strlen(name);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name);
+ (*env)->SetObjectField(env, entry, entry_name, bytes);
+
+ len = strlen(dir);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir);
+ (*env)->SetObjectField(env, entry, entry_dir, bytes);
+
+ len = strlen(fstype);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
+ (*env)->SetObjectField(env, entry, entry_fstype, bytes);
+
+ len = strlen(options);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
+ (*env)->SetObjectField(env, entry, entry_options, bytes);
+
+ return 0;
+}
+
JNIEXPORT void JNICALL
Java_sun_nio_fs_LinuxNativeDispatcher_endmntent(JNIEnv* env, jclass this, jlong stream)
{
--- a/jdk/src/solaris/native/sun/nio/fs/SolarisNativeDispatcher.c Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/native/sun/nio/fs/SolarisNativeDispatcher.c Thu Aug 16 11:14:42 2012 +0100
@@ -28,12 +28,22 @@
#include "jvm.h"
#include "jlong.h"
-#include <dlfcn.h>
+#include <strings.h>
#include <errno.h>
#include <sys/acl.h>
+#include <sys/mnttab.h>
+#include <sys/mkdev.h>
+
+#include "jni.h"
#include "sun_nio_fs_SolarisNativeDispatcher.h"
+static jfieldID entry_name;
+static jfieldID entry_dir;
+static jfieldID entry_fstype;
+static jfieldID entry_options;
+static jfieldID entry_dev;
+
static void throwUnixException(JNIEnv* env, int errnum) {
jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException",
"(I)V", errnum);
@@ -44,6 +54,15 @@
JNIEXPORT void JNICALL
Java_sun_nio_fs_SolarisNativeDispatcher_init(JNIEnv *env, jclass clazz) {
+ clazz = (*env)->FindClass(env, "sun/nio/fs/UnixMountEntry");
+ if (clazz == NULL)
+ return;
+
+ entry_name = (*env)->GetFieldID(env, clazz, "name", "[B");
+ entry_dir = (*env)->GetFieldID(env, clazz, "dir", "[B");
+ entry_fstype = (*env)->GetFieldID(env, clazz, "fstype", "[B");
+ entry_options = (*env)->GetFieldID(env, clazz, "opts", "[B");
+ entry_dev = (*env)->GetFieldID(env, clazz, "dev", "J");
}
JNIEXPORT jint JNICALL
@@ -59,3 +78,63 @@
}
return (jint)n;
}
+
+JNIEXPORT jint JNICALL
+Java_sun_nio_fs_SolarisNativeDispatcher_getextmntent(JNIEnv* env, jclass this,
+ jlong value, jobject entry)
+{
+ struct extmnttab ent;
+ FILE* fp = jlong_to_ptr(value);
+ jsize len;
+ jbyteArray bytes;
+ char* name;
+ char* dir;
+ char* fstype;
+ char* options;
+ dev_t dev;
+
+ if (getextmntent(fp, &ent, 0))
+ return -1;
+ name = ent.mnt_special;
+ dir = ent.mnt_mountp;
+ fstype = ent.mnt_fstype;
+ options = ent.mnt_mntopts;
+ dev = makedev(ent.mnt_major, ent.mnt_minor);
+ if (dev == NODEV) {
+ throwUnixException(env, errno);
+ return -1;
+ }
+
+ len = strlen(name);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name);
+ (*env)->SetObjectField(env, entry, entry_name, bytes);
+
+ len = strlen(dir);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir);
+ (*env)->SetObjectField(env, entry, entry_dir, bytes);
+
+ len = strlen(fstype);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
+ (*env)->SetObjectField(env, entry, entry_fstype, bytes);
+
+ len = strlen(options);
+ bytes = (*env)->NewByteArray(env, len);
+ if (bytes == NULL)
+ return -1;
+ (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
+ (*env)->SetObjectField(env, entry, entry_options, bytes);
+
+ if (dev != 0)
+ (*env)->SetLongField(env, entry, entry_dev, (jlong)dev);
+
+ return 0;
+}
--- a/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c Thu Aug 16 10:48:43 2012 +0100
+++ b/jdk/src/solaris/native/sun/nio/fs/UnixNativeDispatcher.c Thu Aug 16 11:14:42 2012 +0100
@@ -40,13 +40,10 @@
#ifdef __solaris__
#include <strings.h>
-#include <sys/mnttab.h>
-#include <sys/mkdev.h>
#endif
#ifdef __linux__
#include <string.h>
-#include <mntent.h>
#endif
#ifdef _ALLBSD_SOURCE
@@ -1083,105 +1080,3 @@
return gid;
}
-
-JNIEXPORT jint JNICALL
-Java_sun_nio_fs_UnixNativeDispatcher_getextmntent(JNIEnv* env, jclass this,
- jlong value, jobject entry)
-{
-#ifdef __solaris__
- struct extmnttab ent;
-#elif defined(_ALLBSD_SOURCE)
- char buf[1024];
- char *str;
- char *last;
-#else
- struct mntent ent;
- char buf[1024];
- int buflen = sizeof(buf);
- struct mntent* m;
-#endif
- FILE* fp = jlong_to_ptr(value);
- jsize len;
- jbyteArray bytes;
- char* name;
- char* dir;
- char* fstype;
- char* options;
- dev_t dev;
-
-#ifdef __solaris__
- if (getextmntent(fp, &ent, 0))
- return -1;
- name = ent.mnt_special;
- dir = ent.mnt_mountp;
- fstype = ent.mnt_fstype;
- options = ent.mnt_mntopts;
- dev = makedev(ent.mnt_major, ent.mnt_minor);
- if (dev == NODEV) {
- /* possible bug on Solaris 8 and 9 */
- throwUnixException(env, errno);
- return -1;
- }
-#elif defined(_ALLBSD_SOURCE)
-again:
- if (!(str = fgets(buf, sizeof(buf), fp)))
- return -1;
-
- name = strtok_r(str, " \t\n", &last);
- if (name == NULL)
- return -1;
-
- // skip comments
- if (*name == '#')
- goto again;
-
- dir = strtok_r((char *)NULL, " \t\n", &last);
- fstype = strtok_r((char *)NULL, " \t\n", &last);
- options = strtok_r((char *)NULL, " \t\n", &last);
- if (options == NULL)
- return -1;
- dev = 0;
-#else
- m = getmntent_r(fp, &ent, (char*)&buf, buflen);
- if (m == NULL)
- return -1;
- name = m->mnt_fsname;
- dir = m->mnt_dir;
- fstype = m->mnt_type;
- options = m->mnt_opts;
- dev = 0;
-#endif
-
- len = strlen(name);
- bytes = (*env)->NewByteArray(env, len);
- if (bytes == NULL)
- return -1;
- (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)name);
- (*env)->SetObjectField(env, entry, entry_name, bytes);
-
- len = strlen(dir);
- bytes = (*env)->NewByteArray(env, len);
- if (bytes == NULL)
- return -1;
- (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)dir);
- (*env)->SetObjectField(env, entry, entry_dir, bytes);
-
- len = strlen(fstype);
- bytes = (*env)->NewByteArray(env, len);
- if (bytes == NULL)
- return -1;
- (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)fstype);
- (*env)->SetObjectField(env, entry, entry_fstype, bytes);
-
- len = strlen(options);
- bytes = (*env)->NewByteArray(env, len);
- if (bytes == NULL)
- return -1;
- (*env)->SetByteArrayRegion(env, bytes, 0, len, (jbyte*)options);
- (*env)->SetObjectField(env, entry, entry_options, bytes);
-
- if (dev != 0)
- (*env)->SetLongField(env, entry, entry_dev, (jlong)dev);
-
- return 0;
-}