]> git.proxmox.com Git - proxmox-backup.git/blob - src/pxar/helper.rs
Cargo.toml: pathpatterns, pxar, proxmox-fuse
[proxmox-backup.git] / src / pxar / helper.rs
1 use libc;
2 use nix::sys::stat::FileStat;
3
4 #[inline(always)]
5 pub fn is_directory(stat: &FileStat) -> bool {
6 (stat.st_mode & libc::S_IFMT) == libc::S_IFDIR
7 }
8
9 #[inline(always)]
10 pub fn is_symlink(stat: &FileStat) -> bool {
11 (stat.st_mode & libc::S_IFMT) == libc::S_IFLNK
12 }
13
14 #[inline(always)]
15 pub fn is_reg_file(stat: &FileStat) -> bool {
16 (stat.st_mode & libc::S_IFMT) == libc::S_IFREG
17 }
18
19 #[inline(always)]
20 pub fn is_block_dev(stat: &FileStat) -> bool {
21 (stat.st_mode & libc::S_IFMT) == libc::S_IFBLK
22 }
23
24 #[inline(always)]
25 pub fn is_char_dev(stat: &FileStat) -> bool {
26 (stat.st_mode & libc::S_IFMT) == libc::S_IFCHR
27 }
28
29 #[inline(always)]
30 pub fn is_fifo(stat: &FileStat) -> bool {
31 (stat.st_mode & libc::S_IFMT) == libc::S_IFIFO
32 }
33 #[inline(always)]
34 pub fn is_socket(stat: &FileStat) -> bool {
35 (stat.st_mode & libc::S_IFMT) == libc::S_IFSOCK
36 }