fuse_backend_rs/overlayfs/
config.rs

1// Copyright (C) 2023 Ant Group. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use self::super::CachePolicy;
5use std::fmt;
6use std::time::Duration;
7
8#[derive(Default, Clone, Debug)]
9pub struct Config {
10    pub mountpoint: String,
11    pub work: String,
12    pub do_import: bool,
13    // Filesystem options.
14    pub writeback: bool,
15    pub no_open: bool,
16    pub no_opendir: bool,
17    pub killpriv_v2: bool,
18    pub no_readdir: bool,
19    pub perfile_dax: bool,
20    pub cache_policy: CachePolicy,
21    pub attr_timeout: Duration,
22    pub entry_timeout: Duration,
23}
24
25impl Clone for CachePolicy {
26    fn clone(&self) -> Self {
27        match *self {
28            CachePolicy::Never => CachePolicy::Never,
29            CachePolicy::Always => CachePolicy::Always,
30            CachePolicy::Auto => CachePolicy::Auto,
31        }
32    }
33}
34
35impl fmt::Debug for CachePolicy {
36    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
37        let policy = match *self {
38            CachePolicy::Never => "Never",
39            CachePolicy::Always => "Always",
40            CachePolicy::Auto => "Auto",
41        };
42
43        write!(f, "CachePolicy: {}", policy)
44    }
45}