fuse_backend_rs/overlayfs/utils.rs
1// Copyright (C) 2023 Ant Group. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4use crate::abi::fuse_abi::stat64;
5use std::ffi::CString;
6use std::io::{self, Error, Result};
7
8pub(super) fn is_dir(st: stat64) -> bool {
9 st.st_mode & libc::S_IFMT == libc::S_IFDIR
10}
11
12pub(super) fn to_cstring(name: &str) -> Result<CString> {
13 CString::new(name).map_err(|e| Error::new(io::ErrorKind::InvalidData, e))
14}