示例#1
0
文件: nfsd.cs 项目: zaubererty/NFS
 private void MkDir(rpcCracker cracker, rpcPacker packer)
 {
     CreateFileOrDirectory(cracker, packer, false);
 }
示例#2
0
文件: nfsd.cs 项目: zaubererty/NFS
        protected override void Proc(uint proc, rpcCracker cracker, rpcPacker packer)
        {
            try
            {
                switch (proc)
                {
                case 1:
                    GetAttr(cracker, packer);
                    break;

                case 2:
                    SetAttr(cracker, packer);
                    break;

                case 3:
                    // Root(). No-op.
                    break;

                case 4:
                    Lookup(cracker, packer);
                    break;

                case 5:
                    ReadLink(cracker, packer);
                    break;

                case 6:
                    Read(cracker, packer);
                    break;

                case 8:
                    Write(cracker, packer);
                    break;

                case 9:
                    Create(cracker, packer);
                    break;

                case 10:
                    Remove(cracker, packer);
                    break;

                case 11:
                    Rename(cracker, packer);
                    break;

                case 13:
                    SymLink(cracker, packer);
                    break;

                case 14:
                    MkDir(cracker, packer);
                    break;

                case 15:
                    RmDir(cracker, packer);
                    break;

                case 16:
                    ReadDir(cracker, packer);
                    break;

                case 17:
                    StatFS(cracker, packer);
                    break;

                default:
                    throw new BadProc();
                }
            }
            catch (BadProc)
            {
                throw;
            }
            catch (NFSStatusException e)
            {
                packer.setUint32((uint)e.Status);
            }
            catch (System.IO.FileNotFoundException)
            {
                packer.setUint32((uint)NFSStatus.NFSERR_NOENT);
            }
            catch (UnauthorizedAccessException)
            {
                packer.setUint32((uint)NFSStatus.NFSERR_PERM);
            }
            catch (PathTooLongException)
            {
                packer.setUint32((uint)NFSStatus.NFSERR_NAMETOOLONG);
            }
            catch (DirectoryNotFoundException)
            {
                packer.setUint32((uint)NFSStatus.NFSERR_NOTDIR);
            }
            catch (Exception e)
            {
                Console.WriteLine("nfsd error:{0}", e);
                packer.setUint32((uint)NFSStatus.NFSERR_IO);
            }
        }
示例#3
0
文件: nfsd.cs 项目: zaubererty/NFS
 private void Create(rpcCracker cracker, rpcPacker packer)
 {
     CreateFileOrDirectory(cracker, packer, true);
 }
示例#4
0
文件: nfsd.cs 项目: zaubererty/NFS
 private void GetAttr(rpcCracker cracker, rpcPacker packer)
 {
     attrstat.PackSuccess(packer, new fattr(new fhandle(cracker)));
 }