private static void checkSimpleTraverse(INodesInPath iip) throws UnresolvedPathException, ParentNotDirectoryException { byte[][] components = iip.getPathComponents(); for (int i=0; i < iip.length() - 1; i++) { INode inode = iip.getINode(i); if (inode == null) { break; } checkIsDirectory(inode, components, i); } }
INodeAttributes getAttributes(INodesInPath iip) throws IOException { INode node = FSDirectory.resolveLastINode(iip); int snapshot = iip.getPathSnapshotId(); INodeAttributes nodeAttrs = node.getSnapshotINode(snapshot); UserGroupInformation ugi = NameNode.getRemoteUser(); INodeAttributeProvider ap = this.getUserFilteredAttributeProvider(ugi); if (ap != null) { // permission checking sends the full components array including the // first empty component for the root. however file status // related calls are expected to strip out the root component according // to TestINodeAttributeProvider. byte[][] components = iip.getPathComponents(); components = Arrays.copyOfRange(components, 1, components.length); nodeAttrs = ap.getAttributes(components, nodeAttrs); } return nodeAttrs; }
final INode[] inodes = inodesInPath.getINodesArray(); final INodeAttributes[] inodeAttrs = new INodeAttributes[inodes.length]; final byte[][] components = inodesInPath.getPathComponents(); for (int i = 0; i < inodes.length && inodes[i] != null; i++) { inodeAttrs[i] = getINodeAttrs(components, i, inodes[i], snapshotId);
static HdfsFileStatus getFileInfo(FSDirectory fsd, INodesInPath iip, boolean needLocation, boolean needBlockToken) throws IOException { fsd.readLock(); try { HdfsFileStatus status = null; if (FSDirectory.isExactReservedName(iip.getPathComponents())) { status = FSDirectory.DOT_RESERVED_STATUS; } else if (iip.isDotSnapshotDir()) { if (fsd.getINode4DotSnapshot(iip) != null) { status = FSDirectory.DOT_SNAPSHOT_DIR_STATUS; } } else { status = getFileInfo(fsd, iip, true, needLocation, needBlockToken); } return status; } finally { fsd.readUnlock(); } }
checkNotSymlink(iip.getINode(last), iip.getPathComponents(), last);
byte[] startAfter, boolean needLocation, boolean includeStoragePolicy) throws IOException { if (FSDirectory.isExactReservedName(iip.getPathComponents())) { return getReservedListing(fsd);
static HdfsFileStatus getFileInfo( FSDirectory fsd, String src, boolean resolveLink, boolean isRawPath) throws IOException { fsd.readLock(); try { HdfsFileStatus status = null; final INodesInPath iip = fsd.getINodesInPath(src, resolveLink); if (FSDirectory.isExactReservedName(iip.getPathComponents())) { status = new HdfsFileStatus(0, true, 0, 0, 0, 0, new FsPermission((short) 01770), null, null, null, HdfsFileStatus.EMPTY_NAME, -1L, 0, null, BlockStoragePolicySuite.ID_UNSPECIFIED); } else if (iip.isDotSnapshotDir()) { if (fsd.getINode4DotSnapshot(iip) != null) { status = FSDirectory.DOT_SNAPSHOT_DIR_STATUS; } } else { status = getFileInfo(fsd, src, iip, isRawPath, true); } return status; } finally { fsd.readUnlock(); } }
static HdfsFileStatus getFileInfo( FSDirectory fsd, String src, boolean resolveLink, boolean isRawPath) throws IOException { fsd.readLock(); try { HdfsFileStatus status = null; final INodesInPath iip = fsd.getINodesInPath(src, resolveLink); if (FSDirectory.isExactReservedName(iip.getPathComponents())) { status = new HdfsFileStatus(0, true, 0, 0, 0, 0, new FsPermission((short) 01770), null, null, null, HdfsFileStatus.EMPTY_NAME, -1L, 0, null, BlockStoragePolicySuite.ID_UNSPECIFIED); } else if (iip.isDotSnapshotDir()) { if (fsd.getINode4DotSnapshot(iip) != null) { status = FSDirectory.DOT_SNAPSHOT_DIR_STATUS; } } else { status = getFileInfo(fsd, src, iip, isRawPath, true); } return status; } finally { fsd.readUnlock(); } }
final INode[] inodes = inodesInPath.getINodesArray(); final INodeAttributes[] inodeAttrs = new INodeAttributes[inodes.length]; final byte[][] components = inodesInPath.getPathComponents(); for (int i = 0; i < inodes.length && inodes[i] != null; i++) { inodeAttrs[i] = getINodeAttrs(components, i, inodes[i], snapshotId);
final INode[] inodes = inodesInPath.getINodesArray(); final INodeAttributes[] inodeAttrs = new INodeAttributes[inodes.length]; final byte[][] components = inodesInPath.getPathComponents(); for (int i = 0; i < inodes.length && inodes[i] != null; i++) { inodeAttrs[i] = getINodeAttrs(components, i, inodes[i], snapshotId);