Snarf.Nfs.FileSystem.FileHandle.Set C# (CSharp) Method

Set() public method

public Set ( uint root, uint handle, uint readOnly ) : System.Boolean
root uint
handle uint
readOnly uint
return System.Boolean
        public Boolean Set(uint root, uint handle, uint readOnly)
        {
            this.root = root;
            this.handle = handle;
            this.@readonly = readOnly;

            return true;
        }

Usage Example

Exemplo n.º 1
0
        public virtual NfsPacket Create(uint xid, NfsPacket packet)
        {
            try {
                FileHandle dirFH   = new FileHandle(packet);
                string     entry   = packet.GetString();
                string     dirName = GetNameFromHandle(dirFH.Handle, xid);
                string     path    = Path.Combine(dirName, entry);

                // make the file

                if (File.Exists(path))
                {
                    throw new NFSException(xid, (uint)NfsReply.ERR_EXIST);
                }

                using (var file = File.Create(path)) { }

                // make a new handle for this file
                FileHandle fh     = new FileHandle();
                long       handle = HandleManager.Current.GetHandle(path);
                fh.Set(dirFH.Root, (uint)handle, dirFH.ReadOnly);

                // get the attributes of this new file
                NfsFileAttributes fa = new NfsFileAttributes();
                fa.Load(path);

                // create the reply packet
                NfsPacket reply = new NfsPacket(128);
                reply.AddReplyHeader(xid);
                reply.SetUInt((uint)NfsReply.OK);
                fh.Emit(ref reply);
                fa.Emit(ref reply);
                return(reply);
            }
            catch (FileNotFoundException) {
                throw new NFSException(xid, (uint)NfsReply.ERR_IO);
            }
            catch (IOException) {
                throw new NFSException(xid, (uint)NfsReply.ERR_IO);
            }
            catch (System.Security.SecurityException) {
                throw new NFSException(xid, (uint)NfsReply.ERR_PERM);
            }
        }
All Usage Examples Of Snarf.Nfs.FileSystem.FileHandle::Set