pub trait FileLike: KernelObject {
    fn flags(&self) -> OpenFlags;
    fn set_flags(&self, f: OpenFlags) -> LxResult;
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        buf: &'life1 mut [u8]
    ) -> Pin<Box<dyn Future<Output = LxResult<usize>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn write(&self, buf: &[u8]) -> LxResult<usize>; fn read_at<'life0, 'life1, 'async_trait>(
        &'life0 self,
        offset: u64,
        buf: &'life1 mut [u8]
    ) -> Pin<Box<dyn Future<Output = LxResult<usize>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn poll(&self, events: PollEvents) -> LxResult<PollStatus>; fn async_poll<'life0, 'async_trait>(
        &'life0 self,
        events: PollEvents
    ) -> Pin<Box<dyn Future<Output = LxResult<PollStatus>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; fn dup(&self) -> Arc<dyn FileLike> { ... } fn write_at(&self, _offset: u64, _buf: &[u8]) -> LxResult<usize> { ... } fn ioctl(
        &self,
        _request: usize,
        _arg1: usize,
        _arg2: usize,
        _arg3: usize
    ) -> LxResult<usize> { ... } fn get_vmo(&self, _offset: usize, _len: usize) -> LxResult<Arc<VmObject>> { ... } fn as_socket(&self) -> LxResult<&dyn Socket> { ... } }
Expand description

Generic file interface

  • Normal file, Directory
  • Socket
  • Epoll instance

Required Methods

Returns open flags.

Set open flags.

read to buffer

write from buffer

read to buffer at given offset

wait for some event on a file descriptor

wait for some event on a file descriptor use async

Provided Methods

Duplicate the file.

write from buffer at given offset

manipulates the underlying device parameters of special files

Returns the VmObject representing the file with given offset and len.

Casting between trait objects, or use crate: cast_trait_object

Implementations

Returns true if the trait object wraps an object of type __T.

Returns a boxed object from a boxed trait object if the underlying object is of type __T. Returns the original boxed trait if it isn’t.

Returns an Rc-ed object from an Rc-ed trait object if the underlying object is of type __T. Returns the original Rc-ed trait if it isn’t.

Returns a reference to the object within the trait object if it is of type __T, or None if it isn’t.

Returns a mutable reference to the object within the trait object if it is of type __T, or None if it isn’t.

Returns an Arc-ed object from an Arc-ed trait object if the underlying object is of type __T. Returns the original Arc-ed trait if it isn’t.

Implementors