jdk/src/solaris/classes/sun/nio/fs/LinuxFileStore.java
changeset 3065 452aaa2899fc
parent 2057 3acf8e5e2ca0
child 3721 1adb60cc9f39
equal deleted inserted replaced
3063:a3fd491f7754 3065:452aaa2899fc
    51      * Finds, and returns, the mount entry for the file system where the file
    51      * Finds, and returns, the mount entry for the file system where the file
    52      * resides.
    52      * resides.
    53      */
    53      */
    54     @Override
    54     @Override
    55     UnixMountEntry findMountEntry() throws IOException {
    55     UnixMountEntry findMountEntry() throws IOException {
    56         UnixFileSystem fs = file().getFileSystem();
    56         LinuxFileSystem fs = (LinuxFileSystem)file().getFileSystem();
    57 
    57 
    58         // step 1: get realpath
    58         // step 1: get realpath
    59         UnixPath path = null;
    59         UnixPath path = null;
    60         try {
    60         try {
    61             byte[] rp = UnixNativeDispatcher.realpath(file());
    61             byte[] rp = UnixNativeDispatcher.realpath(file());
    77                 break;
    77                 break;
    78             path = parent;
    78             path = parent;
    79             parent = parent.getParent();
    79             parent = parent.getParent();
    80         }
    80         }
    81 
    81 
    82         // step 3: lookup mounted file systems
    82         // step 3: lookup mounted file systems (use /proc/mounts to ensure we
       
    83         // find the file system even when not in /etc/mtab)
    83         byte[] dir = path.asByteArray();
    84         byte[] dir = path.asByteArray();
    84         for (UnixMountEntry entry: fs.getMountEntries()) {
    85         for (UnixMountEntry entry: fs.getMountEntries("/proc/mounts")) {
    85             if (Arrays.equals(dir, entry.dir()))
    86             if (Arrays.equals(dir, entry.dir()))
    86                 return entry;
    87                 return entry;
    87         }
    88         }
    88 
    89 
    89         throw new IOException("Mount point not found in mtab");
    90         throw new IOException("Mount point not found");
    90     }
    91     }
    91 
    92 
    92     // returns true if extended attributes enabled on file system where given
    93     // returns true if extended attributes enabled on file system where given
    93     // file resides, returns false if disabled or unable to determine.
    94     // file resides, returns false if disabled or unable to determine.
    94     private boolean isExtendedAttributesEnabled(UnixPath path) {
    95     private boolean isExtendedAttributesEnabled(UnixPath path) {
   111         return false;
   112         return false;
   112     }
   113     }
   113 
   114 
   114     @Override
   115     @Override
   115     public boolean supportsFileAttributeView(String name) {
   116     public boolean supportsFileAttributeView(String name) {
   116         // support DosFileAttributeView and NamedAttributeView if extended
   117         // support DosFileAttributeView and UserDefinedAttributeView if extended
   117         // attributes enabled
   118         // attributes enabled
   118         if (name.equals("dos") || name.equals("xattr")) {
   119         if (name.equals("dos") || name.equals("user")) {
   119             // lookup fstypes.properties
   120             // lookup fstypes.properties
   120             FeatureStatus status = checkIfFeaturePresent("user_xattr");
   121             FeatureStatus status = checkIfFeaturePresent("user_xattr");
   121             if (status == FeatureStatus.PRESENT)
   122             if (status == FeatureStatus.PRESENT)
   122                 return true;
   123                 return true;
   123             if (status == FeatureStatus.NOT_PRESENT)
   124             if (status == FeatureStatus.NOT_PRESENT)