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