UnixFileStore.java revision 2362
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
*/
abstract class UnixFileStore
extends FileStore
{
// original path of file that identified file system
// device ID
private final long dev;
// entry in the mount tab
private final UnixMountEntry entry;
// return the device ID where the given file resides
try {
} catch (UnixException x) {
return 0L; // keep compiler happy
}
}
this.entry = findMountEntry();
}
}
/**
* Find the mount entry for the file store
*/
/**
* 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();
return file;
}
long dev() {
return dev;
}
UnixMountEntry entry() {
return entry;
}
}
}
public boolean isReadOnly() {
return entry.isReadOnly();
}
@SuppressWarnings("unchecked")
{
throw new NullPointerException();
if (view == FileStoreSpaceAttributeView.class)
return (V) new UnixFileStoreSpaceAttributeView(this);
return (V) null;
}
return new UnixFileStoreSpaceAttributeView(this)
.readAttributes().totalSpace();
return new UnixFileStoreSpaceAttributeView(this)
.readAttributes().usableSpace();
return new UnixFileStoreSpaceAttributeView(this)
}
throw new NullPointerException();
if (type == BasicFileAttributeView.class)
return true;
if (type == PosixFileAttributeView.class ||
type == FileOwnerAttributeView.class)
{
// lookup fstypes.properties
// assume supported if UNKNOWN
}
return false;
}
return true;
return supportsFileAttributeView(PosixFileAttributeView.class);
return supportsFileAttributeView(FileOwnerAttributeView.class);
return false;
}
if (ob == this)
return true;
if (!(ob instanceof UnixFileStore))
return false;
return false;
// deviceIDs are equal but they may not be equal if one or both of
// them is a loopback file system
boolean thisIsLoopback = isLoopback();
return false; // one, but not both, are lofs
if (!thisIsLoopback)
return true; // neither is lofs
// both are lofs so compare mount points
}
public int hashCode() {
}
}
private static class UnixFileStoreSpaceAttributeView
implements FileStoreSpaceAttributeView
{
private final UnixFileStore fs;
}
return "space";
}
public FileStoreSpaceAttributes readAttributes()
throws IOException
{
final UnixFileStoreAttributes attrs;
try {
} catch (UnixException x) {
return null; // keep compile happy
}
return new FileStoreSpaceAttributes() {
public long totalSpace() {
}
public long usableSpace() {
}
public long unallocatedSpace() {
}
};
}
}
// -- fstypes.properties --
private static volatile Properties props;
enum FeatureStatus {
}
/**
* Returns status to indicate if file system supports a given feature
*/
synchronized (loadLock) {
new PrivilegedAction<Properties>() {
public Properties run() {
return loadProperties();
}});
}
}
}
s = s.trim().toLowerCase();
return FeatureStatus.PRESENT;
}
if (s.startsWith("no")) {
s = s.substring(2);
return FeatureStatus.NOT_PRESENT;
}
}
}
}
return FeatureStatus.UNKNOWN;
}
private static Properties loadProperties() {
try {
try {
} finally {
}
} catch (IOException x) {
}
return result;
}
}