1 // Copyright (c) 2024 Huawei Technologies Co.,Ltd. All rights reserved. 2 // 3 // StratoVirt is licensed under Mulan PSL v2. 4 // You can use this software according to the terms and conditions of the Mulan 5 // PSL v2. 6 // You may obtain a copy of Mulan PSL v2 at: 7 // http://license.coscl.org.cn/MulanPSL2 8 // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY 9 // KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 10 // NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 11 // See the Mulan PSL v2 for more details. 12 13 use thiserror::Error; 14 15 #[derive(Error, Debug)] 16 pub enum OzonecErr { 17 #[error("Failed to access /proc/{0}")] 18 ReadProcPid(i32), 19 #[error("Failed to access /proc/{0}/status")] 20 ReadProcStat(i32), 21 #[error("Failed to open {0}")] 22 OpenFile(String), 23 #[error("Failed to create directory {0}")] 24 CreateDir(String), 25 #[error("Failed to mount {0}")] 26 Mount(String), 27 #[error("Failed to access /proc/self")] 28 AccessProcSelf, 29 #[error("Failed to get mountinfo")] 30 GetMntInfo, 31 #[error("Dup2 {0} error")] 32 Dup2(String), 33 #[error("Failed to get all capabilities of {0} set")] 34 GetAllCaps(String), 35 #[error("Failed to set the capability set {0}")] 36 SetCaps(String), 37 #[error("Failed to add architecture to seccomp filter")] 38 AddScmpArch, 39 #[error("Failed to get current directory")] 40 GetCurDir, 41 #[error("Failed to load container state")] 42 LoadConState, 43 #[error("Failed to get oci state")] 44 GetOciState, 45 #[error("Failed to bind device: {0}")] 46 BindDev(String), 47 #[error("Close fd error")] 48 CloseFd, 49 } 50