Struct kcore::chan::Chan[][src]

pub struct Chan { /* fields omitted */ }
Expand description

Channel represents a virtual file from kernel’s perspective.

Implementations

impl Chan[src]

pub async fn attach(
    dev: Arc<dyn Device + Send + Sync>,
    aname: &[u8]
) -> Result<Arc<Self>>
[src]

Create a new mount space from the root of a device.

pub async fn path(self: &Arc<Chan>) -> Result<Vec<u8>>[src]

Get the absolute path string of this chan.

pub async fn new(chan: &Arc<Chan>) -> Result<Arc<Self>>[src]

Create a new mount space rooted at a chan.

pub async fn mount(&self, old: &Arc<Self>) -> Result<()>[src]

Mount directory to this chan.

This will mount all union directories from old to this chan.

pub async fn bind(&self, old: &Arc<Self>) -> Result<()>[src]

Bind file to this chan.

Drop any previously bound chan.

pub async fn clear_mount(&self)[src]

Remove all mount point of this chan.

pub async fn open(
    self: &Arc<Self>,
    path: &[u8],
    create_dir: Option<bool>
) -> Result<Option<Arc<Self>>>
[src]

Open a file located at path starting from this chan.

Return NotFound if failed to find any directory components within the path. Otherwise it can find the parent directory.

pub async fn close(self: Arc<Self>)[src]

Close a file. The async destructor.

pub fn dup(self: &Arc<Self>) -> Arc<Self>[src]

Duplicate a handle of file.

pub fn is_dir(&self) -> bool[src]

Check if this chan is directory. Chans in umnt are of same type of itself.

pub async fn remove(&self) -> Result<bool>[src]

Remove wrapper.

pub async fn stat(&self) -> Result<Dirent>[src]

Stat wrapper.

pub async fn wstat(&self, dirent: &Dirent) -> Result<()>[src]

Wstat wrapper.

pub async fn read(&self, buf: &mut [u8], off: usize) -> Result<usize>[src]

Read wrapper.

pub async fn write(&self, buf: &[u8], off: usize) -> Result<usize>[src]

Write wrapper.

pub async fn truncate(&self, size: usize) -> Result<usize>[src]

Truncate wrapper.

Trait Implementations

impl Debug for Chan[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl !RefUnwindSafe for Chan

impl Send for Chan

impl Sync for Chan

impl Unpin for Chan

impl !UnwindSafe for Chan

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.