/*
* 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.
*/
/**
* Linux implementation of FileStore
*/
class LinuxFileStore
extends UnixFileStore
{
// used when checking if extended attributes are enabled or not
private volatile boolean xattrChecked;
private volatile boolean xattrEnabled;
super(file);
}
}
/**
* Finds, and returns, the mount entry for the file system where the file
* resides.
*/
// step 1: get realpath
try {
} catch (UnixException x) {
x.rethrowAsIOException(file());
}
// step 2: find mount point
try {
} catch (UnixException x) {
}
break;
}
return entry;
}
throw new IOException("Mount point not found");
}
// returns true if extended attributes enabled on file system where given
// file resides, returns false if disabled or unable to determine.
try {
try {
// fgetxattr returns size if called with size==0
return true;
} catch (UnixException e) {
// attribute does not exist
return true;
} finally {
}
} catch (IOException ignore) {
// nothing we can do
}
return false;
}
// support DosFileAttributeView and UserDefinedAttributeView if extended
// attributes enabled
if (type == DosFileAttributeView.class ||
type == UserDefinedFileAttributeView.class)
{
// lookup fstypes.properties
return true;
return false;
// if file system is mounted with user_xattr option then assume
// extended attributes are enabled
return true;
// user_xattr option not present but we special-case ext3/4 as we
// know that extended attributes are not enabled by default.
return false;
// not ext3/4 so probe mount point
if (!xattrChecked) {
xattrChecked = true;
}
return xattrEnabled;
}
return super.supportsFileAttributeView(type);
}
return supportsFileAttributeView(DosFileAttributeView.class);
return supportsFileAttributeView(UserDefinedFileAttributeView.class);
return super.supportsFileAttributeView(name);
}
}