Пример #1
0
        public Nfs3FileSystemStatResult FileSystemStat(Nfs3FileHandle fileHandle)
        {
            MemoryStream  ms     = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, NfsProc3.Fsstat);

            fileHandle.Write(writer);

            RpcReply reply = DoSend(ms);

            if (reply.Header.IsSuccess)
            {
                Nfs3FileSystemStatResult statReply = new Nfs3FileSystemStatResult(reply.BodyReader);
                if (statReply.Status == Nfs3Status.Ok)
                {
                    return(statReply);
                }
                else
                {
                    throw new Nfs3Exception(statReply.Status);
                }
            }
            else
            {
                throw new RpcException(reply.Header.ReplyHeader);
            }
        }
        public bool Equals(Nfs3FileSystemStatResult other)
        {
            if (other == null)
            {
                return(false);
            }

            return(other.Status == Status &&
                   object.Equals(other.PostOpAttributes, PostOpAttributes) &&
                   object.Equals(other.FileSystemStat, FileSystemStat));
        }
Пример #3
0
        public Nfs3FileSystemStat FsStat(Nfs3FileHandle handle)
        {
            Nfs3FileSystemStat result;

            if (_cachedStats.TryGetValue(handle, out result))
            {
                //increase caching to at least one second to prevent multiple RPC calls for single Size calculation
                if (result.InvariantUntil > DateTime.Now.AddSeconds(-1))
                {
                    return(result);
                }
            }
            Nfs3FileSystemStatResult getResult = _nfsClient.FileSystemStat(handle);

            if (getResult.Status == Nfs3Status.Ok)
            {
                _cachedStats[handle] = getResult.FileSystemStat;
                return(getResult.FileSystemStat);
            }
            else
            {
                throw new Nfs3Exception(getResult.Status);
            }
        }