@Override final AclFeature getAclFeature(int snapshotId) { return referred.getAclFeature(snapshotId); }
@Override public final AclFeature getAclFeature() { return getAclFeature(Snapshot.CURRENT_STATE_ID); }
/** * Reads the existing extended ACL entries of an inode. This method returns * only the extended ACL entries stored in the AclFeature. If the inode does * not have an ACL, then this method returns an empty list. This method * supports querying by snapshot ID. * * @param inode INode to read * @param snapshotId int ID of snapshot to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INode inode, int snapshotId) { AclFeature f = inode.getAclFeature(snapshotId); return getEntriesFromAclFeature(f); }
SnapshotCopy(INode inode) { this.name = inode.getLocalNameBytes(); this.permission = inode.getPermissionLong(); if (inode.getAclFeature() != null) { aclFeature = AclStorage.addAclFeature(inode.getAclFeature()); } else { aclFeature = null; } this.modificationTime = inode.getModificationTime(); this.accessTime = inode.getAccessTime(); this.xAttrFeature = inode.getXAttrFeature(); }
if (inode.getAclFeature() != null) { inode.removeAclFeature(snapshotId); } else { if (inode.getAclFeature() != null) { inode.removeAclFeature(snapshotId);
INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); AclFeature f = inode.getAclFeature(); if (f == null) { return;
AclFeature f = inode.getAclFeature(); if (f == null) { return AclUtil.getMinimalAcl(perm);
@Override public final AclFeature getAclFeature() { return getAclFeature(Snapshot.CURRENT_STATE_ID); }
@Override final AclFeature getAclFeature(int snapshotId) { return referred.getAclFeature(snapshotId); }
@Override public final AclFeature getAclFeature() { return getAclFeature(Snapshot.CURRENT_STATE_ID); }
@Override final AclFeature getAclFeature(int snapshotId) { return referred.getAclFeature(snapshotId); }
/** * Add create directory record to edit log */ public void logMkDir(String path, INode newNode) { PermissionStatus permissions = newNode.getPermissionStatus(); MkdirOp op = MkdirOp.getInstance(cache.get()) .setInodeId(newNode.getId()) .setPath(path) .setTimestamp(newNode.getModificationTime()) .setPermissionStatus(permissions); AclFeature f = newNode.getAclFeature(); if (f != null) { op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode)); } XAttrFeature x = newNode.getXAttrFeature(); if (x != null) { op.setXAttrs(x.getXAttrs()); } logEdit(op); }
/** * Reads the existing extended ACL entries of an inode. This method returns * only the extended ACL entries stored in the AclFeature. If the inode does * not have an ACL, then this method returns an empty list. This method * supports querying by snapshot ID. * * @param inode INode to read * @param snapshotId int ID of snapshot to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INode inode, int snapshotId) { AclFeature f = inode.getAclFeature(snapshotId); return getEntriesFromAclFeature(f); }
/** * Reads the existing extended ACL entries of an inode. This method returns * only the extended ACL entries stored in the AclFeature. If the inode does * not have an ACL, then this method returns an empty list. This method * supports querying by snapshot ID. * * @param inode INode to read * @param snapshotId int ID of snapshot to read * @return List<AclEntry> containing extended inode ACL entries */ public static List<AclEntry> readINodeAcl(INode inode, int snapshotId) { AclFeature f = inode.getAclFeature(snapshotId); return getEntriesFromAclFeature(f); }
SnapshotCopy(INode inode) { this.name = inode.getLocalNameBytes(); this.permission = inode.getPermissionLong(); if (inode.getAclFeature() != null) { aclFeature = AclStorage.addAclFeature(inode.getAclFeature()); } else { aclFeature = null; } this.modificationTime = inode.getModificationTime(); this.accessTime = inode.getAccessTime(); this.xAttrFeature = inode.getXAttrFeature(); }
SnapshotCopy(INode inode) { this.name = inode.getLocalNameBytes(); this.permission = inode.getPermissionLong(); if (inode.getAclFeature() != null) { aclFeature = AclStorage.addAclFeature(inode.getAclFeature()); } else { aclFeature = null; } this.modificationTime = inode.getModificationTime(); this.accessTime = inode.getAccessTime(); this.xAttrFeature = inode.getXAttrFeature(); }
/** * Get AclFeature for the path */ public static AclFeature getAclFeature(Path pathToCheck, MiniDFSCluster cluster) throws IOException { INode inode = cluster.getNamesystem().getFSDirectory() .getINode(pathToCheck.toUri().getPath(), false); assertNotNull(inode); AclFeature aclFeature = inode.getAclFeature(); return aclFeature; }
private static void unprotectedRemoveAcl(FSDirectory fsd, INodesInPath iip) throws IOException { assert fsd.hasWriteLock(); INode inode = FSDirectory.resolveLastINode(iip); int snapshotId = iip.getLatestSnapshotId(); AclFeature f = inode.getAclFeature(); if (f == null) { return; } FsPermission perm = inode.getFsPermission(); List<AclEntry> featureEntries = AclStorage.getEntriesFromAclFeature(f); if (featureEntries.get(0).getScope() == AclEntryScope.ACCESS) { // Restore group permissions from the feature's entry to permission // bits, overwriting the mask, which is not part of a minimal ACL. AclEntry groupEntryKey = new AclEntry.Builder() .setScope(AclEntryScope.ACCESS).setType(AclEntryType.GROUP).build(); int groupEntryIndex = Collections.binarySearch( featureEntries, groupEntryKey, AclTransformation.ACL_ENTRY_COMPARATOR); assert groupEntryIndex >= 0; FsAction groupPerm = featureEntries.get(groupEntryIndex).getPermission(); FsPermission newPerm = new FsPermission(perm.getUserAction(), groupPerm, perm.getOtherAction(), perm.getStickyBit()); inode.setPermission(newPerm, snapshotId); } inode.removeAclFeature(snapshotId); } }
/** * Add create directory record to edit log */ public void logMkDir(String path, INode newNode) { PermissionStatus permissions = newNode.getPermissionStatus(); MkdirOp op = MkdirOp.getInstance(cache.get()) .setInodeId(newNode.getId()) .setPath(path) .setTimestamp(newNode.getModificationTime()) .setPermissionStatus(permissions); AclFeature f = newNode.getAclFeature(); if (f != null) { op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode)); } XAttrFeature x = newNode.getXAttrFeature(); if (x != null) { op.setXAttrs(x.getXAttrs()); } logEdit(op); }
/** * Add create directory record to edit log */ public void logMkDir(String path, INode newNode) { PermissionStatus permissions = newNode.getPermissionStatus(); MkdirOp op = MkdirOp.getInstance(cache.get()) .setInodeId(newNode.getId()) .setPath(path) .setTimestamp(newNode.getModificationTime()) .setPermissionStatus(permissions); AclFeature f = newNode.getAclFeature(); if (f != null) { op.setAclEntries(AclStorage.readINodeLogicalAcl(newNode)); } XAttrFeature x = newNode.getXAttrFeature(); if (x != null) { op.setXAttrs(x.getXAttrs()); } logEdit(op); }