示例#1
0
        /// <exception cref="System.IO.IOException"/>
        public static Org.Apache.Hadoop.Nfs.Nfs3.Request.RENAME3Request Deserialize(XDR xdr
                                                                                    )
        {
            FileHandle fromDirHandle = ReadHandle(xdr);
            string     fromName      = xdr.ReadString();
            FileHandle toDirHandle   = ReadHandle(xdr);
            string     toName        = xdr.ReadString();

            return(new Org.Apache.Hadoop.Nfs.Nfs3.Request.RENAME3Request(fromDirHandle, fromName
                                                                         , toDirHandle, toName));
        }
示例#2
0
        // The name of the link
        // It contains the target
        /// <exception cref="System.IO.IOException"/>
        public static Org.Apache.Hadoop.Nfs.Nfs3.Request.SYMLINK3Request Deserialize(XDR
                                                                                     xdr)
        {
            FileHandle handle  = ReadHandle(xdr);
            string     name    = xdr.ReadString();
            SetAttr3   symAttr = new SetAttr3();

            symAttr.Deserialize(xdr);
            string symData = xdr.ReadString();

            return(new Org.Apache.Hadoop.Nfs.Nfs3.Request.SYMLINK3Request(handle, name, symAttr
                                                                          , symData));
        }
示例#3
0
        /// <exception cref="System.IO.IOException"/>
        public static Org.Apache.Hadoop.Nfs.Nfs3.Request.MKNOD3Request Deserialize(XDR xdr
                                                                                   )
        {
            FileHandle handle  = ReadHandle(xdr);
            string     name    = xdr.ReadString();
            int        type    = xdr.ReadInt();
            SetAttr3   objAttr = new SetAttr3();

            Nfs3FileAttributes.Specdata3 spec = null;
            if (type == NfsFileType.Nfschr.ToValue() || type == NfsFileType.Nfsblk.ToValue())
            {
                objAttr.Deserialize(xdr);
                spec = new Nfs3FileAttributes.Specdata3(xdr.ReadInt(), xdr.ReadInt());
            }
            else
            {
                if (type == NfsFileType.Nfssock.ToValue() || type == NfsFileType.Nfsfifo.ToValue(
                        ))
                {
                    objAttr.Deserialize(xdr);
                }
            }
            return(new Org.Apache.Hadoop.Nfs.Nfs3.Request.MKNOD3Request(handle, name, type, objAttr
                                                                        , spec));
        }
示例#4
0
        /// <exception cref="System.IO.IOException"/>
        public static Org.Apache.Hadoop.Nfs.Nfs3.Request.CREATE3Request Deserialize(XDR xdr
                                                                                    )
        {
            FileHandle handle  = ReadHandle(xdr);
            string     name    = xdr.ReadString();
            int        mode    = xdr.ReadInt();
            SetAttr3   objAttr = new SetAttr3();
            long       verf    = 0;

            if ((mode == Nfs3Constant.CreateUnchecked) || (mode == Nfs3Constant.CreateGuarded
                                                           ))
            {
                objAttr.Deserialize(xdr);
            }
            else
            {
                if (mode == Nfs3Constant.CreateExclusive)
                {
                    verf = xdr.ReadHyper();
                }
                else
                {
                    throw new IOException("Wrong create mode:" + mode);
                }
            }
            return(new Org.Apache.Hadoop.Nfs.Nfs3.Request.CREATE3Request(handle, name, mode,
                                                                         objAttr, verf));
        }
示例#5
0
            internal static READDIR3Response.Entry3 Deserialzie(XDR xdr)
            {
                long   fileId = xdr.ReadHyper();
                string name   = xdr.ReadString();
                long   cookie = xdr.ReadHyper();

                return(new READDIR3Response.Entry3(fileId, name, cookie));
            }
示例#6
0
        /// <exception cref="System.IO.IOException"/>
        public static Org.Apache.Hadoop.Nfs.Nfs3.Request.RMDIR3Request Deserialize(XDR xdr
                                                                                   )
        {
            FileHandle handle = ReadHandle(xdr);
            string     name   = xdr.ReadString();

            return(new Org.Apache.Hadoop.Nfs.Nfs3.Request.RMDIR3Request(handle, name));
        }
