Exemple #1
0
            /// <exception cref="System.IO.IOException"/>
            private INodeReference LoadINodeReference(FsImageProto.INodeReferenceSection.INodeReference
                                                      r)
            {
                long  referredId = r.GetReferredId();
                INode referred   = fsDir.GetInode(referredId);

                INodeReference.WithCount withCount = (INodeReference.WithCount)referred.GetParentReference
                                                         ();
                if (withCount == null)
                {
                    withCount = new INodeReference.WithCount(null, referred);
                }
                INodeReference @ref;

                if (r.HasDstSnapshotId())
                {
                    // DstReference
                    @ref = new INodeReference.DstReference(null, withCount, r.GetDstSnapshotId());
                }
                else
                {
                    @ref = new INodeReference.WithName(null, withCount, r.GetName().ToByteArray(), r.
                                                       GetLastSnapshotId());
                }
                return(@ref);
            }
Exemple #2
0
            /// <exception cref="System.IO.IOException"/>
            internal void LoadINodeDirectorySection(InputStream @in)
            {
                IList <INodeReference> refList = parent.GetLoaderContext().GetRefList();

                while (true)
                {
                    FsImageProto.INodeDirectorySection.DirEntry e = FsImageProto.INodeDirectorySection.DirEntry
                                                                    .ParseDelimitedFrom(@in);
                    // note that in is a LimitedInputStream
                    if (e == null)
                    {
                        break;
                    }
                    INodeDirectory p = dir.GetInode(e.GetParent()).AsDirectory();
                    foreach (long id in e.GetChildrenList())
                    {
                        INode child = dir.GetInode(id);
                        AddToParent(p, child);
                    }
                    foreach (int refId in e.GetRefChildrenList())
                    {
                        INodeReference @ref = refList[refId];
                        AddToParent(p, @ref);
                    }
                }
            }
Exemple #3
0
 /// <summary>Returns the path of the EncryptionZoneInt.</summary>
 /// <remarks>
 /// Returns the path of the EncryptionZoneInt.
 /// <p/>
 /// Called while holding the FSDirectory lock.
 /// </remarks>
 private string GetFullPathName(EncryptionZoneManager.EncryptionZoneInt ezi)
 {
     System.Diagnostics.Debug.Assert(dir.HasReadLock());
     return(dir.GetInode(ezi.GetINodeId()).GetFullPathName());
 }