private int GetNumNonNull(INodesInPath iip) { IList <INode> inodes = iip.GetReadOnlyINodes(); for (int i = inodes.Count - 1; i >= 0; i--) { if (inodes[i] != null) { return(i + 1); } } return(0); }
/// <summary>Looks up the EncryptionZoneInt for a path within an encryption zone.</summary> /// <remarks> /// Looks up the EncryptionZoneInt for a path within an encryption zone. /// Returns null if path is not within an EZ. /// <p/> /// Must be called while holding the manager lock. /// </remarks> private EncryptionZoneManager.EncryptionZoneInt GetEncryptionZoneForPath(INodesInPath iip) { System.Diagnostics.Debug.Assert(dir.HasReadLock()); Preconditions.CheckNotNull(iip); IList <INode> inodes = iip.GetReadOnlyINodes(); for (int i = inodes.Count - 1; i >= 0; i--) { INode inode = inodes[i]; if (inode != null) { EncryptionZoneManager.EncryptionZoneInt ezi = encryptionZones[inode.GetId()]; if (ezi != null) { return(ezi); } } } return(null); }