author | chegar |
Sun, 17 Aug 2014 15:54:13 +0100 | |
changeset 25859 | 3317bb8137f4 |
parent 22597 | jdk/src/aix/classes/sun/nio/fs/AixFileStore.java@7515a991bb37 |
child 35775 | 00710c1b504a |
permissions | -rw-r--r-- |
22597
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
1 |
/* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
2 |
* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
3 |
* Copyright 2013 SAP AG. All rights reserved. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
4 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
5 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
6 |
* This code is free software; you can redistribute it and/or modify it |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
7 |
* under the terms of the GNU General Public License version 2 only, as |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
8 |
* published by the Free Software Foundation. Oracle designates this |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
9 |
* particular file as subject to the "Classpath" exception as provided |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
10 |
* by Oracle in the LICENSE file that accompanied this code. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
11 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
12 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
13 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
14 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
15 |
* version 2 for more details (a copy is included in the LICENSE file that |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
16 |
* accompanied this code). |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
17 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License version |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
19 |
* 2 along with this work; if not, write to the Free Software Foundation, |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
20 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
21 |
* |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
22 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
23 |
* or visit www.oracle.com if you need additional information or have any |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
24 |
* questions. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
25 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
26 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
27 |
package sun.nio.fs; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
28 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
29 |
import java.nio.file.attribute.*; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
30 |
import java.util.*; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
31 |
import java.io.IOException; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
32 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
33 |
/** |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
34 |
* AIX implementation of FileStore |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
35 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
36 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
37 |
class AixFileStore |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
38 |
extends UnixFileStore |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
39 |
{ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
40 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
41 |
AixFileStore(UnixPath file) throws IOException { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
42 |
super(file); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
43 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
44 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
45 |
AixFileStore(UnixFileSystem fs, UnixMountEntry entry) throws IOException { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
46 |
super(fs, entry); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
47 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
48 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
49 |
/** |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
50 |
* Finds, and returns, the mount entry for the file system where the file |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
51 |
* resides. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
52 |
*/ |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
53 |
@Override |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
54 |
UnixMountEntry findMountEntry() throws IOException { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
55 |
AixFileSystem fs = (AixFileSystem)file().getFileSystem(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
56 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
57 |
// step 1: get realpath |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
58 |
UnixPath path = null; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
59 |
try { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
60 |
byte[] rp = UnixNativeDispatcher.realpath(file()); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
61 |
path = new UnixPath(fs, rp); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
62 |
} catch (UnixException x) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
63 |
x.rethrowAsIOException(file()); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
64 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
65 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
66 |
// step 2: find mount point |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
67 |
UnixPath parent = path.getParent(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
68 |
while (parent != null) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
69 |
UnixFileAttributes attrs = null; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
70 |
try { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
71 |
attrs = UnixFileAttributes.get(parent, true); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
72 |
} catch (UnixException x) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
73 |
x.rethrowAsIOException(parent); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
74 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
75 |
if (attrs.dev() != dev()) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
76 |
break; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
77 |
path = parent; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
78 |
parent = parent.getParent(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
79 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
80 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
81 |
// step 3: lookup mounted file systems |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
82 |
byte[] dir = path.asByteArray(); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
83 |
for (UnixMountEntry entry: fs.getMountEntries()) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
84 |
if (Arrays.equals(dir, entry.dir())) |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
85 |
return entry; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
86 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
87 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
88 |
throw new IOException("Mount point not found"); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
89 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
90 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
91 |
// returns true if extended attributes enabled on file system where given |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
92 |
// file resides, returns false if disabled or unable to determine. |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
93 |
private boolean isExtendedAttributesEnabled(UnixPath path) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
94 |
return false; |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
95 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
96 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
97 |
@Override |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
98 |
public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
99 |
return super.supportsFileAttributeView(type); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
100 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
101 |
|
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
102 |
@Override |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
103 |
public boolean supportsFileAttributeView(String name) { |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
104 |
return super.supportsFileAttributeView(name); |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
105 |
} |
7515a991bb37
8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff
changeset
|
106 |
} |