コード例 #1
0
ファイル: GenericINode.cs プロジェクト: terry2012/expressos
 public int Read(ByteBufferRef buffer, int offset, int count, ref uint pos)
 {
     switch (kind)
     {
     case INodeKind.ArchINodeKind:
         return(ArchINode.ReadImpl(buffer, offset, count, ref pos));
     }
     return(-ErrorCode.EINVAL);
 }
コード例 #2
0
ファイル: GenericINode.cs プロジェクト: terry2012/expressos
        internal int FStat64(Thread current, UserPtr buf)
        {
            switch (kind)
            {
            case INodeKind.ArchINodeKind:
                return(ArchINode.ArchFStat64(current, buf));

            case INodeKind.SecureFSINodeKind:
                return(SFSINode.SFSFStat64(current, buf));
            }
            return(-ErrorCode.EINVAL);
        }
コード例 #3
0
ファイル: GenericINode.cs プロジェクト: terry2012/expressos
        public int Truncate(Thread current, int length)
        {
            switch (kind)
            {
            case INodeKind.ArchINodeKind:
                return(ArchINode.ftruncate(current, length));

            case INodeKind.SecureFSINodeKind:
                return(SFSINode.ftruncate(length));
            }

            return(-ErrorCode.EINVAL);
        }
コード例 #4
0
ファイル: GenericINode.cs プロジェクト: terry2012/expressos
        internal int Read(Thread current, ref Arch.ExceptionRegisters regs, UserPtr userBuf, int len, uint pos, File file)
        {
            switch (kind)
            {
            case INodeKind.ArchINodeKind:
            case INodeKind.SocketINodeKind:
                return(ArchINode.ArchRead(current, ref regs, userBuf, len, pos, file));

            case INodeKind.SecureFSINodeKind:
                return(SFSINode.SFSRead(current, ref regs, userBuf, len, pos, file));
            }
            return(-ErrorCode.EINVAL);
        }
コード例 #5
0
ファイル: GenericINode.cs プロジェクト: terry2012/expressos
        private int Close()
        {
            switch (kind)
            {
            case INodeKind.ArchINodeKind:
            case INodeKind.AshmemINodeKind:
            case INodeKind.BinderSharedINodeKind:
            case INodeKind.ScreenBufferINodeKind:
            case INodeKind.SocketINodeKind:
                ArchINode.Close();
                return(0);

            case INodeKind.SecureFSINodeKind:
                return(SFSINode.SFSClose());

            default:
                return(0);
            }
        }
コード例 #6
0
ファイル: GenericINode.cs プロジェクト: terry2012/expressos
        /*
         * Write a segment buffer.
         *
         * The buffer itself is passed as a reference, because some inode might take the ownership
         * of the buffer and put it as a part of its completion. In this case the buf is set to empty
         */
        internal int Write(Thread current, ref Arch.ExceptionRegisters regs, ref ByteBufferRef buf, int len, uint pos, File file)
        {
            switch (kind)
            {
            case INodeKind.ConsoleINodeKind:
            {
                uint dummy = 0;
                return(ConsoleINode.WriteImpl(current, buf, len, ref dummy));
            }

            case INodeKind.ArchINodeKind:
            case INodeKind.SocketINodeKind:
                return(ArchINode.ArchWrite(current, ref regs, ref buf, len, pos, file));

            case INodeKind.SecureFSINodeKind:
                return(SFSINode.SFSWrite(current, ref regs, buf, len, pos, file));
            }
            return(-ErrorCode.EINVAL);
        }