/** The same as valueOf(inode, path, false). */ public static INodeFile valueOf(INode inode, String path ) throws FileNotFoundException { return valueOf(inode, path, false); }
/** * Returns true if the file is closed */ static boolean isFileClosed(FSDirectory fsd, FSPermissionChecker pc, String src) throws IOException { final INodesInPath iip = fsd.resolvePath(pc, src, DirOp.READ); return !INodeFile.valueOf(iip.getLastINode(), src).isUnderConstruction(); }
private static void verifyTargetFile(FSDirectory fsd, final String target, final INodesInPath targetIIP) throws IOException { // check the target if (FSDirEncryptionZoneOp.getEZForPath(fsd, targetIIP) != null) { throw new HadoopIllegalArgumentException( "concat can not be called for files in an encryption zone."); } final INodeFile targetINode = INodeFile.valueOf(targetIIP.getLastINode(), target); if(targetINode.isUnderConstruction()) { throw new HadoopIllegalArgumentException("concat: target file " + target + " is under construction"); } }
static long getPreferredBlockSize(FSDirectory fsd, FSPermissionChecker pc, String src) throws IOException { fsd.readLock(); try { final INodesInPath iip = fsd.resolvePath(pc, src, DirOp.READ_LINK); return INodeFile.valueOf(iip.getLastINode(), iip.getPath()) .getPreferredBlockSize(); } finally { fsd.readUnlock(); } }
static INodesInPath resolvePathForStartFile(FSDirectory dir, FSPermissionChecker pc, String src, EnumSet<CreateFlag> flag, boolean createParent) throws IOException { INodesInPath iip = dir.resolvePath(pc, src, DirOp.CREATE); if (dir.isPermissionEnabled()) { dir.checkAncestorAccess(pc, iip, FsAction.WRITE); } INode inode = iip.getLastINode(); if (inode != null) { // Verify that the destination does not exist as a directory already. if (inode.isDirectory()) { throw new FileAlreadyExistsException(iip.getPath() + " already exists as a directory"); } // Verifies it's indeed a file and perms allow overwrite INodeFile.valueOf(inode, src); if (dir.isPermissionEnabled() && flag.contains(CreateFlag.OVERWRITE)) { dir.checkPathAccess(pc, iip, FsAction.WRITE); } } else { if (!createParent) { dir.verifyParentDir(iip); } if (!flag.contains(CreateFlag.CREATE)) { throw new FileNotFoundException("Can't overwrite non-existent " + src); } } return iip; }
/** The same as valueOf(inode, path, false). */ public static INodeFile valueOf(INode inode, String path ) throws FileNotFoundException { return valueOf(inode, path, false); }
/** The same as valueOf(inode, path, false). */ public static INodeFile valueOf(INode inode, String path ) throws FileNotFoundException { return valueOf(inode, path, false); }
+ clientMachine); final INodeFile file = INodeFile.valueOf(inode, path, true);
final INodesInPath iip = fsd.resolvePath(pc, src, DirOp.READ); src = iip.getPath(); final INodeFile inode = INodeFile.valueOf(iip.getLastINode(), src); if (fsd.isPermissionEnabled()) { fsd.checkPathAccess(pc, iip, FsAction.READ);
final INodeFile srcINodeFile = INodeFile.valueOf(srcINode, src);
final INodesInPath iip = dir.resolvePath(pc, src, DirOp.WRITE); src = iip.getPath(); final INodeFile inode = INodeFile.valueOf(iip.getLastINode(), src); if (!inode.isUnderConstruction()) { return true;
path = renameReservedPathsOnUpgrade(path, getLayoutVersion()); final INodesInPath iip = fsDir.getINodesInPath(path, DirOp.WRITE); oldnode = INodeFile.valueOf(iip.getLastINode(), path);
fsd.checkPathAccess(pc, iip, FsAction.WRITE); INodeFile file = INodeFile.valueOf(iip.getLastINode(), src);
INodeFile getINodeFile(Path p) throws Exception { final String s = p.toString(); return INodeFile.valueOf(fsdir.getINode(s), s); }
INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path, true); if (oldFile != null && addCloseOp.overwrite) { final INodeFile file = INodeFile.valueOf(iip.getLastINode(), path); INodeFile file = INodeFile.valueOf(iip.getLastINode(), path); if (!file.isUnderConstruction()) { LocatedBlock lb = FSDirAppendOp.prepareFileForAppend(fsNamesys, iip, INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path); INodeFile oldFile = INodeFile.valueOf(iip.getLastINode(), path);
private static void verifyTargetFile(FSDirectory fsd, final String target, final INodesInPath targetIIP) throws IOException { // check the target if (fsd.getEZForPath(targetIIP) != null) { throw new HadoopIllegalArgumentException( "concat can not be called for files in an encryption zone."); } final INodeFile targetINode = INodeFile.valueOf(targetIIP.getLastINode(), target); if(targetINode.isUnderConstruction()) { throw new HadoopIllegalArgumentException("concat: target file " + target + " is under construction"); } }
private static void verifyTargetFile(FSDirectory fsd, final String target, final INodesInPath targetIIP) throws IOException { // check the target if (fsd.getEZForPath(targetIIP) != null) { throw new HadoopIllegalArgumentException( "concat can not be called for files in an encryption zone."); } final INodeFile targetINode = INodeFile.valueOf(targetIIP.getLastINode(), target); if(targetINode.isUnderConstruction()) { throw new HadoopIllegalArgumentException("concat: target file " + target + " is under construction"); } }
/** * Returns true if the file is closed */ static boolean isFileClosed(FSDirectory fsd, String src) throws IOException { FSPermissionChecker pc = fsd.getPermissionChecker(); final INodesInPath iip = fsd.resolvePath(pc, src); src = iip.getPath(); if (fsd.isPermissionEnabled()) { fsd.checkTraverse(pc, iip); } return !INodeFile.valueOf(iip.getLastINode(), src).isUnderConstruction(); }
/** * Returns true if the file is closed */ static boolean isFileClosed(FSDirectory fsd, String src) throws IOException { FSPermissionChecker pc = fsd.getPermissionChecker(); final INodesInPath iip = fsd.resolvePath(pc, src); src = iip.getPath(); if (fsd.isPermissionEnabled()) { fsd.checkTraverse(pc, iip); } return !INodeFile.valueOf(iip.getLastINode(), src).isUnderConstruction(); }
static INodeFile assertBlockCollection(String path, int numBlocks, final FSDirectory dir, final BlockManager blkManager) throws Exception { final INodeFile file = INodeFile.valueOf(dir.getINode(path), path); assertEquals(numBlocks, file.getBlocks().length); for(BlockInfoContiguous b : file.getBlocks()) { assertBlockCollection(blkManager, file, b); } return file; }