示例#7
0
 /// <exception cref="System.IO.IOException"/>
 public static Org.Apache.Hadoop.Nfs.Nfs3.Request.MKDIR3Request Deserialize(XDR xdr
     )
 {
     FileHandle handle = ReadHandle(xdr);
     string name = xdr.ReadString();
     SetAttr3 objAttr = new SetAttr3();
     objAttr.Deserialize(xdr);
     return new Org.Apache.Hadoop.Nfs.Nfs3.Request.MKDIR3Request(handle, name, objAttr
         );
 }
示例#8
0
        public override XDR Mnt(XDR xdr, XDR @out, int xid, IPAddress client)
        {
            if (hostsMatcher == null)
            {
                return(MountResponse.WriteMNTResponse(Nfs3Status.Nfs3errAcces, @out, xid, null));
            }
            AccessPrivilege accessPrivilege = hostsMatcher.GetAccessPrivilege(client);

            if (accessPrivilege == AccessPrivilege.None)
            {
                return(MountResponse.WriteMNTResponse(Nfs3Status.Nfs3errAcces, @out, xid, null));
            }
            string path = xdr.ReadString();

            if (Log.IsDebugEnabled())
            {
                Log.Debug("MOUNT MNT path: " + path + " client: " + client);
            }
            string host = client.GetHostName();

            if (Log.IsDebugEnabled())
            {
                Log.Debug("Got host: " + host + " path: " + path);
            }
            if (!exports.Contains(path))
            {
                Log.Info("Path " + path + " is not shared.");
                MountResponse.WriteMNTResponse(Nfs3Status.Nfs3errNoent, @out, xid, null);
                return(@out);
            }
            FileHandle handle = null;

            try
            {
                HdfsFileStatus exFileStatus = dfsClient.GetFileInfo(path);
                handle = new FileHandle(exFileStatus.GetFileId());
            }
            catch (IOException e)
            {
                Log.Error("Can't get handle for export:" + path, e);
                MountResponse.WriteMNTResponse(Nfs3Status.Nfs3errNoent, @out, xid, null);
                return(@out);
            }
            System.Diagnostics.Debug.Assert((handle != null));
            Log.Info("Giving handle (fileId:" + handle.GetFileId() + ") to client for export "
                     + path);
            mounts.AddItem(new MountEntry(host, path));
            MountResponse.WriteMNTResponse(Nfs3Status.Nfs3Ok, @out, xid, handle.GetContent());
            return(@out);
        }
示例#9
0
        public override XDR Umnt(XDR xdr, XDR @out, int xid, IPAddress client)
        {
            string path = xdr.ReadString();

            if (Log.IsDebugEnabled())
            {
                Log.Debug("MOUNT UMNT path: " + path + " client: " + client);
            }
            string host = client.GetHostName();

            mounts.Remove(new MountEntry(host, path));
            RpcAcceptedReply.GetAcceptInstance(xid, new VerifierNone()).Write(@out);
            return(@out);
        }
示例#10
0
            internal static READDIRPLUS3Response.EntryPlus3 Deseralize(XDR xdr)
            {
                long   fileId = xdr.ReadHyper();
                string name   = xdr.ReadString();
                long   cookie = xdr.ReadHyper();

                xdr.ReadBoolean();
                Nfs3FileAttributes nameAttr      = Nfs3FileAttributes.Deserialize(xdr);
                FileHandle         objFileHandle = new FileHandle();

                objFileHandle.Deserialize(xdr);
                return(new READDIRPLUS3Response.EntryPlus3(fileId, name, cookie, nameAttr, objFileHandle
                                                           ));
            }
示例#11
0
        public override void Read(XDR xdr)
        {
            mCredentialsLength = xdr.ReadInt();
            mStamp             = xdr.ReadInt();
            mHostName          = xdr.ReadString();
            mUID = xdr.ReadInt();
            mGID = xdr.ReadInt();
            int length = xdr.ReadInt();

            mAuxGIDs = new int[length];
            for (int i = 0; i < length; i++)
            {
                mAuxGIDs[i] = xdr.ReadInt();
            }
        }