1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::rmi::error::Error;
use alloc::collections::BTreeSet;
use spinning_top::Spinlock;

pub static VMID_SET: Spinlock<BTreeSet<usize>> = Spinlock::new(BTreeSet::new());

pub fn remove(id: usize) -> Result<(), Error> {
    VMID_SET
        .lock()
        .remove(&id)
        .then_some(())
        .ok_or(Error::RmiErrorInput)
}