pub struct FsOptions {
    socket: Option<String>,
    socket_path: Option<String>,
    fd: Option<RawDescriptor>,
    tag: String,
    shared_dir: PathBuf,
    uid_map: Option<String>,
    gid_map: Option<String>,
    cfg: Option<Config>,
    uid: u32,
    gid: u32,
    disable_sandbox: bool,
    skip_pivot_root: bool,
}
Expand description

FS Device

Fields§

§socket: Option<String>

deprecated - please use –socket-path instead

§socket_path: Option<String>

path to the vhost-user socket to bind to. If this flag is set, –fd cannot be specified.

§fd: Option<RawDescriptor>

file descriptor of a connected vhost-user socket. If this flag is set, –socket-path cannot be specified.

§tag: String

the virtio-fs tag

§shared_dir: PathBuf

path to a directory to share

§uid_map: Option<String>

uid map to use

§gid_map: Option<String>

gid map to use

§cfg: Option<Config>

colon-separated options for configuring a directory to be shared with the VM through virtio-fs. The format is the same as crosvm run --shared-dir flag except only the keys related to virtio-fs are valid here.

§uid: u32

uid of the device process in the new user namespace created by minijail. These two options (uid/gid) are useful when the crosvm process cannot get CAP_SETGID/CAP_SETUID but an identity mapping of the current user/group between the VM and the host is required. Say the current user and the crosvm process has uid 5000, a user can use “uid=5000” and “uidmap=5000 5000 1” such that files owned by user 5000 still appear to be owned by user 5000 in the VM. These 2 options are useful only when there is 1 user in the VM accessing shared files. If multiple users want to access the shared file, gid/uid options are useless. It’d be better to create a new user namespace and give CAP_SETUID/CAP_SETGID to the crosvm. Default: 0.

§gid: u32

gid of the device process in the new user namespace created by minijail. Default: 0.

§disable_sandbox: bool

disable-sandbox controls whether vhost-user-fs device uses minijail sandbox. By default, it is false, the vhost-user-fs will enter new mnt/user/pid/net namespace. If the this option is true, the vhost-user-fs device only create a new mount namespace and run without seccomp filter. Default: false.

§skip_pivot_root: bool

disable pivot_root when process is jailed.

virtio-fs typically uses mount namespaces and pivot_root for file system isolation, making the jailed process’s root directory “/”.

Android’s security model restricts crosvm’s access to certain system capabilities, specifically those related to managing mount namespaces and using pivot_root. These capabilities are typically associated with the SYS_ADMIN capability. To maintain a secure environment, Android relies on mechanisms like SELinux to enforce isolation and control access to directories.

Trait Implementations§

source§

impl FromArgs for Options

source§

fn from_args(__cmd_name: &[&str], __args: &[&str]) -> Result<Self, EarlyExit>

Construct the type from an input set of arguments. Read more
source§

fn redact_arg_values( __cmd_name: &[&str], __args: &[&str] ) -> Result<Vec<String>, EarlyExit>

Get a String with just the argument names, e.g., options, flags, subcommands, etc, but without the values of the options and arguments. This can be useful as a means to capture anonymous usage statistics without revealing the content entered by the end user. Read more
source§

impl SubCommand for Options

source§

const COMMAND: &'static CommandInfo = _

Information about the subcommand.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> SubCommands for T
where T: SubCommand,

§

const COMMANDS: &'static [&'static CommandInfo<'static>] = _

Info for the commands.
§

fn dynamic_commands() -> &'static [&'static CommandInfo<'static>]

Get a list of commands that are discovered at runtime.
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V