fuse_backend_rs/abi/virtio_fs.rs
1// Copyright © 2019 Intel Corporation
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! Fuse extension protocol messages to support virtio-fs.
6
7#![allow(missing_docs)]
8
9use bitflags::bitflags;
10use vm_memory::ByteValued;
11
12bitflags! {
13 /// Flags for Setupmapping request.
14 pub struct SetupmappingFlags: u64 {
15 /// Mapping with write permission
16 const WRITE = 0x1;
17 /// Mapping with read permission
18 const READ = 0x2;
19 }
20}
21
22/// Setup file mapping request message for virtio-fs.
23#[repr(C)]
24#[derive(Debug, Default, Copy, Clone)]
25pub struct SetupmappingIn {
26 /// File handler.
27 pub fh: u64,
28 /// File offset.
29 pub foffset: u64,
30 /// Length to map.
31 pub len: u64,
32 /// Mapping flags
33 pub flags: u64,
34 /// Mapping offset in the DAX window.
35 pub moffset: u64,
36}
37
38unsafe impl ByteValued for SetupmappingIn {}
39
40/// Remove file mapping request message header for virtio-fs.
41#[repr(C)]
42#[derive(Debug, Default, Copy, Clone)]
43pub struct RemovemappingIn {
44 /// Number of `RemovemappingOne` entries in the message payload.
45 pub count: u32,
46}
47
48unsafe impl ByteValued for RemovemappingIn {}
49
50/// Remove file mapping request payload entry for virtio-fs.
51#[repr(C)]
52#[derive(Debug, Default, Copy, Clone)]
53pub struct RemovemappingOne {
54 /// Mapping offset in the DAX window.
55 pub moffset: u64,
56 /// Length to unmap.
57 pub len: u64,
58}
59
60unsafe impl ByteValued for RemovemappingOne {}