pub fn mount(&self, fs: BackFileSystem, path: &str) -> Result<()> {
        let (mut entry, ino) = fs.mount()?;
        // TODO: support larger backend fs inode range
        // Just reject it for now
        if ino > VFS_MAX_INO {
            return Err(Error::new(
                ErrorKind::Other,
                format!(
                    "Unsupported max inode number, requested {} supported {}",
                    ino, VFS_MAX_INO
                ),
            ));
        }

        // Serialize mount operations. Do not expect poisoned lock here.
        let _guard = self.lock.lock().unwrap();
        let inode = self.root.mount(path)?;
        let index = self.next_super.fetch_add(1, Ordering::Relaxed);
        if index == PSEUDO_FS_SUPER {
            return Err(Error::new(
                ErrorKind::Other,
                "vfs maximum mountpoints reached",
            ));
        }
        // hash inode number with index so that we can find the real inode later on
        entry.inode = self.hash_inode(index, entry.inode)?;

        // TODO: handle over mount on the same mountpoint

        // The visibility of mountpoints and superblocks:
        // superblock should be committed first because it won't be accessed until
        // a lookup returns a cross mountpoint inode.
        let mut superblocks = self.superblocks.load().deref().deref().clone();
        superblocks.insert(index, Arc::new(fs));
        self.superblocks.store(Arc::new(superblocks));
        trace!("super_index {} inode {}", index, inode);

        let mut mountpoints = self.mountpoints.load().deref().deref().clone();
        mountpoints.insert(
            inode,
            Arc::new(MountPointData {
                super_index: index,
                ino: ROOT_ID,
                root_entry: entry,
            }),
        );
        self.mountpoints.store(Arc::new(mountpoints));
        Ok(())
    }
/// Mount a backend file system to path
Mount a backend file system to path
Mount a backend file system to path
pub fn mount(&self, fs: BackFileSystem, path: &str) -> Result<()> {
        let (mut entry, ino) = fs.mount()?;
        // TODO: support larger backend fs inode range
        // Just reject it for now
        if ino > VFS_MAX_INO {
            return Err(Error::new(
                ErrorKind::Other,
                format!(
                    "Unsupported max inode number, requested {} supported {}",
                    ino, VFS_MAX_INO
                ),
            ));
        }
        // Serialize mount operations. Do not expect poisoned lock here.
        let _guard = self.lock.lock().unwrap();
        let inode = self.root.mount(path)?;
        let index = self.next_super.fetch_add(1, Ordering::Relaxed);
        if index == PSEUDO_FS_SUPER {
            return Err(Error::new(
                ErrorKind::Other,
                "vfs maximum mountpoints reached",
            ));
        }
        // hash inode number with index so that we can find the real inode later on
        entry.inode = self.hash_inode(index, entry.inode)?;
        // TODO: handle over mount on the same mountpoint
        // The visibility of mountpoints and superblocks:
        // superblock should be committed first because it won't be accessed until
        // a lookup returns a cross mountpoint inode.
        let mut superblocks = self.superblocks.load().deref().deref().clone();
        superblocks.insert(index, Arc::new(fs));
        self.superblocks.store(Arc::new(superblocks));
        trace!("super_index {} inode {}", index, inode);
        let mut mountpoints = self.mountpoints.load().deref().deref().clone();
        mountpoints.insert(
            inode,
            Arc::new(MountPointData {
                super_index: index,
                ino: ROOT_ID,
                root_entry: entry,
            }),
        );
        self.mountpoints.store(Arc::new(mountpoints));
        Ok(())
    }
pub fn mount ( & self , fs : BackFileSystem , path : & str ) -> Result < ( ) > { let ( mut entry , ino ) = fs . mount ( ) ? ; // TODO: support larger backend fs inode range // Just reject it for now if ino > VFS_MAX_INO { return Err ( Error :: new ( ErrorKind :: Other , format ! ( " " ino VFS_MAX_INO ) , ) ) ; } // Serialize mount operations. Do not expect poisoned lock here. let _guard = self . lock . lock ( ) . unwrap ( ) ; let inode = self . root . mount ( path ) ? ; let index = self . next_super . fetch_add ( 1 , Ordering :: Relaxed ) ; if index == PSEUDO_FS_SUPER { return Err ( Error :: new ( ErrorKind :: Other , " " , ) ) ; } // hash inode number with index so that we can find the real inode later on entry . inode = self . hash_inode ( index , entry . inode ) ? ; // TODO: handle over mount on the same mountpoint // The visibility of mountpoints and superblocks: // superblock should be committed first because it won't be accessed until // a lookup returns a cross mountpoint inode. let mut superblocks = self . superblocks . load ( ) . deref ( ) . deref ( ) . clone ( ) ; superblocks . insert ( index , Arc :: new ( fs ) ) ; self . superblocks . store ( Arc :: new ( superblocks ) ) ; trace ! ( " " index inode ) ; let mut mountpoints = self . mountpoints . load ( ) . deref ( ) . deref ( ) . clone ( ) ; mountpoints . insert ( inode , Arc :: new ( MountPointData { super_index : index , ino : ROOT_ID , root_entry : entry , } ) , ) ; self . mountpoints . store ( Arc :: new ( mountpoints ) ) ; Ok ( ( ) ) }
Mount a backend file system to path
Mount a backend file system to path
&self
fs
BackFileSystem
path
&str
&self
fs
BackFileSystem
path
&str