$OpenBSD: patch-jdk_src_solaris_classes_sun_nio_fs_BsdFileSystem_java,v 1.3 2009/10/07 01:53:54 kurt Exp $
--- jdk/src/solaris/classes/sun/nio/fs/BsdFileSystem.java.orig	Sun Sep 27 09:39:53 2009
+++ jdk/src/solaris/classes/sun/nio/fs/BsdFileSystem.java	Sun Sep 27 10:37:54 2009
@@ -31,49 +31,23 @@ import java.io.IOException;
 import java.util.*;
 import java.security.AccessController;
 import sun.security.action.GetPropertyAction;
-import static sun.nio.fs.BsdNativeDispatcher.*;
 
 /**
  * Bsd implementation of FileSystem
  */
 
 class BsdFileSystem extends UnixFileSystem {
-    private final boolean hasInotify;
 
     BsdFileSystem(UnixFileSystemProvider provider, String dir) {
         super(provider, dir);
-
-        // assume X.Y[-Z] format
-        String osversion = AccessController
-            .doPrivileged(new GetPropertyAction("os.version"));
-        String[] vers = Util.split(osversion, '.');
-        assert vers.length >= 2;
-
-        int majorVersion = Integer.parseInt(vers[0]);
-        int minorVersion = Integer.parseInt(vers[1]);
-        int microVersion = 0;
-        if (vers.length > 2) {
-            String[] microVers = Util.split(vers[2], '-');
-            microVersion = (microVers.length > 0) ?
-                Integer.parseInt(microVers[0]) : 0;
-        }
-
-        // inotify available since 2.6.13
-        this.hasInotify = ((majorVersion > 2) ||
-            (majorVersion == 2 && minorVersion > 6) ||
-            ((majorVersion == 2) && (minorVersion == 6) && (microVersion >= 13)));
     }
 
     @Override
     public WatchService newWatchService()
         throws IOException
     {
-        if (hasInotify) {
-            return new BsdWatchService(this);
-        } else {
-            // use polling implementation on older kernels
-            return new PollingWatchService();
-        }
+        // use polling implementation until we implement a BSD/kqueue one
+        return new PollingWatchService();
     }
 
     @Override
@@ -82,10 +56,6 @@ class BsdFileSystem extends UnixFileSystem {
                                                                 UnixPath file,
                                                                 LinkOption... options)
     {
-        if (view == DosFileAttributeView.class)
-            return (V) new BsdDosFileAttributeView(file, followLinks(options));
-        if (view == UserDefinedFileAttributeView.class)
-            return (V) new BsdUserDefinedFileAttributeView(file, followLinks(options));
         return super.newFileAttributeView(view, file, options);
     }
 
@@ -95,10 +65,6 @@ class BsdFileSystem extends UnixFileSystem {
                                                          UnixPath file,
                                                          LinkOption... options)
     {
-        if (name.equals("dos"))
-            return new BsdDosFileAttributeView(file, followLinks(options));
-        if (name.equals("user"))
-            return new BsdUserDefinedFileAttributeView(file, followLinks(options));
         return super.newFileAttributeView(name, file, options);
     }
 
@@ -109,9 +75,6 @@ class BsdFileSystem extends UnixFileSystem {
         private static Set<String> supportedFileAttributeViews() {
             Set<String> result = new HashSet<String>();
             result.addAll(UnixFileSystem.standardFileAttributeViews());
-            // additional Bsd-specific views
-            result.add("dos");
-            result.add("user");
             return Collections.unmodifiableSet(result);
         }
     }
@@ -123,40 +86,32 @@ class BsdFileSystem extends UnixFileSystem {
 
     @Override
     void copyNonPosixAttributes(int ofd, int nfd) {
-        BsdUserDefinedFileAttributeView.copyExtendedAttributes(ofd, nfd);
     }
 
     /**
-     * Returns object to iterate over the mount entries in the given fstab file.
+     * Returns object to iterate over mount entries
      */
-    Iterable<UnixMountEntry> getMountEntries(String fstab) {
+    @Override
+    Iterable<UnixMountEntry> getMountEntries() {
         ArrayList<UnixMountEntry> entries = new ArrayList<UnixMountEntry>();
         try {
-            long fp = setmntent(fstab.getBytes(), "r".getBytes());
+            long iter = BsdNativeDispatcher.getfsstat();
             try {
                 for (;;) {
                     UnixMountEntry entry = new UnixMountEntry();
-                    int res = getextmntent(fp, entry);
+                    int res = BsdNativeDispatcher.fsstatEntry(iter, entry);
                     if (res < 0)
                         break;
                     entries.add(entry);
                 }
             } finally {
-                endmntent(fp);
+                BsdNativeDispatcher.endfsstat(iter);
             }
 
         } catch (UnixException x) {
             // nothing we can do
         }
         return entries;
-    }
-
-    /**
-     * Returns object to iterate over the mount entries in /etc/mtab
-     */
-    @Override
-    Iterable<UnixMountEntry> getMountEntries() {
-        return getMountEntries("/etc/mtab");
     }
 
     @Override
