Example #1
0
 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);
 }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
            }
        }
Example #6
0
        /*
         * 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);
        }