提交 73b00f40 编写于 作者: A alanb

6979526: (file) java/nio/file/FileStore/Basic.java fails if the same file...

6979526: (file) java/nio/file/FileStore/Basic.java fails if the same file system is mounted more than once
Reviewed-by: kevinw, forax
上级 8cfd77bd
...@@ -156,9 +156,4 @@ class LinuxFileStore ...@@ -156,9 +156,4 @@ class LinuxFileStore
return supportsFileAttributeView(UserDefinedFileAttributeView.class); return supportsFileAttributeView(UserDefinedFileAttributeView.class);
return super.supportsFileAttributeView(name); return super.supportsFileAttributeView(name);
} }
@Override
boolean isLoopback() {
return false;
}
} }
...@@ -108,9 +108,4 @@ class SolarisFileStore ...@@ -108,9 +108,4 @@ class SolarisFileStore
return supportsFileAttributeView(UserDefinedFileAttributeView.class); return supportsFileAttributeView(UserDefinedFileAttributeView.class);
return super.supportsFileAttributeView(name); return super.supportsFileAttributeView(name);
} }
@Override
boolean isLoopback() {
return type().equals("lofs");
}
} }
...@@ -76,12 +76,6 @@ abstract class UnixFileStore ...@@ -76,12 +76,6 @@ abstract class UnixFileStore
*/ */
abstract UnixMountEntry findMountEntry() throws IOException; abstract UnixMountEntry findMountEntry() throws IOException;
/**
* Returns true if this file store represents a loopback file system that
* will have the same device ID as underlying file system.
*/
abstract boolean isLoopback();
UnixPath file() { UnixPath file() {
return file; return file;
} }
...@@ -169,22 +163,13 @@ abstract class UnixFileStore ...@@ -169,22 +163,13 @@ abstract class UnixFileStore
if (!(ob instanceof UnixFileStore)) if (!(ob instanceof UnixFileStore))
return false; return false;
UnixFileStore other = (UnixFileStore)ob; UnixFileStore other = (UnixFileStore)ob;
if (dev != other.dev) return (this.dev == other.dev) &&
return false; Arrays.equals(this.entry.dir(), other.entry.dir());
// deviceIDs are equal but they may not be equal if one or both of
// them is a loopback file system
boolean thisIsLoopback = isLoopback();
if (thisIsLoopback != other.isLoopback())
return false; // one, but not both, are lofs
if (!thisIsLoopback)
return true; // neither is lofs
// both are lofs so compare mount points
return Arrays.equals(this.entry.dir(), other.entry.dir());
} }
@Override @Override
public int hashCode() { public int hashCode() {
return (int)(dev ^ (dev >>> 32)); return (int)(dev ^ (dev >>> 32)) ^ Arrays.hashCode(entry.dir());
} }
@Override @Override
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
*/ */
/* @test /* @test
* @bug 4313887 6873621 * @bug 4313887 6873621 6979526
* @summary Unit test for java.nio.file.FileStore * @summary Unit test for java.nio.file.FileStore
* @library .. * @library ..
*/ */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册